@arcgis/core 4.31.0-next.20240706 → 4.31.0-next.20240708
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/{3edc527a24cb9a4868e5.js → 20d0390504e4cc9f93f4.js} +1 -1
- package/assets/esri/core/workers/chunks/{ef8ba10380053ea4c4dd.js → 34ea46659c8cebec3ffa.js} +1 -1
- package/assets/esri/core/workers/chunks/5089a12084a8a8fb93d8.js +1 -0
- package/assets/esri/core/workers/chunks/{5afc1562bb5c20127ef1.js → e840e54455eb500b501d.js} +18 -18
- package/chunks/ChapmanAtmosphere.glsl.js +1 -1
- package/chunks/ComponentShader.glsl.js +3 -3
- package/chunks/DefaultMaterial.glsl.js +1 -1
- package/chunks/EdgeShader.glsl.js +5 -6
- package/chunks/Heatmap.glsl.js +4 -4
- package/chunks/HighlightApply.glsl.js +172 -135
- package/chunks/LineCallout.glsl.js +4 -4
- package/chunks/MeasurementArrow.glsl.js +5 -5
- package/chunks/RealisticTree.glsl.js +2 -2
- package/chunks/Terrain.glsl.js +39 -39
- package/geometry/support/meshUtils/exporters/gltf/gltf.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/views/3d/environment/ChapmanAtmosphere.js +1 -1
- package/views/3d/environment/Fog.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/TransparencyMode.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentShader.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/Laserline.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +11 -11
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/Terrain.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/DiscardOrAdjustAlpha.glsl.js +9 -0
- package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
- package/views/3d/webgl-engine/lib/MainFramebuffer.js +5 -0
- package/views/3d/webgl-engine/lib/RenderContext.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/Heatmap.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/HighlightApply.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/LineCallout.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/MeasurementArrow.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/RealisticTree.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/sources/edgeRenderer/EdgeShader.glsl.js +1 -1
- package/assets/esri/core/workers/chunks/9a9abefa8099aa1ebc3d.js +0 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/AlphaDiscard.glsl.js +0 -7
- package/views/3d/webgl-engine/core/shaderLibrary/util/DiscardOrAdjustAlphaBlend.glsl.js +0 -7
- package/views/3d/webgl-engine/lib/MainColor.js +0 -5
- package/views/3d/webgl-engine/shaders/sources/edgeRenderer/DiscardByCoverage.glsl.js +0 -5
|
@@ -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{removeMaybe as i,abortMaybe as a,destroyMaybe as n,releaseMaybe as h}from"../../../../core/maybe.js";import o from"../../../../core/PooledArray.js";import{throwIfAborted as d}from"../../../../core/promiseUtils.js";import{watch as l,syncAndInitial as _,initial as u,sync as p}from"../../../../core/reactiveUtils.js";import{signal as c}from"../../../../core/signal.js";import{property as m}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 f,multiply as b}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as T,create as E}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as A}from"../../../../chunks/vec42.js";import{fromValues as P,ZEROS as S}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{a as R}from"../../../../chunks/boundedPlane.js";import{RenderCategory as C,InternalRenderCategory as w}from"../../webgl.js";import{debugFlags as I}from"../../support/debugFlags.js";import{TransparencyMode as O}from"../../terrain/TransparencyMode.js";import{DepthFormat as D,ColorFormat as y}from"../../webgl/formats.js";import{FBOCache as N,defaultWebGLFBO as x}from"../core/FBOCache.js";import{RenderPassManager as M}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as v}from"../core/shaderLibrary/ShaderOutput.js";import{HUDRenderStyle as H}from"../core/shaderLibrary/hud/HUDRenderStyle.js";import{distanceFadeEnd as F}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as L}from"../effects/RenderNodes.js";import{isPrepareRenderPlugin as q}from"../effects/RenderPlugin.js";import{RenderPluginManager as U}from"../effects/RenderPluginManager.js";import{Blit as j}from"../effects/blit/Blit.js";import{AnimationTimeStep as V}from"./AnimationTimeStep.js";import{Decorations as G,RenderRequestType as B,StencilBits as Q}from"./basicInterfaces.js";import{BoundingInfo as k}from"./BoundingInfo.js";import{zero as z,union as W}from"./depthRange.js";import{depthRangeFromScene as X}from"./depthRangeUtils.js";import{MainColor as Y}from"./MainColor.js";import{RenderOccludedFlag as J}from"./Material.js";import{RenderContext as K,defaultRenderOccludedMask as $}from"./RenderContext.js";import{splitRenderGeometryChangeSetByMaterial as Z,RendererTarget as ee}from"./rendererUtils.js";import{setupFeatureDefaults as te,RenderFeature as re}from"./RenderFeature.js";import{RenderPluginInput as se}from"./RenderPluginInput.js";import{RenderSlot as ie}from"./RenderSlot.js";import{ShadowAccumulator as ae}from"./ShadowAccumulator.js";import{ShadowMap as ne,SnapshotSlot as he}from"./ShadowMap.js";import oe from"./SliceHelper.js";import{TransparencyPassType as de}from"./TransparencyPassType.js";import{Viewshed as le}from"./Viewshed.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 ge}from"../statistics/RendererPerformanceInfo.js";import{RenderState as fe}from"../../../support/RenderState.js";import{DepthStencilAttachment as be,PixelFormat as Te,PixelType as Ee,ClearBufferBit as Ae,TextureType as Pe,ColorAttachment as Se}from"../../../webgl/enums.js";import{ensureAttachmentMaxSize as Re}from"../../../webgl/FramebufferObject.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=P(0,0,0,1),this._sliceHelper=new oe,this._blit=null,this._state=c(fe.IDLE),this._highQualityTransparencyEnabled=!0,this._terrainTransparency=O.Opaque,this._ssrEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new V,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=c(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new se,this._releaseNormals=e=>{e.some((({name:e})=>"normals"===e))&&this._pluginInput.release("normals")},this._debugNeedsDepth=!1,this.fboCache=new N(i),this._renderStateFeatures=c(te(!has("disable-feature:high-quality-idle"),e.view.qualityProfile)),this._mainColor=new Y(this._rctx),this.performanceInfo=new me(this._rctx),this._shadowMap=new ne(this.fboCache,e.viewingMode),this._viewshed=new le({fboCache:this.fboCache,view:e.view},((e,t,r)=>{t.setGLViewport(this._rctx);const{camera:s,contentCamera:i}=e;this._ensureBindParametersCamera(t,t),this._renderAllGeometry(r),this._ensureBindParametersCamera(s,i),e.camera.setGLViewport(this._rctx)})),this._shadowAccumulator=new ae(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 K(this._rctx,this._mainColor,this._shadowMap,this._sliceHelper),this._nodes=new L(this._renderContext),this._plugins=new U({renderContext:this._renderContext,techniques:r,materials:t,requestRender:n,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this.renderPassManager=new M,this._plugins.add(this.renderPassManager),this._plugins.add(this._viewshed),this._handles=[l((()=>this._stage.view.state.camera),(()=>n()),_),l((()=>I.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(_e.TRANSPARENT):()=>{},n()}),u),l((()=>this._stage.view.environment.background?.color),(e=>{const t=e?s(e):S;A(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),n()}),_),l((()=>this._stage.view.state.camera.relativeElevation),(e=>{this._inGlobeView=(e??1/0)>=F}),_)]}destroy(){this._handles.forEach((e=>e.remove())),this._gpuTimerHandle=i(this._gpuTimerHandle),this._nodes.destroy(),this._mainColor.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.dispose(),this._loadEdgeViewTask=a(this._loadEdgeViewTask),this._edgeView=n(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.fboCache.destroy(),this._plugins.destroy(),this._renderers.clear(),this._blit=n(this._blit),k.prune()}get _bindParameters(){return this._renderContext.bindParameters}updateRenderFeatures(e=null,t=!has("disable-feature:high-quality-idle")){this._renderStateFeatures.value=te(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(re.HighQualityTransparency)}get hasReflections(){return(this._pluginsHas.water||this._hasOverlayWater)&&(this._ssrEnabled||this.isFeatureEnabled(re.WaterReflection))}get hasDecorations(){return this._plugins.hasDecorations||this._nodes.produces("magnifier-color")}get hasHighlights(){return this._plugins.produces(v.Highlight,ie.OPAQUE_MATERIAL,ie.TRANSPARENT_MATERIAL,ie.DRAPED_MATERIAL)}get hasSSAO(){return(this._stage.view.qualitySettings.ambientOcclusion||this.isFeatureEnabled(re.SSAO))&&!this._inGlobeView}get hasSMAA(){return this._stage.view.qualitySettings.antialiasingEnabled||this.isFeatureEnabled(re.Antialiasing)}get fullResolutionAtmosphere(){return this._stage.view.qualitySettings.highResolutionAtmosphere||this.isFeatureEnabled(re.HighResolutionAtmosphere)}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=h(this._bindParameters.ssr.lastFrameColor),this._bindParameters.multipassTerrain.depth=h(this._bindParameters.multipassTerrain.depth),this._bindParameters.multipassGeometry.depth=h(this._bindParameters.multipassGeometry.depth),this._pluginInput.release("highlight mix")}_disposeOffscreenBuffers(){this._mainColor.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._viewshed.shadowMap?.disposeOffscreenBuffers(),this._bindParameters.depth=h(this._bindParameters.depth),this._bindParameters.hudVisibility=h(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");d(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(l((()=>r.updating),(()=>this._requestRender()),p)),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,T)}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;Z(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,ie.LINE_CALLOUTS_HUD_DEPTH,ie.HUD_MATERIAL,ie.LABEL_MATERIAL),has.water=this._plugins.produces(v.Normal,ie.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?i(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,r=ee.Default,s=G.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=ee.Default,s=G.ON){this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=r===ee.Default,this._disposeBindBuffers();const i=this._mainColor,{camera:a,contentCamera:n,mode:o,alignPixelEnabled:d}=e;this._bindParameters.ensuredScreenSize={width:a.fullWidth,height:a.fullHeight},Re(this._bindParameters.ensuredScreenSize,this._rctx.parameters.maxTextureSize),this._state.value=o,this._bindParameters.overlay=this.renderOverlay(t),this._bindParameters.overlay&&this.performanceInfo.advance(ge.OVERLAY),this._renderContext.time=t,this._bindParameters.transparencyPassType=de.NONE,this._bindParameters.alignPixelEnabled=d,this._bindParameters.decorations=s,this._bindParameters.mainDepth=null,this._bindParameters.viewshedEnabled=this._viewshed.enabled;const l=this._nodes.produces("magnifier-color"),_=this._nodes.produces("final-color"),u=R(this._sliceHelper.plane);s===G.OFF&&(this._sliceHelper.plane=null),a.setGLViewport(this._rctx);const p=i.initialize(this.fboCache,this._bindParameters.ensuredScreenSize,this._backgroundColor);this.hasReflections?this._bindParameters.ssr.lastFrameColor=p:p?.release(),this._ensureBindParametersCamera(a,n),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&s===G.ON;const c=this._plugins.produces(v.Color,ie.OPAQUE_TERRAIN)&&(this._terrainTransparency===O.Semitransparent||this._terrainTransparency===O.TransparentWithDraped),m=this._highQualityTransparency&&c,g=this._plugins.produces(v.Color,...De);this._prepareShaders(m,g),this.performanceInfo.advance(ge.PREPARE);const f=this._computeDepthRange(a);this._renderShadowMap(a,this._bindParameters.lighting.mainLight.direction,f),this._ensureBindParametersCamera(a,n);let b=this._renderNormals();this._pluginInput.set("normals",b);const T=this._needsDepth;if(b){let e=null;T&&(e=b.getAttachment(be),e?.retain()),this._pluginInput.set("ssao",this._renderSSAO()),this._renderNoSSAOGeometryDepth(T,e),b=null}else this._renderAllGeometryDepth(T);this._renderShadowAccumulation(f,a,n),this._ensureBindParametersSSR(t),this._renderContext.output=v.Color,i.bind(),this._bindParameters.mainDepth=i.depth.attachment;const E=this.plugins.produces(v.Color,...Oe);E&&this._renderOpaqueGeometry(),i.update((e=>this._renderNodes(C.OPAQUE,e,E))),this.fboCache.debugCallback?.("opaque-color",i.color.fbo),this._renderPlugins(ie.OPAQUE_ENVIRONMENT,ge.OPAQUE_ENVIRONMENT),this._renderMultipassTerrainDepth(m),this._setMultipassTerrain(m),this._renderEdges(_e.OPAQUE),i.bind(),this._renderPlugins(ie.VOXEL,ge.VOXEL),this._renderHiddenTransparentEdges(),g&&(this._oitEnabled?this._renderOITPass(we.Geometry):this._renderTransparentMaterial()),i.update((e=>this._renderNodes(C.TRANSPARENT,e,g))),this.fboCache.debugCallback?.("transparent-color",i.color.fbo),this._renderMultipassGeometryDepth(m),this._renderHUDVisibility(),m||this._plugins.render(this._pluginInput,ie.LINE_CALLOUTS);const A=r===ee.ObjectAndLayerID?this._renderObjectAndLayerIdColor():null;this._renderEdges(_e.TRANSPARENT);const P=c?this._renderTransparentTerrain():null;P&&(this.performanceInfo.advance(ge.TRANSPARENT_TERRAIN),this._bindParameters.hudVisibility&&(m?this._renderLineCallouts(H.Occluded):(this._rctx.bindFramebuffer(this._bindParameters.hudVisibility?.fbo),this._compositingHelper.compositeHUD(this._bindParameters,P.getTexture())),this._renderHUD(H.Occluded,i.color))),this._setTerrainCulling(!1),P&&(i.bind(),this._compositingHelper.composite(this._bindParameters,P.getTexture(),pe.PremultipliedAlpha),P.release(),m&&(this._renderEdges(_e.OPAQUE),g&&(this._oitEnabled?this._renderOITPass(we.Geometry):this._renderTransparentMaterial(),this.performanceInfo.advance(ge.TRANSPARENT)),this._renderEdges(_e.TRANSPARENT))),this._bindParameters.ssao=h(this._bindParameters.ssao),m&&this._renderLineCallouts(H.NotOccluded),this._setMultipassEnabled(!1),this._renderTransparentEnvironment(),this._renderViewshed(),i.update((e=>this._renderNodes(w.LASERLINES,e))),this._renderOccluded(),this._pluginInput.set("highlights",this._renderHighlightPrepass()),i.update((e=>this._renderNodes(C.COMPOSITE,e)));const S=this._nodes.produces("aa-color"),I=!(r!==ee.Default||_||l&&s===G.ON&&r===ee.Default),D=this._pluginInput.get("composite-color"),y=I?x:this.fboCache.acquire(D.fbo.width,D.fbo.height,"aa-color"),N=S?this._renderNodes(w.ANTIALIASING,y):this._blitToDefault(D,y,!1);this._pluginInput.set(w.ANTIALIASING,N),this._renderHUD(H.NotOccluded,N);const M=this._renderNodes(w.HIGHLIGHTS,N);let F=this._renderNodes(w.MAGNIFIER,M);return l&&s===G.ON&&r===ee.Default&&!_&&(F=this._blitToDefault(F)),_?(F.attachDepth(i.depth),this._blitToDefault(this._renderNodes(C.FINAL,F)),F.detachDepth()):this._pluginInput.set(C.FINAL,F),this._pluginInput.release("highlights"),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),i.release(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this._sliceHelper.plane=u,this.fboCache.frameEnd(),this.performanceInfo.finishFrame(),r!==ee.Default&&(this._releaseFBOs(),this._disposeOffscreenBuffers()),{screen:this._pluginInput.get("final-color"),oid:A}}_prepareShaders(e,t){this._renderContext.output=v.Color,this._prepareOpaqueGeometry(),this._setMultipassTerrain(e),this._plugins.prepare(ie.TRANSPARENT_TERRAIN),this._setMultipassTerrain(!1),e||this._plugins.prepare(ie.LINE_CALLOUTS),t&&this._prepareTransparencySlots(),this._plugins.prepare(ie.VIEWSHED,ie.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,ie.TRANSPARENT_ENVIRONMENT),this._rctx.gl.flush()}_renderObjectAndLayerIdColor(){if(!has("enable-feature:objectAndLayerId-rendering"))return;const e=this._renderContext.output,t=this._bindParameters.ensuredScreenSize,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=H.NotOccluded,this._plugins.render(this._pluginInput,ie.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===B.BACKGROUND;if(r||t){const e=r?this.performanceInfo.elapsedTime:0,s=t?this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.getError(),i=Math.max(e,s);this._animationTimestep.frame(i,r)}}readDepthPixels(e,t){const{mainDepth:r,camera:s,ensuredScreenSize:i}=this._bindParameters;if(!r)return;const a=this.fboCache.acquire(i.width,i.height,"linear-depth");this._rctx.bindFramebuffer(a.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),a.fbo?.readPixels(e[0],e[1],e[2],e[3],Te.RGBA,Ee.UNSIGNED_BYTE,t),a.release()}readHUDVisibility(e,t,r,s,i){this._bindParameters.hudVisibility?.fbo?.readPixels(e,t,r,s,Te.RGBA,Ee.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._bindParameters.ensuredScreenSize,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._mainColor.depth,Ie),this._mainColor.bind(),this._compositingHelper.composite(this._bindParameters,s.getTexture(),pe.Alpha),s.release(),this.performanceInfo.advance(e===_e.OPAQUE?ge.OPAQUE_EDGES:ge.TRANSPARENT_EDGES)}_renderShadowMap(e,t,r){const s=this._shadowMap;s.enabled&&(s.start(e,t,r,this.isFeatureEnabled(re.HighResolutionShadows),this._stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(v.ShadowHighlight,this._shadowMap),s.moveSnapshot(he.Highlight),this._renderShadowCascades(v.ShadowExcludeHighlight,this._shadowMap),s.copySnapshot(he.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=h(this._bindParameters.depth));const r=this._bindParameters.ensuredScreenSize,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),h(this._bindParameters.depth),this._bindParameters.depth=s.obtainDepthTexture(),s.release(),this.performanceInfo.advance(ge.DEPTH)}_renderAllGeometryDepth(e){if(!e)return void(this._bindParameters.depth=h(this._bindParameters.depth));const t=this._bindParameters.ensuredScreenSize,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),h(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=h(this._bindParameters.multipassTerrain.depth));const t=this._renderContext.output;this._renderContext.output=v.Depth;const r=this._bindParameters.ensuredScreenSize,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(),h(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=h(this._bindParameters.multipassGeometry.depth));const t=this._renderContext.output,r=this._bindParameters.ensuredScreenSize,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,h(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 z;const t=X(e,this._plugins.plugins,this._stage.layers);return W(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._bindParameters.ensuredScreenSize,s=this.fboCache.acquire(r.width,r.height,"normals",y.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")+(this._viewshedEnabled?1:0);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();const t=this._nodes.render("ssao",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(ie.TRANSPARENT_TERRAIN),this._renderOpaqueGeometryAndTransparentMaterial(e),this._renderTransparentTerrain()}_renderOpaqueGeometryAndTransparentMaterial(e){this._renderContext.output=e,this._plugins.prepare(ie.TRANSPARENT_MATERIAL,ie.TRANSPARENT_NO_SSAO_DEPTH),this._renderOpaqueGeometry(),this._renderTransparentMaterial()}_renderGeometryForSSAO(e){this._renderContext.output=e,this._plugins.render(this._pluginInput,ie.INTEGRATED_MESH,ie.OPAQUE_TERRAIN,ie.OPAQUE_MATERIAL,ie.TRANSPARENT_MATERIAL),this._renderTransparentTerrain()}_renderGeometryExcludedFromSSAO(e){this._renderContext.output=e,this._plugins.render(this._pluginInput,ie.OPAQUE_NO_SSAO_DEPTH,ie.TRANSPARENT_NO_SSAO_DEPTH)}_prepareOpaqueGeometry(){this._plugins.prepare(...Oe,ie.OPAQUE_ENVIRONMENT)}_renderOpaqueGeometry(){this._plugins.render(this._pluginInput,...Oe)}_renderTransparentMaterial(){this._plugins.render(this._pluginInput,...De)}_renderTransparentTerrain(){const e=this._renderContext.output;if(!this._plugins.produces(e,ie.TRANSPARENT_TERRAIN))return;const t=()=>this._plugins.render(this._pluginInput,ie.TRANSPARENT_TERRAIN);if(e!==v.Color)return void t();const r=this._bindParameters.ensuredScreenSize,s=this.fboCache.acquire(r.width,r.height,"transparent terrain");return this.renderToTargets(t,s,this._mainColor.depth,[0,0,0,0]),s}_renderHUDVisibility(){if(this._plugins.produces(this._renderContext.output,ie.OCCLUSION_PIXELS)){const e=()=>{const e=this._bindParameters.ensuredScreenSize;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",y.RGBA4)),t.attachDepth(r||this._mainColor.depth),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer([0,1,0,1]),this._plugins.render(this._pluginInput,ie.OCCLUSION_PIXELS),t.detachDepth(),t};this._bindParameters.hudVisibility=e(),this._mainColor.bind(),this.performanceInfo.advance(ge.HUD_VISIBILITY)}else this._bindParameters.hudVisibility=h(this._bindParameters.hudVisibility)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,e===H.Occluded){const e=()=>this._plugins.render(this._pluginInput,ie.LINE_CALLOUTS),t=this._bindParameters.ensuredScreenSize,r=this.fboCache.acquireDepth(D.DEPTH16_BUFFER,t.width,t.height,"line callouts");this.renderToTargets(e,this._mainColor.color,r,void 0,!0,!0),r.release()}else this._plugins.render(this._pluginInput,ie.LINE_CALLOUTS)}_renderHUD(e,t){if(this._pluginsHas.hudElements){if(this._oitEnabled){const r=this._renderOITPass(we.HUD,e);this._rctx.bindFramebuffer(t.fbo),this._compositingHelper.composite(this._bindParameters,r.getTexture(),pe.PremultipliedAlpha),r.release()}else if(e===H.Occluded){this._renderContext.output=v.Color;const t=()=>this._renderHUDElements(e),r=this._bindParameters.ensuredScreenSize,s=this.fboCache.acquireDepth(D.DEPTH16_BUFFER,r.width,r.height,"hud");this.renderToTargets(t,this._mainColor.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===H.Occluded?ge.HUD_OCCLUDED:ge.HUD)}}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.prepare(ie.LINE_CALLOUTS_HUD_DEPTH,ie.HUD_MATERIAL,ie.LABEL_MATERIAL),this._plugins.render(this._pluginInput,ie.LINE_CALLOUTS_HUD_DEPTH,ie.HUD_MATERIAL,ie.LABEL_MATERIAL)}get _needsShadowHighlight(){return this._shadowMap.enabled&&this._plugins.produces(v.ShadowHighlight,ie.OPAQUE_MATERIAL)}_renderHighlightPrepass(){if(!this.hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:r}=this,s=r.ensuredScreenSize;let i=this._pluginInput.get("highlight mix");null==i&&(i=e.acquire(s.width,s.height,"highlight mix",y.RGBA),this._pluginInput.set("highlight mix",i),r.highlightTexture=i.getTexture()),t.bindFramebuffer(i.fbo);const a=[0,0,0,0];t.clearFramebuffer(a);const n=i.getTexture(),h=e.acquire(s.width,s.height,"highlights",y.RGBA);h.acquireDepth(D.DEPTH16_BUFFER),t.bindFramebuffer(h.fbo),t.clearFramebuffer(a,!0);const{highlightOrder:o}=this._stage.view,d=Math.min(16,o.length),{highlightGroupMap:l}=r;l.clear();for(let _=0;_<d;++_){const e=o.at(_);e&&l.set(e,_)}for(let _=0;_<d;++_)r.highlightLevel=_,r.highlightGroup=o.at(_),t.bindFramebuffer(h.fbo),t.clearFramebuffer(void 0,!0),this._renderAllGeometry(v.Highlight),0===_&&(t.clear(Ae.DEPTH_BUFFER_BIT),this._renderHUDElements(H.Both)),t.clear(Ae.DEPTH_BUFFER_BIT),t.bindTexture(n,0),t.gl.copyTexImage2D(Pe.TEXTURE_2D,0,Te.RGBA,0,0,s.width,s.height,0);return h}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(){this._renderContext.output=v.Color,this._bindParameters.transparencyPassType=de.ColorAlpha,this._plugins.prepare(...De),this._bindParameters.transparencyPassType=de.FrontFace,this._plugins.prepare(...De),this._bindParameters.transparencyPassType=de.NONE,this._techniques.acquire(ce).release()}_renderOITPass(e,t=H.Both){const r=e===we.HUD,s=this._bindParameters.ensuredScreenSize,i=r?this.fboCache.acquire(s.width,s.height,"oit hud composite"):null,a=r?()=>this._renderHUDElements(t):()=>this._renderTransparentMaterial(),n=this._renderContext.output;return this._renderContext.output=v.Color,this._renderOIT(this._bindParameters,a,i),this._renderContext.output=n,i}_renderOIT(e,t,r){const s=this._bindParameters.ensuredScreenSize;e.transparencyPassType=de.ColorAlpha;const i=r?"oit hud color alpha":"oit color alpha",a=this.fboCache.acquire(s.width,s.height,i,y.RGBA16F);a.acquireColor(Se.COLOR_ATTACHMENT1,y.R16F),r||a.attachDepth(this._mainColor.depth),this._rctx.bindFramebuffer(a.fbo),this._rctx.clearFramebuffer([0,0,0,1]),t(),a.detachDepth(),e.transparencyPassType=de.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._mainColor.depth),this._rctx.bindFramebuffer(n.fbo),this._rctx.clearFramebuffer([0,0,0,0],!!r),t(),n.detachDepth(),e.transparencyPassType=de.NONE,r?(this._rctx.bindFramebuffer(r.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(Ae.COLOR_BUFFER_BIT)):this._mainColor.bind(),this._compositingHelper.compositeOIT(e,a.getTexture(),a.getTexture(Se.COLOR_ATTACHMENT1),n.getTexture()),r?.detachDepth(),n.release(),a.release()}_renderOccluded(){let e=0;ye.clear(),this._plugins.plugins.forAll((t=>{if(!t.material)return;t.queryRenderOccludedState(J.OccludeAndTransparentStencil)&&(e|=J.OccludeAndTransparentStencil,ye.push(t))}));const t=this._mainColor,r=(r,s,i,a,n)=>{if(!(e&s))return;const h=this._bindParameters.ensuredScreenSize,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"):t.depth,this.renderToTargets(i,o,d,[0,0,0,0],a,n),t.bind(),this._compositingHelper.composite(this._bindParameters,o.getTexture(),pe.PremultipliedAlpha,r),a&&d.release(),o.release()},s=(e,t)=>{this._bindParameters.slot=e,t.forAll((e=>{if(q(e)){const t=e.prepareTechnique(this._renderContext);t&&e.renderNode(this._renderContext,t)}}))};0!==ye.length&&(s(ie.OCCLUDER_MATERIAL,ye),r(.5,J.OccludeAndTransparentStencil,(()=>s(ie.TRANSPARENT_OCCLUDER_MATERIAL,ye)),!1,!1));const i=ye.length>0;ye.clear(),this._plugins.plugins.forAll((t=>{if(!t.material)return;const r=t.queryRenderOccludedState(J.OccludeAndTransparent),s=t.queryRenderOccludedState(J.Transparent),i=t.queryRenderOccludedState(J.Opaque);(r||s||i)&&(e|=r?J.OccludeAndTransparent:s?J.Transparent:J.Opaque,ye.push(t))}));const a=this._plugins.renderOccludedFlags;if(e|=a,!e)return;const n=e=>{this._renderContext.renderOccludedMask=e,a>J.Occlude&&this._plugins.render(this._pluginInput,ie.OCCLUDED_TERRAIN),s(ie.OPAQUE_MATERIAL,ye),s(ie.TRANSPARENT_MATERIAL,ye),s(ie.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,ye),this._renderContext.renderOccludedMask=$};this._renderContext.output=v.Color,r(.5,J.OccludeAndTransparent,(()=>n(J.OccludeAndTransparent)),!0,Q.OutlineVisualElementMask),r(.5,J.Transparent,(()=>n(J.Transparent)),!0,Q.OutlineVisualElementMask),r(1,J.Opaque,(()=>n(J.Opaque)),!0,Q.OutlineVisualElementMask),(i||ye.length>0)&&this.performanceInfo.advance(ge.OCCLUDED),ye.clear()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this._mainColor.bind(),this._plugins.render(this._pluginInput,ie.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,ie.TRANSPARENT_ENVIRONMENT),this.performanceInfo.advance(ge.TRANSPARENT_ENVIRONMENT)}_renderViewshed(){this._viewshedEnabled&&(this._viewshed.renderHighQuality=this.isFeatureEnabled(re.HighResolutionViewshed),this._plugins.render(this._pluginInput,ie.VIEWSHED),this._pluginInput.release("normals"),this.performanceInfo.advance(ge.VIEWSHED))}_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(!this._nodes.produces(e))return r&&this.performanceInfo.advance(e),t;t.setName(e),this._pluginInput.set(e,t);const s=this._nodes.render(t,this._pluginInput,this._releaseNormals);return this.performanceInfo.advance(e),s}_blitToDefault(e,t=x,r=!0){this._blit??=new j(this._techniques);const s=this._blit.render(this._rctx,e,t,this._bindParameters,this._requestRender);return this._pluginInput.set(e.name,s),r&&e.release(),s}_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=T:(f(xe,this._bindParameters.camera.viewMatrix),f(Ne,this._bindParameters.camera.projectionMatrix),b(Me,xe,Ne),b(Me,this._renderContext.lastFrameCamera.viewMatrix,Me),b(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=T,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}}get _viewshedEnabled(){return this._viewshed.enabled&&this._plugins.produces(this._renderContext.output,ie.VIEWSHED)}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([m({readOnly:!0})],Ce.prototype,"fullResolutionAtmosphere",null),e([m()],Ce.prototype,"_edgeView",void 0),e([m()],Ce.prototype,"updating",null),function(e){e[e.Geometry=0]="Geometry",e[e.HUD=1]="HUD"}(we||(we={}));const Ie=[0,0,0,0],Oe=[ie.INTEGRATED_MESH,ie.OPAQUE_TERRAIN,ie.OPAQUE_MATERIAL,ie.OPAQUE_NO_SSAO_DEPTH],De=[ie.TRANSPARENT_MATERIAL,ie.TRANSPARENT_NO_SSAO_DEPTH],ye=new o,Ne=E(),xe=E(),Me=E();function ve(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{removeMaybe as i,abortMaybe as a,destroyMaybe as n,releaseMaybe as h}from"../../../../core/maybe.js";import o from"../../../../core/PooledArray.js";import{throwIfAborted as d}from"../../../../core/promiseUtils.js";import{watch as l,syncAndInitial as _,initial as u,sync as p}from"../../../../core/reactiveUtils.js";import{signal as c}from"../../../../core/signal.js";import{property as m}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 f,invert as g,multiply as b}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as T,create as E}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as A}from"../../../../chunks/vec42.js";import{fromValues as R,ZEROS as P}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{a as S}from"../../../../chunks/boundedPlane.js";import{RenderCategory as w,InternalRenderCategory as C}from"../../webgl.js";import{debugFlags as I}from"../../support/debugFlags.js";import{TransparencyMode as O}from"../../terrain/TransparencyMode.js";import{DepthFormat as D,ColorFormat as y}from"../../webgl/formats.js";import{FBOCache as N,defaultWebGLFBO as x}from"../core/FBOCache.js";import{RenderPassManager as M}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as v}from"../core/shaderLibrary/ShaderOutput.js";import{HUDRenderStyle as H}from"../core/shaderLibrary/hud/HUDRenderStyle.js";import{distanceFadeEnd as F}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as L}from"../effects/RenderNodes.js";import{isPrepareRenderPlugin as q}from"../effects/RenderPlugin.js";import{RenderPluginManager as U}from"../effects/RenderPluginManager.js";import{Blit as V}from"../effects/blit/Blit.js";import{AnimationTimeStep as j}from"./AnimationTimeStep.js";import{Decorations as G,RenderRequestType as B,StencilBits as Q}from"./basicInterfaces.js";import{BoundingInfo as k}from"./BoundingInfo.js";import{zero as W,union as z}from"./depthRange.js";import{depthRangeFromScene as X}from"./depthRangeUtils.js";import{MainFramebuffer as Y}from"./MainFramebuffer.js";import{RenderOccludedFlag as J}from"./Material.js";import{RenderContext as K,defaultRenderOccludedMask as $}from"./RenderContext.js";import{splitRenderGeometryChangeSetByMaterial as Z,RendererTarget as ee}from"./rendererUtils.js";import{setupFeatureDefaults as te,RenderFeature as re}from"./RenderFeature.js";import{RenderPluginInput as se}from"./RenderPluginInput.js";import{RenderSlot as ie}from"./RenderSlot.js";import{ShadowAccumulator as ae}from"./ShadowAccumulator.js";import{ShadowMap as ne,SnapshotSlot as he}from"./ShadowMap.js";import oe from"./SliceHelper.js";import{TransparencyPassType as de}from"./TransparencyPassType.js";import{Viewshed as le}from"./Viewshed.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{RenderState as ge}from"../../../support/RenderState.js";import{DepthStencilAttachment as be,PixelFormat as Te,PixelType as Ee,ClearBufferBit as Ae,TextureType as Re,ColorAttachment as Pe}from"../../../webgl/enums.js";class Se{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 oe,this._blit=null,this._state=c(ge.IDLE),this._highQualityTransparencyEnabled=!0,this._terrainTransparency=O.Opaque,this._ssrEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new j,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=c(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new se,this._releaseNormals=e=>{e.some((({name:e})=>"normals"===e))&&this._pluginInput.release("normals")},this._debugNeedsDepth=!1,this.fboCache=new N(i),this._renderStateFeatures=c(te(!has("disable-feature:high-quality-idle"),e.view.qualityProfile)),this._framebuffer=new Y(this.fboCache),this.performanceInfo=new me(this._rctx),this._shadowMap=new ne(this.fboCache,e.viewingMode),this._viewshed=new le({fboCache:this.fboCache,view:e.view},((e,t,r)=>{t.setGLViewport(this._rctx);const{camera:s,contentCamera:i}=e;this._ensureBindParametersCamera(t,t),this._renderAllGeometry(r),this._ensureBindParametersCamera(s,i),e.camera.setGLViewport(this._rctx)})),this._shadowAccumulator=new ae(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 K(this._rctx,this._shadowMap,this._sliceHelper,this._framebuffer),this._nodes=new L(this._renderContext),this._plugins=new U({renderContext:this._renderContext,techniques:r,materials:t,requestRender:n,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this.renderPassManager=new M,this._plugins.add(this.renderPassManager),this._plugins.add(this._viewshed),this._handles=[l((()=>this._stage.view.state.camera),(()=>n()),_),l((()=>I.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(_e.TRANSPARENT):()=>{},n()}),u),l((()=>this._stage.view.environment.background?.color),(e=>{const t=e?s(e):P;A(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),n()}),_),l((()=>this._stage.view.state.camera.relativeElevation),(e=>{this._inGlobeView=(e??1/0)>=F}),_)]}destroy(){this._handles.forEach((e=>e.remove())),this._gpuTimerHandle=i(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.dispose(),this._loadEdgeViewTask=a(this._loadEdgeViewTask),this._edgeView=n(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.fboCache.destroy(),this._plugins.destroy(),this._renderers.clear(),this._blit=n(this._blit),k.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=te(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(re.HighQualityTransparency)}get hasReflections(){return(this._pluginsHas.water||this._hasOverlayWater)&&(this._ssrEnabled||this.isFeatureEnabled(re.WaterReflection))}get hasDecorations(){return this._plugins.hasDecorations||this._nodes.produces("magnifier-color")}get hasHighlights(){return this._plugins.produces(v.Highlight,ie.OPAQUE_MATERIAL,ie.TRANSPARENT_MATERIAL,ie.DRAPED_MATERIAL)}get hasSSAO(){return(this._stage.view.qualitySettings.ambientOcclusion||this.isFeatureEnabled(re.SSAO))&&!this._inGlobeView}get hasSMAA(){return this._stage.view.qualitySettings.antialiasingEnabled||this.isFeatureEnabled(re.Antialiasing)}get fullResolutionAtmosphere(){return this._stage.view.qualitySettings.highResolutionAtmosphere||this.isFeatureEnabled(re.HighResolutionAtmosphere)}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=h(this._bindParameters.ssr.lastFrameColor),this._bindParameters.multipassTerrain.depth=h(this._bindParameters.multipassTerrain.depth),this._bindParameters.multipassGeometry.depth=h(this._bindParameters.multipassGeometry.depth),this._pluginInput.release("highlight mix")}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._viewshed.shadowMap?.disposeOffscreenBuffers(),this._bindParameters.depth=h(this._bindParameters.depth),this._bindParameters.hudVisibility=h(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");d(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:Me(this._stage.view.resourceController)});return this._handles.push(l((()=>r.updating),(()=>this._requestRender()),p)),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&&f(this._bindParameters.ssr.reprojectionMatrix,T)}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;Z(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,ie.LINE_CALLOUTS_HUD_DEPTH,ie.HUD_MATERIAL,ie.LABEL_MATERIAL),has.water=this._plugins.produces(v.Normal,ie.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?i(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,r=ee.Default,s=G.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=ee.Default,s=G.ON){this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=r===ee.Default,this._disposeBindBuffers();const i=this._framebuffer,{camera:a,contentCamera:n,mode:o,alignPixelEnabled:d}=e;this._state.value=o,this._bindParameters.overlay=this.renderOverlay(t),this._bindParameters.overlay&&this.performanceInfo.advance(fe.OVERLAY),this._renderContext.time=t,this._bindParameters.transparencyPassType=de.NONE,this._bindParameters.alignPixelEnabled=d,this._bindParameters.decorations=s,this._bindParameters.mainDepth=null,this._bindParameters.viewshedEnabled=this._viewshed.enabled;const l=this._nodes.produces("magnifier-color"),_=this._nodes.produces("final-color"),u=S(this._sliceHelper.plane);s===G.OFF&&(this._sliceHelper.plane=null),a.setGLViewport(this._rctx);const p=i.initialize(a.fullWidth,a.fullHeight,this._backgroundColor);this.hasReflections?this._bindParameters.ssr.lastFrameColor=p:p?.release(),this._ensureBindParametersCamera(a,n),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&s===G.ON;const c=this._plugins.produces(v.Color,ie.OPAQUE_TERRAIN)&&(this._terrainTransparency===O.Transparent||this._terrainTransparency===O.InvisibleWithDraped),m=this._highQualityTransparency&&c,f=this._plugins.produces(v.Color,...Oe);this._prepareShaders(m,f),this.performanceInfo.advance(fe.PREPARE);const g=this._computeDepthRange(a);this._renderShadowMap(a,this._bindParameters.lighting.mainLight.direction,g),this._ensureBindParametersCamera(a,n);let b=this._renderNormals();this._pluginInput.set("normals",b);const T=this._needsDepth;if(b){let e=null;T&&(e=b.getAttachment(be),e?.retain()),this._pluginInput.set("ssao",this._renderSSAO()),this._renderNoSSAOGeometryDepth(T,e),b=null}else this._renderAllGeometryDepth(T);this._renderShadowAccumulation(g,a,n),this._ensureBindParametersSSR(t),this._renderContext.output=v.Color,i.bind(),this._bindParameters.mainDepth=i.depth.attachment;const E=this.plugins.produces(v.Color,...Ie);E&&this._renderOpaqueGeometry(),i.update((e=>this._renderNodes(w.OPAQUE,e,E))),this.fboCache.debugCallback?.("opaque-color",i.color.fbo),this._renderPlugins(ie.OPAQUE_ENVIRONMENT,fe.OPAQUE_ENVIRONMENT),this._renderMultipassTerrainDepth(m),this._setMultipassTerrain(m),this._renderEdges(_e.OPAQUE),i.bind(),this._renderPlugins(ie.VOXEL,fe.VOXEL),this._renderHiddenTransparentEdges(),f&&(this._oitEnabled?this._renderOITPass(we.Geometry):this._renderTransparentMaterial()),i.update((e=>this._renderNodes(w.TRANSPARENT,e,f))),this.fboCache.debugCallback?.("transparent-color",i.color.fbo),this._renderMultipassGeometryDepth(m),this._renderHUDVisibility(),m||this._plugins.render(this._pluginInput,ie.LINE_CALLOUTS);const A=r===ee.ObjectAndLayerID?this._renderObjectAndLayerIdColor():null;this._renderEdges(_e.TRANSPARENT);const R=c?this._renderTransparentTerrain():null;R&&(this.performanceInfo.advance(fe.TRANSPARENT_TERRAIN),this._bindParameters.hudVisibility&&(m?this._renderLineCallouts(H.Occluded):(this._rctx.bindFramebuffer(this._bindParameters.hudVisibility?.fbo),this._compositingHelper.compositeHUD(this._bindParameters,R.getTexture())),this._renderHUD(H.Occluded,i.color))),this._setTerrainCulling(!1),R&&(i.bind(),this._compositingHelper.composite(this._bindParameters,R.getTexture(),pe.PremultipliedAlpha),R.release(),m&&(this._renderEdges(_e.OPAQUE),f&&(this._oitEnabled?this._renderOITPass(we.Geometry):this._renderTransparentMaterial(),this.performanceInfo.advance(fe.TRANSPARENT)),this._renderEdges(_e.TRANSPARENT))),this._bindParameters.ssao=h(this._bindParameters.ssao),m&&this._renderLineCallouts(H.NotOccluded),this._setMultipassEnabled(!1),this._renderTransparentEnvironment(),this._renderViewshed(),i.update((e=>this._renderNodes(C.LASERLINES,e))),this._renderOccluded(),this._pluginInput.set("highlights",this._renderHighlightPrepass()),i.update((e=>this._renderNodes(w.COMPOSITE,e)));const P=this._nodes.produces("aa-color"),I=!(r!==ee.Default||_||l&&s===G.ON&&r===ee.Default),D=this._pluginInput.get("composite-color"),y=I?x:this.fboCache.acquire(D.fbo.width,D.fbo.height,"aa-color"),N=P?this._renderNodes(C.ANTIALIASING,y):this._blitToDefault(D,y,!1);this._pluginInput.set(C.ANTIALIASING,N),this._renderHUD(H.NotOccluded,N);const M=this._renderNodes(C.HIGHLIGHTS,N);let F=this._renderNodes(C.MAGNIFIER,M);return l&&s===G.ON&&r===ee.Default&&!_&&(F=this._blitToDefault(F)),_?(F.attachDepth(i.depth),this._blitToDefault(this._renderNodes(w.FINAL,F)),F.detachDepth()):this._pluginInput.set(w.FINAL,F),this._pluginInput.release("highlights"),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),i.release(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this._sliceHelper.plane=u,this.fboCache.frameEnd(),this.performanceInfo.finishFrame(),r!==ee.Default&&(this._releaseFBOs(),this._disposeOffscreenBuffers()),{screen:this._pluginInput.get("final-color"),oid:A}}_prepareShaders(e,t){this._renderContext.output=v.Color,this._prepareOpaqueGeometry(),this._setMultipassTerrain(e),this._plugins.prepare(ie.TRANSPARENT_TERRAIN),this._setMultipassTerrain(!1),e||this._plugins.prepare(ie.LINE_CALLOUTS),t&&this._prepareTransparencySlots(),this._plugins.prepare(ie.VIEWSHED,ie.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,ie.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=H.NotOccluded,this._plugins.render(this._pluginInput,ie.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===B.BACKGROUND;if(r||t){const e=r?this.performanceInfo.elapsedTime:0,s=t?this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.getError(),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],Te.RGBA,Ee.UNSIGNED_BYTE,t),i.release()}readHUDVisibility(e,t,r,s,i){this._bindParameters.hudVisibility?.fbo?.readPixels(e,t,r,s,Te.RGBA,Ee.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,Ce),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(re.HighResolutionShadows),this._stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(v.ShadowHighlight,this._shadowMap),s.moveSnapshot(he.Highlight),this._renderShadowCascades(v.ShadowExcludeHighlight,this._shadowMap),s.copySnapshot(he.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=h(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),h(this._bindParameters.depth),this._bindParameters.depth=s.obtainDepthTexture(),s.release(),this.performanceInfo.advance(fe.DEPTH)}_renderAllGeometryDepth(e){if(!e)return void(this._bindParameters.depth=h(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),h(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=h(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(),h(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=h(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,h(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=X(e,this._plugins.plugins,this._stage.layers);return z(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",y.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")+(this._viewshedEnabled?1:0);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();const t=this._nodes.render("ssao",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(ie.TRANSPARENT_TERRAIN),this._renderOpaqueGeometryAndTransparentMaterial(e),this._renderTransparentTerrain()}_renderOpaqueGeometryAndTransparentMaterial(e){this._renderContext.output=e,this._plugins.prepare(ie.TRANSPARENT_MATERIAL,ie.TRANSPARENT_NO_SSAO_DEPTH),this._renderOpaqueGeometry(),this._renderTransparentMaterial()}_renderGeometryForSSAO(e){this._renderContext.output=e,this._plugins.render(this._pluginInput,ie.INTEGRATED_MESH,ie.OPAQUE_TERRAIN,ie.OPAQUE_MATERIAL,ie.TRANSPARENT_MATERIAL),this._renderTransparentTerrain()}_renderGeometryExcludedFromSSAO(e){this._renderContext.output=e,this._plugins.render(this._pluginInput,ie.OPAQUE_NO_SSAO_DEPTH,ie.TRANSPARENT_NO_SSAO_DEPTH)}_prepareOpaqueGeometry(){this._plugins.prepare(...Ie,ie.OPAQUE_ENVIRONMENT)}_renderOpaqueGeometry(){this._plugins.render(this._pluginInput,...Ie)}_renderTransparentMaterial(){this._plugins.render(this._pluginInput,...Oe)}_renderTransparentTerrain(){const e=this._renderContext.output;if(!this._plugins.produces(e,ie.TRANSPARENT_TERRAIN))return;const t=()=>this._plugins.render(this._pluginInput,ie.TRANSPARENT_TERRAIN);if(e!==v.Color)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,ie.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",y.RGBA4)),t.attachDepth(r||this._framebuffer.depth),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer([0,1,0,1]),this._plugins.render(this._pluginInput,ie.OCCLUSION_PIXELS),t.detachDepth(),t};this._bindParameters.hudVisibility=e(),this._framebuffer.bind(),this.performanceInfo.advance(fe.HUD_VISIBILITY)}else this._bindParameters.hudVisibility=h(this._bindParameters.hudVisibility)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,e===H.Occluded){const e=()=>this._plugins.render(this._pluginInput,ie.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,ie.LINE_CALLOUTS)}_renderHUD(e,t){if(this._pluginsHas.hudElements){if(this._oitEnabled){const r=this._renderOITPass(we.HUD,e);this._rctx.bindFramebuffer(t.fbo),this._compositingHelper.composite(this._bindParameters,r.getTexture(),pe.PremultipliedAlpha),r.release()}else if(e===H.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===H.Occluded?fe.HUD_OCCLUDED:fe.HUD)}}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.prepare(ie.LINE_CALLOUTS_HUD_DEPTH,ie.HUD_MATERIAL,ie.LABEL_MATERIAL),this._plugins.render(this._pluginInput,ie.LINE_CALLOUTS_HUD_DEPTH,ie.HUD_MATERIAL,ie.LABEL_MATERIAL)}get _needsShadowHighlight(){return this._shadowMap.enabled&&this._plugins.produces(v.ShadowHighlight,ie.OPAQUE_MATERIAL)}_renderHighlightPrepass(){if(!this.hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:r}=this,s=this._framebufferSize;let i=this._pluginInput.get("highlight mix");null==i&&(i=e.acquire(s.width,s.height,"highlight mix",y.RGBA),this._pluginInput.set("highlight mix",i),r.highlightTexture=i.getTexture()),t.bindFramebuffer(i.fbo);const a=[0,0,0,0];t.clearFramebuffer(a);const n=i.getTexture(),h=e.acquire(s.width,s.height,"highlights",y.RGBA);h.acquireDepth(D.DEPTH16_BUFFER),t.bindFramebuffer(h.fbo),t.clearFramebuffer(a,!0);const{highlightOrder:o}=this._stage.view,d=Math.min(16,o.length),{highlightGroupMap:l}=r;l.clear();for(let _=0;_<d;++_){const e=o.at(_);e&&l.set(e,_)}for(let _=0;_<d;++_)r.highlightLevel=_,r.highlightGroup=o.at(_),t.bindFramebuffer(h.fbo),t.clearFramebuffer(void 0,!0),this._renderAllGeometry(v.Highlight),0===_&&(t.clear(Ae.DEPTH_BUFFER_BIT),this._renderHUDElements(H.Both)),t.clear(Ae.DEPTH_BUFFER_BIT),t.bindTexture(n,0),t.gl.copyTexImage2D(Re.TEXTURE_2D,0,Te.RGBA,0,0,s.width,s.height,0);return h}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(){this._renderContext.output=v.Color,this._bindParameters.transparencyPassType=de.ColorAlpha,this._plugins.prepare(...Oe),this._bindParameters.transparencyPassType=de.FrontFace,this._plugins.prepare(...Oe),this._bindParameters.transparencyPassType=de.NONE,this._techniques.acquire(ce).release()}_renderOITPass(e,t=H.Both){const r=e===we.HUD,s=this._framebufferSize,i=r?this.fboCache.acquire(s.width,s.height,"oit hud composite"):null,a=r?()=>this._renderHUDElements(t):()=>this._renderTransparentMaterial(),n=this._renderContext.output;return this._renderContext.output=v.Color,this._renderOIT(this._bindParameters,a,i),this._renderContext.output=n,i}_renderOIT(e,t,r){const s=this._framebufferSize;e.transparencyPassType=de.ColorAlpha;const i=r?"oit hud color alpha":"oit color alpha",a=this.fboCache.acquire(s.width,s.height,i,y.RGBA16F);a.acquireColor(Pe.COLOR_ATTACHMENT1,y.R16F),r||a.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(a.fbo),this._rctx.clearFramebuffer([0,0,0,1]),t(),a.detachDepth(),e.transparencyPassType=de.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=de.NONE,r?(this._rctx.bindFramebuffer(r.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(Ae.COLOR_BUFFER_BIT)):this._framebuffer.bind(),this._compositingHelper.compositeOIT(e,a.getTexture(),a.getTexture(Pe.COLOR_ATTACHMENT1),n.getTexture()),r?.detachDepth(),n.release(),a.release()}_renderOccluded(){let e=0;De.clear(),this._plugins.plugins.forAll((t=>{if(!t.material)return;t.queryRenderOccludedState(J.OccludeAndTransparentStencil)&&(e|=J.OccludeAndTransparentStencil,De.push(t))}));const t=this._framebuffer,r=(r,s,i,a,n)=>{if(!(e&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"):t.depth,this.renderToTargets(i,o,d,[0,0,0,0],a,n),t.bind(),this._compositingHelper.composite(this._bindParameters,o.getTexture(),pe.PremultipliedAlpha,r),a&&d.release(),o.release()},s=(e,t)=>{this._bindParameters.slot=e,t.forAll((e=>{if(q(e)){const t=e.prepareTechnique(this._renderContext);t&&e.renderNode(this._renderContext,t)}}))};0!==De.length&&(s(ie.OCCLUDER_MATERIAL,De),r(.5,J.OccludeAndTransparentStencil,(()=>s(ie.TRANSPARENT_OCCLUDER_MATERIAL,De)),!1,!1));const i=De.length>0;De.clear(),this._plugins.plugins.forAll((t=>{if(!t.material)return;const r=t.queryRenderOccludedState(J.OccludeAndTransparent),s=t.queryRenderOccludedState(J.Transparent),i=t.queryRenderOccludedState(J.Opaque);(r||s||i)&&(e|=r?J.OccludeAndTransparent:s?J.Transparent:J.Opaque,De.push(t))}));const a=this._plugins.renderOccludedFlags;if(e|=a,!e)return;const n=e=>{this._renderContext.renderOccludedMask=e,a>J.Occlude&&this._plugins.render(this._pluginInput,ie.OCCLUDED_TERRAIN),s(ie.OPAQUE_MATERIAL,De),s(ie.TRANSPARENT_MATERIAL,De),s(ie.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,De),this._renderContext.renderOccludedMask=$};this._renderContext.output=v.Color,r(.5,J.OccludeAndTransparent,(()=>n(J.OccludeAndTransparent)),!0,Q.OutlineVisualElementMask),r(.5,J.Transparent,(()=>n(J.Transparent)),!0,Q.OutlineVisualElementMask),r(1,J.Opaque,(()=>n(J.Opaque)),!0,Q.OutlineVisualElementMask),(i||De.length>0)&&this.performanceInfo.advance(fe.OCCLUDED),De.clear()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this._framebuffer.bind(),this._plugins.render(this._pluginInput,ie.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,ie.TRANSPARENT_ENVIRONMENT),this.performanceInfo.advance(fe.TRANSPARENT_ENVIRONMENT)}_renderViewshed(){this._viewshedEnabled&&(this._viewshed.renderHighQuality=this.isFeatureEnabled(re.HighResolutionViewshed),this._plugins.render(this._pluginInput,ie.VIEWSHED),this._pluginInput.release("normals"),this.performanceInfo.advance(fe.VIEWSHED))}_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(!this._nodes.produces(e))return r&&this.performanceInfo.advance(e),t;t.setName(e),this._pluginInput.set(e,t);const s=this._nodes.render(t,this._pluginInput,this._releaseNormals);return this.performanceInfo.advance(e),s}_blitToDefault(e,t=x,r=!0){this._blit??=new V(this._techniques);const s=this._blit.render(this._rctx,e,t,this._bindParameters,this._requestRender);return this._pluginInput.set(e.name,s),r&&e.release(),s}_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=T:(g(Ne,this._bindParameters.camera.viewMatrix),g(ye,this._bindParameters.camera.projectionMatrix),b(xe,Ne,ye),b(xe,this._renderContext.lastFrameCamera.viewMatrix,xe),b(xe,this._renderContext.lastFrameCamera.projectionMatrix,xe),this._reprojectionMatrix=xe);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=T,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}}get _viewshedEnabled(){return this._viewshed.enabled&&this._plugins.produces(this._renderContext.output,ie.VIEWSHED)}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([m({readOnly:!0})],Se.prototype,"fullResolutionAtmosphere",null),e([m()],Se.prototype,"_edgeView",void 0),e([m()],Se.prototype,"updating",null),function(e){e[e.Geometry=0]="Geometry",e[e.HUD=1]="HUD"}(we||(we={}));const Ce=[0,0,0,0],Ie=[ie.INTEGRATED_MESH,ie.OPAQUE_TERRAIN,ie.OPAQUE_MATERIAL,ie.OPAQUE_NO_SSAO_DEPTH],Oe=[ie.TRANSPARENT_MATERIAL,ie.TRANSPARENT_NO_SSAO_DEPTH],De=new o,ye=E(),Ne=E(),xe=E();function Me(e){return t=>e.immediate.schedule(t)}export{Se 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"../core/shaderLibrary/ForwardLinearDepth.glsl.js";import"../core/shaderLibrary/Offset.glsl.js";import"../core/shaderLibrary/ShaderOutput.js";import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/Transform.glsl.js";import"../core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js";import"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import"../core/shaderLibrary/attributes/PositionAttribute.glsl.js";import"../core/shaderLibrary/attributes/SymbolColor.glsl.js";import"../core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import"../core/shaderLibrary/attributes/VertexColor.glsl.js";import"../core/shaderLibrary/attributes/VertexNormal.glsl.js";import"../core/shaderLibrary/attributes/VerticalOffset.glsl.js";import"../core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js";import"../core/shaderLibrary/shading/ComputeNormalTexture.glsl.js";import"../core/shaderLibrary/shading/EvaluateAmbientOcclusion.glsl.js";import"../core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import"../core/shaderLibrary/shading/MainLighting.glsl.js";import"../core/shaderLibrary/shading/MultipassTerrainTest.glsl.js";import"../core/shaderLibrary/shading/Normals.glsl.js";import"../core/shaderLibrary/shading/PhysicallyBasedRendering.glsl.js";import"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import"../core/shaderLibrary/shading/TextureTransformUV.glsl.js";import"../core/shaderLibrary/shading/VisualVariables.glsl.js";import"../core/shaderLibrary/util/AlphaCutoff.js";import"../core/shaderLibrary/util/
|
|
5
|
+
import"../core/shaderLibrary/ForwardLinearDepth.glsl.js";import"../core/shaderLibrary/Offset.glsl.js";import"../core/shaderLibrary/ShaderOutput.js";import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/Transform.glsl.js";import"../core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js";import"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import"../core/shaderLibrary/attributes/PositionAttribute.glsl.js";import"../core/shaderLibrary/attributes/SymbolColor.glsl.js";import"../core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import"../core/shaderLibrary/attributes/VertexColor.glsl.js";import"../core/shaderLibrary/attributes/VertexNormal.glsl.js";import"../core/shaderLibrary/attributes/VerticalOffset.glsl.js";import"../core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js";import"../core/shaderLibrary/shading/ComputeNormalTexture.glsl.js";import"../core/shaderLibrary/shading/EvaluateAmbientOcclusion.glsl.js";import"../core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import"../core/shaderLibrary/shading/MainLighting.glsl.js";import"../core/shaderLibrary/shading/MultipassTerrainTest.glsl.js";import"../core/shaderLibrary/shading/Normals.glsl.js";import"../core/shaderLibrary/shading/PhysicallyBasedRendering.glsl.js";import"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import"../core/shaderLibrary/shading/TextureTransformUV.glsl.js";import"../core/shaderLibrary/shading/VisualVariables.glsl.js";import"../core/shaderLibrary/util/AlphaCutoff.js";import"../core/shaderLibrary/util/DiscardOrAdjustAlpha.glsl.js";import"../core/shaderLibrary/util/MixExternalColor.glsl.js";import"../core/shaderLibrary/util/View.glsl.js";import"../core/shaderModules/Float3PassUniform.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/interfaces.js";import"../core/shaderModules/ShaderBuilder.js";import"../core/shaderModules/Texture2DPassUniform.js";import"../lib/VertexAttribute.js";import"./OutputColorHighlightOID.glsl.js";export{b as build}from"../../../../chunks/DefaultMaterial.glsl.js";
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../core/shaderLibrary/util/
|
|
5
|
+
import"../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../core/shaderLibrary/util/AlphaCutoff.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/interfaces.js";import"../core/shaderModules/ShaderBuilder.js";import"../core/shaderModules/Texture2DPassUniform.js";export{b as build}from"../../../../chunks/Heatmap.glsl.js";
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../core/shaderModules/Float2PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/Integer2PassUniform.js";import"../core/shaderModules/IntegerPassUniform.js";import"../core/shaderModules/interfaces.js";import"../core/shaderModules/ShaderBuilder.js";import"../core/shaderModules/Texture2DPassUniform.js";import"../../../../chunks/HighlightDownsample.glsl.js";export{b as build}from"../../../../chunks/HighlightApply.glsl.js";
|
|
5
|
+
import"../core/shaderLibrary/util/AlphaCutoff.js";import"../core/shaderModules/Float2PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/Integer2PassUniform.js";import"../core/shaderModules/IntegerPassUniform.js";import"../core/shaderModules/interfaces.js";import"../core/shaderModules/ShaderBuilder.js";import"../core/shaderModules/Texture2DPassUniform.js";import"../../../../chunks/HighlightDownsample.glsl.js";export{b as build}from"../../../../chunks/HighlightApply.glsl.js";
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../core/libs/gl-matrix-2/math/vec2.js";import"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/hud/AlignPixel.glsl.js";import"../core/shaderLibrary/hud/HUD.glsl.js";import"../core/shaderLibrary/hud/HUDVisibility.glsl.js";import"../core/shaderLibrary/shading/MultipassGeometryTest.glsl.js";import"../core/shaderLibrary/util/ScreenSizePerspective.glsl.js";import"../core/shaderModules/Float2PassUniform.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/interfaces.js";import"../core/shaderModules/ShaderBuilder.js";import"../lib/VertexAttribute.js";export{b as build}from"../../../../chunks/LineCallout.glsl.js";
|
|
5
|
+
import"../../../../core/libs/gl-matrix-2/math/vec2.js";import"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/hud/AlignPixel.glsl.js";import"../core/shaderLibrary/hud/HUD.glsl.js";import"../core/shaderLibrary/hud/HUDVisibility.glsl.js";import"../core/shaderLibrary/shading/MultipassGeometryTest.glsl.js";import"../core/shaderLibrary/util/AlphaCutoff.js";import"../core/shaderLibrary/util/ScreenSizePerspective.glsl.js";import"../core/shaderModules/Float2PassUniform.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/interfaces.js";import"../core/shaderModules/ShaderBuilder.js";import"../lib/VertexAttribute.js";export{b as build}from"../../../../chunks/LineCallout.glsl.js";
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../core/shaderLibrary/util/View.glsl.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/interfaces.js";import"../core/shaderModules/ShaderBuilder.js";import"../lib/VertexAttribute.js";export{b as build}from"../../../../chunks/MeasurementArrow.glsl.js";
|
|
5
|
+
import"../core/shaderLibrary/util/AlphaCutoff.js";import"../core/shaderLibrary/util/View.glsl.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/interfaces.js";import"../core/shaderModules/ShaderBuilder.js";import"../lib/VertexAttribute.js";export{b as build}from"../../../../chunks/MeasurementArrow.glsl.js";
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../core/shaderLibrary/ForwardLinearDepth.glsl.js";import"../core/shaderLibrary/Offset.glsl.js";import"../core/shaderLibrary/ShaderOutput.js";import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/Transform.glsl.js";import"../core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js";import"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import"../core/shaderLibrary/attributes/PositionAttribute.glsl.js";import"../core/shaderLibrary/attributes/SymbolColor.glsl.js";import"../core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import"../core/shaderLibrary/attributes/VertexColor.glsl.js";import"../core/shaderLibrary/attributes/VerticalOffset.glsl.js";import"../core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js";import"../core/shaderLibrary/shading/EvaluateAmbientOcclusion.glsl.js";import"../core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import"../core/shaderLibrary/shading/MainLighting.glsl.js";import"../core/shaderLibrary/shading/MultipassTerrainTest.glsl.js";import"../core/shaderLibrary/shading/PhysicallyBasedRendering.glsl.js";import"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import"../core/shaderLibrary/shading/VisualVariables.glsl.js";import"../core/shaderLibrary/util/AlphaCutoff.js";import"../core/shaderLibrary/util/
|
|
5
|
+
import"../core/shaderLibrary/ForwardLinearDepth.glsl.js";import"../core/shaderLibrary/Offset.glsl.js";import"../core/shaderLibrary/ShaderOutput.js";import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/Transform.glsl.js";import"../core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js";import"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import"../core/shaderLibrary/attributes/PositionAttribute.glsl.js";import"../core/shaderLibrary/attributes/SymbolColor.glsl.js";import"../core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import"../core/shaderLibrary/attributes/VertexColor.glsl.js";import"../core/shaderLibrary/attributes/VerticalOffset.glsl.js";import"../core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js";import"../core/shaderLibrary/shading/EvaluateAmbientOcclusion.glsl.js";import"../core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import"../core/shaderLibrary/shading/MainLighting.glsl.js";import"../core/shaderLibrary/shading/MultipassTerrainTest.glsl.js";import"../core/shaderLibrary/shading/PhysicallyBasedRendering.glsl.js";import"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import"../core/shaderLibrary/shading/VisualVariables.glsl.js";import"../core/shaderLibrary/util/AlphaCutoff.js";import"../core/shaderLibrary/util/DiscardOrAdjustAlpha.glsl.js";import"../core/shaderLibrary/util/MixExternalColor.glsl.js";import"../core/shaderLibrary/util/View.glsl.js";import"../core/shaderModules/Float3PassUniform.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/interfaces.js";import"../core/shaderModules/ShaderBuilder.js";import"../core/shaderModules/Texture2DPassUniform.js";import"../lib/VertexAttribute.js";import"./OutputColorHighlightOID.glsl.js";export{b as build}from"../../../../chunks/RealisticTree.glsl.js";
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../../../core/libs/gl-matrix-2/math/vec2.js";import"../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../../core/shaderLibrary/Slice.glsl.js";import"../../../core/shaderLibrary/shading/MultipassTerrainTest.glsl.js";import"../../../core/shaderModules/Float2PassUniform.js";import"../../../core/shaderModules/Float4PassUniform.js";import"../../../core/shaderModules/FloatPassUniform.js";import"../../../core/shaderModules/interfaces.js";import"../../../core/shaderModules/ShaderBuilder.js";import"../../../core/shaderModules/Uniform.js";import"../../../lib/VertexAttribute.js";import"./AdjustProjectedPosition.glsl.js";import"./
|
|
5
|
+
import"../../../../../../core/libs/gl-matrix-2/math/vec2.js";import"../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../../core/shaderLibrary/Slice.glsl.js";import"../../../core/shaderLibrary/shading/MultipassTerrainTest.glsl.js";import"../../../core/shaderModules/Float2PassUniform.js";import"../../../core/shaderModules/Float4PassUniform.js";import"../../../core/shaderModules/FloatPassUniform.js";import"../../../core/shaderModules/interfaces.js";import"../../../core/shaderModules/ShaderBuilder.js";import"../../../core/shaderModules/Uniform.js";import"../../../lib/VertexAttribute.js";import"./AdjustProjectedPosition.glsl.js";import"./DiscardNonSilhouetteEdges.glsl.js";import"./EdgeUtil.glsl.js";import"./LineAmplitude.glsl.js";import"./LineOffset.glsl.js";import"./UnpackAttributes.glsl.js";export{b as build}from"../../../../../../chunks/EdgeShader.glsl.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[8096],{8096:(e,t,s)=>{s.r(t),s.d(t,{toBinaryGLTF:()=>j});var n,i=s(74887);!function(e){e[e.JSON=1313821514]="JSON",e[e.BIN=5130562]="BIN"}(n||(n={}));class r{constructor(e,t){if(!e)throw new Error("GLB requires a JSON gltf chunk");this._length=r.HEADER_SIZE,this._length+=r.CHUNK_HEADER_SIZE;const s=function(e){return(new TextEncoder).encode(e).buffer}(e);if(this._length+=_(s.byteLength,4),t&&(this._length+=r.CHUNK_HEADER_SIZE,this._length+=t.byteLength,t.byteLength%4))throw new Error("Expected BIN chunk length to be divisible by 4 at this point");this.buffer=new ArrayBuffer(this._length),this._outView=new DataView(this.buffer),this._writeHeader();const i=this._writeChunk(s,12,n.JSON,32);t&&this._writeChunk(t,i,n.BIN)}_writeHeader(){this._outView.setUint32(0,r.MAGIC,!0),this._outView.setUint32(4,r.VERSION,!0),this._outView.setUint32(8,this._length,!0)}_writeChunk(e,t,s,n=0){const i=_(e.byteLength,4);for(this._outView.setUint32(t,i,!0),this._outView.setUint32(t+=4,s,!0),function(e,t,s,n,i){new Uint8Array(e,s,i).set(new Uint8Array(t,0,i),0)}(this._outView.buffer,e,t+=4,0,e.byteLength),t+=e.byteLength;t%4;)n&&this._outView.setUint8(t,n),t++;return t}}function _(e,t){return t*Math.ceil(e/t)}r.HEADER_SIZE=12,r.CHUNK_HEADER_SIZE=8,r.MAGIC=1179937895,r.VERSION=2;var E,a,o,T,A,R,c,N,u=s(53966),f=s(91869),h=s(34727),l=s(67026),O=s(82534),S=s(38954),C=s(51850),I=s(80882),L=s(72258);(N=E||(E={}))[N.External=0]="External",N[N.DataURI=1]="DataURI",N[N.GLB=2]="GLB",function(e){e[e.External=0]="External",e[e.DataURI=1]="DataURI",e[e.GLB=2]="GLB"}(a||(a={})),function(e){e[e.ARRAY_BUFFER=34962]="ARRAY_BUFFER",e[e.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER"}(o||(o={})),function(e){e.SCALAR="SCALAR",e.VEC2="VEC2",e.VEC3="VEC3",e.VEC4="VEC4",e.MAT2="MAT2",e.MAT3="MAT3",e.MAT4="MAT4"}(T||(T={})),function(e){e[e.POINTS=0]="POINTS",e[e.LINES=1]="LINES",e[e.LINE_LOOP=2]="LINE_LOOP",e[e.LINE_STRIP=3]="LINE_STRIP",e[e.TRIANGLES=4]="TRIANGLES",e[e.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",e[e.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(A||(A={})),function(e){e.OPAQUE="OPAQUE",e.MASK="MASK",e.BLEND="BLEND"}(R||(R={})),function(e){e[e.NoColor=0]="NoColor",e[e.FaceColor=1]="FaceColor",e[e.VertexColor=2]="VertexColor"}(c||(c={}));var d=s(63907);class M{constructor(e,t,s,n,i){this._buffer=e,this._componentType=s,this._dataType=n,this._data=[],this._isFinalized=!1,this._accessorIndex=-1,this._accessorAttribute=null,this._accessorMin=null,this._accessorMax=null,t.bufferViews||(t.bufferViews=[]),this.index=t.bufferViews.length,this._bufferView={buffer:e.index,byteLength:-1,target:i};const r=this._getElementSize();r>=4&&i!==o.ELEMENT_ARRAY_BUFFER&&(this._bufferView.byteStride=r),t.bufferViews.push(this._bufferView),this._numComponentsForDataType=this._calculateNumComponentsForDataType()}push(e){const t=this._data.length;if(this._data.push(e),this._accessorIndex>=0){const s=t%this._numComponentsForDataType,n=this._accessorMin[s];this._accessorMin[s]="number"!=typeof n?e:Math.min(n,e);const i=this._accessorMax[s];this._accessorMax[s]="number"!=typeof i?e:Math.max(i,e)}}get dataSize(){return this._data.length*this._sizeComponentType()}get byteSize(){return function(e,t){return 4*Math.ceil(e/4)}(this.dataSize)}getByteOffset(){if(!this._isFinalized)throw new Error("Cannot get BufferView offset until it is finalized");return this._buffer.getByteOffset(this)}get byteOffset(){if(!this._isFinalized)throw new Error("Cannot get BufferView offset until it is finalized");return this._buffer.getByteOffset(this)}_createTypedArray(e,t){switch(this._componentType){case d.pe.BYTE:return new Int8Array(e,t);case d.pe.FLOAT:return new Float32Array(e,t);case d.pe.SHORT:return new Int16Array(e,t);case d.pe.UNSIGNED_BYTE:return new Uint8Array(e,t);case d.pe.UNSIGNED_INT:return new Uint32Array(e,t);case d.pe.UNSIGNED_SHORT:return new Uint16Array(e,t)}}writeOutToBuffer(e,t){this._createTypedArray(e,t).set(this._data)}writeAsync(e){if(this._asyncWritePromise)throw new Error("Can't write multiple bufferView values asynchronously");return this._asyncWritePromise=e.then((e=>{const t=new Uint8Array(e);for(let e=0;e<t.length;++e)this._data.push(t[e]);delete this._asyncWritePromise})),this._asyncWritePromise}startAccessor(e){if(this._accessorIndex>=0)throw new Error("Accessor was started without ending the previous one");this._accessorIndex=this._data.length,this._accessorAttribute=e;const t=this._numComponentsForDataType;this._accessorMin=new Array(t),this._accessorMax=new Array(t)}endAccessor(){if(this._accessorIndex<0)throw new Error("An accessor was not started, but was attempted to be ended");const e=this._getElementSize(),t=this._numComponentsForDataType,s=(this._data.length-this._accessorIndex)/t;if(s%1)throw new Error("An accessor was ended with missing component values");for(let e=0;e<this._accessorMin.length;++e)"number"!=typeof this._accessorMin[e]&&(this._accessorMin[e]=0),"number"!=typeof this._accessorMax[e]&&(this._accessorMax[e]=0);const n={byteOffset:e*(this._accessorIndex/t),componentType:this._componentType,count:s,type:this._dataType,min:this._accessorMin,max:this._accessorMax,name:this._accessorAttribute};switch(this._accessorAttribute){case"TEXCOORD_0":case"TEXCOORD_1":case"COLOR_0":case"WEIGHTS_0":switch(this._componentType){case d.pe.UNSIGNED_BYTE:case d.pe.UNSIGNED_SHORT:n.normalized=!0}}return this._accessorIndex=-1,this._accessorAttribute=null,this._accessorMin=null,this._accessorMax=null,n}get finalized(){return this._finalizedPromise?this._finalizedPromise:this._isFinalized?this._finalizedPromise=Promise.resolve():this._finalizedPromise=new Promise((e=>this._finalizedPromiseResolve=e))}async finalize(){const e=this._bufferView,t=this._buffer.getViewFinalizePromises(this);this._asyncWritePromise&&t.push(this._asyncWritePromise),await Promise.allSettled(t),this._isFinalized=!0,e.byteOffset=this.getByteOffset(),e.byteLength=this.dataSize,this._finalizedPromiseResolve&&this._finalizedPromiseResolve()}_getElementSize(){return this._sizeComponentType()*this._numComponentsForDataType}_sizeComponentType(){switch(this._componentType){case d.pe.BYTE:case d.pe.UNSIGNED_BYTE:return 1;case d.pe.SHORT:case d.pe.UNSIGNED_SHORT:return 2;case d.pe.UNSIGNED_INT:case d.pe.FLOAT:return 4}}_calculateNumComponentsForDataType(){switch(this._dataType){case T.SCALAR:return 1;case T.VEC2:return 2;case T.VEC3:return 3;case T.VEC4:case T.MAT2:return 4;case T.MAT3:return 9;case T.MAT4:return 16}}}class D{constructor(e){this._gltf=e,this._bufferViews=[],this._isFinalized=!1,e.buffers||(e.buffers=[]),this.index=e.buffers.length;const t={byteLength:-1};e.buffers.push(t),this._buffer=t}addBufferView(e,t,s){if(this._finalizePromise)throw new Error("Cannot add buffer view after fiinalizing buffer");const n=new M(this,this._gltf,e,t,s);return this._bufferViews.push(n),n}getByteOffset(e){let t=0;for(const s of this._bufferViews){if(s===e)return t;t+=s.byteSize}throw new Error("Given bufferView was not present in this buffer")}getViewFinalizePromises(e){const t=[];for(const s of this._bufferViews){if(e&&s===e)return t;t.push(s.finalized)}return t}getArrayBuffer(){if(!this._isFinalized)throw new Error("Cannot get ArrayBuffer from Buffer before it is finalized");const e=this._getTotalSize(),t=new ArrayBuffer(e);let s=0;for(const e of this._bufferViews)e.writeOutToBuffer(t,s),s+=e.byteSize;return t}finalize(){if(this._finalizePromise)throw new Error(`Buffer ${this.index} was already finalized`);return this._finalizePromise=Promise.allSettled(this.getViewFinalizePromises()).then((()=>{this._isFinalized=!0;const e=this.getArrayBuffer();this._buffer.byteLength=e.byteLength,this._buffer.uri=e})),this._gltf.extras.promises.push(this._finalizePromise),this._finalizePromise}_getTotalSize(){let e=0;for(const t of this._bufferViews)e+=t.byteSize;return e}}function p(e,t){null==t.normal&&(t.normal=new Float32Array(t.position.length));const s=e.faces,{position:n,normal:i}=t,r=s.length/3;for(let e=0;e<r;++e){const t=3*s[3*e],r=3*s[3*e+1],_=3*s[3*e+2],E=(0,S.s)(U,n[t],n[t+1],n[t+2]),a=(0,S.s)(B,n[r],n[r+1],n[r+2]),o=(0,S.s)(m,n[_],n[_+1],n[_+2]),T=(0,S.f)(a,a,E),A=(0,S.f)(o,o,E),R=(0,S.b)(T,T,A);i[t]+=R[0],i[t+1]+=R[1],i[t+2]+=R[2],i[r]+=R[0],i[r+1]+=R[1],i[r+2]+=R[2],i[_]+=R[0],i[_+1]+=R[1],i[_+2]+=R[2]}for(let e=0;e<i.length;e+=3)(0,S.s)(G,i[e],i[e+1],i[e+2]),(0,S.n)(G,G),i[e]=G[0],i[e+1]=G[1],i[e+2]=G[2]}const U=(0,C.vt)(),B=(0,C.vt)(),m=(0,C.vt)(),G=(0,C.vt)();s(44208);var P=s(49186),g=s(84952);async function F(e,t){const s=w(e);if(null==s)throw new P.A("imageToArrayBuffer","Unsupported image type");const n=function(e){if(!(e instanceof HTMLImageElement))return"image/png";const t=e.src;if((0,g.DB)(t)){const e=(0,g.r$)(t);return"image/jpeg"===e?.mediaType?e.mediaType:"image/png"}return/\.png$/i.test(t)?"image/png":/\.(jpg|jpeg)$/i.test(t)?"image/jpeg":"image/png"}(e),r=await new Promise((e=>s.toBlob(e,n)));if((0,i.Te)(t),!r)throw new P.A("imageToArrayBuffer","Failed to encode image");const _=await r.arrayBuffer();return(0,i.Te)(t),{data:_,type:n}}function w(e){if(e instanceof HTMLCanvasElement)return e;if(e instanceof HTMLVideoElement)return null;const t=document.createElement("canvas");t.width=e.width,t.height=e.height;const s=t.getContext("2d");return e instanceof HTMLImageElement?s.drawImage(e,0,0,e.width,e.height):e instanceof ImageData&&s.putImageData(e,0,0),t}var b=s(51530);const H=()=>u.A.getLogger("esri.geometry.support.meshUtils.exporters.gltf.gltf");class x{constructor(e,t){this.options=t,this._materialMap=new Array,this._imageMap=new Map,this._textureMap=new Map,this.gltf={asset:{version:"2.0",copyright:e.copyright,generator:e.generator},extras:{output:t.output,binChunkBuffer:null,promises:[]}},this._addScenes(e)}_addScenes(e){this.gltf.scene=e.defaultScene;const t=this.gltf.extras,s=t.output.buffer===E.GLB||t.output.image===a.GLB;s&&(t.binChunkBuffer=new D(this.gltf)),e.forEachScene((e=>{this._addScene(e)})),s&&t.binChunkBuffer.finalize()}_addScene(e){this.gltf.scenes||(this.gltf.scenes=[]);const t={};e.name&&(t.name=e.name),e.forEachNode((e=>{t.nodes||(t.nodes=[]),t.nodes.push(...this._addNodes(e))})),this.gltf.scenes.push(t)}_addNodes(e){this.gltf.nodes||(this.gltf.nodes=[]);const t={};e.name&&(t.name=e.name);const s=e.translation;(0,S.e)(s,C.uY)||(t.translation=(0,C.o8)(s));const n=e.rotation;(0,l.t2)(n,O.zK)||(t.rotation=(0,O.o8)(n));const i=e.scale;(0,S.e)(i,C.Un)||(t.scale=(0,C.o8)(i));const r=this.gltf.nodes.length;if(this.gltf.nodes.push(t),e.mesh&&e.mesh.vertexAttributes.position){const s=this._createMeshes(e.mesh),n=[r];if(1===s.length)this._addMesh(t,s[0]);else for(const e of s){const t={};this._addMesh(t,e),n.push(this.gltf.nodes.length),this.gltf.nodes.push(t)}return n}return e.forEachNode((e=>{t.children||(t.children=[]),t.children.push(...this._addNodes(e))})),[r]}_addMesh(e,t){this.gltf.meshes??=[];const s=this.gltf.meshes.length;this.gltf.meshes.push(t),e.mesh=s}_createMeshes(e){const t=this.gltf.extras,s=t.output.buffer===E.GLB;let n;n=s?t.binChunkBuffer:new D(this.gltf);const i=this.options.origin,r=e.vertexSpace.clone();r.origin=[i.x,i.y,i.z??0];const _=(0,L.UR)({vertexAttributes:e.vertexAttributes,vertexSpace:e.vertexSpace,transform:this.options?.ignoreLocalTransform?null:e.transform,spatialReference:e.spatialReference},r,{targetUnit:"meters"});if(!_)return[];(function(e,t){if(e.components)for(const s of e.components)s.faces&&"smooth"===s.shading&&p(s,t)})(e,_),y(_);const{position:a,normal:A,tangent:R}=_,{uv:c,color:N}=e.vertexAttributes,u=n.addBufferView(d.pe.FLOAT,T.VEC3,o.ARRAY_BUFFER);let f,h,l,O;A&&(f=n.addBufferView(d.pe.FLOAT,T.VEC3,o.ARRAY_BUFFER)),c&&(h=n.addBufferView(d.pe.FLOAT,T.VEC2,o.ARRAY_BUFFER)),R&&(l=n.addBufferView(d.pe.FLOAT,T.VEC4,o.ARRAY_BUFFER)),N&&(O=n.addBufferView(d.pe.UNSIGNED_BYTE,T.VEC4,o.ARRAY_BUFFER)),u.startAccessor("POSITION"),f&&f.startAccessor("NORMAL"),h&&h.startAccessor("TEXCOORD_0"),l&&l.startAccessor("TANGENT"),O&&O.startAccessor("COLOR_0");const S=_.position.length/3;for(let e=0;e<S;++e)u.push(a[3*e]),u.push(a[3*e+1]),u.push(a[3*e+2]),f&&null!=A&&(f.push(A[3*e]),f.push(A[3*e+1]),f.push(A[3*e+2])),h&&null!=c&&(h.push(c[2*e]),h.push(c[2*e+1])),l&&null!=R&&(l.push(R[4*e]),l.push(R[4*e+1]),l.push(R[4*e+2]),l.push(R[4*e+3])),O&&null!=N&&(O.push(N[4*e]),O.push(N[4*e+1]),O.push(N[4*e+2]),O.push(N[4*e+3]));const C=u.endAccessor(),I=this._addAccessor(u.index,C);let M,U,B,m,G;if(f){const e=f.endAccessor();M=this._addAccessor(f.index,e)}if(h){const e=h.endAccessor();U=this._addAccessor(h.index,e)}if(l){const e=l.endAccessor();B=this._addAccessor(l.index,e)}if(O){const e=O.endAccessor();m=this._addAccessor(O.index,e)}const P=[];return e.components&&e.components.length>0&&e.components[0].faces?(G=n.addBufferView(d.pe.UNSIGNED_INT,T.SCALAR,o.ELEMENT_ARRAY_BUFFER),this._addMeshVertexIndexed(G,e.components,P,I,M,U,B,m)):this._addMeshVertexNonIndexed(e.components,P,I,M,U,B,m),u.finalize(),f&&f.finalize(),h&&h.finalize(),l&&l.finalize(),G&&G.finalize(),O&&O.finalize(),s||n.finalize(),P}_addMaterial(e){if(null===e)return;const t=this._materialMap.indexOf(e);if(-1!==t)return t;this.gltf.materials||(this.gltf.materials=[]);const s={};switch(e.alphaMode){case"mask":s.alphaMode=R.MASK;break;case"auto":case"blend":s.alphaMode=R.BLEND}.5!==e.alphaCutoff&&(s.alphaCutoff=e.alphaCutoff),e.doubleSided&&(s.doubleSided=e.doubleSided),s.pbrMetallicRoughness={};const n=e=>e**2.1,i=e=>{const t=e.toRgba();return t[0]=n(t[0]/255),t[1]=n(t[1]/255),t[2]=n(t[2]/255),t};if(null!=e.color&&(s.pbrMetallicRoughness.baseColorFactor=i(e.color)),null!=e.colorTexture&&(s.pbrMetallicRoughness.baseColorTexture=this._createTextureInfo(e.colorTexture,e.colorTextureTransform)),null!=e.normalTexture&&(s.normalTexture=this._createTextureInfo(e.normalTexture,e.normalTextureTransform)),e instanceof I.A){if(null!=e.emissiveTexture&&(s.emissiveTexture=this._createTextureInfo(e.emissiveTexture,e.emissiveTextureTransform)),null!=e.emissiveColor){const t=i(e.emissiveColor);s.emissiveFactor=[t[0],t[1],t[2]]}null!=e.occlusionTexture&&(s.occlusionTexture=this._createTextureInfo(e.occlusionTexture,e.occlusionTextureTransform)),null!=e.metallicRoughnessTexture&&(s.pbrMetallicRoughness.metallicRoughnessTexture=this._createTextureInfo(e.metallicRoughnessTexture,e.metallicRoughnessTextureTransform)),s.pbrMetallicRoughness.metallicFactor=e.metallic,s.pbrMetallicRoughness.roughnessFactor=e.roughness}else s.pbrMetallicRoughness.metallicFactor=1,s.pbrMetallicRoughness.roughnessFactor=1,H().warnOnce("Meshes exported to GLTF without MeshMaterialMetallicRoughness material will appear different when imported back.");const r=this.gltf.materials.length;return this.gltf.materials.push(s),this._materialMap.push(e),r}_createTextureInfo(e,t){const s={index:this._addTexture(e)};return t?(s.extensions||(s.extensions={}),s.extensions.KHR_texture_transform={scale:t.scale,offset:t.offset,rotation:(0,h.kU)(t.rotation)},s):s}_addTexture(e){const t=this.gltf.textures??[];return this.gltf.textures=t,(0,f.tE)(this._textureMap,e,(()=>{const s={sampler:this._addSampler(e),source:this._addImage(e)},n=t.length;return t.push(s),n}))}_addImage(e){const t=this._imageMap.get(e);if(null!=t)return t;this.gltf.images||(this.gltf.images=[]);const s={};if(e.url)s.uri=e.url;else{const t=e.data;s.extras=t;for(let e=0;e<this.gltf.images.length;++e)if(t===this.gltf.images[e].extras)return e;const n=this.gltf.extras;switch(n.output.image){case a.GLB:{const e=n.binChunkBuffer.addBufferView(d.pe.UNSIGNED_BYTE,T.SCALAR);if((0,b.x3)(t))null!=t.data&&e.writeOutToBuffer(t.data,0);else{const i=F(t,this.options.signal).then((({data:e,type:t})=>(s.mimeType=t,e)));n.promises.push(e.writeAsync(i).then((()=>{e.finalize()})))}s.bufferView=e.index;break}case a.DataURI:if((0,b.x3)(t)){H().warnOnce("Image export for basis compressed textures not available.");break}s.uri=function(e){const t=w(e);return null!=t?t.toDataURL():""}(t);break;default:if((0,b.x3)(t)){H().warnOnce("Image export for basis compressed textures not available.");break}n.promises.push(F(t,this.options.signal).then((({data:e,type:t})=>{s.uri=e,s.mimeType=t})))}}const n=this.gltf.images.length;return this.gltf.images.push(s),this._imageMap.set(e,n),n}_addSampler(e){this.gltf.samplers||(this.gltf.samplers=[]);let t=d.pF.REPEAT,s=d.pF.REPEAT;if("string"==typeof e.wrap)switch(e.wrap){case"clamp":t=d.pF.CLAMP_TO_EDGE,s=d.pF.CLAMP_TO_EDGE;break;case"mirror":t=d.pF.MIRRORED_REPEAT,s=d.pF.MIRRORED_REPEAT}else{switch(e.wrap.vertical){case"clamp":s=d.pF.CLAMP_TO_EDGE;break;case"mirror":s=d.pF.MIRRORED_REPEAT}switch(e.wrap.horizontal){case"clamp":t=d.pF.CLAMP_TO_EDGE;break;case"mirror":t=d.pF.MIRRORED_REPEAT}}const n={wrapS:t,wrapT:s};for(let e=0;e<this.gltf.samplers.length;++e)if(JSON.stringify(n)===JSON.stringify(this.gltf.samplers[e]))return e;const i=this.gltf.samplers.length;return this.gltf.samplers.push(n),i}_addAccessor(e,t){this.gltf.accessors||(this.gltf.accessors=[]);const s={bufferView:e,byteOffset:t.byteOffset,componentType:t.componentType,count:t.count,type:t.type,min:t.min,max:t.max,name:t.name};t.normalized&&(s.normalized=!0);const n=this.gltf.accessors.length;return this.gltf.accessors.push(s),n}_addMeshVertexIndexed(e,t,s,n,i,r,_,E){const a=new Map;for(const o of t){e.startAccessor("INDICES");for(let t=0;t<o.faces.length;++t)e.push(o.faces[t]);const t=e.endAccessor(),T={attributes:{POSITION:n},indices:this._addAccessor(e.index,t),material:this._addMaterial(o.material)};i&&"flat"!==o.shading&&(T.attributes.NORMAL=i),r&&(T.attributes.TEXCOORD_0=r),_&&"flat"!==o.shading&&(T.attributes.TANGENT=_),E&&(T.attributes.COLOR_0=E);const A=a.get(o.name);if(A)A.primitives.push(T);else{const e={name:o.name,primitives:[T]};a.set(o.name,e),s.push(e)}}}_addMeshVertexNonIndexed(e,t,s,n,i,r,_){const E={primitives:[]};t.push(E);const a={attributes:{POSITION:s}};n&&(a.attributes.NORMAL=n),i&&(a.attributes.TEXCOORD_0=i),r&&(a.attributes.TANGENT=r),_&&(a.attributes.COLOR_0=_),e&&(a.material=this._addMaterial(e[0].material)),E.primitives.push(a)}}function y({position:e,normal:t,tangent:s}){V(e,3),V(t,3),V(s,4)}function V(e,t){if(null!=e)for(let s=1,n=2;s<e.length;s+=t,n+=t){const t=e[s],i=e[n];e[s]=i,e[n]=-t}}var Y=s(4576);class v{constructor(){this.copyright="",this.defaultScene=0,this.generator="",this._scenes=[]}addScene(e){if(this._scenes.includes(e))throw new Error("Scene already added");this._scenes.push(e)}removeScene(e){(0,Y.TF)(this._scenes,e)}forEachScene(e){this._scenes.forEach(e)}}class z{constructor(e){this.mesh=e,this.name="",this.translation=(0,C.vt)(),this.rotation=(0,O.vt)(),this.scale=(0,C.o8)(C.Un),this._nodes=[]}addNode(e){if(this._nodes.includes(e))throw new Error("Node already added");this._nodes.push(e)}forEachNode(e){this._nodes.forEach(e)}set rotationAngles(e){(0,l.A6)(this.rotation,e[0],e[1],e[2])}}const X="model.gltf",k="model.glb";async function W(e,t){const s=new x(e,t).gltf,n=s.extras.promises;let _=1,o=1,T=null;await Promise.allSettled(n),(0,i.Te)(t.signal);const A=t.jsonSpacing??4,R=new Map,c=JSON.stringify(s,((e,s)=>{if("extras"!==e){if(s instanceof ArrayBuffer){if(function(e){if(e.byteLength<8)return!1;const t=new Uint8Array(e);return 137===t[0]&&80===t[1]&&78===t[2]&&71===t[3]&&13===t[4]&&10===t[5]&&26===t[6]&&10===t[7]}(s))switch(t.output?.image){case a.DataURI:case a.GLB:break;case a.External:default:{const e=`img${o}.png`;return o++,R.set(e,s),e}}switch(t.output?.buffer){case E.DataURI:return function(e){const t=[],s=new Uint8Array(e);for(let e=0;e<s.length;e++)t.push(String.fromCharCode(s[e]));return"data:application/octet-stream;base64,"+btoa(t.join(""))}(s);case E.GLB:if(T)throw new Error("Already encountered an ArrayBuffer, there should only be one in the GLB format.");return void(T=s);case E.External:default:{const e=`data${_}.bin`;return _++,R.set(e,s),e}}}return s}}),A);return t.output?.buffer===E.GLB||t.output?.image===a.GLB?R.set(k,new r(c,T).buffer):R.set(X,c),R}class K{constructor(){this.name="",this._nodes=[]}addNode(e){if(this._nodes.includes(e))throw new Error("Node already added");this._nodes.push(e)}forEachNode(e){this._nodes.forEach(e)}}async function j(e,t){const s=new v,n=new K;return s.addScene(n),n.addNode(new z(e)),await async function(e,t){const s=(await W(e,{output:{buffer:E.GLB,image:a.GLB},jsonSpacing:0,...t})).get(k);if(!(s&&s instanceof ArrayBuffer))throw new Error("failed to export to glb");return s}(s,{origin:e.origin,...t})}},51530:(e,t,s)=>{s.d(t,{KB:()=>E,Xi:()=>r,pn:()=>a,x3:()=>_});var n=s(44208),i=s(89192);class r{constructor(e){this.data=e,this.type="encoded-mesh-texture",this.encoding=i.JS.KTX2_ENCODING}}function _(e){return"encoded-mesh-texture"===e?.type}async function E(e){const t=new Blob([e]),s=await t.text();return JSON.parse(s)}async function a(e,t){if(t===i.JS.KTX2_ENCODING)return new r(e);const s=new Blob([e],{type:t}),_=URL.createObjectURL(s),E=new Image;if((0,n.A)("esri-iPhone"))return new Promise(((e,t)=>{const s=()=>{i(),e(E)},n=e=>{i(),t(e)},i=()=>{URL.revokeObjectURL(_),E.removeEventListener("load",s),E.removeEventListener("error",n)};E.addEventListener("load",s),E.addEventListener("error",n),E.src=_}));try{E.src=_,await E.decode()}catch(e){console.warn("Failed decoding HTMLImageElement")}return URL.revokeObjectURL(_),E}},89192:(e,t,s)=>{var n,i,r,_,E,a,o,T,A;s.d(t,{Am:()=>_,C7:()=>r,ID:()=>T,JS:()=>A,Mg:()=>a,dd:()=>E,it:()=>i,s2:()=>n,sf:()=>o}),function(e){e[e.None=0]="None",e[e.Front=1]="Front",e[e.Back=2]="Back",e[e.COUNT=3]="COUNT"}(n||(n={})),function(e){e[e.Less=0]="Less",e[e.Lequal=1]="Lequal",e[e.COUNT=2]="COUNT"}(i||(i={})),function(e){e[e.BACKGROUND=0]="BACKGROUND",e[e.UPDATE=1]="UPDATE"}(r||(r={})),function(e){e[e.NOT_LOADED=0]="NOT_LOADED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED"}(_||(_={})),function(e){e[e.IntegratedMeshMaskExcluded=1]="IntegratedMeshMaskExcluded",e[e.OutlineVisualElementMask=2]="OutlineVisualElementMask"}(E||(E={})),function(e){e[e.Highlight=0]="Highlight",e[e.MaskOccludee=1]="MaskOccludee",e[e.COUNT=2]="COUNT"}(a||(a={})),function(e){e[e.Blend=0]="Blend",e[e.Opaque=1]="Opaque",e[e.Mask=2]="Mask",e[e.MaskBlend=3]="MaskBlend",e[e.COUNT=4]="COUNT"}(o||(o={})),function(e){e[e.OFF=0]="OFF",e[e.ON=1]="ON"}(T||(T={})),function(e){e.DDS_ENCODING="image/vnd-ms.dds",e.KTX2_ENCODING="image/ktx2",e.BASIS_ENCODING="image/x.basis"}(A||(A={}))},63907:(e,t,s)=>{var n,i,r,_,E,a,o,T,A,R,c,N,u,f,h,l,O,S,C,I,L,d,M;s.d(t,{Ab:()=>f,Ac:()=>o,Ap:()=>u,CQ:()=>p,Cj:()=>c,Co:()=>C,H0:()=>h,Hr:()=>M,MT:()=>A,NZ:()=>E,Nm:()=>d,R:()=>I,Tb:()=>_,WR:()=>i,Y7:()=>a,_U:()=>S,dn:()=>r,eA:()=>R,hn:()=>n,ld:()=>l,nI:()=>D,pF:()=>N,pe:()=>T,vt:()=>L,yQ:()=>O}),function(e){e[e.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",e[e.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",e[e.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT"}(n||(n={})),function(e){e[e.POINTS=0]="POINTS",e[e.LINES=1]="LINES",e[e.LINE_LOOP=2]="LINE_LOOP",e[e.LINE_STRIP=3]="LINE_STRIP",e[e.TRIANGLES=4]="TRIANGLES",e[e.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",e[e.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(i||(i={})),function(e){e[e.ZERO=0]="ZERO",e[e.ONE=1]="ONE",e[e.SRC_COLOR=768]="SRC_COLOR",e[e.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",e[e.SRC_ALPHA=770]="SRC_ALPHA",e[e.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",e[e.DST_ALPHA=772]="DST_ALPHA",e[e.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",e[e.DST_COLOR=774]="DST_COLOR",e[e.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",e[e.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",e[e.CONSTANT_COLOR=32769]="CONSTANT_COLOR",e[e.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",e[e.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",e[e.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA"}(r||(r={})),function(e){e[e.ADD=32774]="ADD",e[e.MIN=32775]="MIN",e[e.MAX=32776]="MAX",e[e.SUBTRACT=32778]="SUBTRACT",e[e.REVERSE_SUBTRACT=32779]="REVERSE_SUBTRACT"}(_||(_={})),function(e){e[e.ARRAY_BUFFER=34962]="ARRAY_BUFFER",e[e.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",e[e.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",e[e.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",e[e.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",e[e.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",e[e.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER",e[e.TRANSFORM_FEEDBACK_BUFFER=35982]="TRANSFORM_FEEDBACK_BUFFER"}(E||(E={})),function(e){e[e.FRONT=1028]="FRONT",e[e.BACK=1029]="BACK",e[e.FRONT_AND_BACK=1032]="FRONT_AND_BACK"}(a||(a={})),function(e){e[e.CW=2304]="CW",e[e.CCW=2305]="CCW"}(o||(o={})),function(e){e[e.BYTE=5120]="BYTE",e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.SHORT=5122]="SHORT",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.INT=5124]="INT",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.FLOAT=5126]="FLOAT",e[e.HALF_FLOAT=5131]="HALF_FLOAT"}(T||(T={})),function(e){e[e.NEVER=512]="NEVER",e[e.LESS=513]="LESS",e[e.EQUAL=514]="EQUAL",e[e.LEQUAL=515]="LEQUAL",e[e.GREATER=516]="GREATER",e[e.NOTEQUAL=517]="NOTEQUAL",e[e.GEQUAL=518]="GEQUAL",e[e.ALWAYS=519]="ALWAYS"}(A||(A={})),function(e){e[e.ZERO=0]="ZERO",e[e.KEEP=7680]="KEEP",e[e.REPLACE=7681]="REPLACE",e[e.INCR=7682]="INCR",e[e.DECR=7683]="DECR",e[e.INVERT=5386]="INVERT",e[e.INCR_WRAP=34055]="INCR_WRAP",e[e.DECR_WRAP=34056]="DECR_WRAP"}(R||(R={})),function(e){e[e.NEAREST=9728]="NEAREST",e[e.LINEAR=9729]="LINEAR",e[e.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",e[e.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",e[e.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",e[e.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR"}(c||(c={})),function(e){e[e.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",e[e.REPEAT=10497]="REPEAT",e[e.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"}(N||(N={})),function(e){e[e.TEXTURE_2D=3553]="TEXTURE_2D",e[e.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",e[e.TEXTURE_3D=32879]="TEXTURE_3D",e[e.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",e[e.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",e[e.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",e[e.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",e[e.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY"}(u||(u={})),function(e){e[e.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",e[e.DEPTH_STENCIL=34041]="DEPTH_STENCIL",e[e.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",e[e.ALPHA=6406]="ALPHA",e[e.RGB=6407]="RGB",e[e.RGBA=6408]="RGBA",e[e.LUMINANCE=6409]="LUMINANCE",e[e.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",e[e.RED=6403]="RED",e[e.RG=33319]="RG",e[e.RED_INTEGER=36244]="RED_INTEGER",e[e.RG_INTEGER=33320]="RG_INTEGER",e[e.RGB_INTEGER=36248]="RGB_INTEGER",e[e.RGBA_INTEGER=36249]="RGBA_INTEGER"}(f||(f={})),function(e){e[e.RGBA4=32854]="RGBA4",e[e.R16F=33325]="R16F",e[e.RG16F=33327]="RG16F",e[e.RGB32F=34837]="RGB32F",e[e.RGBA16F=34842]="RGBA16F",e[e.R32F=33326]="R32F",e[e.RG32F=33328]="RG32F",e[e.RGBA32F=34836]="RGBA32F",e[e.R11F_G11F_B10F=35898]="R11F_G11F_B10F",e[e.RGB8=32849]="RGB8",e[e.RGBA8=32856]="RGBA8",e[e.RGB5_A1=32855]="RGB5_A1",e[e.R8=33321]="R8",e[e.RG8=33323]="RG8",e[e.R8I=33329]="R8I",e[e.R8UI=33330]="R8UI",e[e.R16I=33331]="R16I",e[e.R16UI=33332]="R16UI",e[e.R32I=33333]="R32I",e[e.R32UI=33334]="R32UI",e[e.RG8I=33335]="RG8I",e[e.RG8UI=33336]="RG8UI",e[e.RG16I=33337]="RG16I",e[e.RG16UI=33338]="RG16UI",e[e.RG32I=33339]="RG32I",e[e.RG32UI=33340]="RG32UI",e[e.RGB16F=34843]="RGB16F",e[e.RGB9_E5=35901]="RGB9_E5",e[e.SRGB8=35905]="SRGB8",e[e.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",e[e.RGB565=36194]="RGB565",e[e.RGBA32UI=36208]="RGBA32UI",e[e.RGB32UI=36209]="RGB32UI",e[e.RGBA16UI=36214]="RGBA16UI",e[e.RGB16UI=36215]="RGB16UI",e[e.RGBA8UI=36220]="RGBA8UI",e[e.RGB8UI=36221]="RGB8UI",e[e.RGBA32I=36226]="RGBA32I",e[e.RGB32I=36227]="RGB32I",e[e.RGBA16I=36232]="RGBA16I",e[e.RGB16I=36233]="RGB16I",e[e.RGBA8I=36238]="RGBA8I",e[e.RGB8I=36239]="RGB8I",e[e.R8_SNORM=36756]="R8_SNORM",e[e.RG8_SNORM=36757]="RG8_SNORM",e[e.RGB8_SNORM=36758]="RGB8_SNORM",e[e.RGBA8_SNORM=36759]="RGBA8_SNORM",e[e.RGB10_A2=32857]="RGB10_A2",e[e.RGB10_A2UI=36975]="RGB10_A2UI"}(h||(h={})),function(e){e[e.FLOAT=5126]="FLOAT",e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",e[e.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",e[e.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",e[e.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",e[e.BYTE=5120]="BYTE",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.SHORT=5122]="SHORT",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.INT=5124]="INT",e[e.HALF_FLOAT=5131]="HALF_FLOAT",e[e.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",e[e.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",e[e.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",e[e.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV"}(l||(l={})),function(e){e[e.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",e[e.STENCIL_INDEX8=36168]="STENCIL_INDEX8",e[e.DEPTH_STENCIL=34041]="DEPTH_STENCIL",e[e.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",e[e.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F",e[e.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",e[e.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8"}(O||(O={})),function(e){e[e.STATIC_DRAW=35044]="STATIC_DRAW",e[e.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",e[e.STREAM_DRAW=35040]="STREAM_DRAW",e[e.STATIC_READ=35045]="STATIC_READ",e[e.DYNAMIC_READ=35049]="DYNAMIC_READ",e[e.STREAM_READ=35041]="STREAM_READ",e[e.STATIC_COPY=35046]="STATIC_COPY",e[e.DYNAMIC_COPY=35050]="DYNAMIC_COPY",e[e.STREAM_COPY=35042]="STREAM_COPY"}(S||(S={})),function(e){e[e.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",e[e.VERTEX_SHADER=35633]="VERTEX_SHADER"}(C||(C={})),function(e){e[e.FRAMEBUFFER=36160]="FRAMEBUFFER",e[e.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",e[e.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER"}(I||(I={})),function(e){e[e.Texture=0]="Texture",e[e.BufferObject=1]="BufferObject",e[e.VertexArrayObject=2]="VertexArrayObject",e[e.Shader=3]="Shader",e[e.Program=4]="Program",e[e.FramebufferObject=5]="FramebufferObject",e[e.Renderbuffer=6]="Renderbuffer",e[e.TransformFeedback=7]="TransformFeedback",e[e.Sync=8]="Sync",e[e.UNCOUNTED=9]="UNCOUNTED",e[e.LinesOfCode=9]="LinesOfCode",e[e.Uniform=10]="Uniform",e[e.COUNT=11]="COUNT"}(L||(L={})),function(e){e[e.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",e[e.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",e[e.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",e[e.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",e[e.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",e[e.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",e[e.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",e[e.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",e[e.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",e[e.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",e[e.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",e[e.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",e[e.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",e[e.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",e[e.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",e[e.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15"}(d||(d={})),function(e){e[e.NONE=0]="NONE",e[e.BACK=1029]="BACK"}(M||(M={}));const D=33306;var p,U,B,m,G,P,g;!function(e){e[e.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",e[e.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",e[e.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",e[e.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",e[e.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",e[e.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",e[e.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",e[e.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",e[e.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC"}(p||(p={})),function(e){e[e.FLOAT=5126]="FLOAT",e[e.FLOAT_VEC2=35664]="FLOAT_VEC2",e[e.FLOAT_VEC3=35665]="FLOAT_VEC3",e[e.FLOAT_VEC4=35666]="FLOAT_VEC4",e[e.INT=5124]="INT",e[e.INT_VEC2=35667]="INT_VEC2",e[e.INT_VEC3=35668]="INT_VEC3",e[e.INT_VEC4=35669]="INT_VEC4",e[e.BOOL=35670]="BOOL",e[e.BOOL_VEC2=35671]="BOOL_VEC2",e[e.BOOL_VEC3=35672]="BOOL_VEC3",e[e.BOOL_VEC4=35673]="BOOL_VEC4",e[e.FLOAT_MAT2=35674]="FLOAT_MAT2",e[e.FLOAT_MAT3=35675]="FLOAT_MAT3",e[e.FLOAT_MAT4=35676]="FLOAT_MAT4",e[e.SAMPLER_2D=35678]="SAMPLER_2D",e[e.SAMPLER_CUBE=35680]="SAMPLER_CUBE",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",e[e.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",e[e.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",e[e.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",e[e.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",e[e.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",e[e.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",e[e.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",e[e.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",e[e.SAMPLER_3D=35679]="SAMPLER_3D",e[e.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",e[e.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",e[e.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",e[e.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",e[e.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",e[e.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",e[e.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",e[e.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",e[e.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",e[e.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",e[e.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",e[e.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY"}(U||(U={})),function(e){e[e.OBJECT_TYPE=37138]="OBJECT_TYPE",e[e.SYNC_CONDITION=37139]="SYNC_CONDITION",e[e.SYNC_STATUS=37140]="SYNC_STATUS",e[e.SYNC_FLAGS=37141]="SYNC_FLAGS"}(B||(B={})),function(e){e[e.UNSIGNALED=37144]="UNSIGNALED",e[e.SIGNALED=37145]="SIGNALED"}(m||(m={})),function(e){e[e.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",e[e.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",e[e.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",e[e.WAIT_FAILED=37149]="WAIT_FAILED"}(G||(G={})),function(e){e[e.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE"}(P||(P={})),function(e){e[e.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT"}(g||(g={}))}}]);
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{DiscardOrAdjustAlphaBlend as a}from"./DiscardOrAdjustAlphaBlend.glsl.js";import{FloatDrawUniform as e}from"../../shaderModules/FloatDrawUniform.js";import{FloatPassUniform as r}from"../../shaderModules/FloatPassUniform.js";import{glsl as o}from"../../shaderModules/interfaces.js";import{AlphaDiscardMode as d}from"../../../lib/basicInterfaces.js";function s(a,e){l(a,e,new r("textureAlphaCutoff",(a=>a.textureAlphaCutoff)))}function t(a,r){l(a,r,new e("textureAlphaCutoff",(a=>a.textureAlphaCutoff)))}function l(e,r,s){const t=e.fragment;switch(r.alphaDiscardMode!==d.Mask&&r.alphaDiscardMode!==d.MaskBlend||t.uniforms.add(s),r.alphaDiscardMode){case d.Blend:return e.include(a);case d.Opaque:t.code.add(o`void discardOrAdjustAlpha(inout vec4 color) {
|
|
6
|
-
color.a = 1.0;
|
|
7
|
-
}`);break;case d.Mask:t.code.add(o`#define discardOrAdjustAlpha(color) { if (color.a < textureAlphaCutoff) { discard; } else { color.a = 1.0; } }`);break;case d.MaskBlend:e.fragment.code.add(o`#define discardOrAdjustAlpha(color) { if (color.a < textureAlphaCutoff) { discard; } }`)}}export{t as DiscardOrAdjustAlphaDraw,s as DiscardOrAdjustAlphaPass};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{alphaCutoff as o}from"./AlphaCutoff.js";import{glsl as r}from"../../shaderModules/interfaces.js";function d(d){d.fragment.code.add(r`
|
|
6
|
-
#define discardOrAdjustAlpha(color) { if (color.a < ${r.float(o)}) { discard; } }
|
|
7
|
-
`)}export{d as DiscardOrAdjustAlphaBlend};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{releaseMaybe as t}from"../../../../core/maybe.js";import{c as r}from"../../../../chunks/vec42.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{DepthFormat as o}from"../../webgl/formats.js";import{ClearBufferBit as i}from"../../../webgl/enums.js";class s{constructor(t){this._rctx=t,this._clearColor=e()}dispose(){this._color=t(this._color),this.release()}initialize(t,e,i){this._acquireColor=()=>t.acquire(e.width,e.height,"composite-color"),this._acquireDepth=()=>t.acquireDepth(o.DEPTH_STENCIL_TEXTURE,e.width,e.height,"depth");const s=this._color;return this._color=null,this.release(),r(this._clearColor,i),s}release(){this._color?.detachDepth(),this._depth=t(this._depth)}updateDepthDetached(t){this._bindTarget(this.color),t(),this._bindTarget(this.color,this.depth)}update(t){const r=this._ensureColor();r.attachDepth(this.depth),this._color=t(r)}bind(){const t=null==this._color;if(this._bindTarget(this.color,this.depth),t){const t=this._rctx;t.setClearStencil(0),t.setClearColor(this._clearColor[0],this._clearColor[1],this._clearColor[2],this._clearColor[3]),t.clear(i.COLOR_BUFFER_BIT|i.DEPTH_BUFFER_BIT|i.STENCIL_BUFFER_BIT)}}_bindTarget(t,r){t.attachDepth(r),this._rctx.bindFramebuffer(t.fbo)}get color(){return this._ensureColor()}get depth(){return this._depth??=this._acquireDepth(),this._depth}_ensureColor(){return this._color??=this._acquireColor(),this._color}}export{s as MainColor};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
-
*/
|
|
5
|
-
import{glsl as e}from"../../../core/shaderModules/interfaces.js";function o(o){const r=o.fragment;r.constants.add("coverageTestThreshold","float",.01),r.code.add(e`#define discardByCoverage(radius, coverage) { if (coverage < coverageTestThreshold) discard; }`)}export{o as DiscardByCoverage};
|