@arcgis/core 4.31.0-next.20240821 → 4.31.0-next.20240822
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{9443b9ec03f25c723c2c.js → 06d328c8aad32c52de97.js} +1 -1
- package/assets/esri/core/workers/chunks/203afe6dd0461d4bd774.js +278 -0
- package/assets/esri/core/workers/chunks/{cd9f48dcee2a1fc261ed.js → c5214a47690c594903d1.js} +25 -25
- package/assets/esri/themes/base/widgets/_Grid.scss +0 -8
- package/assets/esri/themes/base/widgets/_Print.scss +13 -15
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/Print/t9n/Print.json +1 -1
- package/assets/esri/widgets/Print/t9n/Print_en.json +1 -1
- package/chunks/ComponentShader.glsl.js +29 -29
- package/chunks/DefaultMaterial.glsl.js +1 -1
- package/chunks/Path.glsl.js +22 -17
- package/exports/csv.js +1 -1
- package/interfaces.d.ts +37 -9
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/views/2d/support/highlightGroupUtils.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/output/Emissions.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadBaseColorTexture.glsl.js +3 -3
- package/views/3d/webgl-engine/lib/OrderIndependentTransparency.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/OutputColorHighlightOID.glsl.js +8 -8
- package/views/3d/webgl-engine/shaders/Path.glsl.js +1 -1
- package/widgets/Feature/FeatureMedia.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/Grid/Column.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
- package/widgets/Print/CustomTemplate.js +1 -1
- package/widgets/Print/PrintViewModel.js +1 -1
- package/widgets/Print/TemplateOptions.js +1 -1
- package/widgets/Print/utils.js +5 -0
- package/widgets/Print.js +1 -1
- package/widgets/support/exportUtils.js +1 -1
- package/assets/esri/core/workers/chunks/e5474bcde5b8fa037b56.js +0 -278
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import has from"../../../core/has.js";import{disposeMaybe as i}from"../../../core/maybe.js";import{MemCachePool as r}from"../../../core/MemCachePool.js";import s from"../../../core/ObjectPool.js";import{watch as n,sync as a}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{IDENTITY as c}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{f as d,s as h,m as u}from"../../../chunks/vec32.js";import{ZEROS as _,fromValues as f,create as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as g,ZEROS as m}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as b,set as y}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as T}from"../../../geometry/support/buffer/BufferView.js";import{ViewingMode as O}from"../../ViewingMode.js";import{TextureUpdate as R}from"./interfaces.js";import{LayerClass as x}from"./LayerClass.js";import{OverlayContent as P}from"./OverlayContent.js";import{overlayRenderOccludedFlag as v}from"./OverlayRenderer.js";import{PatchRenderData as w}from"./PatchRenderData.js";import{RenderOrder as D}from"./RenderOrder.js";import{TerrainAttributesCache as S}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as E}from"./terrainUtils.js";import{TileRenderer as A}from"./TileRenderer.js";import{TileUpdate as C}from"./TileUpdate.js";import{IteratorPreorder as j,sortTiles as N,compareTiles as B}from"./tileUtils.js";import{TransparencyMode as I}from"./TransparencyMode.js";import{componentMinimalSizeForIntersectionData as F,ComponentIntersectionData as U}from"../webgl-engine/collections/Component/ComponentIntersectionData.js";import{ShaderOutput as L}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{T as G}from"../../../chunks/Terrain.glsl.js";import{TileBlendInput as q}from"../webgl-engine/core/shaderLibrary/terrain/TileBlendInput.js";import{SyncPrepareRenderPlugin as M,ConsumesDepth as k,ConsumesNone as z}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as V}from"../webgl-engine/lib/Attribute.js";import{RenderRequestType as H}from"../webgl-engine/lib/basicInterfaces.js";import{createEmptyTexture as Y}from"../webgl-engine/lib/glUtil3D.js";import{newIntersectorResult as Q}from"../webgl-engine/lib/Intersector.js";import{IntersectorType as W,StoreResults as X}from"../webgl-engine/lib/IntersectorInterfaces.js";import{RenderOccludedFlag as K}from"../webgl-engine/lib/Material.js";import{intersectAabbInvDirBefore as Z,intersectTriangles as J,MeshIntersectionOptions as $}from"../webgl-engine/lib/RayIntersections.js";import{RenderSlot as ee}from"../webgl-engine/lib/RenderSlot.js";import{getSettings as te}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as ie}from"../webgl-engine/lib/VertexAttribute.js";import{terrainId as re,getVerticalOffsetTerrain as se}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as ne}from"../webgl-engine/materials/DrawParameters.js";import{TerrainTechnique as ae}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as oe}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as le}from"../../webgl/enums.js";const ce=7,de=10,he=b();let ue=class extends M{get _isGlobal(){return this._stage.viewingMode===O.Global}get _techniques(){return this._context.techniques}get _rctx(){return this._context.renderContext.rctx}constructor(e,t,i,n,a){super({}),this._overlayRenderer=e,this._stage=t,this._allTiles=i,this._ellipsoidRadius=n,this.type=W.TERRAIN,this.isGround=!0,this._tileSize=256,this._configuration=new oe,this._passParameters=new G,this._drawParameters=new ne,this._renderDataPool=new s(w),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new j,this._castShadows=!1,this._inViewshed=!1,this._emptyTex=null,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.renderOccludedFlags=K.Occlude,this.produces=new Map([[ee.OPAQUE_TERRAIN,()=>this._produces()],[ee.TRANSPARENT_TERRAIN,()=>this._produces()],[ee.OCCLUDED_TERRAIN,()=>this._produces()]]),this._tileTextureCache=new r(((e,t)=>a.newCache(e,t)),"TileTexture"),this.tileGeometryCache=new S(a)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this),this.addHandles(n((()=>this._overlayRenderer.rendersOccludedDraped),(e=>{this.renderOccludedFlags=e?v:K.Occlude,this.setNeedsRender()}),a))}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy()}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}consumes(){return this._overlayRenderer.hasWater?k:z}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}updateHeading(e){this._tileRenderer?.updateHeading(e)}set transparency(e){this._configuration.transparencyMode!==e&&(this._configuration.transparencyMode=e,this.setNeedsRender())}get transparency(){return this._configuration.transparencyMode}get renderPatchBorders(){return!!this._configuration.tileBorders}set renderPatchBorders(e){this._configuration.tileBorders!==e&&(this._configuration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get visualizeNormals(){return!!this._configuration.visualizeNormals}set visualizeNormals(e){this._configuration.visualizeNormals!==e&&(this._configuration.visualizeNormals=e,this.setNeedsRender(),this.notifyChange("visualizeNormals"))}get cullBackFaces(){return this._configuration.backfaceCullingEnabled}set cullBackFaces(e){this._configuration.backfaceCullingEnabled!==e&&(this._configuration.backfaceCullingEnabled=e,this.notifyChange("cullBackFaces"),this.setNeedsRender())}set renderOrder(e){this._set("renderOrder",e),this._setSortingDirty()}get layerUid(){return re}get slicePlaneEnabled(){return this._configuration.hasSlicePlane}set slicePlaneEnabled(e){this._configuration.hasSlicePlane!==e&&(this._configuration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._configuration.textureFadingEnabled!==e&&(this._configuration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._configuration.pbrMode!==e&&(this._configuration.pbrMode=e,this.setNeedsRender())}setDebugScreenSizePerspective(e){this._configuration.screenSizePerspective!==e&&(this._configuration.screenSizePerspective=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}setTileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}_ensureRenderData(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._ensureRenderData(e),this.updateTileGeometryState(e),this.reuseTextureFromParent(e)||this.updateTileTexture(e,C.TEXTURE_FADING)}reuseTextureFromParent(e){const t=e.parent;if(!t)return!1;const i=g(1&e.lij[2]?.5:0,1&e.lij[1]?0:.5,.5,.5);return t.renderData?.reuseTexture(e.renderData,i)??!1}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,t===C.TEXTURE_FADING?R.FADING:R.UNFADED),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[x.ELEVATION])i.pendingUpdates&=~C.GEOMETRY;e.resetPendingUpdate(C.GEOMETRY);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.loaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=de-ce,i=Math.max(0,Math.floor((e.level-t)/ce)*ce);if(this._isGlobal&&0===i)return _;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=H.UPDATE){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=H.UPDATE){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=H.UPDATE){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new A(this._rctx,this._tileSize,this._techniques,this._tileTextureCache),this.updateTileBackground(),this._emptyTex=Y(this._rctx)}uninitializeRenderContext(){this._emptyTex=i(this._emptyTex),this._tileRenderer=i(this._tileRenderer)}intersect(e,t,i,r){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&this.transparency!==I.Opaque)return;const s=_e,n=fe;d(s,r,i),h(n,1/s[0],1/s[1],1/s[2]);const a=e.results.min,o=e.results.max,l=e.results.ground,_=e.options.store===X.MIN,f=!!e.results.ground.target,p=se(e.verticalOffset),g=e.tolerance;let m,b=_&&null!=a.dist?a.dist:1/0;const O=e.options,R=O.normalRequired||!O.backfacesTerrain,x=new $(!1,R),P=h=>{const f=h.renderData;if(!f?.vao)return;const P=f.geometry;y(he,P.boundingBox);const v=f.localOrigin;null!=p&&(p.localOrigin=v,p.applyToAabb(he));const w=he;if(pe[0]=i[0]-v[0],pe[1]=i[1]-v[1],pe[2]=i[2]-v[2],!Z(w,pe,n,g,b))return;const D=(e,t,i)=>{e.set(this.type,h,t,i,c),b=_&&null!=a.dist?a.dist:1/0},S=(n,c,d)=>{if((!R||null!=d)&&n>=0&&(O.backfacesTerrain||u(d,s)<0)&&(O.invisibleTerrain||!O.selectionMode||null==t||t(i,r,n))){if((null==l.dist||n<l.dist)&&D(l,n,d),O.isFiltered)return;O.store===X.ALL&&(null==m?(m=Q(e.ray),D(m,n,d),e.results.all.push(m)):n<m.dist&&D(m,n,d)),(null==a.dist||n<a.dist)&&D(a,n,d),O.store!==X.MIN&&(null==o.dist||n>o.dist)&&D(o,n,d)}},E=ge;d(E,r,v);const{indices:A,indexCount:C}=P,j=P.vertexAttributes,N=j.getField(ie.POSITION,T),B=new V(N.typedBuffer,3,j.stride/4),I=C/3;if(!p&&I>F){const e=h.renderData;null==e.intersectionData&&(e.intersectionData=new U(A,0,I,B)),e.intersectionData.intersectRay(pe,E,x,S)}else J(pe,E,0,I,A,B,p,x,S)},v=this._rootTiles;if(null!=v){(()=>{const t=this._tileIterator;t.reset(v);const r=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||r&&e.intersectsClippingArea)||null==p&&!e.intersectsRay(i,s,g,b)||f&&this._useStencilForTile(e)?t.skipSubtree():P(e)})()}}processScaleRangeQueries(e,t){if(!t.done)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._visiblePatchesByOrigin.values())for(const i of t)null!=i.renderData?.textureReference&&e.queriesForTile(i);e.process(),t.madeProgress()}}prepareTechnique(e){const t=has("enable-feature:terrain-shadows")&&e.bindParameters.shadowMap.enabled;t!==this._castShadows&&(this._castShadows=t,this._patchesByOriginDirty=!0);const i=e.bindParameters.viewshedEnabled;if(this._inViewshed!==i&&(this._inViewshed=i,this._patchesByOriginDirty=!0),e.bindParameters.slot===ee.OCCLUDED_TERRAIN){if(!(e.renderOccludedMask&v))return null}else{const t=this.transparency===I.Opaque?ee.OPAQUE_TERRAIN:ee.TRANSPARENT_TERRAIN;if(e.bindParameters.slot!==t)return null}if(this.transparency===I.Invisible)return null;switch(e.output){case L.Color:case L.ColorEmission:return this._configuration.hasScreenSpaceReflections=null!=e.bindParameters.ssr.lastFrameColor,this._configuration.hasCloudsReflections=null!=e.bindParameters.cloudsFade.data,this._configuration.receiveShadows=e.bindParameters.shadowMap.ready,this._configuration.receiveAmbientOcclusion=null!=e.bindParameters.ssao,this._configuration.overlayMode=this._overlayRenderer.mode,this._updateTechnique(e.output,e.bindParameters.slot===ee.OCCLUDED_TERRAIN);case L.Shadow:case L.ShadowExcludeHighlight:return this._castShadows?(this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._updateTechnique(L.Shadow,!1)):null;case L.ViewshedShadow:return this._inViewshed?(this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._updateTechnique(L.ViewshedShadow,!1)):null;case L.Depth:return this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._updateTechnique(L.Depth,!1);case L.Normal:return this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._updateTechnique(L.Normal,!1);case L.ObjectAndLayerIdColor:return this._updateTechnique(L.ObjectAndLayerIdColor,!1);case L.Highlight:return this._overlayRenderer.hasHighlights&&0===e.bindParameters.highlightLevel?(this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._updateTechnique(L.Highlight,!1)):null}return null}renderNode(e,t){switch(this._updatePatchGroups(),t.useStencil=!1,e.output){case L.Color:case L.ColorEmission:{const i=e.bindParameters.slot===ee.OCCLUDED_TERRAIN?P.Occluded:P.Color;this._renderMaterialPass(e,t,i);break}case L.Depth:case L.Normal:this._renderAuxiliaryPass(e,t,P.Color,this._visiblePatchesByOrigin);break;case L.Highlight:0===e.bindParameters.highlightLevel&&this._renderAuxiliaryPass(e,t,P.Highlight,this._visiblePatchesByOrigin);break;case L.Shadow:case L.ShadowExcludeHighlight:case L.ViewshedShadow:this._renderAuxiliaryPass(e,t,null,this._allPatchesByOrigin);break;case L.ObjectAndLayerIdColor:this._renderAuxiliaryPass(e,t,P.ObjectAndLayerIdColor,this._visiblePatchesByOrigin)}}updateTileBackground(e){if(null==this._tileRenderer)return;const i=this._tileRenderer;let r;if(null!=e){const i=t.toUnitRGBA(e);r=f(i[0]||0,i[1]||0,i[2]||0)}i.setBackground(r),this._allTiles.forAll((e=>i.updateTileTexture(e,R.FADING))),this._configuration.tileBlendInput=i.backgroundIsGrid?q.GridComposite:null!=i.backgroundColor?q.ColorComposite:q.LayerOnly,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty&&this.renderOrder!==D.NONE){const e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(const i of e)N(this.renderOrder,i,t);e.sort(((e,t)=>B(e[0],t[0],this.renderOrder))),this._visiblePatchesByOrigin=new Map(e.map((e=>[e[0].renderData.localOrigin,e]))),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this._tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),i=e.renderData;if(!i){this._numTilesCulled++;continue}const r=i.localOrigin;if(this._castShadows||this._inViewshed){let t=this._allPatchesByOrigin.get(r);t||(t=[],this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let s=this._visiblePatchesByOrigin.get(r);s||(s=[],this._visiblePatchesByOrigin.set(r,s)),s.push(e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,i,r){const s=e.rctx;this._passParameters.overlayContent=i,s.bindTechnique(t,e.bindParameters,this._passParameters);const n=this._stencilEnabledLayerExtents.length>0;r.forEach((r=>{this._drawParameters.origin=r[0].renderData.localOrigin,t.program.bindDraw(e.bindParameters,this._passParameters,this._drawParameters);for(let s=0;s<r.length;s++)this._renderPatch(e,t,r[s],le.TRIANGLES,n,i)})),e.rctx.bindVAO(null)}_renderMaterialPass(e,t,i){const{rctx:r}=e;this._passParameters.overlayContent=i,r.bindTechnique(t,e.bindParameters,this._passParameters),this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;const s=e.bindParameters.camera,n=t.program;if(this._configuration.screenSizePerspective&&this.pointsOfInterest){const e=te(this._stage.viewingMode,this._ellipsoidRadius),t=this.pointsOfInterest.centerOnSurfaceFrequent.distance;e.update({distance:t,fovY:s.fovY})}const a=this._stencilEnabledLayerExtents.length>0,o=i===P.Occluded;o&&(n.bindTexture("tex",this._emptyTex),n.setUniform3fv("textureOpacities",_),n.setUniform4fv("texOffsetAndScale",m));const l=null!=this._tileRenderer?.backgroundColor?this._tileRenderer.backgroundColor:_;this._configuration.tileBlendInput===q.ColorComposite&&n.setUniform3fv("backgroundColor",l);const c=this.wireframe?le.LINES:le.TRIANGLES;this._configuration.textureFadingEnabled&&n.bindTexture("texNext",this._emptyTex);const d=this._visiblePatchesByOrigin;for(const h of d.values()){const r=h[0].renderData.localOrigin;this._drawParameters.origin=r,t.program.bindDraw(e.bindParameters,this._passParameters,this._drawParameters),this._numOriginsRendered++;for(const s of h){const r=s.renderData,l=r.textureReference;if(null!=l){if(!o){n.setUniform4fv("texOffsetAndScale",l.offsetAndScale),n.bindTexture("tex",l.texture.texture);const e=r.textureFadeFactor,t=e<1?r.nextTextureReference:null;this._configuration.textureFadingEnabled&&null!=t&&e<1?(n.setUniform1f("fadeFactor",e),n.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),n.setUniform3fv("nextTexOpacities",t.opacities),n.bindTexture("texNext",t.texture.texture)):n.setUniform1f("fadeFactor",1),r.textureIsFading&&this.setNeedsRender(),n.setUniform3fv("textureOpacities",l.opacities)}this._renderPatch(e,t,s,c,a,i),s.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}e.rctx.bindVAO(null)}_renderPatch(e,t,i,r,s,n){const a=i.renderData,o=a.vao,l=o?.indexBuffer;if(!o||null==l)return void(E&&console.error("Rendered tile with no indices: ",i.lij," : ",a));const c=t.program;null==n||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(c,a.overlay),s&&(t.useStencil=this._useStencilForTile(i),e.rctx.setPipelineState(t.getPipeline()));const d=a.geometry.indexCount;e.rctx.bindVAO(o),c.assertCompatibleVertexAttributeLocations(o),e.rctx.drawElements(r,d,l.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_updateTechnique(e,t){return this._configuration.output=e,this._configuration.renderOccluded=t,this._shaderTechnique=this._techniques.releaseAndAcquire(ae,this._configuration,this._shaderTechnique),this._shaderTechnique}get test(){}};e([o({readOnly:!0})],ue.prototype,"_isGlobal",null),e([o()],ue.prototype,"renderOccludedFlags",void 0),e([o({value:!1})],ue.prototype,"renderingDisabled",null),e([o({value:!0})],ue.prototype,"visible",null),e([o()],ue.prototype,"renderPatchBorders",null),e([o()],ue.prototype,"visualizeNormals",null),e([o()],ue.prototype,"cullBackFaces",null),e([o({value:D.FRONT_TO_BACK})],ue.prototype,"renderOrder",null),e([o()],ue.prototype,"wireframe",null),ue=e([l("esri.views.3d.terrain.TerrainRenderer")],ue);const _e=p(),fe=p(),pe=p(),ge=p();export{ue as TerrainRenderer};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import has from"../../../core/has.js";import{disposeMaybe as i}from"../../../core/maybe.js";import{MemCachePool as r}from"../../../core/MemCachePool.js";import s from"../../../core/ObjectPool.js";import{watch as n,sync as a}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{IDENTITY as c}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{f as d,s as h,m as u}from"../../../chunks/vec32.js";import{ZEROS as _,fromValues as f,create as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as g,ZEROS as m}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as b,set as y}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as T}from"../../../geometry/support/buffer/BufferView.js";import{ViewingMode as R}from"../../ViewingMode.js";import{TextureUpdate as x}from"./interfaces.js";import{LayerClass as O}from"./LayerClass.js";import{OverlayContent as P}from"./OverlayContent.js";import{overlayRenderOccludedFlag as v}from"./OverlayRenderer.js";import{PatchRenderData as w}from"./PatchRenderData.js";import{RenderOrder as D}from"./RenderOrder.js";import{TerrainAttributesCache as S}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as E}from"./terrainUtils.js";import{TileRenderer as C}from"./TileRenderer.js";import{TileUpdate as A}from"./TileUpdate.js";import{IteratorPreorder as j,sortTiles as N,compareTiles as B}from"./tileUtils.js";import{TransparencyMode as I}from"./TransparencyMode.js";import{componentMinimalSizeForIntersectionData as F,ComponentIntersectionData as U}from"../webgl-engine/collections/Component/ComponentIntersectionData.js";import{ShaderOutput as L}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{T as G}from"../../../chunks/Terrain.glsl.js";import{TileBlendInput as M}from"../webgl-engine/core/shaderLibrary/terrain/TileBlendInput.js";import{SyncPrepareRenderPlugin as q,ConsumesDepth as k,ConsumesNone as z}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as V}from"../webgl-engine/lib/Attribute.js";import{RenderRequestType as H}from"../webgl-engine/lib/basicInterfaces.js";import{createEmptyTexture as Y}from"../webgl-engine/lib/glUtil3D.js";import{newIntersectorResult as Q}from"../webgl-engine/lib/Intersector.js";import{IntersectorType as W,StoreResults as X}from"../webgl-engine/lib/IntersectorInterfaces.js";import{RenderOccludedFlag as K}from"../webgl-engine/lib/Material.js";import{intersectAabbInvDirBefore as Z,intersectTriangles as J,MeshIntersectionOptions as $}from"../webgl-engine/lib/RayIntersections.js";import{RenderSlot as ee}from"../webgl-engine/lib/RenderSlot.js";import{getSettings as te}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as ie}from"../webgl-engine/lib/VertexAttribute.js";import{terrainId as re,getVerticalOffsetTerrain as se}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as ne}from"../webgl-engine/materials/DrawParameters.js";import{TerrainTechnique as ae}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as oe}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as le}from"../../webgl/enums.js";const ce=7,de=10,he=b();let ue=class extends q{get _isGlobal(){return this._stage.viewingMode===R.Global}get _techniques(){return this._context.techniques}get _rctx(){return this._context.renderContext.rctx}constructor(e,t,i,n,a){super({}),this._overlayRenderer=e,this._stage=t,this._allTiles=i,this._ellipsoidRadius=n,this.type=W.TERRAIN,this.isGround=!0,this._tileSize=256,this._configuration=new oe,this._passParameters=new G,this._drawParameters=new ne,this._renderDataPool=new s(w),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new j,this._castShadows=!1,this._inViewshed=!1,this._emptyTex=null,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.renderOccludedFlags=K.Occlude,this.produces=new Map([[ee.OPAQUE_TERRAIN,()=>this._produces()],[ee.TRANSPARENT_TERRAIN,()=>this._produces()],[ee.OCCLUDED_TERRAIN,()=>this._produces()]]),this._tileTextureCache=new r(((e,t)=>a.newCache(e,t)),"TileTexture"),this.tileGeometryCache=new S(a)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this),this.addHandles(n((()=>this._overlayRenderer.rendersOccludedDraped),(e=>{this.renderOccludedFlags=e?v:K.Occlude,this.setNeedsRender()}),a))}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy()}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}consumes(){return this._overlayRenderer.hasWater?k:z}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}updateHeading(e){this._tileRenderer?.updateHeading(e)}set transparency(e){this._configuration.transparencyMode!==e&&(this._configuration.transparencyMode=e,this.setNeedsRender())}get transparency(){return this._configuration.transparencyMode}get renderPatchBorders(){return!!this._configuration.tileBorders}set renderPatchBorders(e){this._configuration.tileBorders!==e&&(this._configuration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get visualizeNormals(){return!!this._configuration.visualizeNormals}set visualizeNormals(e){this._configuration.visualizeNormals!==e&&(this._configuration.visualizeNormals=e,this.setNeedsRender(),this.notifyChange("visualizeNormals"))}get cullBackFaces(){return this._configuration.backfaceCullingEnabled}set cullBackFaces(e){this._configuration.backfaceCullingEnabled!==e&&(this._configuration.backfaceCullingEnabled=e,this.notifyChange("cullBackFaces"),this.setNeedsRender())}set renderOrder(e){this._set("renderOrder",e),this._setSortingDirty()}get layerUid(){return re}get slicePlaneEnabled(){return this._configuration.hasSlicePlane}set slicePlaneEnabled(e){this._configuration.hasSlicePlane!==e&&(this._configuration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._configuration.textureFadingEnabled!==e&&(this._configuration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._configuration.pbrMode!==e&&(this._configuration.pbrMode=e,this.setNeedsRender())}setDebugScreenSizePerspective(e){this._configuration.screenSizePerspective!==e&&(this._configuration.screenSizePerspective=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}setTileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}_ensureRenderData(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._ensureRenderData(e),this.updateTileGeometryState(e),this.reuseTextureFromParent(e)||this.updateTileTexture(e,A.TEXTURE_FADING)}reuseTextureFromParent(e){const t=e.parent;if(!t)return!1;const i=g(1&e.lij[2]?.5:0,1&e.lij[1]?0:.5,.5,.5);return t.renderData?.reuseTexture(e.renderData,i)??!1}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,t===A.TEXTURE_FADING?x.FADING:x.UNFADED),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[O.ELEVATION])i.pendingUpdates&=~A.GEOMETRY;e.resetPendingUpdate(A.GEOMETRY);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.loaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=de-ce,i=Math.max(0,Math.floor((e.level-t)/ce)*ce);if(this._isGlobal&&0===i)return _;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=H.UPDATE){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=H.UPDATE){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=H.UPDATE){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new C(this._rctx,this._tileSize,this._techniques,this._tileTextureCache),this.updateTileBackground(),this._emptyTex=Y(this._rctx)}uninitializeRenderContext(){this._emptyTex=i(this._emptyTex),this._tileRenderer=i(this._tileRenderer)}intersect(e,t,i,r){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&this.transparency!==I.Opaque)return;const s=_e,n=fe;d(s,r,i),h(n,1/s[0],1/s[1],1/s[2]);const a=e.results.min,o=e.results.max,l=e.results.ground,_=e.options.store===X.MIN,f=!!e.results.ground.target,p=se(e.verticalOffset),g=e.tolerance;let m,b=_&&null!=a.dist?a.dist:1/0;const R=e.options,x=R.normalRequired||!R.backfacesTerrain,O=new $(!1,x),P=h=>{const f=h.renderData;if(!f?.vao)return;const P=f.geometry;y(he,P.boundingBox);const v=f.localOrigin;null!=p&&(p.localOrigin=v,p.applyToAabb(he));const w=he;if(pe[0]=i[0]-v[0],pe[1]=i[1]-v[1],pe[2]=i[2]-v[2],!Z(w,pe,n,g,b))return;const D=(e,t,i)=>{e.set(this.type,h,t,i,c),b=_&&null!=a.dist?a.dist:1/0},S=(n,c,d)=>{if((!x||null!=d)&&n>=0&&(R.backfacesTerrain||u(d,s)<0)&&(R.invisibleTerrain||!R.selectionMode||null==t||t(i,r,n))){if((null==l.dist||n<l.dist)&&D(l,n,d),R.isFiltered)return;R.store===X.ALL&&(null==m?(m=Q(e.ray),D(m,n,d),e.results.all.push(m)):n<m.dist&&D(m,n,d)),(null==a.dist||n<a.dist)&&D(a,n,d),R.store!==X.MIN&&(null==o.dist||n>o.dist)&&D(o,n,d)}},E=ge;d(E,r,v);const{indices:C,indexCount:A}=P,j=P.vertexAttributes,N=j.getField(ie.POSITION,T),B=new V(N.typedBuffer,3,j.stride/4),I=A/3;if(!p&&I>F){const e=h.renderData;null==e.intersectionData&&(e.intersectionData=new U(C,0,I,B)),e.intersectionData.intersectRay(pe,E,O,S)}else J(pe,E,0,I,C,B,p,O,S)},v=this._rootTiles;if(null!=v){(()=>{const t=this._tileIterator;t.reset(v);const r=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||r&&e.intersectsClippingArea)||null==p&&!e.intersectsRay(i,s,g,b)||f&&this._useStencilForTile(e)?t.skipSubtree():P(e)})()}}processScaleRangeQueries(e,t){if(!t.done)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._visiblePatchesByOrigin.values())for(const i of t)null!=i.renderData?.textureReference&&e.queriesForTile(i);e.process(),t.madeProgress()}}prepareTechnique(e){const t=has("enable-feature:terrain-shadows")&&e.bindParameters.shadowMap.enabled;t!==this._castShadows&&(this._castShadows=t,this._patchesByOriginDirty=!0);const i=e.bindParameters.viewshedEnabled;if(this._inViewshed!==i&&(this._inViewshed=i,this._patchesByOriginDirty=!0),e.bindParameters.slot===ee.OCCLUDED_TERRAIN){if(!(e.renderOccludedMask&v))return null}else{const t=this.transparency===I.Opaque?ee.OPAQUE_TERRAIN:ee.TRANSPARENT_TERRAIN;if(e.bindParameters.slot!==t)return null}if(this.transparency===I.Invisible)return null;switch(e.output){case L.Color:case L.ColorEmission:return this._configuration.hasScreenSpaceReflections=null!=e.bindParameters.ssr.lastFrameColor,this._configuration.hasCloudsReflections=null!=e.bindParameters.cloudsFade.data,this._configuration.receiveShadows=e.bindParameters.shadowMap.ready,this._configuration.receiveAmbientOcclusion=null!=e.bindParameters.ssao,this._configuration.overlayMode=this._overlayRenderer.mode,this._updateTechnique(e.output,e.bindParameters.slot===ee.OCCLUDED_TERRAIN);case L.Shadow:case L.ShadowExcludeHighlight:return this._castShadows?(this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._updateTechnique(L.Shadow,!1)):null;case L.ViewshedShadow:return this._inViewshed?(this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._updateTechnique(L.ViewshedShadow,!1)):null;case L.Depth:case L.Normal:return this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._updateTechnique(e.output,!1);case L.ObjectAndLayerIdColor:return this._updateTechnique(L.ObjectAndLayerIdColor,!1);case L.Highlight:return this._overlayRenderer.hasHighlights&&0===e.bindParameters.highlightLevel?(this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._updateTechnique(L.Highlight,!1)):null}return null}renderNode(e,t){switch(this._updatePatchGroups(),t.useStencil=!1,e.output){case L.Color:case L.ColorEmission:{const i=e.bindParameters.slot===ee.OCCLUDED_TERRAIN?P.Occluded:P.Color;this._renderMaterialPass(e,t,i);break}case L.Depth:case L.Normal:this._renderAuxiliaryPass(e,t,P.Color,this._visiblePatchesByOrigin);break;case L.Highlight:0===e.bindParameters.highlightLevel&&this._renderAuxiliaryPass(e,t,P.Highlight,this._visiblePatchesByOrigin);break;case L.Shadow:case L.ShadowExcludeHighlight:case L.ViewshedShadow:this._renderAuxiliaryPass(e,t,null,this._allPatchesByOrigin);break;case L.ObjectAndLayerIdColor:this._renderAuxiliaryPass(e,t,P.ObjectAndLayerIdColor,this._visiblePatchesByOrigin)}}updateTileBackground(e){if(null==this._tileRenderer)return;const i=this._tileRenderer;let r;if(null!=e){const i=t.toUnitRGBA(e);r=f(i[0]||0,i[1]||0,i[2]||0)}i.setBackground(r),this._allTiles.forAll((e=>i.updateTileTexture(e,x.FADING))),this._configuration.tileBlendInput=i.backgroundIsGrid?M.GridComposite:null!=i.backgroundColor?M.ColorComposite:M.LayerOnly,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty&&this.renderOrder!==D.NONE){const e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(const i of e)N(this.renderOrder,i,t);e.sort(((e,t)=>B(e[0],t[0],this.renderOrder))),this._visiblePatchesByOrigin=new Map(e.map((e=>[e[0].renderData.localOrigin,e]))),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this._tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),i=e.renderData;if(!i){this._numTilesCulled++;continue}const r=i.localOrigin;if(this._castShadows||this._inViewshed){let t=this._allPatchesByOrigin.get(r);t||(t=[],this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let s=this._visiblePatchesByOrigin.get(r);s||(s=[],this._visiblePatchesByOrigin.set(r,s)),s.push(e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,i,r){const s=e.rctx;this._passParameters.overlayContent=i,s.bindTechnique(t,e.bindParameters,this._passParameters);const n=this._stencilEnabledLayerExtents.length>0;r.forEach((r=>{this._drawParameters.origin=r[0].renderData.localOrigin,t.program.bindDraw(e.bindParameters,this._passParameters,this._drawParameters);for(let s=0;s<r.length;s++)this._renderPatch(e,t,r[s],le.TRIANGLES,n,i)})),e.rctx.bindVAO(null)}_renderMaterialPass(e,t,i){const{rctx:r}=e;this._passParameters.overlayContent=i,r.bindTechnique(t,e.bindParameters,this._passParameters),this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;const s=e.bindParameters.camera,n=t.program;if(this._configuration.screenSizePerspective&&this.pointsOfInterest){const e=te(this._stage.viewingMode,this._ellipsoidRadius),t=this.pointsOfInterest.centerOnSurfaceFrequent.distance;e.update({distance:t,fovY:s.fovY})}const a=this._stencilEnabledLayerExtents.length>0,o=i===P.Occluded;o&&(n.bindTexture("tex",this._emptyTex),n.setUniform3fv("textureOpacities",_),n.setUniform4fv("texOffsetAndScale",m));const l=null!=this._tileRenderer?.backgroundColor?this._tileRenderer.backgroundColor:_;this._configuration.tileBlendInput===M.ColorComposite&&n.setUniform3fv("backgroundColor",l);const c=this.wireframe?le.LINES:le.TRIANGLES;this._configuration.textureFadingEnabled&&n.bindTexture("texNext",this._emptyTex);const d=this._visiblePatchesByOrigin;for(const h of d.values()){const r=h[0].renderData.localOrigin;this._drawParameters.origin=r,t.program.bindDraw(e.bindParameters,this._passParameters,this._drawParameters),this._numOriginsRendered++;for(const s of h){const r=s.renderData,l=r.textureReference;if(null!=l){if(!o){n.setUniform4fv("texOffsetAndScale",l.offsetAndScale),n.bindTexture("tex",l.texture.texture);const e=r.textureFadeFactor,t=e<1?r.nextTextureReference:null;this._configuration.textureFadingEnabled&&null!=t&&e<1?(n.setUniform1f("fadeFactor",e),n.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),n.setUniform3fv("nextTexOpacities",t.opacities),n.bindTexture("texNext",t.texture.texture)):n.setUniform1f("fadeFactor",1),r.textureIsFading&&this.setNeedsRender(),n.setUniform3fv("textureOpacities",l.opacities)}this._renderPatch(e,t,s,c,a,i),s.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}e.rctx.bindVAO(null)}_renderPatch(e,t,i,r,s,n){const a=i.renderData,o=a.vao,l=o?.indexBuffer;if(!o||null==l)return void(E&&console.error("Rendered tile with no indices: ",i.lij," : ",a));const c=t.program;null==n||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(c,a.overlay),s&&(t.useStencil=this._useStencilForTile(i),e.rctx.setPipelineState(t.getPipeline()));const d=a.geometry.indexCount;e.rctx.bindVAO(o),c.assertCompatibleVertexAttributeLocations(o),e.rctx.drawElements(r,d,l.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_updateTechnique(e,t){return this._configuration.output=e,this._configuration.renderOccluded=t,this._shaderTechnique=this._techniques.releaseAndAcquire(ae,this._configuration,this._shaderTechnique),this._shaderTechnique}get test(){}};e([o({readOnly:!0})],ue.prototype,"_isGlobal",null),e([o()],ue.prototype,"renderOccludedFlags",void 0),e([o({value:!1})],ue.prototype,"renderingDisabled",null),e([o({value:!0})],ue.prototype,"visible",null),e([o()],ue.prototype,"renderPatchBorders",null),e([o()],ue.prototype,"visualizeNormals",null),e([o()],ue.prototype,"cullBackFaces",null),e([o({value:D.FRONT_TO_BACK})],ue.prototype,"renderOrder",null),e([o()],ue.prototype,"wireframe",null),ue=e([l("esri.views.3d.terrain.TerrainRenderer")],ue);const _e=p(),fe=p(),pe=p(),ge=p();export{ue as TerrainRenderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{ViewingMode as e}from"../../../../../ViewingMode.js";import{IntegratedMeshMode as r}from"./ComponentTechniqueConfiguration.js";import{C as t}from"../../../../../../chunks/ComponentShader.glsl.js";import{ShaderOutput as
|
|
5
|
+
import{ViewingMode as e}from"../../../../../ViewingMode.js";import{IntegratedMeshMode as r}from"./ComponentTechniqueConfiguration.js";import{C as t}from"../../../../../../chunks/ComponentShader.glsl.js";import{isColorOrColorEmission as i,ShaderOutput as o}from"../../../core/shaderLibrary/ShaderOutput.js";import{ReloadableShaderModule as n}from"../../../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as s}from"../../../core/shaderTechnique/ShaderTechnique.js";import{StencilBits as l}from"../../../lib/basicInterfaces.js";import{blending as a,oitDepthTest as u,getDrawBuffers as c,OITPolygonOffset as p}from"../../../lib/OrderIndependentTransparency.js";import{Program as d}from"../../../lib/Program.js";import{stencilWriteMaskOn as m,replaceBitWhenDepthTestPasses as f,stencilBaseAllZerosParams as h}from"../../../lib/StencilUtils.js";import{TransparencyPassType as b}from"../../../lib/TransparencyPassType.js";import{VertexAttribute as g}from"../../../lib/VertexAttribute.js";import{SpecialDrawBuffers as O}from"../../../../../webgl/enums.js";import{makePipelineState as j,cullingParams as P,defaultDepthWriteParams as T,defaultColorWriteParams as M}from"../../../../../webgl/renderState.js";class N extends s{constructor(r,t,i){t.spherical=r.viewingMode===e.Global,t.doublePrecisionRequiresObfuscation=r.rctx.driverTest.doublePrecisionRequiresObfuscation.result,super(r,t,i)}initializeProgram(e){return new d(e.rctx,N.shader.get().build(this.configuration),S)}_setPipelineState(e){const{output:t,hasOccludees:n,hasPolygonOffset:s,integratedMeshMode:d,blendingEnabled:g,cullFace:N}=this.configuration,S=d!==r.None,E=e===b.NONE,w=e===b.FrontFace;return j({blending:i(t)&&g?a(e):null,culling:P(N),depthTest:{func:u(e)},depthWrite:E||w?T:null,drawBuffers:t===o.Depth?{buffers:[O.NONE]}:c(e,t),colorWrite:M,stencilWrite:S||n?m:null,stencilTest:S?f(l.IntegratedMeshMaskExcluded):n?h:null,polygonOffset:E||w?s?{factor:2,units:2}:null:p})}initializePipeline(){return this._setPipelineState(this.configuration.transparencyPassType)}}N.shader=new n(t,(()=>import("./shader/ComponentShader.glsl.js")));const S=new Map([[g.POSITION,0],[g.NORMAL,1],[g.NORMALCOMPRESSED,1],[g.COLOR,2],[g.UV0,3],[g.UVREGION,4],[g.COMPONENTINDEX,5]]);export{N as ComponentTechnique,S as attributeLocations};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
var
|
|
5
|
+
var n;function o(o){return r(o)||o===n.Depth||o===n.Normal||o===n.ObjectAndLayerIdColor}function r(o){return o===n.Shadow||o===n.ShadowHighlight||o===n.ShadowExcludeHighlight||o===n.ViewshedShadow}function t(o){return w(o)||o===n.Normal}function i(o){return C(o)||o===n.Normal}function e(o){return o===n.Highlight||o===n.ObjectAndLayerIdColor}function h(n){return u(n)||e(n)}function u(o){return o===n.Color}function l(n){return u(n)||H(n)}function d(o){return u(o)||o===n.ObjectAndLayerIdColor}function c(o){return u(o)||o===n.Highlight}function a(n){return c(n)||S(n)}function g(n){return u(n)||e(n)}function f(n){return l(n)||e(n)}function w(n){return g(n)||S(n)}function C(n){return f(n)||S(n)}function S(o){return o===n.Depth}function H(o){return o===n.ColorEmission}!function(n){n[n.Color=0]="Color",n[n.ColorEmission=1]="ColorEmission",n[n.Depth=2]="Depth",n[n.Normal=3]="Normal",n[n.Shadow=4]="Shadow",n[n.ShadowHighlight=5]="ShadowHighlight",n[n.ShadowExcludeHighlight=6]="ShadowExcludeHighlight",n[n.ViewshedShadow=7]="ViewshedShadow",n[n.Highlight=8]="Highlight",n[n.ObjectAndLayerIdColor=9]="ObjectAndLayerIdColor",n[n.COUNT=10]="COUNT"}(n||(n={}));export{n as ShaderOutput,h as is2DGeometryOutput,t as is3DGeometryOutput,i as is3DGeometryOutputMRT,u as isColor,H as isColorEmission,C as isColorEmissionHighlightOIDOrDepth,f as isColorEmissionHighlightOrOID,w as isColorHighlightOIDOrDepth,a as isColorHighlightOrDepth,g as isColorHighlightOrOID,l as isColorOrColorEmission,c as isColorOrHighlight,d as isColorOrOID,S as isDepth,o as isDepthLikeOutput,e as isHighlightOrOID,r as isShadowRelatedOutput};
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{
|
|
5
|
+
import{isColorOrColorEmission as e}from"../ShaderOutput.js";import{VertexTextureCoordinates as s}from"../attributes/VertexTextureCoordinates.glsl.js";import{Float3DrawUniform as i}from"../../shaderModules/Float3DrawUniform.js";import{Float3PassUniform as r}from"../../shaderModules/Float3PassUniform.js";import{glsl as o,If as t}from"../../shaderModules/interfaces.js";import{Texture2DDrawUniform as m}from"../../shaderModules/Texture2DDrawUniform.js";import{Texture2DPassUniform as n}from"../../shaderModules/Texture2DPassUniform.js";import{BindType as a}from"../../shaderTechnique/BindType.js";import{GLEmissiveTexturePassParameters as u}from"../../../lib/GLTextureMaterial.js";var d;!function(e){e[e.None=0]="None",e[e.Value=1]="Value",e[e.Texture=2]="Texture",e[e.COUNT=3]="COUNT"}(d||(d={}));class f extends u{}function c(u,f){if(!e(f.output))return;const{emissionSource:c,hasEmissiveTextureTransform:x,bindType:l}=f,p=c===d.Texture;p&&(u.include(s,f),u.fragment.uniforms.add(l===a.Pass?new n("texEmission",(e=>e.textureEmissive)):new m("texEmission",(e=>e.textureEmissive))));const v=c===d.Value||p;v&&u.fragment.uniforms.add(l===a.Pass?new r("emissionFactor",(e=>e.emissiveFactor)):new i("emissionFactor",(e=>e.emissiveFactor))),u.fragment.code.add(o`
|
|
6
6
|
vec4 getEmissions() {
|
|
7
7
|
vec4 emissions = ${v?"vec4(emissionFactor, 1.0)":"vec4(0.0)"};
|
|
8
|
-
${t(p,`emissions *= textureLookup(texEmission, ${
|
|
8
|
+
${t(p,`emissions *= textureLookup(texEmission, ${x?"emissiveUV":"vuv0"});\n emissions.w = emissions.rgb == vec3(0.0) ? 0.0: emissions.w;`)};
|
|
9
9
|
return emissions;
|
|
10
10
|
}
|
|
11
11
|
`)}export{d as EmissionSource,c as Emissions,f as EmissionsParameters};
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{
|
|
5
|
+
import{isColorOrColorEmission as e}from"../ShaderOutput.js";import{VertexTextureCoordinates as r}from"../attributes/VertexTextureCoordinates.glsl.js";import{glsl as o}from"../../shaderModules/interfaces.js";import{Texture2DDrawUniform as t}from"../../shaderModules/Texture2DDrawUniform.js";import{AlphaDiscardMode as a}from"../../../lib/basicInterfaces.js";function s(s,u){const d=u.hasColorTexture&&(e(u.output)||u.alphaDiscardMode!==a.Opaque);d&&(s.include(r,u),s.fragment.uniforms.add(new t("baseColorTexture",(e=>e.texture)))),s.fragment.code.add(o`
|
|
6
6
|
vec4 readBaseColorTexture() {
|
|
7
|
-
return ${
|
|
7
|
+
return ${d?"textureLookup(baseColorTexture, vuv0)":"vec4(1.0)"};
|
|
8
8
|
}
|
|
9
|
-
`)}export{
|
|
9
|
+
`)}export{s as ReadBaseColorTexture};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{
|
|
5
|
+
import{isColorEmission as r}from"../core/shaderLibrary/ShaderOutput.js";import{TransparencyPassType as n}from"./TransparencyPassType.js";import{BlendFactor as t,CompareFunction as e,ColorAttachment as o}from"../../../webgl/enums.js";import{separateBlendingParams as u,defaultDepthWriteParams as A}from"../../../webgl/renderState.js";const O=u(t.SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA),T=u(t.ONE,t.ZERO,t.ONE,t.ONE_MINUS_SRC_ALPHA);function c(r){return r===n.FrontFace?null:T}function s(r){switch(r){case n.NONE:return O;case n.ColorAlpha:return T;case n.FrontFace:case n.COUNT:return null}}function C(r){return r===n.FrontFace?A:null}const N=5e5,a={factor:-1,units:-2};function E(r){return r?a:null}function f(r,t=e.LESS){return r===n.NONE||r===n.FrontFace?t:e.LEQUAL}function _(t,e){const u=r(e);return t===n.ColorAlpha?u?{buffers:[o.COLOR_ATTACHMENT0,o.COLOR_ATTACHMENT1,o.COLOR_ATTACHMENT2]}:{buffers:[o.COLOR_ATTACHMENT0,o.COLOR_ATTACHMENT1]}:u?{buffers:[o.COLOR_ATTACHMENT0,o.COLOR_ATTACHMENT1]}:null}export{a as OITPolygonOffset,N as OITPolygonOffsetLimit,s as blending,T as blendingColorAlpha,O as blendingDefault,_ as getDrawBuffers,E as getOITPolygonOffset,c as oitBlending,f as oitDepthTest,C as oitDepthWrite};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import{unitRGBAFromColor as s}from"../../../../core/colorUtils.js";import has from"../../../../core/has.js";import{clamp as i}from"../../../../core/mathUtils.js";import{removeMaybe as a,abortMaybe as n,destroyMaybe as h,releaseMaybe as o}from"../../../../core/maybe.js";import d from"../../../../core/PooledArray.js";import{throwIfAborted as l}from"../../../../core/promiseUtils.js";import{watch as _,syncAndInitial as u,initial as p,sync as c}from"../../../../core/reactiveUtils.js";import{signal as m}from"../../../../core/signal.js";import{property as f}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/accessorSupport/interfaces.js";import"../../../../core/accessorSupport/tracking/Flags.js";import"../../../../core/Warning.js";import"../../../../core/Error.js";import{equals as g,invert as b,multiply as T}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as E,create as A}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as P}from"../../../../chunks/vec42.js";import{fromValues as R,ZEROS as S}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{a as C}from"../../../../chunks/boundedPlane.js";import{InternalRenderCategory as w,RenderCategory as O}from"../../webgl.js";import{debugFlags as I}from"../../support/debugFlags.js";import{TransparencyMode as y}from"../../terrain/TransparencyMode.js";import{DepthFormat as D,ColorFormat as N}from"../../webgl/formats.js";import{FBOCache as x,defaultWebGLFBO as M}from"../core/FBOCache.js";import{RenderPassManager as H}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as v}from"../core/shaderLibrary/ShaderOutput.js";import{HUDRenderStyle as L}from"../core/shaderLibrary/hud/HUDRenderStyle.js";import{distanceFadeEnd as F}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as q}from"../effects/RenderNodes.js";import{isPrepareRenderPlugin as U}from"../effects/RenderPlugin.js";import{RenderPluginManager as j}from"../effects/RenderPluginManager.js";import{Blit as G}from"../effects/blit/Blit.js";import{AnimationTimeStep as V}from"./AnimationTimeStep.js";import{Decorations as B,RenderRequestType as Q,StencilBits as k}from"./basicInterfaces.js";import{BoundingInfo as z}from"./BoundingInfo.js";import{zero as W,union as X}from"./depthRange.js";import{depthRangeFromScene as Y}from"./depthRangeUtils.js";import{MainFramebuffer as J}from"./MainFramebuffer.js";import{RenderOccludedFlag as K}from"./Material.js";import{RenderContext as $,defaultRenderOccludedMask as Z}from"./RenderContext.js";import{splitRenderGeometryChangeSetByMaterial as ee,RendererTarget as te}from"./rendererUtils.js";import{setupFeatureDefaults as re,RenderFeature as se}from"./RenderFeature.js";import{RenderPluginInput as ie}from"./RenderPluginInput.js";import{RenderSlot as ae}from"./RenderSlot.js";import{ShadowAccumulator as ne}from"./ShadowAccumulator.js";import{ShadowMap as he,SnapshotSlot as oe}from"./ShadowMap.js";import de from"./SliceHelper.js";import{TransparencyPassType as le}from"./TransparencyPassType.js";import{Transparency as _e}from"./edgeRendering/interfaces.js";import{MergedRenderer as ue}from"../materials/renderers/MergedRenderer.js";import{AlphaMode as pe}from"../shaders/CompositingTechniqueConfiguration.js";import{OITCompositingTechnique as ce}from"../shaders/OITCompositingTechnique.js";import{RendererPerformanceInfo as me,PerformanceCategory as fe}from"../statistics/RendererPerformanceInfo.js";import{defaultHighlightName as ge}from"../../../support/HighlightDefaults.js";import{RenderState as be}from"../../../support/RenderState.js";import{DepthStencilAttachment as Te,PixelFormat as Ee,PixelType as Ae,FramebufferBit as Pe,TextureType as Re,ColorAttachment as Se}from"../../../webgl/enums.js";class Ce{constructor(e,t,r,i,a,n){this._stage=e,this._techniques=r,this._rctx=i,this._compositingHelper=a,this._requestRender=n,this._pluginsHas={hudElements:!1,water:!1},this._hasOverlayWater=!1,this.renderOverlay=e=>{},this._renderers=new Map,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=R(0,0,0,1),this._sliceHelper=new de,this._blit=null,this._state=m(be.IDLE),this._highQualityTransparencyEnabled=!0,this._terrainTransparency=y.Opaque,this._ssrEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new V,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=m(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new ie,this._releaseNormals=e=>{e.some((({name:e})=>"normals"===e))&&this._pluginInput.release("normals")},this._debugNeedsDepth=!1,this.fboCache=new x(i),this._renderStateFeatures=m(re(!has("disable-feature:high-quality-idle"),e.view.qualityProfile)),this._framebuffer=new J(this.fboCache),this.performanceInfo=new me(this._rctx),this._shadowMap=new he(this.fboCache,e.viewingMode),this._shadowAccumulator=new ne(this.fboCache,r,e,(e=>{const t=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),this._shadowMap.enabled=t}),((e,t,r)=>{const s=this._stage.view.qualitySettings.maximumPixelRatio;e.shadowMap.start(e.camera,t,r,!0,s),this._renderShadowCascades(v.Shadow,e.shadowMap),e.shadowMap.finish(),e.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(e.camera,e.contentCamera)}),n),this._renderContext=new $(this._rctx,this._shadowMap,this._sliceHelper),this._nodes=new q(this._renderContext),this._plugins=new j({renderContext:this._renderContext,techniques:r,materials:t,requestRender:n,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this.renderPassManager=new H,this._plugins.add(this.renderPassManager),this._handles=[_((()=>this._stage.view.state.camera),(()=>n()),u),_((()=>I.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(_e.TRANSPARENT):()=>{},n()}),p),_((()=>this._stage.view.environment.background?.color),(e=>{const t=e?s(e):S;P(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),n()}),u),_((()=>this._stage.view.state.camera.relativeElevation),(e=>{this._inGlobeView=(e??1/0)>=F}),u)]}destroy(){this._handles.forEach((e=>e.remove())),this._gpuTimerHandle=a(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.dispose(),this._loadEdgeViewTask=n(this._loadEdgeViewTask),this._edgeView=h(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.fboCache.destroy(),this._plugins.destroy(),this._renderers.clear(),this._blit=h(this._blit),z.prune()}get _bindParameters(){return this._renderContext.bindParameters}get _framebufferSize(){return this._framebuffer.size}updateRenderFeatures(e=null,t=!has("disable-feature:high-quality-idle")){this._renderStateFeatures.value=re(t,e),this._plugins.renderFeatureChanged(),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,r){this._renderStateFeatures.mutate((s=>s.set(t,e,r))),this._requestRender()}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(se.HighQualityTransparency)}get hasReflections(){return(this._pluginsHas.water||this._hasOverlayWater)&&(this._ssrEnabled||this.isFeatureEnabled(se.WaterReflection))}get hasDecorations(){return this._plugins.hasDecorations||this._nodes.produces("magnifier-color")}get hasHighlights(){return this._plugins.produces(v.Highlight,ae.OPAQUE_MATERIAL,ae.TRANSPARENT_MATERIAL,ae.DRAPED_MATERIAL)}get hasSSAO(){return(this._stage.view.qualitySettings.ambientOcclusion||this.isFeatureEnabled(se.SSAO))&&!this._inGlobeView}get hasSMAA(){return this._stage.view.qualitySettings.antialiasingEnabled||this.isFeatureEnabled(se.Antialiasing)}get fullResolutionAtmosphere(){return this._stage.view.qualitySettings.highResolutionAtmosphere||this.isFeatureEnabled(se.HighResolutionAtmosphere)}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=o(this._bindParameters.ssr.lastFrameColor),this._bindParameters.multipassTerrain.depth=o(this._bindParameters.multipassTerrain.depth),this._bindParameters.multipassGeometry.depth=o(this._bindParameters.multipassGeometry.depth),this._pluginInput.release("highlight mix")}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._bindParameters.depth=o(this._bindParameters.depth),this._bindParameters.hudVisibility=o(this._bindParameters.hudVisibility)}get updating(){return null!=this._edgeView&&this._edgeView.updating||this._shadowAccumulator.running||this._plugins.updating||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=r((async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");l(e);const r=this._edgeView=new t({rctx:this._rctx,renderSR:this._stage.view.renderSpatialReference,viewingMode:this._stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:He(this._stage.view.resourceController)});return this._handles.push(_((()=>r.updating),(()=>this._requestRender()),c)),this._requestRender(),this._edgeViewCallbacks.forEach((e=>e(r))),this._edgeViewCallbacks.length=0,r}))),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&g(this._bindParameters.ssr.reprojectionMatrix,E)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:t,_bindParameters:r}=this;if(void 0!==e.qualitySettings?.reflections&&this._ssrEnabled!==e.qualitySettings.reflections&&(this._ssrEnabled=e.qualitySettings.reflections,this._requestRender()),void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&t.maxCascades!==e.shadowMapMaxCascades&&(t.maxCascades=e.shadowMapMaxCascades,this._requestRender()),null!=e.environment){null!=e.environment.weather&&(this._bindParameters.weather=e.environment.weather,this._bindParameters.weatherVisible=!!e.weatherVisible);const t="virtual"!==e.environment.lighting.type;r.enableFillLights!==t&&(r.enableFillLights=t,this._requestRender())}void 0!==e.highQualityTransparency&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),void 0!==e.hasOverlayWater&&this._hasOverlayWater!==e.hasOverlayWater&&(this._hasOverlayWater=e.hasOverlayWater,this._requestRender()),void 0!==e.slicePlane&&this._sliceHelper.plane!==e.slicePlane&&(this._sliceHelper.plane=e.slicePlane,this._requestRender()),void 0!==e.terrainTransparency&&this._terrainTransparency!==e.terrainTransparency&&(this._terrainTransparency=e.terrainTransparency,this._requestRender()),void 0!==e.shadowCast&&this._shadowAccumulator.setOptions(e.shadowCast)}get hasSlicePlane(){return!!this._sliceHelper.plane}get plugins(){return this._plugins}getMaterialRenderer(e){return this._renderers.get(e)}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}modify(e,t){this._isRendering&&console.warn("Renderer.modify called while rendering");const{adds:r,removes:s,updates:i}=e;if(0===r.length&&0===s.length&&0===i.length)return;ee(e).forEach(((r,s)=>{if(t.done)return;let i=this._renderers.get(s);null==i&&r.adds.length>0&&(i=new ue({material:s}),i.initializeRenderContext(this._plugins._context),this._plugins.add(i),this._renderers.set(s,i)),i&&(i.modify(r),0===i.numGeometries&&(this._renderers.delete(i.material),this._plugins.remove(i),i.destroy())),r.removes.forEach((t=>e.removes.removeUnordered(t))),r.adds.forEach((t=>e.adds.removeUnordered(t))),r.updates.forEach((t=>e.updates.removeUnordered(t))),t.madeProgress()})),this.updateHasFlags(),this._requestRender()}updateHasFlags(){const has=this._pluginsHas;has.hudElements=this._plugins.produces(v.Color,ae.LINE_CALLOUTS_HUD_DEPTH,ae.HUD_MATERIAL,ae.LABEL_MATERIAL),has.water=this._plugins.produces(v.Normal,ae.DRAPED_WATER),this._bindParameters.hasOccludees=this._plugins.hasOccludees}updateAnimation(e){const t=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(e),this._hasAnimations=this._nodes.updateAnimation()||this._hasAnimations,this._hasAnimations!==t&&(this._gpuTimerHandle=t?a(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,r=te.Default,s=B.ON){try{return this._isRendering=!0,this._render(e,t,r,s)}catch(i){console.error(`Exception during rendering: ${i}`)}finally{this._isRendering=!1}return{screen:this._pluginInput.get("final-color"),oid:null}}_render(e,t,r=te.Default,s=B.ON){this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=r===te.Default,this._disposeBindBuffers();const i=this._framebuffer,{camera:a,contentCamera:n,mode:h,alignPixelEnabled:d}=e;this._state.value=h,this._bindParameters.overlay=this.renderOverlay(t),this._bindParameters.overlay&&this.performanceInfo.advance(fe.OVERLAY),this._renderContext.time=t,this._bindParameters.transparencyPassType=le.NONE,this._bindParameters.alignPixelEnabled=d,this._bindParameters.decorations=s,this._bindParameters.mainDepth=null,this._bindParameters.viewshedEnabled=this._nodes.produces(w.VIEWSHED);const l=this._nodes.produces("magnifier-color"),_=this._nodes.produces("final-color"),u=C(this._sliceHelper.plane);s===B.OFF&&(this._sliceHelper.plane=null),a.setGLViewport(this._rctx);const p=this._nodes.require("composite-color:emissions","composite-color:emissions")>0&&this._plugins.hasEmissions,c=p?v.ColorEmission:v.Color,m=i.initialize(a.fullWidth,a.fullHeight,this._backgroundColor,p);this.hasReflections?this._bindParameters.ssr.lastFrameColor=m:m?.release(),this._ensureBindParametersCamera(a,n),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&s===B.ON;const f=this._plugins.produces(v.Color,ae.OPAQUE_TERRAIN)&&(this._terrainTransparency===y.Transparent||this._terrainTransparency===y.InvisibleWithDraped),g=this._highQualityTransparency&&f,b=this._plugins.produces(v.Color,...ye);this._prepareShaders(g,b,c),this.performanceInfo.advance(fe.PREPARE);const T=this._computeDepthRange(a);this._renderShadowMap(a,this._bindParameters.lighting.mainLight.direction,T),this._ensureBindParametersCamera(a,n);let E=this._renderNormals();this._pluginInput.set("normals",E);const A=this._needsDepth;if(E){let e=null;A&&(e=E.getAttachment(Te),e?.retain()),this._pluginInput.set("ssao",this._renderSSAO()),this._renderNoSSAOGeometryDepth(A,e),E=null}else this._renderAllGeometryDepth(A);this._renderShadowAccumulation(T,a,n),this._ensureBindParametersSSR(t),this._renderContext.output=c,i.bind(),this._bindParameters.mainDepth=i.depth.attachment;const P=this.plugins.produces(v.Color,...Ie);P&&this._renderOpaqueGeometry(),i.update((e=>this._renderNodes(O.OPAQUE,e,P))),this.fboCache.debugCallback?.("opaque-color",i.color.fbo),this._renderPlugins(ae.OPAQUE_ENVIRONMENT,fe.OPAQUE_ENVIRONMENT),this._renderMultipassTerrainDepth(g),this._setMultipassTerrain(g),this._renderEdges(_e.OPAQUE),i.bind(),this._renderPlugins(ae.VOXEL,fe.VOXEL),this._renderHiddenTransparentEdges(),b&&(this._oitEnabled?this._renderOITPass(we.Geometry,c):this._renderTransparentMaterial()),i.update((e=>this._renderNodes(O.TRANSPARENT,e,b))),this.fboCache.debugCallback?.("transparent-color",i.color.fbo),this._renderMultipassGeometryDepth(g),this._renderHUDVisibility(),g||this._plugins.render(this._pluginInput,ae.LINE_CALLOUTS);const R=r===te.ObjectAndLayerID?this._renderObjectAndLayerIdColor():null;this._renderEdges(_e.TRANSPARENT);const S=f?this._renderTransparentTerrain():null;S&&(this.performanceInfo.advance(fe.TRANSPARENT_TERRAIN),this._bindParameters.hudVisibility&&(g?this._renderLineCallouts(L.Occluded):(this._rctx.bindFramebuffer(this._bindParameters.hudVisibility?.fbo),this._compositingHelper.compositeHUD(this._bindParameters,S.getTexture())),this._renderHUD(L.Occluded,i.color,c))),this._setTerrainCulling(!1),S&&(i.bind(),this._compositingHelper.composite(this._bindParameters,S.getTexture(),pe.PremultipliedAlpha),S.release(),g&&(this._renderEdges(_e.OPAQUE),b&&(this._oitEnabled?this._renderOITPass(we.Geometry,c):this._renderTransparentMaterial(),this.performanceInfo.advance(fe.TRANSPARENT)),this._renderEdges(_e.TRANSPARENT))),this._bindParameters.ssao=o(this._bindParameters.ssao),g&&this._renderLineCallouts(L.NotOccluded),this._setMultipassEnabled(!1),this._renderTransparentEnvironment(),i.update((e=>this._renderNodes(w.VIEWSHED,e))),i.update((e=>this._renderNodes(w.LASERLINES,e))),this._renderOccluded(c),this._pluginInput.set("highlights",this._renderHighlightPrepass()),i.update((e=>this._renderNodes(p?O.COMPOSITE_EMISSIONS:O.COMPOSITE,e)));const I=!(r!==te.Default||_||l&&s===B.ON&&r===te.Default),D=this._pluginInput.get(p?"composite-color:emissions":"composite-color");p&&(D.setName("composite-color"),this._pluginInput.set("composite-color",D));const N=I?M:this.fboCache.acquire(D.fbo.width,D.fbo.height,"aa-color"),x=this._nodes.produces("aa-color")?this._renderNodes(w.ANTIALIASING,N):this._blitFBO(D,N,!1);this._pluginInput.set(w.ANTIALIASING,x),this._renderHUD(L.NotOccluded,x,c);const H=this._renderNodes(w.HIGHLIGHTS,x),F=this._renderNodes(w.MAGNIFIER,H);return l&&s===B.ON&&r===te.Default&&!_&&this._blitFBO(F),_?(F.attachDepth(i.depth),this._blitFBO(this._renderNodes(O.FINAL,F)),F.detachDepth()):this._pluginInput.set(O.FINAL,F),this._pluginInput.release("highlights"),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),i.releaseDepth(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this._sliceHelper.plane=u,this.fboCache.frameEnd(),this.performanceInfo.finishFrame(),r!==te.Default&&(this._releaseFBOs(),this._disposeOffscreenBuffers()),{screen:this._pluginInput.get("final-color"),oid:R}}_prepareShaders(e,t,r){this._renderContext.output=r,this._prepareOpaqueGeometry(),this._setMultipassTerrain(e),this._plugins.prepare(ae.TRANSPARENT_TERRAIN),this._setMultipassTerrain(!1),e||this._plugins.prepare(ae.LINE_CALLOUTS),t&&this._prepareTransparencySlots(r),this._plugins.prepare(ae.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,ae.TRANSPARENT_ENVIRONMENT),this._rctx.gl.flush()}_renderObjectAndLayerIdColor(){if(!has("enable-feature:objectAndLayerId-rendering"))return;const e=this._renderContext.output,t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"oid");return r.acquireDepth(D.DEPTH_STENCIL_TEXTURE),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer([0,0,0,0],!0,!0),this._renderAllGeometry(v.ObjectAndLayerIdColor),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(void 0,!0,!0),this._bindParameters.hudRenderStyle=L.NotOccluded,this._plugins.render(this._pluginInput,ae.HUD_MATERIAL),this._renderContext.output=e,this.performanceInfo.advance(fe.OBJECT_AND_LAYER_ID_COLOR),r}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=e===Q.BACKGROUND;if(r||t){const e=r?this.performanceInfo.elapsedTime:0;let s=0;t?s=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const i=Math.max(e,s);this._animationTimestep.frame(i,r)}}readDepthPixels(e,t){const{mainDepth:r,camera:s}=this._bindParameters;if(!r)return;const i=this.fboCache.acquire(this._framebufferSize.width,this._framebufferSize.height,"linear-depth");this._rctx.bindFramebuffer(i.fbo),s.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer([0,0,0,0]),this._compositingHelper.blitDepthToLinearDepth(this._bindParameters,r),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),i.fbo?.readPixels(e[0],e[1],e[2],e[3],Ee.RGBA,Ae.UNSIGNED_BYTE,t),i.release()}readHUDVisibility(e,t,r,s,i){this._bindParameters.hudVisibility?.fbo?.readPixels(e,t,r,s,Ee.RGBA,Ae.UNSIGNED_BYTE,i)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_setMultipassTerrain(e){this._setMultipassEnabled(e),this._setTerrainCulling(e)}_setMultipassEnabled(e){this._bindParameters.multipassEnabled=e}_setTerrainCulling(e){this._bindParameters.multipassTerrain.cullAboveGround=e}_renderEdges(e){const t=this._edgeView;if(!t?.shouldRender())return;const r=this._framebufferSize,s=this.fboCache.acquire(r.width,r.height,"edges"),i=()=>t.render(this._bindParameters,e),a=this._bindParameters.multipassGeometry.depth;this.renderToTargets(i,s,a??this._framebuffer.depth,Oe),this._framebuffer.bind(),this._compositingHelper.composite(this._bindParameters,s.getTexture(),pe.Alpha),s.release(),this.performanceInfo.advance(e===_e.OPAQUE?fe.OPAQUE_EDGES:fe.TRANSPARENT_EDGES)}_renderShadowMap(e,t,r){const s=this._shadowMap;s.enabled&&(s.start(e,t,r,this.isFeatureEnabled(se.HighResolutionShadows),this._stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(v.ShadowHighlight,this._shadowMap),s.moveSnapshot(oe.Highlight),this._renderShadowCascades(v.ShadowExcludeHighlight,this._shadowMap),s.copySnapshot(oe.ExcludeHighlight),this._renderShadowCascades(v.ShadowHighlight,this._shadowMap)):this._renderShadowCascades(v.Shadow),s.finish(),e.setGLViewport(this._rctx),this.performanceInfo.advance(fe.SHADOW_MAP))}_renderShadowCascades(e,t=this._shadowMap){for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this._renderAllGeometry(e)}get _needsDepth(){return this._plugins.consumes(v.Depth)||this._nodes.requireGeometryDepth()||this.hasReflections||this._needsShadowHighlight||this._needsShadowCast||this._debugNeedsDepth}_renderNoSSAOGeometryDepth(e,t){if(!e||!t)return void(this._bindParameters.depth=o(this._bindParameters.depth));const r=this._framebufferSize,s=this.fboCache.acquire(r.width,r.height,"depth");s.attachDepth(t),t.release(),this._rctx.bindFramebuffer(s.fbo),this._rctx.clearFramebuffer(void 0,!1,!0),this._renderGeometryExcludedFromSSAO(v.Depth),o(this._bindParameters.depth),this._bindParameters.depth=s.obtainDepthTexture(),s.release(),this.performanceInfo.advance(fe.DEPTH)}_renderAllGeometryDepth(e){if(!e)return void(this._bindParameters.depth=o(this._bindParameters.depth));const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"depth").acquireDepth(D.DEPTH_STENCIL_TEXTURE);this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(void 0,!0,!0),this._renderAllGeometry(v.Depth),o(this._bindParameters.depth),this._bindParameters.depth=r.obtainDepthTexture(),r.release(),this.performanceInfo.advance(fe.DEPTH)}_renderMultipassTerrainDepth(e){if(!e)return void(this._bindParameters.multipassTerrain.depth=o(this._bindParameters.multipassTerrain.depth));const t=this._renderContext.output;this._renderContext.output=v.Depth;const r=this._framebufferSize,s=this.fboCache.acquire(r.width,r.height,"terrain depth").acquireDepth(D.DEPTH_STENCIL_TEXTURE);this._rctx.bindFramebuffer(s.fbo),this._rctx.clearFramebuffer(void 0,!0,!0),this._renderTransparentTerrain(),o(this._bindParameters.multipassTerrain.depth),this._bindParameters.multipassTerrain.depth=s.obtainDepthTexture(),this._renderContext.output=t,s.release()}_renderMultipassGeometryDepth(e){if(!e)return void(this._bindParameters.multipassGeometry.depth=o(this._bindParameters.multipassGeometry.depth));const t=this._renderContext.output,r=this._framebufferSize,s=this.fboCache.acquire(r.width,r.height,"geometry depth").acquireDepth(D.DEPTH_STENCIL_TEXTURE);this._rctx.bindFramebuffer(s.fbo),this._rctx.clearFramebuffer(void 0,!0,!0),this._renderOpaqueGeometryAndTransparentMaterial(v.Depth),this._renderContext.output=t,o(this._bindParameters.multipassGeometry.depth),this._bindParameters.multipassGeometry.depth=s.obtainDepthTexture(),s.release()}get _needsDepthRange(){return this._shadowMap.enabled||this._needsShadowCast}_computeDepthRange(e){if(!this._needsDepthRange)return W;const t=Y(e,this._plugins.plugins,this._stage.layers);return X(t,this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}_renderNormals(){const e=this._nodes.require("normals","final-color","composite-color","opaque-color","transparent-color","laserline-color"),t=(this.hasSSAO?1:0)+e;if(0===t)return;const r=this._framebufferSize,s=this.fboCache.acquire(r.width,r.height,"normals",N.RGBA);s.acquireDepth(D.DEPTH_STENCIL_TEXTURE),this._rctx.bindFramebuffer(s.fbo),this._rctx.clearFramebuffer([0,0,0,0],!0,!0),this._renderGeometryForSSAO(v.Normal);const i=this._nodes.optional("normals","final-color","composite-color","opaque-color","transparent-color","viewshed-color");return s.retain(t+i-1),this.performanceInfo.advance(fe.NORMALS),s}_renderSSAO(){const e=this._pluginInput.get("normals");if(!this.hasSSAO||!e)return void e?.detachDepth();M.setName("ssao");const t=this._nodes.render(M,this._pluginInput);return this._bindParameters.ssao=t,e.detachDepth(),this._pluginInput.release("normals"),this.performanceInfo.advance(fe.SSAO),t}_renderAllGeometry(e){this._renderContext.output=e,this._plugins.prepare(ae.TRANSPARENT_TERRAIN),this._renderOpaqueGeometryAndTransparentMaterial(e),this._renderTransparentTerrain()}renderAllGeometryForShadowMap(e,t){const{camera:r,contentCamera:s}=this._bindParameters;t.setGLViewport(this._rctx),this._ensureBindParametersCamera(t,t),this._renderAllGeometry(e),this._ensureBindParametersCamera(r,s),this._bindParameters.camera.setGLViewport(this._rctx)}_renderOpaqueGeometryAndTransparentMaterial(e){this._renderContext.output=e,this._plugins.prepare(ae.TRANSPARENT_MATERIAL,ae.TRANSPARENT_NO_SSAO_DEPTH),this._renderOpaqueGeometry(),this._renderTransparentMaterial()}_renderGeometryForSSAO(e){this._renderContext.output=e,this._plugins.render(this._pluginInput,ae.INTEGRATED_MESH,ae.OPAQUE_TERRAIN,ae.OPAQUE_MATERIAL,ae.TRANSPARENT_MATERIAL),this._renderTransparentTerrain()}_renderGeometryExcludedFromSSAO(e){this._renderContext.output=e,this._plugins.render(this._pluginInput,ae.OPAQUE_NO_SSAO_DEPTH,ae.TRANSPARENT_NO_SSAO_DEPTH)}_prepareOpaqueGeometry(){this._plugins.prepare(...Ie,ae.OPAQUE_ENVIRONMENT)}_renderOpaqueGeometry(){this._plugins.render(this._pluginInput,...Ie)}_renderTransparentMaterial(){this._plugins.render(this._pluginInput,...ye)}_renderTransparentTerrain(){const e=this._renderContext.output;if(!this._plugins.produces(e,ae.TRANSPARENT_TERRAIN))return;const t=()=>this._plugins.render(this._pluginInput,ae.TRANSPARENT_TERRAIN);if(e!==v.Color&&e!==v.ColorEmission)return void t();const r=this._framebufferSize,s=this.fboCache.acquire(r.width,r.height,"transparent terrain");return this.renderToTargets(t,s,this._framebuffer.depth,[0,0,0,0]),s}_renderHUDVisibility(){if(this._plugins.produces(this._renderContext.output,ae.OCCLUSION_PIXELS)){const e=()=>{const e=this._framebufferSize;let t=this._bindParameters.hudVisibility;const r=this._bindParameters.multipassGeometry.depth;return t?.fbo?.width===e.width&&t?.fbo?.height===e.height||(t?.release(),t=this.fboCache.acquire(e.width,e.height,"hud visibility",N.RGBA4)),t.attachDepth(r||this._framebuffer.depth),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer([0,1,0,1]),this._plugins.render(this._pluginInput,ae.OCCLUSION_PIXELS),t.detachDepth(),t};this._bindParameters.hudVisibility=e(),this._framebuffer.bind(),this.performanceInfo.advance(fe.HUD_VISIBILITY)}else this._bindParameters.hudVisibility=o(this._bindParameters.hudVisibility)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,e===L.Occluded){const e=()=>this._plugins.render(this._pluginInput,ae.LINE_CALLOUTS),t=this._framebufferSize,r=this.fboCache.acquireDepth(D.DEPTH16_BUFFER,t.width,t.height,"line callouts");this.renderToTargets(e,this._framebuffer.color,r,void 0,!0,!0),r.release()}else this._plugins.render(this._pluginInput,ae.LINE_CALLOUTS)}_renderHUD(e,t,r){if(this._pluginsHas.hudElements){if(this._oitEnabled){const s=this._renderOITPass(we.HUD,r,e);this._rctx.bindFramebuffer(t.fbo),this._compositingHelper.composite(this._bindParameters,s.getTexture(),pe.PremultipliedAlpha),s.release()}else if(e===L.Occluded){this._renderContext.output=v.Color;const t=()=>this._renderHUDElements(e),r=this._framebufferSize,s=this.fboCache.acquireDepth(D.DEPTH16_BUFFER,r.width,r.height,"hud");this.renderToTargets(t,this._framebuffer.color,s,void 0,!0,!0),s.release()}else this._renderContext.output=v.Color,t.acquireDepth(D.DEPTH16_BUFFER),this._rctx.bindFramebuffer(t.fbo),this._renderHUDElements(e),t.detachDepth();this.performanceInfo.advance(e===L.Occluded?fe.HUD_OCCLUDED:fe.HUD)}}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.prepare(ae.LINE_CALLOUTS_HUD_DEPTH,ae.HUD_MATERIAL,ae.LABEL_MATERIAL),this._plugins.render(this._pluginInput,ae.LINE_CALLOUTS_HUD_DEPTH,ae.HUD_MATERIAL,ae.LABEL_MATERIAL)}get _needsShadowHighlight(){return this._shadowMap.enabled&&this._plugins.produces(v.ShadowHighlight,ae.OPAQUE_MATERIAL)}_renderHighlightPrepass(){if(!this.hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:r}=this,s=this._framebufferSize;let a=this._pluginInput.get("highlight mix");null==a&&(a=e.acquire(s.width,s.height,"highlight mix",N.RGBA),this._pluginInput.set("highlight mix",a),r.highlightTexture=a.getTexture()),t.bindFramebuffer(a.fbo);const n=[0,0,0,0];t.clearFramebuffer(n);const h=a.getTexture(),o=e.acquire(s.width,s.height,"highlights",N.RGBA);o.acquireDepth(D.DEPTH16_BUFFER),t.bindFramebuffer(o.fbo),t.clearFramebuffer(n,!0);const{highlights:d}=this._stage.view,l=i(d.length,1,16),{highlightGroupMap:_}=r;_.clear(),_.set(ge,0);for(let i=1;i<l;++i){const e=d.at(i-1)?.name;e&&_.set(e,i)}for(let i=0;i<l;++i)r.highlightLevel=i,r.highlightGroup=0===i?ge:d.at(i-1).name,t.bindFramebuffer(o.fbo),t.clearFramebuffer(void 0,!0),this._renderAllGeometry(v.Highlight),0===i&&(t.clear(Pe.DEPTH),this._renderHUDElements(L.Both)),t.clear(Pe.DEPTH),t.bindTexture(h,0),t.gl.copyTexImage2D(Re.TEXTURE_2D,0,Ee.RGBA,0,0,s.width,s.height,0);return o}get _needsShadowCast(){return this._shadowAccumulator.isAccumulating}_renderShadowAccumulation(e,t,r){this._needsShadowCast&&this._bindParameters.depth&&this._shadowAccumulator.renderAccumulation(this._bindParameters.depth,e,t,r)&&this.performanceInfo.advance(fe.ACCUMULATED_SHADOWS)}_prepareTransparencySlots(e){this._renderContext.output=e,this._bindParameters.transparencyPassType=le.ColorAlpha,this._plugins.prepare(...ye),this._bindParameters.transparencyPassType=le.FrontFace,this._plugins.prepare(...ye),this._bindParameters.transparencyPassType=le.NONE,this._techniques.acquire(ce).release()}_renderOITPass(e,t,r=L.Both){const s=e===we.HUD,i=this._framebufferSize,a=s?this.fboCache.acquire(i.width,i.height,"oit hud composite"):null,n=s?()=>this._renderHUDElements(r):()=>this._renderTransparentMaterial(),h=this._renderContext.output;return this._renderContext.output=t,this._renderOIT(this._bindParameters,n,a),this._renderContext.output=h,a}_renderOIT(e,t,r){const s=this._framebufferSize;e.transparencyPassType=le.ColorAlpha;const i=r?"oit hud color alpha":"oit color alpha",a=this.fboCache.acquire(s.width,s.height,i,N.RGBA16F);a.acquireColor(Se.COLOR_ATTACHMENT1,N.R16F),r||a.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(a.fbo),this._rctx.clearFramebuffer([0,0,0,1]),t(),a.detachDepth(),e.transparencyPassType=le.FrontFace;const n=this.fboCache.acquire(s.width,s.height,r?"oit hud front":"oit front");r?n.acquireDepth(D.DEPTH16_BUFFER):n.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(n.fbo),this._rctx.clearFramebuffer([0,0,0,0],!!r),t(),n.detachDepth(),e.transparencyPassType=le.NONE,r?(this._rctx.bindFramebuffer(r.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(Pe.COLOR)):this._framebuffer.bind(),this._compositingHelper.compositeOIT(e,a.getTexture(),a.getTexture(Se.COLOR_ATTACHMENT1),n.getTexture()),r?.detachDepth(),n.release(),a.release()}_renderOccluded(e){let t=0;De.clear(),this._plugins.plugins.forAll((e=>{if(!e.material)return;e.queryRenderOccludedState(K.OccludeAndTransparentStencil)&&(t|=K.OccludeAndTransparentStencil,De.push(e))}));const r=this._framebuffer,s=(e,s,i,a,n)=>{if(!(t&s))return;const h=this._framebufferSize,o=this.fboCache.acquire(h.width,h.height,"tmp color");let d;d=a?this.fboCache.acquireDepth(D.DEPTH_STENCIL_TEXTURE,h.width,h.height,"tmp depth"):r.depth,this.renderToTargets(i,o,d,[0,0,0,0],a,n),r.bind(),this._compositingHelper.composite(this._bindParameters,o.getTexture(),pe.PremultipliedAlpha,e),a&&d.release(),o.release()},i=(e,t)=>{this._bindParameters.slot=e,t.forAll((e=>{if(U(e)){const t=e.prepareTechnique(this._renderContext);t&&e.renderNode(this._renderContext,t)}}))};0!==De.length&&(i(ae.OCCLUDER_MATERIAL,De),s(.5,K.OccludeAndTransparentStencil,(()=>i(ae.TRANSPARENT_OCCLUDER_MATERIAL,De)),!1,!1));const a=De.length>0;De.clear(),this._plugins.plugins.forAll((e=>{if(!e.material)return;const r=e.queryRenderOccludedState(K.OccludeAndTransparent),s=e.queryRenderOccludedState(K.Transparent),i=e.queryRenderOccludedState(K.Opaque);(r||s||i)&&(t|=r?K.OccludeAndTransparent:s?K.Transparent:K.Opaque,De.push(e))}));const n=this._plugins.renderOccludedFlags;if(t|=n,!t)return;const h=e=>{this._renderContext.renderOccludedMask=e,n>K.Occlude&&this._plugins.render(this._pluginInput,ae.OCCLUDED_TERRAIN),i(ae.OPAQUE_MATERIAL,De),i(ae.TRANSPARENT_MATERIAL,De),i(ae.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,De),this._renderContext.renderOccludedMask=Z};this._renderContext.output=e,s(.5,K.OccludeAndTransparent,(()=>h(K.OccludeAndTransparent)),!0,k.OutlineVisualElementMask),s(.5,K.Transparent,(()=>h(K.Transparent)),!0,k.OutlineVisualElementMask),s(1,K.Opaque,(()=>h(K.Opaque)),!0,k.OutlineVisualElementMask),(a||De.length>0)&&this.performanceInfo.advance(fe.OCCLUDED),De.clear()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this._framebuffer.bind(),this._plugins.render(this._pluginInput,ae.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,ae.TRANSPARENT_ENVIRONMENT),this.performanceInfo.advance(fe.TRANSPARENT_ENVIRONMENT)}_renderPlugins(e,t){this._plugins.produces(this._renderContext.output,e)&&(this._plugins.render(this._pluginInput,e),this.performanceInfo.advance(t))}_renderNodes(e,t,r=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return r&&this.performanceInfo.advance(e),t;const s=this._nodes.render(t,this._pluginInput,this._releaseNormals);return this.performanceInfo.advance(e),s}_blitFBO(e,t=M,r=!0){return this._blit??=new G(this._techniques),this._blit.blit(this._rctx,e,t,this._bindParameters),this._pluginInput.set(e.name,t),r&&e.release(),t}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=E:(b(xe,this._bindParameters.camera.viewMatrix),b(Ne,this._bindParameters.camera.projectionMatrix),T(Me,xe,Ne),T(Me,this._renderContext.lastFrameCamera.viewMatrix,Me),T(Me,this._renderContext.lastFrameCamera.projectionMatrix,Me),this._reprojectionMatrix=Me);const t=this._stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=t>0?Math.min(t,e-this._ssrEnableTime)/t:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=E,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0}}renderToTargets(e,t,r,s,i=!1,a=!1){t.attachDepth(r),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(s,i,a),e(),t.detachDepth()}get test(){}}var we;e([f({readOnly:!0})],Ce.prototype,"fullResolutionAtmosphere",null),e([f()],Ce.prototype,"_edgeView",void 0),e([f()],Ce.prototype,"updating",null),function(e){e[e.Geometry=0]="Geometry",e[e.HUD=1]="HUD"}(we||(we={}));const Oe=[0,0,0,0],Ie=[ae.INTEGRATED_MESH,ae.OPAQUE_TERRAIN,ae.OPAQUE_MATERIAL,ae.OPAQUE_NO_SSAO_DEPTH],ye=[ae.TRANSPARENT_MATERIAL,ae.TRANSPARENT_NO_SSAO_DEPTH],De=new d,Ne=A(),xe=A(),Me=A();function He(e){return t=>e.immediate.schedule(t)}export{Ce as Renderer};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import{unitRGBAFromColor as s}from"../../../../core/colorUtils.js";import has from"../../../../core/has.js";import{clamp as i}from"../../../../core/mathUtils.js";import{removeMaybe as a,abortMaybe as n,destroyMaybe as h,releaseMaybe as o}from"../../../../core/maybe.js";import d from"../../../../core/PooledArray.js";import{throwIfAborted as l}from"../../../../core/promiseUtils.js";import{watch as _,syncAndInitial as u,initial as p,sync as c}from"../../../../core/reactiveUtils.js";import{signal as m}from"../../../../core/signal.js";import{property as f}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/accessorSupport/interfaces.js";import"../../../../core/accessorSupport/tracking/Flags.js";import"../../../../core/Warning.js";import"../../../../core/Error.js";import{equals as g,invert as b,multiply as T}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as E,create as A}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as P}from"../../../../chunks/vec42.js";import{fromValues as R,ZEROS as S}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{a as C}from"../../../../chunks/boundedPlane.js";import{InternalRenderCategory as w,RenderCategory as O}from"../../webgl.js";import{debugFlags as I}from"../../support/debugFlags.js";import{TransparencyMode as y}from"../../terrain/TransparencyMode.js";import{DepthFormat as D,ColorFormat as N}from"../../webgl/formats.js";import{FBOCache as x,defaultWebGLFBO as M}from"../core/FBOCache.js";import{RenderPassManager as H}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as v,isColorOrColorEmission as L}from"../core/shaderLibrary/ShaderOutput.js";import{HUDRenderStyle as F}from"../core/shaderLibrary/hud/HUDRenderStyle.js";import{distanceFadeEnd as q}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as U}from"../effects/RenderNodes.js";import{isPrepareRenderPlugin as j}from"../effects/RenderPlugin.js";import{RenderPluginManager as G}from"../effects/RenderPluginManager.js";import{Blit as V}from"../effects/blit/Blit.js";import{AnimationTimeStep as B}from"./AnimationTimeStep.js";import{Decorations as Q,RenderRequestType as k,StencilBits as z}from"./basicInterfaces.js";import{BoundingInfo as W}from"./BoundingInfo.js";import{zero as X,union as Y}from"./depthRange.js";import{depthRangeFromScene as J}from"./depthRangeUtils.js";import{MainFramebuffer as K}from"./MainFramebuffer.js";import{RenderOccludedFlag as $}from"./Material.js";import{RenderContext as Z,defaultRenderOccludedMask as ee}from"./RenderContext.js";import{splitRenderGeometryChangeSetByMaterial as te,RendererTarget as re}from"./rendererUtils.js";import{setupFeatureDefaults as se,RenderFeature as ie}from"./RenderFeature.js";import{RenderPluginInput as ae}from"./RenderPluginInput.js";import{RenderSlot as ne}from"./RenderSlot.js";import{ShadowAccumulator as he}from"./ShadowAccumulator.js";import{ShadowMap as oe,SnapshotSlot as de}from"./ShadowMap.js";import le from"./SliceHelper.js";import{TransparencyPassType as _e}from"./TransparencyPassType.js";import{Transparency as ue}from"./edgeRendering/interfaces.js";import{MergedRenderer as pe}from"../materials/renderers/MergedRenderer.js";import{AlphaMode as ce}from"../shaders/CompositingTechniqueConfiguration.js";import{OITCompositingTechnique as me}from"../shaders/OITCompositingTechnique.js";import{RendererPerformanceInfo as fe,PerformanceCategory as ge}from"../statistics/RendererPerformanceInfo.js";import{defaultHighlightName as be}from"../../../support/HighlightDefaults.js";import{RenderState as Te}from"../../../support/RenderState.js";import{DepthStencilAttachment as Ee,PixelFormat as Ae,PixelType as Pe,FramebufferBit as Re,TextureType as Se,ColorAttachment as Ce}from"../../../webgl/enums.js";class we{constructor(e,t,r,i,a,n){this._stage=e,this._techniques=r,this._rctx=i,this._compositingHelper=a,this._requestRender=n,this._pluginsHas={hudElements:!1,water:!1},this._hasOverlayWater=!1,this.renderOverlay=e=>{},this._renderers=new Map,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=R(0,0,0,1),this._sliceHelper=new le,this._blit=null,this._state=m(Te.IDLE),this._highQualityTransparencyEnabled=!0,this._terrainTransparency=y.Opaque,this._ssrEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new B,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=m(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new ae,this._releaseNormals=e=>{e.some((({name:e})=>"normals"===e))&&this._pluginInput.release("normals")},this._debugNeedsDepth=!1,this.fboCache=new x(i),this._renderStateFeatures=m(se(!has("disable-feature:high-quality-idle"),e.view.qualityProfile)),this._framebuffer=new K(this.fboCache),this.performanceInfo=new fe(this._rctx),this._shadowMap=new oe(this.fboCache,e.viewingMode),this._shadowAccumulator=new he(this.fboCache,r,e,(e=>{const t=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),this._shadowMap.enabled=t}),((e,t,r)=>{const s=this._stage.view.qualitySettings.maximumPixelRatio;e.shadowMap.start(e.camera,t,r,!0,s),this._renderShadowCascades(v.Shadow,e.shadowMap),e.shadowMap.finish(),e.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(e.camera,e.contentCamera)}),n),this._renderContext=new Z(this._rctx,this._shadowMap,this._sliceHelper),this._nodes=new U(this._renderContext),this._plugins=new G({renderContext:this._renderContext,techniques:r,materials:t,requestRender:n,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this.renderPassManager=new H,this._plugins.add(this.renderPassManager),this._handles=[_((()=>this._stage.view.state.camera),(()=>n()),u),_((()=>I.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(ue.TRANSPARENT):()=>{},n()}),p),_((()=>this._stage.view.environment.background?.color),(e=>{const t=e?s(e):S;P(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),n()}),u),_((()=>this._stage.view.state.camera.relativeElevation),(e=>{this._inGlobeView=(e??1/0)>=q}),u)]}destroy(){this._handles.forEach((e=>e.remove())),this._gpuTimerHandle=a(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.dispose(),this._loadEdgeViewTask=n(this._loadEdgeViewTask),this._edgeView=h(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.fboCache.destroy(),this._plugins.destroy(),this._renderers.clear(),this._blit=h(this._blit),W.prune()}get _bindParameters(){return this._renderContext.bindParameters}get _framebufferSize(){return this._framebuffer.size}updateRenderFeatures(e=null,t=!has("disable-feature:high-quality-idle")){this._renderStateFeatures.value=se(t,e),this._plugins.renderFeatureChanged(),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,r){this._renderStateFeatures.mutate((s=>s.set(t,e,r))),this._requestRender()}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(ie.HighQualityTransparency)}get hasReflections(){return(this._pluginsHas.water||this._hasOverlayWater)&&(this._ssrEnabled||this.isFeatureEnabled(ie.WaterReflection))}get hasDecorations(){return this._plugins.hasDecorations||this._nodes.produces("magnifier-color")}get hasHighlights(){return this._plugins.produces(v.Highlight,ne.OPAQUE_MATERIAL,ne.TRANSPARENT_MATERIAL,ne.DRAPED_MATERIAL)}get hasSSAO(){return(this._stage.view.qualitySettings.ambientOcclusion||this.isFeatureEnabled(ie.SSAO))&&!this._inGlobeView}get hasSMAA(){return this._stage.view.qualitySettings.antialiasingEnabled||this.isFeatureEnabled(ie.Antialiasing)}get fullResolutionAtmosphere(){return this._stage.view.qualitySettings.highResolutionAtmosphere||this.isFeatureEnabled(ie.HighResolutionAtmosphere)}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=o(this._bindParameters.ssr.lastFrameColor),this._bindParameters.multipassTerrain.depth=o(this._bindParameters.multipassTerrain.depth),this._bindParameters.multipassGeometry.depth=o(this._bindParameters.multipassGeometry.depth),this._pluginInput.release("highlight mix")}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._bindParameters.depth=o(this._bindParameters.depth),this._bindParameters.hudVisibility=o(this._bindParameters.hudVisibility)}get updating(){return null!=this._edgeView&&this._edgeView.updating||this._shadowAccumulator.running||this._plugins.updating||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=r((async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");l(e);const r=this._edgeView=new t({rctx:this._rctx,renderSR:this._stage.view.renderSpatialReference,viewingMode:this._stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:ve(this._stage.view.resourceController)});return this._handles.push(_((()=>r.updating),(()=>this._requestRender()),c)),this._requestRender(),this._edgeViewCallbacks.forEach((e=>e(r))),this._edgeViewCallbacks.length=0,r}))),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&g(this._bindParameters.ssr.reprojectionMatrix,E)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:t,_bindParameters:r}=this;if(void 0!==e.qualitySettings?.reflections&&this._ssrEnabled!==e.qualitySettings.reflections&&(this._ssrEnabled=e.qualitySettings.reflections,this._requestRender()),void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&t.maxCascades!==e.shadowMapMaxCascades&&(t.maxCascades=e.shadowMapMaxCascades,this._requestRender()),null!=e.environment){null!=e.environment.weather&&(this._bindParameters.weather=e.environment.weather,this._bindParameters.weatherVisible=!!e.weatherVisible);const t="virtual"!==e.environment.lighting.type;r.enableFillLights!==t&&(r.enableFillLights=t,this._requestRender())}void 0!==e.highQualityTransparency&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),void 0!==e.hasOverlayWater&&this._hasOverlayWater!==e.hasOverlayWater&&(this._hasOverlayWater=e.hasOverlayWater,this._requestRender()),void 0!==e.slicePlane&&this._sliceHelper.plane!==e.slicePlane&&(this._sliceHelper.plane=e.slicePlane,this._requestRender()),void 0!==e.terrainTransparency&&this._terrainTransparency!==e.terrainTransparency&&(this._terrainTransparency=e.terrainTransparency,this._requestRender()),void 0!==e.shadowCast&&this._shadowAccumulator.setOptions(e.shadowCast)}get hasSlicePlane(){return!!this._sliceHelper.plane}get plugins(){return this._plugins}getMaterialRenderer(e){return this._renderers.get(e)}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}modify(e,t){this._isRendering&&console.warn("Renderer.modify called while rendering");const{adds:r,removes:s,updates:i}=e;if(0===r.length&&0===s.length&&0===i.length)return;te(e).forEach(((r,s)=>{if(t.done)return;let i=this._renderers.get(s);null==i&&r.adds.length>0&&(i=new pe({material:s}),i.initializeRenderContext(this._plugins._context),this._plugins.add(i),this._renderers.set(s,i)),i&&(i.modify(r),0===i.numGeometries&&(this._renderers.delete(i.material),this._plugins.remove(i),i.destroy())),r.removes.forEach((t=>e.removes.removeUnordered(t))),r.adds.forEach((t=>e.adds.removeUnordered(t))),r.updates.forEach((t=>e.updates.removeUnordered(t))),t.madeProgress()})),this.updateHasFlags(),this._requestRender()}updateHasFlags(){const has=this._pluginsHas;has.hudElements=this._plugins.produces(v.Color,ne.LINE_CALLOUTS_HUD_DEPTH,ne.HUD_MATERIAL,ne.LABEL_MATERIAL),has.water=this._plugins.produces(v.Normal,ne.DRAPED_WATER),this._bindParameters.hasOccludees=this._plugins.hasOccludees}updateAnimation(e){const t=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(e),this._hasAnimations=this._nodes.updateAnimation()||this._hasAnimations,this._hasAnimations!==t&&(this._gpuTimerHandle=t?a(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,r=re.Default,s=Q.ON){try{return this._isRendering=!0,this._render(e,t,r,s)}catch(i){console.error(`Exception during rendering: ${i}`)}finally{this._isRendering=!1}return{screen:this._pluginInput.get("final-color"),oid:null}}_render(e,t,r=re.Default,s=Q.ON){this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=r===re.Default,this._disposeBindBuffers();const i=this._framebuffer,{camera:a,contentCamera:n,mode:h,alignPixelEnabled:d}=e;this._state.value=h,this._bindParameters.overlay=this.renderOverlay(t),this._bindParameters.overlay&&this.performanceInfo.advance(ge.OVERLAY),this._renderContext.time=t,this._bindParameters.transparencyPassType=_e.NONE,this._bindParameters.alignPixelEnabled=d,this._bindParameters.decorations=s,this._bindParameters.mainDepth=null,this._bindParameters.viewshedEnabled=this._nodes.produces(w.VIEWSHED);const l=this._nodes.produces("magnifier-color"),_=this._nodes.produces("final-color"),u=C(this._sliceHelper.plane);s===Q.OFF&&(this._sliceHelper.plane=null),a.setGLViewport(this._rctx);const p=this._nodes.require("composite-color:emissions","composite-color:emissions")>0&&this._plugins.hasEmissions,c=p?v.ColorEmission:v.Color,m=i.initialize(a.fullWidth,a.fullHeight,this._backgroundColor,p);this.hasReflections?this._bindParameters.ssr.lastFrameColor=m:m?.release(),this._ensureBindParametersCamera(a,n),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&s===Q.ON;const f=this._plugins.produces(v.Color,ne.OPAQUE_TERRAIN)&&(this._terrainTransparency===y.Transparent||this._terrainTransparency===y.InvisibleWithDraped),g=this._highQualityTransparency&&f,b=this._plugins.produces(v.Color,...De);this._prepareShaders(g,b,c),this.performanceInfo.advance(ge.PREPARE);const T=this._computeDepthRange(a);this._renderShadowMap(a,this._bindParameters.lighting.mainLight.direction,T),this._ensureBindParametersCamera(a,n);let E=this._renderNormals();this._pluginInput.set("normals",E);const A=this._needsDepth;if(E){let e=null;A&&(e=E.getAttachment(Ee),e?.retain()),this._pluginInput.set("ssao",this._renderSSAO()),this._renderNoSSAOGeometryDepth(A,e),E=null}else this._renderAllGeometryDepth(A);this._renderShadowAccumulation(T,a,n),this._ensureBindParametersSSR(t),this._renderContext.output=c,i.bind(),this._bindParameters.mainDepth=i.depth.attachment;const P=this.plugins.produces(v.Color,...ye);P&&this._renderOpaqueGeometry(),i.update((e=>this._renderNodes(O.OPAQUE,e,P))),this.fboCache.debugCallback?.("opaque-color",i.color.fbo),this._renderPlugins(ne.OPAQUE_ENVIRONMENT,ge.OPAQUE_ENVIRONMENT),this._renderMultipassTerrainDepth(g),this._setMultipassTerrain(g),this._renderEdges(ue.OPAQUE),i.bind(),this._renderPlugins(ne.VOXEL,ge.VOXEL),this._renderHiddenTransparentEdges(),b&&(this._oitEnabled?this._renderOITPass(Oe.Geometry,c):this._renderTransparentMaterial()),i.update((e=>this._renderNodes(O.TRANSPARENT,e,b))),this.fboCache.debugCallback?.("transparent-color",i.color.fbo),this._renderMultipassGeometryDepth(g),this._renderHUDVisibility(),g||this._plugins.render(this._pluginInput,ne.LINE_CALLOUTS);const R=r===re.ObjectAndLayerID?this._renderObjectAndLayerIdColor():null;this._renderEdges(ue.TRANSPARENT);const S=f?this._renderTransparentTerrain():null;S&&(this.performanceInfo.advance(ge.TRANSPARENT_TERRAIN),this._bindParameters.hudVisibility&&(g?this._renderLineCallouts(F.Occluded):(this._rctx.bindFramebuffer(this._bindParameters.hudVisibility?.fbo),this._compositingHelper.compositeHUD(this._bindParameters,S.getTexture())),this._renderHUD(F.Occluded,i.color,c))),this._setTerrainCulling(!1),S&&(i.bind(),this._compositingHelper.composite(this._bindParameters,S.getTexture(),ce.PremultipliedAlpha),S.release(),g&&(this._renderEdges(ue.OPAQUE),b&&(this._oitEnabled?this._renderOITPass(Oe.Geometry,c):this._renderTransparentMaterial(),this.performanceInfo.advance(ge.TRANSPARENT)),this._renderEdges(ue.TRANSPARENT))),this._bindParameters.ssao=o(this._bindParameters.ssao),g&&this._renderLineCallouts(F.NotOccluded),this._setMultipassEnabled(!1),this._renderTransparentEnvironment(),i.update((e=>this._renderNodes(w.VIEWSHED,e))),i.update((e=>this._renderNodes(w.LASERLINES,e))),this._renderOccluded(c),this._pluginInput.set("highlights",this._renderHighlightPrepass()),i.update((e=>this._renderNodes(p?O.COMPOSITE_EMISSIONS:O.COMPOSITE,e)));const I=!(r!==re.Default||_||l&&s===Q.ON&&r===re.Default),D=this._pluginInput.get(p?"composite-color:emissions":"composite-color");p&&(D.setName("composite-color"),this._pluginInput.set("composite-color",D));const N=I?M:this.fboCache.acquire(D.fbo.width,D.fbo.height,"aa-color"),x=this._nodes.produces("aa-color")?this._renderNodes(w.ANTIALIASING,N):this._blitFBO(D,N,!1);this._pluginInput.set(w.ANTIALIASING,x),this._renderHUD(F.NotOccluded,x,c);const H=this._renderNodes(w.HIGHLIGHTS,x),L=this._renderNodes(w.MAGNIFIER,H);return l&&s===Q.ON&&r===re.Default&&!_&&this._blitFBO(L),_?(L.attachDepth(i.depth),this._blitFBO(this._renderNodes(O.FINAL,L)),L.detachDepth()):this._pluginInput.set(O.FINAL,L),this._pluginInput.release("highlights"),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),i.releaseDepth(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this._sliceHelper.plane=u,this.fboCache.frameEnd(),this.performanceInfo.finishFrame(),r!==re.Default&&(this._releaseFBOs(),this._disposeOffscreenBuffers()),{screen:this._pluginInput.get("final-color"),oid:R}}_prepareShaders(e,t,r){this._renderContext.output=r,this._prepareOpaqueGeometry(),this._setMultipassTerrain(e),this._plugins.prepare(ne.TRANSPARENT_TERRAIN),this._setMultipassTerrain(!1),e||this._plugins.prepare(ne.LINE_CALLOUTS),t&&this._prepareTransparencySlots(r),this._plugins.prepare(ne.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,ne.TRANSPARENT_ENVIRONMENT),this._rctx.gl.flush()}_renderObjectAndLayerIdColor(){if(!has("enable-feature:objectAndLayerId-rendering"))return;const e=this._renderContext.output,t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"oid");return r.acquireDepth(D.DEPTH_STENCIL_TEXTURE),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer([0,0,0,0],!0,!0),this._renderAllGeometry(v.ObjectAndLayerIdColor),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(void 0,!0,!0),this._bindParameters.hudRenderStyle=F.NotOccluded,this._plugins.render(this._pluginInput,ne.HUD_MATERIAL),this._renderContext.output=e,this.performanceInfo.advance(ge.OBJECT_AND_LAYER_ID_COLOR),r}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=e===k.BACKGROUND;if(r||t){const e=r?this.performanceInfo.elapsedTime:0;let s=0;t?s=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const i=Math.max(e,s);this._animationTimestep.frame(i,r)}}readDepthPixels(e,t){const{mainDepth:r,camera:s}=this._bindParameters;if(!r)return;const i=this.fboCache.acquire(this._framebufferSize.width,this._framebufferSize.height,"linear-depth");this._rctx.bindFramebuffer(i.fbo),s.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer([0,0,0,0]),this._compositingHelper.blitDepthToLinearDepth(this._bindParameters,r),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),i.fbo?.readPixels(e[0],e[1],e[2],e[3],Ae.RGBA,Pe.UNSIGNED_BYTE,t),i.release()}readHUDVisibility(e,t,r,s,i){this._bindParameters.hudVisibility?.fbo?.readPixels(e,t,r,s,Ae.RGBA,Pe.UNSIGNED_BYTE,i)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_setMultipassTerrain(e){this._setMultipassEnabled(e),this._setTerrainCulling(e)}_setMultipassEnabled(e){this._bindParameters.multipassEnabled=e}_setTerrainCulling(e){this._bindParameters.multipassTerrain.cullAboveGround=e}_renderEdges(e){const t=this._edgeView;if(!t?.shouldRender())return;const r=this._framebufferSize,s=this.fboCache.acquire(r.width,r.height,"edges"),i=()=>t.render(this._bindParameters,e),a=this._bindParameters.multipassGeometry.depth;this.renderToTargets(i,s,a??this._framebuffer.depth,Ie),this._framebuffer.bind(),this._compositingHelper.composite(this._bindParameters,s.getTexture(),ce.Alpha),s.release(),this.performanceInfo.advance(e===ue.OPAQUE?ge.OPAQUE_EDGES:ge.TRANSPARENT_EDGES)}_renderShadowMap(e,t,r){const s=this._shadowMap;s.enabled&&(s.start(e,t,r,this.isFeatureEnabled(ie.HighResolutionShadows),this._stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(v.ShadowHighlight,this._shadowMap),s.moveSnapshot(de.Highlight),this._renderShadowCascades(v.ShadowExcludeHighlight,this._shadowMap),s.copySnapshot(de.ExcludeHighlight),this._renderShadowCascades(v.ShadowHighlight,this._shadowMap)):this._renderShadowCascades(v.Shadow),s.finish(),e.setGLViewport(this._rctx),this.performanceInfo.advance(ge.SHADOW_MAP))}_renderShadowCascades(e,t=this._shadowMap){for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this._renderAllGeometry(e)}get _needsDepth(){return this._plugins.consumes(v.Depth)||this._nodes.requireGeometryDepth()||this.hasReflections||this._needsShadowHighlight||this._needsShadowCast||this._debugNeedsDepth}_renderNoSSAOGeometryDepth(e,t){if(!e||!t)return void(this._bindParameters.depth=o(this._bindParameters.depth));const r=this._framebufferSize,s=this.fboCache.acquire(r.width,r.height,"depth");s.attachDepth(t),t.release(),this._rctx.bindFramebuffer(s.fbo),this._rctx.clearFramebuffer(void 0,!1,!0),this._renderGeometryExcludedFromSSAO(v.Depth),o(this._bindParameters.depth),this._bindParameters.depth=s.obtainDepthTexture(),s.release(),this.performanceInfo.advance(ge.DEPTH)}_renderAllGeometryDepth(e){if(!e)return void(this._bindParameters.depth=o(this._bindParameters.depth));const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"depth").acquireDepth(D.DEPTH_STENCIL_TEXTURE);this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(void 0,!0,!0),this._renderAllGeometry(v.Depth),o(this._bindParameters.depth),this._bindParameters.depth=r.obtainDepthTexture(),r.release(),this.performanceInfo.advance(ge.DEPTH)}_renderMultipassTerrainDepth(e){if(!e)return void(this._bindParameters.multipassTerrain.depth=o(this._bindParameters.multipassTerrain.depth));const t=this._renderContext.output;this._renderContext.output=v.Depth;const r=this._framebufferSize,s=this.fboCache.acquire(r.width,r.height,"terrain depth").acquireDepth(D.DEPTH_STENCIL_TEXTURE);this._rctx.bindFramebuffer(s.fbo),this._rctx.clearFramebuffer(void 0,!0,!0),this._renderTransparentTerrain(),o(this._bindParameters.multipassTerrain.depth),this._bindParameters.multipassTerrain.depth=s.obtainDepthTexture(),this._renderContext.output=t,s.release()}_renderMultipassGeometryDepth(e){if(!e)return void(this._bindParameters.multipassGeometry.depth=o(this._bindParameters.multipassGeometry.depth));const t=this._renderContext.output,r=this._framebufferSize,s=this.fboCache.acquire(r.width,r.height,"geometry depth").acquireDepth(D.DEPTH_STENCIL_TEXTURE);this._rctx.bindFramebuffer(s.fbo),this._rctx.clearFramebuffer(void 0,!0,!0),this._renderOpaqueGeometryAndTransparentMaterial(v.Depth),this._renderContext.output=t,o(this._bindParameters.multipassGeometry.depth),this._bindParameters.multipassGeometry.depth=s.obtainDepthTexture(),s.release()}get _needsDepthRange(){return this._shadowMap.enabled||this._needsShadowCast}_computeDepthRange(e){if(!this._needsDepthRange)return X;const t=J(e,this._plugins.plugins,this._stage.layers);return Y(t,this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}_renderNormals(){const e=this._nodes.require("normals","final-color","composite-color","opaque-color","transparent-color","laserline-color"),t=(this.hasSSAO?1:0)+e;if(0===t)return;const r=this._framebufferSize,s=this.fboCache.acquire(r.width,r.height,"normals",N.RGBA);s.acquireDepth(D.DEPTH_STENCIL_TEXTURE),this._rctx.bindFramebuffer(s.fbo),this._rctx.clearFramebuffer([0,0,0,0],!0,!0),this._renderGeometryForSSAO(v.Normal);const i=this._nodes.optional("normals","final-color","composite-color","opaque-color","transparent-color","viewshed-color");return s.retain(t+i-1),this.performanceInfo.advance(ge.NORMALS),s}_renderSSAO(){const e=this._pluginInput.get("normals");if(!this.hasSSAO||!e)return void e?.detachDepth();M.setName("ssao");const t=this._nodes.render(M,this._pluginInput);return this._bindParameters.ssao=t,e.detachDepth(),this._pluginInput.release("normals"),this.performanceInfo.advance(ge.SSAO),t}_renderAllGeometry(e){this._renderContext.output=e,this._plugins.prepare(ne.TRANSPARENT_TERRAIN),this._renderOpaqueGeometryAndTransparentMaterial(e),this._renderTransparentTerrain()}renderAllGeometryForShadowMap(e,t){const{camera:r,contentCamera:s}=this._bindParameters;t.setGLViewport(this._rctx),this._ensureBindParametersCamera(t,t),this._renderAllGeometry(e),this._ensureBindParametersCamera(r,s),this._bindParameters.camera.setGLViewport(this._rctx)}_renderOpaqueGeometryAndTransparentMaterial(e){this._renderContext.output=e,this._plugins.prepare(ne.TRANSPARENT_MATERIAL,ne.TRANSPARENT_NO_SSAO_DEPTH),this._renderOpaqueGeometry(),this._renderTransparentMaterial()}_renderGeometryForSSAO(e){this._renderContext.output=e,this._plugins.render(this._pluginInput,ne.INTEGRATED_MESH,ne.OPAQUE_TERRAIN,ne.OPAQUE_MATERIAL,ne.TRANSPARENT_MATERIAL),this._renderTransparentTerrain()}_renderGeometryExcludedFromSSAO(e){this._renderContext.output=e,this._plugins.render(this._pluginInput,ne.OPAQUE_NO_SSAO_DEPTH,ne.TRANSPARENT_NO_SSAO_DEPTH)}_prepareOpaqueGeometry(){this._plugins.prepare(...ye,ne.OPAQUE_ENVIRONMENT)}_renderOpaqueGeometry(){this._plugins.render(this._pluginInput,...ye)}_renderTransparentMaterial(){this._plugins.render(this._pluginInput,...De)}_renderTransparentTerrain(){const e=this._renderContext.output;if(!this._plugins.produces(e,ne.TRANSPARENT_TERRAIN))return;const t=()=>this._plugins.render(this._pluginInput,ne.TRANSPARENT_TERRAIN);if(!L(e))return void t();const r=this._framebufferSize,s=this.fboCache.acquire(r.width,r.height,"transparent terrain");return this.renderToTargets(t,s,this._framebuffer.depth,[0,0,0,0]),s}_renderHUDVisibility(){if(this._plugins.produces(this._renderContext.output,ne.OCCLUSION_PIXELS)){const e=()=>{const e=this._framebufferSize;let t=this._bindParameters.hudVisibility;const r=this._bindParameters.multipassGeometry.depth;return t?.fbo?.width===e.width&&t?.fbo?.height===e.height||(t?.release(),t=this.fboCache.acquire(e.width,e.height,"hud visibility",N.RGBA4)),t.attachDepth(r||this._framebuffer.depth),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer([0,1,0,1]),this._plugins.render(this._pluginInput,ne.OCCLUSION_PIXELS),t.detachDepth(),t};this._bindParameters.hudVisibility=e(),this._framebuffer.bind(),this.performanceInfo.advance(ge.HUD_VISIBILITY)}else this._bindParameters.hudVisibility=o(this._bindParameters.hudVisibility)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,e===F.Occluded){const e=()=>this._plugins.render(this._pluginInput,ne.LINE_CALLOUTS),t=this._framebufferSize,r=this.fboCache.acquireDepth(D.DEPTH16_BUFFER,t.width,t.height,"line callouts");this.renderToTargets(e,this._framebuffer.color,r,void 0,!0,!0),r.release()}else this._plugins.render(this._pluginInput,ne.LINE_CALLOUTS)}_renderHUD(e,t,r){if(this._pluginsHas.hudElements){if(this._oitEnabled){const s=this._renderOITPass(Oe.HUD,r,e);this._rctx.bindFramebuffer(t.fbo),this._compositingHelper.composite(this._bindParameters,s.getTexture(),ce.PremultipliedAlpha),s.release()}else if(e===F.Occluded){this._renderContext.output=v.Color;const t=()=>this._renderHUDElements(e),r=this._framebufferSize,s=this.fboCache.acquireDepth(D.DEPTH16_BUFFER,r.width,r.height,"hud");this.renderToTargets(t,this._framebuffer.color,s,void 0,!0,!0),s.release()}else this._renderContext.output=v.Color,t.acquireDepth(D.DEPTH16_BUFFER),this._rctx.bindFramebuffer(t.fbo),this._renderHUDElements(e),t.detachDepth();this.performanceInfo.advance(e===F.Occluded?ge.HUD_OCCLUDED:ge.HUD)}}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.prepare(ne.LINE_CALLOUTS_HUD_DEPTH,ne.HUD_MATERIAL,ne.LABEL_MATERIAL),this._plugins.render(this._pluginInput,ne.LINE_CALLOUTS_HUD_DEPTH,ne.HUD_MATERIAL,ne.LABEL_MATERIAL)}get _needsShadowHighlight(){return this._shadowMap.enabled&&this._plugins.produces(v.ShadowHighlight,ne.OPAQUE_MATERIAL)}_renderHighlightPrepass(){if(!this.hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:r}=this,s=this._framebufferSize;let a=this._pluginInput.get("highlight mix");null==a&&(a=e.acquire(s.width,s.height,"highlight mix",N.RGBA),this._pluginInput.set("highlight mix",a),r.highlightTexture=a.getTexture()),t.bindFramebuffer(a.fbo);const n=[0,0,0,0];t.clearFramebuffer(n);const h=a.getTexture(),o=e.acquire(s.width,s.height,"highlights",N.RGBA);o.acquireDepth(D.DEPTH16_BUFFER),t.bindFramebuffer(o.fbo),t.clearFramebuffer(n,!0);const{highlights:d}=this._stage.view,l=i(d.length,1,16),{highlightGroupMap:_}=r;_.clear(),_.set(be,0);for(let i=1;i<l;++i){const e=d.at(i-1)?.name;e&&_.set(e,i)}for(let i=0;i<l;++i)r.highlightLevel=i,r.highlightGroup=0===i?be:d.at(i-1).name,t.bindFramebuffer(o.fbo),t.clearFramebuffer(void 0,!0),this._renderAllGeometry(v.Highlight),0===i&&(t.clear(Re.DEPTH),this._renderHUDElements(F.Both)),t.clear(Re.DEPTH),t.bindTexture(h,0),t.gl.copyTexImage2D(Se.TEXTURE_2D,0,Ae.RGBA,0,0,s.width,s.height,0);return o}get _needsShadowCast(){return this._shadowAccumulator.isAccumulating}_renderShadowAccumulation(e,t,r){this._needsShadowCast&&this._bindParameters.depth&&this._shadowAccumulator.renderAccumulation(this._bindParameters.depth,e,t,r)&&this.performanceInfo.advance(ge.ACCUMULATED_SHADOWS)}_prepareTransparencySlots(e){this._renderContext.output=e,this._bindParameters.transparencyPassType=_e.ColorAlpha,this._plugins.prepare(...De),this._bindParameters.transparencyPassType=_e.FrontFace,this._plugins.prepare(...De),this._bindParameters.transparencyPassType=_e.NONE,this._techniques.acquire(me).release()}_renderOITPass(e,t,r=F.Both){const s=e===Oe.HUD,i=this._framebufferSize,a=s?this.fboCache.acquire(i.width,i.height,"oit hud composite"):null,n=s?()=>this._renderHUDElements(r):()=>this._renderTransparentMaterial(),h=this._renderContext.output;return this._renderContext.output=t,this._renderOIT(this._bindParameters,n,a),this._renderContext.output=h,a}_renderOIT(e,t,r){const s=this._framebufferSize;e.transparencyPassType=_e.ColorAlpha;const i=r?"oit hud color alpha":"oit color alpha",a=this.fboCache.acquire(s.width,s.height,i,N.RGBA16F);a.acquireColor(Ce.COLOR_ATTACHMENT1,N.R16F),r||a.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(a.fbo),this._rctx.clearFramebuffer([0,0,0,1]),t(),a.detachDepth(),e.transparencyPassType=_e.FrontFace;const n=this.fboCache.acquire(s.width,s.height,r?"oit hud front":"oit front");r?n.acquireDepth(D.DEPTH16_BUFFER):n.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(n.fbo),this._rctx.clearFramebuffer([0,0,0,0],!!r),t(),n.detachDepth(),e.transparencyPassType=_e.NONE,r?(this._rctx.bindFramebuffer(r.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(Re.COLOR)):this._framebuffer.bind(),this._compositingHelper.compositeOIT(e,a.getTexture(),a.getTexture(Ce.COLOR_ATTACHMENT1),n.getTexture()),r?.detachDepth(),n.release(),a.release()}_renderOccluded(e){let t=0;Ne.clear(),this._plugins.plugins.forAll((e=>{if(!e.material)return;e.queryRenderOccludedState($.OccludeAndTransparentStencil)&&(t|=$.OccludeAndTransparentStencil,Ne.push(e))}));const r=this._framebuffer,s=(e,s,i,a,n)=>{if(!(t&s))return;const h=this._framebufferSize,o=this.fboCache.acquire(h.width,h.height,"tmp color");let d;d=a?this.fboCache.acquireDepth(D.DEPTH_STENCIL_TEXTURE,h.width,h.height,"tmp depth"):r.depth,this.renderToTargets(i,o,d,[0,0,0,0],a,n),r.bind(),this._compositingHelper.composite(this._bindParameters,o.getTexture(),ce.PremultipliedAlpha,e),a&&d.release(),o.release()},i=(e,t)=>{this._bindParameters.slot=e,t.forAll((e=>{if(j(e)){const t=e.prepareTechnique(this._renderContext);t&&e.renderNode(this._renderContext,t)}}))};0!==Ne.length&&(i(ne.OCCLUDER_MATERIAL,Ne),s(.5,$.OccludeAndTransparentStencil,(()=>i(ne.TRANSPARENT_OCCLUDER_MATERIAL,Ne)),!1,!1));const a=Ne.length>0;Ne.clear(),this._plugins.plugins.forAll((e=>{if(!e.material)return;const r=e.queryRenderOccludedState($.OccludeAndTransparent),s=e.queryRenderOccludedState($.Transparent),i=e.queryRenderOccludedState($.Opaque);(r||s||i)&&(t|=r?$.OccludeAndTransparent:s?$.Transparent:$.Opaque,Ne.push(e))}));const n=this._plugins.renderOccludedFlags;if(t|=n,!t)return;const h=e=>{this._renderContext.renderOccludedMask=e,n>$.Occlude&&this._plugins.render(this._pluginInput,ne.OCCLUDED_TERRAIN),i(ne.OPAQUE_MATERIAL,Ne),i(ne.TRANSPARENT_MATERIAL,Ne),i(ne.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,Ne),this._renderContext.renderOccludedMask=ee};this._renderContext.output=e,s(.5,$.OccludeAndTransparent,(()=>h($.OccludeAndTransparent)),!0,z.OutlineVisualElementMask),s(.5,$.Transparent,(()=>h($.Transparent)),!0,z.OutlineVisualElementMask),s(1,$.Opaque,(()=>h($.Opaque)),!0,z.OutlineVisualElementMask),(a||Ne.length>0)&&this.performanceInfo.advance(ge.OCCLUDED),Ne.clear()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this._framebuffer.bind(),this._plugins.render(this._pluginInput,ne.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,ne.TRANSPARENT_ENVIRONMENT),this.performanceInfo.advance(ge.TRANSPARENT_ENVIRONMENT)}_renderPlugins(e,t){this._plugins.produces(this._renderContext.output,e)&&(this._plugins.render(this._pluginInput,e),this.performanceInfo.advance(t))}_renderNodes(e,t,r=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return r&&this.performanceInfo.advance(e),t;const s=this._nodes.render(t,this._pluginInput,this._releaseNormals);return this.performanceInfo.advance(e),s}_blitFBO(e,t=M,r=!0){return this._blit??=new V(this._techniques),this._blit.blit(this._rctx,e,t,this._bindParameters),this._pluginInput.set(e.name,t),r&&e.release(),t}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=E:(b(Me,this._bindParameters.camera.viewMatrix),b(xe,this._bindParameters.camera.projectionMatrix),T(He,Me,xe),T(He,this._renderContext.lastFrameCamera.viewMatrix,He),T(He,this._renderContext.lastFrameCamera.projectionMatrix,He),this._reprojectionMatrix=He);const t=this._stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=t>0?Math.min(t,e-this._ssrEnableTime)/t:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=E,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0}}renderToTargets(e,t,r,s,i=!1,a=!1){t.attachDepth(r),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(s,i,a),e(),t.detachDepth()}get test(){}}var Oe;e([f({readOnly:!0})],we.prototype,"fullResolutionAtmosphere",null),e([f()],we.prototype,"_edgeView",void 0),e([f()],we.prototype,"updating",null),function(e){e[e.Geometry=0]="Geometry",e[e.HUD=1]="HUD"}(Oe||(Oe={}));const Ie=[0,0,0,0],ye=[ne.INTEGRATED_MESH,ne.OPAQUE_TERRAIN,ne.OPAQUE_MATERIAL,ne.OPAQUE_NO_SSAO_DEPTH],De=[ne.TRANSPARENT_MATERIAL,ne.TRANSPARENT_NO_SSAO_DEPTH],Ne=new d,xe=A(),Me=A(),He=A();function ve(e){return t=>e.immediate.schedule(t)}export{we as Renderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import has from"../../../../core/has.js";import{e,s as
|
|
5
|
+
import has from"../../../../core/has.js";import{e,s as t,c as r,n as s,f as a,l as i,j as o,m as n,t as h}from"../../../../chunks/vec32.js";import{ZEROS as l,create as c,fromValues as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ViewingMode as m}from"../../../ViewingMode.js";import{newLayout as p}from"../../support/buffer/InterleavedLayout.js";import{is3DGeometryOutputMRT as f,isShadowRelatedOutput as d,is3DGeometryOutput as g,ShaderOutput as T,isColorOrColorEmission as _}from"../core/shaderLibrary/ShaderOutput.js";import{NormalType as x}from"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{EmissionSource as b}from"../core/shaderLibrary/output/Emissions.glsl.js";import{NormalsDoubleSidedMode as v}from"../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as S}from"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{alphaCutoff as O}from"../core/shaderLibrary/util/AlphaCutoff.js";import{CullFaceOptions as M}from"../lib/basicInterfaces.js";import{GLTextureMaterial as w}from"../lib/GLTextureMaterial.js";import{Material as y}from"../lib/Material.js";import{OITPolygonOffsetLimit as C}from"../lib/OrderIndependentTransparency.js";import{intersectTriangleGeometry as I}from"../lib/RayIntersections.js";import{RenderSlot as R}from"../lib/RenderSlot.js";import{VertexAttribute as A}from"../lib/VertexAttribute.js";import{getVerticalOffsetObject3D as P}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as j}from"./DefaultBufferWriter.js";import{verticalOffsetAtDistance as E}from"./internal/MaterialUtil.js";import{DefaultMaterialTechnique as L,DefaultMaterialPassParameters as D}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as N}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as V}from"../shaders/RealisticTreeTechnique.js";class B extends y{constructor(e){super(e,G),this._configuration=new N,this.supportsEdges=!0,this.produces=new Map([[R.OPAQUE_MATERIAL,e=>(f(e)||d(e))&&!this.parameters.transparent],[R.TRANSPARENT_MATERIAL,e=>(f(e)||d(e))&&this.parameters.transparent&&this.parameters.writeDepth],[R.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,e=>(g(e)||d(e))&&this.parameters.transparent&&!this.parameters.writeDepth]]),this._vertexBufferLayout=F(this.parameters)}isVisibleForOutput(e){return e!==T.Shadow&&e!==T.ShadowExcludeHighlight&&e!==T.ShadowHighlight||this.parameters.castShadows}get visible(){const e=this.parameters;if(e.layerOpacity<O)return!1;const{hasInstancedColor:t,hasVertexColors:r,hasSymbolColors:s,vvColor:a}=e,i=t||a||s,o="replace"===e.colorMixMode,n=e.opacity>=O;if(r&&i)return o||n;const h=e.externalColor&&e.externalColor[3]>=O;return r?o?h:n:i?o||n:o?h:n}get hasEmissions(){return!!this.parameters.emissiveTextureId||!e(this.parameters.emissiveFactor,l)}getConfiguration(e,t){return this._configuration.output=e,this._configuration.hasNormalTexture=!!this.parameters.normalTextureId,this._configuration.hasColorTexture=!!this.parameters.textureId,this._configuration.hasVertexTangents=this.parameters.hasVertexTangents,this._configuration.instanced=this.parameters.isInstanced,this._configuration.instancedDoublePrecision=this.parameters.instancedDoublePrecision,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.hasVerticalOffset=null!=this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasSliceHighlight=this.parameters.hasSliceHighlight,this._configuration.alphaDiscardMode=this.parameters.textureAlphaMode,this._configuration.normalType=this.parameters.normalType,this._configuration.transparent=this.parameters.transparent,this._configuration.discardInvisibleFragments=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,null!=this.parameters.customDepthTest&&(this._configuration.customDepthTest=this.parameters.customDepthTest),this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.cullFace=this.parameters.hasSlicePlane?M.None:this.parameters.cullFace,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration.hasModelTransformation=null!=this.parameters.modelTransformation,_(e)&&(this._configuration.hasVertexColors=this.parameters.hasVertexColors,this._configuration.hasSymbolColors=this.parameters.hasSymbolColors,this.parameters.treeRendering?this._configuration.doubleSidedMode=v.WindingOrder:this._configuration.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?v.View:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?v.WindingOrder:v.None,this._configuration.instancedColor=this.parameters.hasInstancedColor,this._configuration.receiveShadows=this.parameters.receiveShadows&&this.parameters.shadowMappingEnabled,this._configuration.receiveAmbientOcclusion=this.parameters.receiveAmbientOcclusion&&null!=t.ssao,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.textureAlphaPremultiplied=!!this.parameters.textureAlphaPremultiplied,this._configuration.pbrMode=this.parameters.usePBR?this.parameters.isSchematic?S.Schematic:S.Normal:S.Disabled,this._configuration.hasMetallicRoughnessTexture=!!this.parameters.metallicRoughnessTextureId,this._configuration.emissionSource=null!=this.parameters.emissiveTextureId?b.Texture:this.parameters.usePBR&&!this.parameters.isSchematic?b.Value:b.None,this._configuration.hasOcclusionTexture=!!this.parameters.occlusionTextureId,this._configuration.offsetBackfaces=!(!this.parameters.transparent||!this.parameters.offsetTransparentBackfaces),this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.enableOffset=t.camera.relativeElevation<C,this._configuration.snowCover=this.hasSnowCover(t),this._configuration.hasColorTextureTransform=!!this.parameters.colorTextureTransformMatrix,this._configuration.hasNormalTextureTransform=!!this.parameters.normalTextureTransformMatrix,this._configuration.hasEmissionTextureTransform=!!this.parameters.emissiveTextureTransformMatrix,this._configuration.hasOcclusionTextureTransform=!!this.parameters.occlusionTextureTransformMatrix,this._configuration.hasMetallicRoughnessTextureTransform=!!this.parameters.metallicRoughnessTextureTransformMatrix),this._configuration}hasSnowCover(e){return null!=e.weather&&e.weatherVisible&&"snowy"===e.weather.type&&"enabled"===e.weather.snowCover}intersect(e,l,c,u,p,f){if(null!=this.parameters.verticalOffset){const e=c.camera;t(Y,l[12],l[13],l[14]);let f=null;switch(c.viewingMode){case m.Global:f=s(q,Y);break;case m.Local:f=r(q,k)}let d=0;const g=a(J,Y,e.eye),T=i(g),_=o(g,g,1/T);let x=null;this.parameters.screenSizePerspective&&(x=n(f,_)),d+=E(e,T,this.parameters.verticalOffset,x??0,this.parameters.screenSizePerspective),o(f,f,d),h(U,f,c.transform.inverseRotation),u=a(H,u,U),p=a(W,p,U)}I(e,c,u,p,P(c.verticalOffset),f)}createGLMaterial(e){return new z(e)}createBufferWriter(){return new j(this._vertexBufferLayout)}}class z extends w{constructor(e){super({...e,...e.material.parameters})}_updateShadowState(e){e.shadowMap.enabled!==this._material.parameters.shadowMappingEnabled&&this._material.setParameters({shadowMappingEnabled:e.shadowMap.enabled})}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){_(this._output)&&(this._updateShadowState(e),this._updateOccludeeState(e));const r=this._material.parameters;this.updateTexture(r.textureId);const s=e.camera.viewInverseTransposeMatrix;return t(r.origin,s[3],s[7],s[11]),this._material.setParameters(this.textureBindParameters),this.ensureTechnique(r.treeRendering?V:L,e)}}class G extends D{constructor(){super(...arguments),this.initTextureTransparent=!1,this.treeRendering=!1,this.hasVertexTangents=!1}}function F(e){const t=p().vec3f(A.POSITION);e.normalType===x.Compressed?t.vec2i16(A.NORMALCOMPRESSED,{glNormalized:!0}):t.vec3f(A.NORMAL),e.hasVertexTangents&&t.vec4f(A.TANGENT);return(e.textureId||e.normalTextureId||e.metallicRoughnessTextureId||e.emissiveTextureId||e.occlusionTextureId)&&t.vec2f(A.UV0),e.hasVertexColors&&t.vec4u8(A.COLOR),e.hasSymbolColors&&t.vec4u8(A.SYMBOLCOLOR),has("enable-feature:objectAndLayerId-rendering")&&t.vec4u8(A.OBJECTANDLAYERIDCOLOR),t}const H=c(),W=c(),k=u(0,0,1),q=c(),U=c(),Y=c(),J=c();export{z as DefaultGLMaterial,B as DefaultMaterial,G as DefaultMaterialParameters};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import has from"../../../../core/has.js";import{clamp as e}from"../../../../core/mathUtils.js";import{fromValues as t}from"../../../../geometry/support/aaBoundingBox.js";import{newLayout as r}from"../../support/buffer/InterleavedLayout.js";import{isShadowRelatedOutput as i,is3DGeometryOutput as s,ShaderOutput as a}from"../core/shaderLibrary/ShaderOutput.js";import{NormalsDoubleSidedMode as o}from"../core/shaderLibrary/shading/Normals.glsl.js";import{
|
|
5
|
+
import has from"../../../../core/has.js";import{clamp as e}from"../../../../core/mathUtils.js";import{fromValues as t}from"../../../../geometry/support/aaBoundingBox.js";import{newLayout as r}from"../../support/buffer/InterleavedLayout.js";import{isShadowRelatedOutput as i,is3DGeometryOutput as s,ShaderOutput as a}from"../core/shaderLibrary/ShaderOutput.js";import{NormalsDoubleSidedMode as o}from"../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as n}from"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{alphaCutoff as h}from"../core/shaderLibrary/util/AlphaCutoff.js";import u from"../lib/GLMaterial.js";import{Material as c}from"../lib/Material.js";import{isPathGeometry as d}from"../lib/PathGeometry.js";import{MeshIntersectionOptions as l,intersectAabbInvDir as p}from"../lib/RayIntersections.js";import{RenderSlot as m}from"../lib/RenderSlot.js";import{VertexAttribute as f}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as b}from"./DefaultBufferWriter.js";import{PathTechniqueConfiguration as S,vertexAttributeLocations as g,PathTechnique as v,PathPassParameters as _}from"./PathTechnique.js";class O extends c{constructor(e){super(e,L),this._vertexBufferLayout=w(),this._configuration=new S,this._vertexAttributeLocations=g,this.supportsEdges=!0,this.produces=new Map([[m.OPAQUE_MATERIAL,e=>(this.parameters.castShadows&&i(e)||s(e))&&!this.parameters.transparent],[m.TRANSPARENT_MATERIAL,e=>(this.parameters.castShadows&&i(e)||s(e))&&this.parameters.transparent]])}getConfiguration(e,t){return this._configuration.output=e,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.discardInvisibleFragments=this.parameters.transparent,this._configuration.hasOccludees=this.parameters.hasOccludees,e===a.Color&&(this._configuration.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?o.View:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?o.WindingOrder:o.None,this._configuration.receiveShadows=this.parameters.receiveShadows,this._configuration.receiveAmbientOcclusion=null!=t.ssao),this._configuration.pbrMode=this.parameters.usePBR?n.Schematic:n.Disabled,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}isVisibleForOutput(e){return e!==a.Shadow&&e!==a.ShadowExcludeHighlight&&e!==a.ShadowHighlight||this.parameters.castShadows}get visible(){return this.parameters.opacity>=h}intersect(r,i,s,a,o,n){const h=r;if(!d(h))return;const u=h.path,c=[this.parameters.size[0],this.parameters.size[1]];if(this.parameters.vvSize){const{offset:t,factor:r,minSize:i,maxSize:s}=this.parameters.vvSize,a=u.sizeAttributeValue;c[0]*=e(t[0]+a*r[0],i[0],s[0]),c[1]*=e(t[2]+a*r[2],i[2],s[2])}const m=new l(!1,s.options.normalRequired),f=Math.max(c[0],c[1]),b=r.boundingInfo;if(null==b)return void A(u,c,a,o,m,n);const S=t(b.bbMin[0]-f,b.bbMin[1]-f,b.bbMin[2]-f,b.bbMax[0]+f,b.bbMax[1]+f,b.bbMax[2]+f),g=[o[0]-a[0],o[1]-a[1],o[2]-a[2]],v=Math.sqrt(g[0]*g[0]+g[1]*g[1]+g[2]*g[2]),_=[v/g[0],v/g[1],v/g[2]];p(S,a,_,s.tolerance)&&A(u,c,a,o,m,n)}createBufferWriter(){return new b(this._vertexBufferLayout)}createGLMaterial(e){return new y(e)}}function w(){const e=r().vec3f(f.POSITION).vec4f(f.PROFILERIGHT).vec4f(f.PROFILEUP).vec4f(f.PROFILEVERTEXANDNORMAL).vec4f(f.FEATUREVALUE);return has("enable-feature:objectAndLayerId-rendering")&&e.vec4u8(f.OBJECTANDLAYERIDCOLOR),e}class y extends u{_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}_updateShadowState(e){null!=this.technique&&e.shadowMap.enabled===this.technique.configuration.receiveShadows||this._material.setParameters({receiveShadows:e.shadowMap.enabled})}beginSlot(e){return this._output===a.Color&&(this._updateShadowState(e),this._updateOccludeeState(e)),this.ensureTechnique(v,e)}}function A(e,t,r,i,s,a){e.baked.size&&e.baked.size[0]===t[0]&&e.baked.size[1]===t[1]||e.baked.bake(t),e.baked.intersect(r,i,s,a)}class L extends _{constructor(){super(...arguments),this.doubleSided=!1,this.doubleSidedType="normal",this.receiveShadows=!1,this.castShadows=!0,this.hasSlicePlane=!1,this.transparent=!1,this.hasOccludees=!1,this.usePBR=!1}}export{L as Parameters,O as PathMaterial};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import{fromValues as o,create as t}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ViewingMode as
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import{fromValues as o,create as t,fromArray as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ViewingMode as i}from"../../../ViewingMode.js";import{ShaderOutput as s}from"../core/shaderLibrary/ShaderOutput.js";import{PathVertexPositionPassParameters as n}from"../core/shaderLibrary/attributes/PathVertexPosition.glsl.js";import{TextureCoordinateType as a}from"../core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{EmissionSource as l}from"../core/shaderLibrary/output/Emissions.glsl.js";import{NormalsDoubleSidedMode as p}from"../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as u}from"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{ReloadableShaderModule as c}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as d}from"../core/shaderTechnique/ShaderTechnique.js";import{parameter as h}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{blending as m,oitDepthTest as v,getDrawBuffers as y,OITPolygonOffset as b}from"../lib/OrderIndependentTransparency.js";import{Program as f}from"../lib/Program.js";import{stencilWriteMaskOn as g,stencilBaseAllZerosParams as O}from"../lib/StencilUtils.js";import{TransparencyPassType as T}from"../lib/TransparencyPassType.js";import{VertexAttribute as P}from"../lib/VertexAttribute.js";import{DefaultTechniqueConfiguration as j}from"./DefaultTechniqueConfiguration.js";import{defaultAdvancedMRRFactors as x}from"./pbrUtils.js";import{P as N}from"../../../../chunks/Path.glsl.js";import{SpecialDrawBuffers as E}from"../../../webgl/enums.js";import{makePipelineState as R,frontFaceCullingParams as S,defaultDepthWriteParams as C,defaultColorWriteParams as V}from"../../../webgl/renderState.js";const L=new Map([[P.POSITION,0],[P.PROFILERIGHT,1],[P.PROFILEUP,2],[P.PROFILEVERTEXANDNORMAL,3],[P.FEATUREVALUE,4],[P.OBJECTANDLAYERIDCOLOR,5]]);class A extends n{constructor(){super(...arguments),this.ambient=o(.2,.2,.2),this.diffuse=o(.8,.8,.8),this.specular=o(0,0,0),this.opacity=1,this.origin=t(),this.modelTransformation=null,this.mrrFactors=r(x),this.texture=null,this.textureNormal=null,this.textureEmissive=null,this.textureOcclusion=null,this.textureMetallicRoughness=null}}class I extends d{constructor(e,o,t){o.spherical=e.viewingMode===i.Global,o.doublePrecisionRequiresObfuscation=e.rctx.driverTest.doublePrecisionRequiresObfuscation.result,super(e,o,t)}initializeProgram(e){return new f(e.rctx,I.shader.get().build(this.configuration),L)}initializePipeline(){const e=this.configuration.transparencyPassType,{output:o,transparent:t,hasSlicePlane:r,doubleSidedMode:i,hasOccludees:n}=this.configuration,a=e===T.NONE,l=e===T.FrontFace;return R({blending:o===s.Color&&t?m(e):null,culling:r&&!t&&i!==p.None?S:null,depthTest:{func:v(e)},depthWrite:a||l?C:null,drawBuffers:o===s.Depth?{buffers:[E.NONE]}:y(e,o),colorWrite:V,stencilWrite:n?g:null,stencilTest:n?O:null,polygonOffset:a||l?null:b})}}I.shader=new c(N,(()=>import("../shaders/Path.glsl.js")));class M extends j{constructor(){super(...arguments),this.output=s.Color,this.doubleSidedMode=p.None,this.transparencyPassType=T.NONE,this.pbrMode=u.Disabled,this.spherical=!1,this.receiveShadows=!1,this.receiveAmbientOcclusion=!1,this.vvSize=!1,this.vvColor=!1,this.vvOpacity=!1,this.hasSlicePlane=!1,this.transparent=!1,this.discardInvisibleFragments=!1,this.hasOccludees=!1,this.multipassEnabled=!1,this.cullAboveGround=!1,this.doublePrecisionRequiresObfuscation=!1,this.objectAndLayerIdColorInstanced=!1}}e([h({count:s.COUNT})],M.prototype,"output",void 0),e([h({count:p.COUNT})],M.prototype,"doubleSidedMode",void 0),e([h({count:T.COUNT})],M.prototype,"transparencyPassType",void 0),e([h({count:u.COUNT})],M.prototype,"pbrMode",void 0),e([h()],M.prototype,"spherical",void 0),e([h()],M.prototype,"receiveShadows",void 0),e([h()],M.prototype,"receiveAmbientOcclusion",void 0),e([h()],M.prototype,"vvSize",void 0),e([h()],M.prototype,"vvColor",void 0),e([h()],M.prototype,"vvOpacity",void 0),e([h()],M.prototype,"hasSlicePlane",void 0),e([h()],M.prototype,"transparent",void 0),e([h()],M.prototype,"discardInvisibleFragments",void 0),e([h()],M.prototype,"hasOccludees",void 0),e([h()],M.prototype,"multipassEnabled",void 0),e([h()],M.prototype,"cullAboveGround",void 0),e([h()],M.prototype,"doublePrecisionRequiresObfuscation",void 0),e([h({constValue:a.None})],M.prototype,"textureCoordinateType",void 0),e([h({constValue:l.None})],M.prototype,"emissionSource",void 0),e([h({constValue:!1})],M.prototype,"occlusionPass",void 0),e([h({constValue:!0})],M.prototype,"hasVvInstancing",void 0),e([h({constValue:!1})],M.prototype,"useCustomDTRExponentForWater",void 0),e([h({constValue:!1})],M.prototype,"useFillLights",void 0),e([h({constValue:!1})],M.prototype,"hasColorTexture",void 0),e([h({constValue:!1})],M.prototype,"hasMetallicRoughnessTexture",void 0),e([h({constValue:!1})],M.prototype,"hasOcclusionTexture",void 0),e([h({constValue:!1})],M.prototype,"hasNormalTexture",void 0);export{A as PathPassParameters,I as PathTechnique,M as PathTechniqueConfiguration,L as vertexAttributeLocations};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{fromArray as e,ZEROS as t,fromValues as i,create as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as s}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ViewingMode as o}from"../../../ViewingMode.js";import{ShaderOutput as l}from"../core/shaderLibrary/ShaderOutput.js";import{NormalType as
|
|
5
|
+
import{fromArray as e,ZEROS as t,fromValues as i,create as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as s}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ViewingMode as o}from"../../../ViewingMode.js";import{isColorOrColorEmission as a,ShaderOutput as l}from"../core/shaderLibrary/ShaderOutput.js";import{NormalType as n}from"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{TextureCoordinateType as c}from"../core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{VertexNormalPassParameters as u,VertexNormalDrawParameters as h}from"../core/shaderLibrary/attributes/VertexNormal.glsl.js";import{EmissionSource as m}from"../core/shaderLibrary/output/Emissions.glsl.js";import{alphaCutoff as p}from"../core/shaderLibrary/util/AlphaCutoff.js";import{ReloadableShaderModule as d}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as f}from"../core/shaderTechnique/ShaderTechnique.js";import{CullFaceOptions as b,DepthTestFunction as g,AlphaDiscardMode as y}from"../lib/basicInterfaces.js";import{Default3D as j}from"../lib/DefaultVertexAttributeLocations.js";import{RenderOccludedFlag as x}from"../lib/Material.js";import{blending as T,oitDepthTest as P,getDrawBuffers as S,getOITPolygonOffset as v}from"../lib/OrderIndependentTransparency.js";import{Program as O}from"../lib/Program.js";import{stencilWriteMaskOn as L,stencilToolMaskBaseParams as M,stencilBaseAllZerosParams as w}from"../lib/StencilUtils.js";import{TransparencyPassType as A}from"../lib/TransparencyPassType.js";import{defaultAdvancedMRRFactors as D}from"../materials/pbrUtils.js";import{D as C}from"../../../../chunks/DefaultMaterial.glsl.js";import{SpecialDrawBuffers as N,CompareFunction as F}from"../../../webgl/enums.js";import{makePipelineState as _,cullingParams as k,defaultDepthWriteParams as q,defaultColorWriteParams as E}from"../../../webgl/renderState.js";class I extends u{constructor(){super(...arguments),this.isSchematic=!1,this.usePBR=!1,this.mrrFactors=e(D),this.hasVertexColors=!1,this.hasSymbolColors=!1,this.doubleSided=!1,this.doubleSidedType="normal",this.cullFace=b.Back,this.isInstanced=!1,this.hasInstancedColor=!1,this.emissiveFactor=t,this.instancedDoublePrecision=!1,this.normalType=n.Attribute,this.receiveShadows=!0,this.receiveAmbientOcclusion=!0,this.castShadows=!0,this.shadowMappingEnabled=!1,this.ambient=i(.2,.2,.2),this.diffuse=i(.8,.8,.8),this.externalColor=s(1,1,1,1),this.colorMixMode="multiply",this.opacity=1,this.layerOpacity=1,this.origin=r(),this.hasSlicePlane=!1,this.hasSliceHighlight=!0,this.offsetTransparentBackfaces=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.vvSymbolAnchor=null,this.vvSymbolRotationMatrix=null,this.modelTransformation=null,this.transparent=!1,this.writeDepth=!0,this.customDepthTest=g.Less,this.textureAlphaMode=y.Blend,this.textureAlphaCutoff=p,this.textureAlphaPremultiplied=!1,this.hasOccludees=!1,this.renderOccluded=x.Occlude,this.isDecoration=!1}}class R extends h{constructor(){super(...arguments),this.origin=r(),this.slicePlaneLocalOrigin=this.origin}}class z extends f{constructor(e,t,i){t.spherical=e.viewingMode===o.Global,t.doublePrecisionRequiresObfuscation=e.rctx.driverTest.doublePrecisionRequiresObfuscation.result,t.textureCoordinateType=t.hasColorTexture||t.hasMetallicRoughnessTexture||t.emissionSource===m.Texture||t.hasOcclusionTexture||t.hasNormalTexture?c.Default:c.None,t.objectAndLayerIdColorInstanced=t.instanced,super(e,t,i)}initializeProgram(e){return this._initializeProgram(e,z.shader)}_initializeProgram(e,t){return new O(e.rctx,t.get().build(this.configuration),j)}_makePipeline(e,t){const{output:i,transparent:r,cullFace:s,customDepthTest:o,writeDepth:n,hasOccludees:c,enableOffset:u}=this.configuration,h=e===A.NONE,m=e===A.FrontFace;return _({blending:a(i)&&r?T(e):null,culling:V(this.configuration)?k(s):null,depthTest:{func:P(e,B(o))},depthWrite:(h||m)&&n?q:null,drawBuffers:i===l.Depth?{buffers:[N.NONE]}:S(e,i),colorWrite:E,stencilWrite:c?L:null,stencilTest:c?t?M:w:null,polygonOffset:h||m?null:v(u)})}initializePipeline(){return this._occludeePipelineState=this._makePipeline(this.configuration.transparencyPassType,!0),this._makePipeline(this.configuration.transparencyPassType,!1)}getPipeline(e){return e?this._occludeePipelineState:super.getPipeline()}}function B(e){return e===g.Lequal?F.LEQUAL:F.LESS}function V(e){return e.cullFace!==b.None||!e.hasSlicePlane&&(!e.transparent&&!e.doubleSidedMode)}z.shader=new d(C,(()=>import("./DefaultMaterial.glsl.js")));export{R as DefaultMaterialDrawParameters,I as DefaultMaterialPassParameters,z as DefaultMaterialTechnique};
|
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{ShaderOutput as o}from"../core/shaderLibrary/ShaderOutput.js";import{Emissions as
|
|
5
|
+
import{ShaderOutput as o,isColorEmission as r,isColorOrColorEmission as t}from"../core/shaderLibrary/ShaderOutput.js";import{Emissions as a}from"../core/shaderLibrary/output/Emissions.glsl.js";import{OutputHighlight as i}from"../core/shaderLibrary/output/OutputHighlight.glsl.js";import{alphaCutoff as l}from"../core/shaderLibrary/util/AlphaCutoff.js";import{ColorConversion as s}from"../core/shaderLibrary/util/ColorConversion.glsl.js";import{glsl as e,If as n}from"../core/shaderModules/interfaces.js";import{TransparencyPassType as u}from"../lib/TransparencyPassType.js";function p(p,d){p.include(i,d),p.include(a,d),p.fragment.include(s);const f=d.output===o.ObjectAndLayerIdColor,c=r(d.output),g=t(d.output)&&d.transparencyPassType===u.ColorAlpha,h=t(d.output)&&d.transparencyPassType!==u.ColorAlpha,m=d.discardInvisibleFragments;let C=0;(h||c||g)&&p.outputs.add("fragColor","vec4",C++),c&&p.outputs.add("fragEmission","vec4",C++),g&&p.outputs.add("fragAlpha","float",C++),p.fragment.code.add(e`
|
|
6
6
|
void outputColorHighlightOID(vec4 finalColor, const in vec3 vWorldPosition) {
|
|
7
|
-
${
|
|
7
|
+
${n(f,e`finalColor.a = 1.0;`)}
|
|
8
8
|
|
|
9
|
-
${
|
|
9
|
+
${n(m,e`if (finalColor.a < ${e.float(l)}){
|
|
10
10
|
discard;
|
|
11
11
|
return;
|
|
12
12
|
}`)}
|
|
13
13
|
|
|
14
14
|
finalColor = highlightSlice(finalColor, vWorldPosition);
|
|
15
|
-
${
|
|
15
|
+
${n(g,e`fragColor = premultiplyAlpha(finalColor);
|
|
16
16
|
fragAlpha = finalColor.a;`)}
|
|
17
|
-
${
|
|
18
|
-
${
|
|
17
|
+
${n(h,"fragColor = finalColor;")}
|
|
18
|
+
${n(c,"fragEmission = getEmissions();")}
|
|
19
19
|
outputHighlight();
|
|
20
|
-
${
|
|
20
|
+
${n(f,"outputObjectAndLayerIdColor();")}
|
|
21
21
|
}
|
|
22
|
-
`)}export{
|
|
22
|
+
`)}export{p as outputColorHighlightOID};
|