@arcgis/core 4.31.0-next.20240708 → 4.31.0-next.20240709
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/{0975e54c50383375cc09.js → 14cf7411e8318a1bccb9.js} +1 -1
- package/assets/esri/core/workers/chunks/{71852b8437ec66b9ef06.js → 2123ab24163a532ebc8d.js} +1 -1
- package/assets/esri/core/workers/chunks/{c91b3800cf3891bf2d59.js → 252ff37bf5e12dae0b18.js} +1 -1
- package/assets/esri/core/workers/chunks/2799007b5f3f4a2e364c.js +51 -0
- package/assets/esri/core/workers/chunks/{ff5e6d823d512f87a527.js → 2dddb8a989b9c96572fe.js} +1 -1
- package/assets/esri/core/workers/chunks/3375de864347a847393d.js +1042 -0
- package/assets/esri/core/workers/chunks/543f9db420c99d429637.js +1 -0
- package/assets/esri/core/workers/chunks/{812e18c65aa6e398c338.js → 5b6c89dc41067d81c952.js} +1 -1
- package/assets/esri/core/workers/chunks/{5089a12084a8a8fb93d8.js → 61e5179fb49866241128.js} +1 -1
- package/assets/esri/core/workers/chunks/632e3ba2b8a881df29a0.js +1 -0
- package/assets/esri/core/workers/chunks/{1cc4a89c96a36d6b3d52.js → 7767559d56d16b644655.js} +1 -1
- package/assets/esri/core/workers/chunks/{43e83f4d827f59ff556a.js → 8087288f00dfdcc479b9.js} +1 -1
- package/assets/esri/core/workers/chunks/{a5fbe1c95e49093e5af4.js → 8cce4b218568638e6e64.js} +1 -1
- package/assets/esri/core/workers/chunks/{c7e2a97cb7bcd153bcef.js → 8e326def543268f8a08e.js} +1 -1
- package/assets/esri/core/workers/chunks/92cb45b18e151db007dc.js +1 -0
- package/assets/esri/core/workers/chunks/b2e8cc76381077b78d4c.js +1 -0
- package/assets/esri/core/workers/chunks/b6a8132708afcd988fa9.js +1 -0
- package/assets/esri/core/workers/chunks/{b4d850e82a8ae902d684.js → c44cc686774ff53c0a94.js} +1 -1
- package/assets/esri/core/workers/chunks/c52701477405c1fb2072.js +1 -0
- package/assets/esri/core/workers/chunks/{9ed11b9202013ca001ee.js → cfc2a1858a8bbb284979.js} +2 -2
- package/assets/esri/core/workers/chunks/{9ed11b9202013ca001ee.js.LICENSE.txt → cfc2a1858a8bbb284979.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/d9863289c69d2550cd49.js +1 -0
- package/assets/esri/core/workers/chunks/e1f4df3a5b0b31521b3c.js +1 -0
- package/assets/esri/core/workers/chunks/{61505947371cebab9cbe.js → fdebfe55cd097714ec11.js} +1 -1
- package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +13 -18
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/AtmosphereCompositing.glsl.js +6 -9
- package/chunks/BlendLayers.glsl.js +1 -7
- package/chunks/BlendWeights.glsl.js +45 -51
- package/chunks/Blur.glsl.js +1 -3
- package/chunks/ChapmanAtmosphere.glsl.js +3 -8
- package/chunks/CheckerBoard.glsl.js +3 -9
- package/chunks/Clouds.glsl.js +21 -10
- package/chunks/CloudsComposition.glsl.js +3 -7
- package/chunks/ColorMaterial.glsl.js +3 -9
- package/chunks/ComponentShader.glsl.js +35 -50
- package/chunks/Compositing.glsl.js +5 -7
- package/chunks/DefaultMaterial.glsl.js +68 -73
- package/chunks/EdgeDetect.glsl.js +5 -10
- package/chunks/EdgeShader.glsl.js +37 -60
- package/chunks/Fog.glsl.js +4 -9
- package/chunks/HUDCompositing.glsl.js +1 -3
- package/chunks/HUDMaterial.glsl.js +8 -14
- package/chunks/Heatmap.glsl.js +4 -7
- package/chunks/HeatmapDensity.glsl.js +5 -11
- package/chunks/HighlightApply.glsl.js +133 -152
- package/chunks/HighlightDownsample.glsl.js +29 -32
- package/chunks/ImageMaterial.glsl.js +11 -21
- package/chunks/LaserlinePath.glsl.js +4 -9
- package/chunks/LineCallout.glsl.js +91 -108
- package/chunks/LineMarker.glsl.js +2 -8
- package/chunks/Magnifier.glsl.js +4 -9
- package/chunks/MeasurementArrow.glsl.js +9 -15
- package/chunks/NativeLine.glsl.js +8 -12
- package/chunks/NoiseTextureAtlas.glsl.js +89 -86
- package/chunks/OITCompositing.glsl.js +2 -3
- package/chunks/OverlayCompositing.glsl.js +2 -4
- package/chunks/Path.glsl.js +31 -55
- package/chunks/Pattern.glsl.js +16 -20
- package/chunks/PointRenderer.glsl.js +39 -48
- package/chunks/Precipitation.glsl.js +15 -27
- package/chunks/RasterColorizer.glsl.js +25 -33
- package/chunks/RealisticTree.glsl.js +53 -65
- package/chunks/SSAO.glsl.js +7 -10
- package/chunks/SSAOBlur.glsl.js +10 -14
- package/chunks/ShadedColorMaterial.glsl.js +12 -15
- package/chunks/ShadowCastAccumulate.glsl.js +2 -4
- package/chunks/ShadowCastVisualize.glsl.js +12 -19
- package/chunks/ShadowHighlight.glsl.js +46 -50
- package/chunks/SimpleAtmosphere.glsl.js +4 -13
- package/chunks/SlicePlaneMaterial.glsl.js +3 -7
- package/chunks/Stars.glsl.js +3 -7
- package/chunks/Terrain.glsl.js +20 -61
- package/chunks/TextureOnly.glsl.js +2 -4
- package/chunks/Viewshed.glsl.js +20 -38
- package/chunks/WaterSurface.glsl.js +34 -60
- package/core/workers/registry.js +1 -1
- package/interfaces.d.ts +34 -4
- package/layers/WCSLayer.js +1 -1
- package/layers/support/SubtypeSublayer.js +1 -1
- package/layers/support/rasterDatasets/WCSRaster.js +1 -1
- package/layers/support/rasterDatasets/multidimensionalUtils.js +1 -1
- package/layers/support/rasterDatasets/wcsCoverageParser.js +1 -1
- package/package.json +3 -3
- package/support/revision.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/ShaderBuilder2D.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/FeatureInstanceStore.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapTechnique.js +1 -1
- package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
- package/views/3d/interactive/editingTools/transform/extentTransform/extentUtils.js +1 -1
- package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
- package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/StreamLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
- package/views/3d/layers/graphics/Graphics3DGraphicsPipeline.js +1 -1
- package/views/3d/layers/graphics/pipeline/Feature3DPipeline.js +5 -0
- package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +5 -0
- package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorkerHandle.js +5 -0
- package/views/3d/layers/graphics/pipeline/PBFPointFeaturesView.js +5 -0
- package/views/3d/layers/graphics/pipeline/TestSymbol.js +5 -0
- package/views/3d/layers/graphics/pipeline/Tile.js +5 -0
- package/views/3d/layers/graphics/pipeline/Tile3DFetcher.js +5 -0
- package/views/3d/layers/graphics/pipeline/Tile3DProcessor.js +5 -0
- package/views/3d/layers/i3s/PointRenderer.js +1 -1
- package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
- package/views/3d/layers/support/projectExtentUtils.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TileCompositor.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js +3 -5
- package/views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +29 -59
- package/views/3d/webgl-engine/core/shaderLibrary/hud/HUDOcclusionPass.glsl.js +6 -12
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceReflections.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/TextureTransformUV.glsl.js +6 -6
- package/views/3d/webgl-engine/core/shaderLibrary/shading/Water.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/TileComposite.glsl.js +2 -4
- package/views/3d/webgl-engine/core/shaderLibrary/util/LocalFromScreenSpace.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderModules/ShaderBuilder.js +1 -1
- package/views/3d/webgl-engine/effects/blit/Blit.js +1 -1
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
- package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
- package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
- package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
- package/views/3d/webgl-engine/lib/DrapedHeatmapRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
- package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/DrawParameters.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/webgl/RenderingContext.js +1 -1
- package/views/webgl/enums.js +1 -1
- package/views/webgl/heatmapTextureUtils.js +1 -1
- package/views/webgl/testSVGPremultipliedAlpha.js +1 -1
- package/widgets/ElevationProfile/ElevationProfileController.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/OrientedImageryViewer/constants.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/assets/esri/core/workers/chunks/0cb2eb96ffb1dbed00eb.js +0 -1
- package/assets/esri/core/workers/chunks/0d6ed27fc9948f4ea061.js +0 -1
- package/assets/esri/core/workers/chunks/225b947ba4b2fcfd5630.js +0 -1
- package/assets/esri/core/workers/chunks/7c7c3068da3bf7467685.js +0 -1
- package/assets/esri/core/workers/chunks/85e5cdd723f68dec8c25.js +0 -1
- package/assets/esri/core/workers/chunks/aed0db145187d9eb52f2.js +0 -51
- package/assets/esri/core/workers/chunks/cf9a32a03b3d3b66effb.js +0 -1
- package/assets/esri/core/workers/chunks/e840e54455eb500b501d.js +0 -1098
- package/assets/esri/core/workers/chunks/fec53ce15ae52f8cb802.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{RenderRequestType as e}from"../../lib/basicInterfaces.js";import{C as r}from"../../../../../chunks/Compositing.glsl.js";import{CompositingTechnique as t}from"../../shaders/CompositingTechnique.js";import{CompositingTechniqueConfiguration as i,AlphaMode as s}from"../../shaders/CompositingTechniqueConfiguration.js";import{
|
|
5
|
+
import{RenderRequestType as e}from"../../lib/basicInterfaces.js";import{C as r}from"../../../../../chunks/Compositing.glsl.js";import{CompositingTechnique as t}from"../../shaders/CompositingTechnique.js";import{CompositingTechniqueConfiguration as i,AlphaMode as s}from"../../shaders/CompositingTechniqueConfiguration.js";import{FramebufferBit as n}from"../../../../webgl/enums.js";class o{constructor(e,n=s.None){this._parameters=new r;const o=new i;o.alphaMode=n,this._technique=e.acquire(t,o)}destroy(){this._technique.release()}render(r,t,i,s,o){return r.bindFramebuffer(i.fbo),r.setClearColor(0,0,0,1),r.clear(n.COLOR),this._technique?.compiled?(this._parameters.texture=t.getTexture(),r.bindTechnique(this._technique,s,this._parameters),r.screen.draw(),i):(o(e.UPDATE),i)}blend(r,t,i,s,n){return r.bindFramebuffer(i.fbo),this._technique?.compiled?(this._parameters.texture=t.getTexture(),r.bindTechnique(this._technique,s,this._parameters),r.screen.draw(),i):(n(e.UPDATE),t)}}export{o as Blit};
|
|
@@ -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{property as r}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators/subclass.js";import{ZEROS as t}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ColorFormat as n}from"../../../webgl/formats.js";import i from"../../../webgl/RenderNode.js";import{alphaCutoff as s}from"../../core/shaderLibrary/util/AlphaCutoff.js";import{glsl as a}from"../../core/shaderModules/interfaces.js";import{Default3D as c}from"../../lib/DefaultVertexAttributeLocations.js";import{
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{property as r}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators/subclass.js";import{ZEROS as t}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ColorFormat as n}from"../../../webgl/formats.js";import i from"../../../webgl/RenderNode.js";import{alphaCutoff as s}from"../../core/shaderLibrary/util/AlphaCutoff.js";import{glsl as a}from"../../core/shaderModules/interfaces.js";import{Default3D as c}from"../../lib/DefaultVertexAttributeLocations.js";import{FramebufferBit as l,ColorAttachment as u,BlendFactor as p,SizedPixelFormat as d,PixelFormat as f,DataType as h}from"../../../../webgl/enums.js";let m=class extends i{constructor(e){super(e),this.destroyedCB=null,this.produces="composite-color",this.consumes={required:["composite-color"]},this.clearColor=t,this._focusedFBOType=0,this._program=new Array}destroy(){this._program.forEach((e=>e.dispose())),this._program.length=0,this.destroyedCB()}render(e){const r=e.find((({name:e})=>"final-color"===e));if(!this._focusedFBO)return r;const o=this.renderingContext;o.bindFramebuffer(r.fbo),o.setClearColor(0,0,0,0),o.clear(l.COLOR);const t=this._ensureShader(o,!1);return o.useProgram(t),o.bindTexture(this._focusedFBO.getTexture(),0),t.setUniform1i("colorTex",0),t.setUniform1i("inputType",this._focusedFBOType),3===this._focusedFBOType&&t.setUniform2fv("nearFar",this.camera.nearFar),o.screen.draw(),r}getReplacingFBO(e,r,o,t,i){r===T.ON&&(t=e.width,i=e.height);const s=this.renderingContext,a=e.depthStencilTexture,c=this._ensureShader(s,null!=a),f=this.fboCache.acquire(t,i,"fbo visualizer"),h=!e.colorTexture?.descriptor.hasMipmap;h&&e.colorTexture?.generateMipmap(),s.useProgram(c),s.unbindTexture(f.fbo?.colorTexture),s.bindFramebuffer(f.fbo),a&&(s.bindTexture(a,1),c.setUniform1i("depthTex",1),f.acquireColor(u.COLOR_ATTACHMENT1,n.RGBA),s.gl.drawBuffers([u.COLOR_ATTACHMENT0,u.COLOR_ATTACHMENT1]));const m=s.getViewport();s.setViewport(0,0,t,i),s.setClearColor(0,0,0,0),s.clear(l.COLOR),s.setBlendingEnabled(!0),s.setBlendFunction(p.ONE,p.ONE_MINUS_SRC_ALPHA),s.bindTexture(e.colorTexture,0),c.setUniform1i("colorTex",0);const v="linear-depth"===o||o.includes("shadow"),g=e.colorTexture?.descriptor.internalFormat,F=v?3:g===d.R16F||g===d.R32F||g===d.R8?1:g===d.RG8?2:g===d.RGBA16F?4:0;return c.setUniform1i("inputType",F),v&&c.setUniform2fv("nearFar",this.camera.nearFar),s.screen.draw(),s.gl.drawBuffers([u.COLOR_ATTACHMENT0]),s.bindFramebuffer(null),s.setViewport(m.x,m.y,m.width,m.height),r===T.ON&&(this._focusedFBO=f,this._focusedFBOType=F),h&&e.colorTexture?.clearMipmap(),f}clearFocusedFBO(){this._focusedFBO=null}getPreviewContent(e,r,o,t){if(!o)return null;const n=this.renderingContext,i=this.fboCache.acquire(e,r,"fbo visualizer");n.bindFramebuffer(i?.fbo),n.setClearColor(this.clearColor[0],this.clearColor[1],this.clearColor[2],this.clearColor[3]),n.clear(l.COLOR),n.setBlendingEnabled(!0),n.setBlendFunction(p.ONE,p.ONE_MINUS_SRC_ALPHA),n.setViewport(0,0,e,r);const s=this._ensureShader(n,!1);n.useProgram(s),n.bindTexture(o.getColorTexture(t),0),s.setUniform1i("colorTex",0),s.setUniform1i("inputType",0),n.screen.draw();const a=new ImageData(new Uint8ClampedArray(e*r*4),e,r);return n.gl.readPixels(0,0,e,r,f.RGBA,h.UNSIGNED_BYTE,new Uint8Array(a.data.buffer)),n.bindFramebuffer(null),i?.release(),a}_ensureShader(e,r){const o=r?1:0;if(this._program[o])return this._program[o];const t="#version 300 es\n in vec2 position;\n out vec2 uv;\n\n void main() {\n gl_Position = vec4(position, 0.0, 1.0);\n uv = position * 0.5 + vec2(0.5);\n }",n=`#version 300 es\n precision highp float;\n\n in vec2 uv;\n uniform sampler2D colorTex;\n layout(location = 0) out vec4 fragColor;\n ${r?"\n layout(location = 1) out vec4 fragDepth;\n uniform sampler2D depthTex;\n ":""}\n uniform int inputType;\n uniform vec2 nearFar;\n\n // Factors to convert rgba back to float\n const vec4 RGBA_2_FLOAT_FACTORS = vec4(\n 255.0 / (256.0),\n 255.0 / (256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0 * 256.0)\n );\n\n\n float rgba2float(vec4 rgba) {\n // Convert components from 0->1 back to 0->255 and then add the components together with their corresponding\n // fixed point factors, i.e. (256^1, 256^2, 256^3, 256^4)\n return dot(rgba, RGBA_2_FLOAT_FACTORS);\n }\n\n float linearDepthFromFloat(float depth) {\n depth = pow(depth, 0.2);\n return -(depth * (nearFar[1] - nearFar[0]) + nearFar[0]);\n }\n\n float linearDepthFromRGBA(vec4 depth) {\n return linearDepthFromFloat(rgba2float(depth));\n }\n\n float linearDepthFromTexture(sampler2D depthTex, vec2 uv) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(depthTex, 0)));\n return linearDepthFromRGBA(texelFetch(depthTex, iuv, 0));\n }\n\n void main() {\n vec4 color;\n if(inputType == 1) {\n color = vec4(vec3(texture(colorTex, uv).r), 1.0);\n } else if(inputType == 2) {\n color = vec4(texture(colorTex, uv).rg, 0.0, 1.0);\n } else if(inputType == 3) {\n float depth = 1.0 - (-linearDepthFromTexture(colorTex, uv) / (nearFar[1] - nearFar[0]));\n color = vec4(vec3(depth), depth >= 0.999 ? 0.0 : 1.0);\n } else if(inputType == 4) {\n color = texture(colorTex, uv);\n color = vec4(color.rgb / color.a, color.a);\n } else {\n color = texture(colorTex, uv);\n }\n\n\n if(color.a < ${a.float(s)})\n discard;\n else {\n fragColor = color;\n ${r?"\n float depth = 1.0 - pow(texture(depthTex, uv).r, 10.0);\n fragDepth = vec4(vec3(depth), depth < 0.000001 ? 0.0 : 1.0);\n ":""}\n }\n }`;return this._program[o]=e.programCache.acquire(t,n,c),this._program[o]}};var T;e([r()],m.prototype,"destroyedCB",void 0),e([r()],m.prototype,"produces",void 0),e([r()],m.prototype,"consumes",void 0),e([r()],m.prototype,"clearColor",void 0),m=e([o("esri.views.3d.webgl-engine.effects.debug.RenderNodeVisualizerNode")],m),function(e){e[e.ON=0]="ON",e[e.OFF=1]="OFF"}(T||(T={}));export{T as FocusState,m as RenderNodeVisualizerNode};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import"../../../../../core/has.js";import{releaseMaybe as t,disposeMaybe as i,destroyMaybe as s}from"../../../../../core/maybe.js";import{property as n}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as r}from"../../../../../core/accessorSupport/decorators/subclass.js";import{c as a,g as h}from"../../../../../chunks/vec32.js";import{create as l,fromRay as o,getStart as c,getEnd as d}from"../../../../../geometry/support/clipRay.js";import{intersectClipRay as p}from"../../../../../geometry/support/frustum.js";import{copy as u}from"../../../../../geometry/support/lineSegment.js";import{wrap as m}from"../../../../../geometry/support/ray.js";import{ViewingMode as _}from"../../../../ViewingMode.js";import P from"../../../webgl/RenderNode.js";import{Blit as g}from"../blit/Blit.js";import{LaserlinePathData as b}from"./LaserlinePathData.js";import{LaserlinePathTechnique as f}from"./LaserlinePathTechnique.js";import{LaserlinePathTechniqueConfiguration as E}from"./LaserlinePathTechniqueConfiguration.js";import{LaserlinePassParameters as q,LaserlineTechnique as D}from"./LaserlineTechnique.js";import{LaserlineTechniqueConfiguration as T}from"./LaserlineTechniqueConfiguration.js";import{RenderRequestType as L,Decorations as V}from"../../lib/basicInterfaces.js";import{updateParameters as C}from"../../materials/internal/MaterialUtil.js";import{AlphaMode as R}from"../../shaders/CompositingTechniqueConfiguration.js";import{
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import"../../../../../core/has.js";import{releaseMaybe as t,disposeMaybe as i,destroyMaybe as s}from"../../../../../core/maybe.js";import{property as n}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as r}from"../../../../../core/accessorSupport/decorators/subclass.js";import{c as a,g as h}from"../../../../../chunks/vec32.js";import{create as l,fromRay as o,getStart as c,getEnd as d}from"../../../../../geometry/support/clipRay.js";import{intersectClipRay as p}from"../../../../../geometry/support/frustum.js";import{copy as u}from"../../../../../geometry/support/lineSegment.js";import{wrap as m}from"../../../../../geometry/support/ray.js";import{ViewingMode as _}from"../../../../ViewingMode.js";import P from"../../../webgl/RenderNode.js";import{Blit as g}from"../blit/Blit.js";import{LaserlinePathData as b}from"./LaserlinePathData.js";import{LaserlinePathTechnique as f}from"./LaserlinePathTechnique.js";import{LaserlinePathTechniqueConfiguration as E}from"./LaserlinePathTechniqueConfiguration.js";import{LaserlinePassParameters as q,LaserlineTechnique as D}from"./LaserlineTechnique.js";import{LaserlineTechniqueConfiguration as T}from"./LaserlineTechniqueConfiguration.js";import{RenderRequestType as L,Decorations as V}from"../../lib/basicInterfaces.js";import{updateParameters as C}from"../../materials/internal/MaterialUtil.js";import{AlphaMode as R}from"../../shaders/CompositingTechniqueConfiguration.js";import{FramebufferBit as A}from"../../../../webgl/enums.js";let j=class extends P{constructor(e){super(e),this.produces="laserline-color",this.consumes={required:["laserline-color","normals"]},this.requireGeometryDepth=!0,this._technique=null,this._pathTechnique=null,this._blit=null,this._heightManifoldEnabled=!1,this._pointDistanceEnabled=!1,this._lineVerticalPlaneEnabled=!1,this._intersectsLineEnabled=!1,this._intersectsLineInfinite=!1,this._pathVerticalPlaneEnabled=!1,this._pathVerticalPlaneData=null,this._passParameters=new q}initialize(){this._techniques=this.view._stage.renderView.techniques,this._passParameters.renderCoordsHelper=this.view.renderCoordsHelper,this._techniqueConfig=new T;const e=new E;e.contrastControlEnabled=this.contrastControlEnabled,this._pathTechnique=this._techniques.acquire(f,e)}destroy(){this._technique=t(this._technique),this._pathVerticalPlaneData=i(this._pathVerticalPlaneData),this._pathTechnique?.release(),this._blit=s(this._blit)}get heightManifoldEnabled(){return this._heightManifoldEnabled}set heightManifoldEnabled(e){this._heightManifoldEnabled!==e&&(this._heightManifoldEnabled=e,this.requestRender(L.UPDATE))}get heightManifoldTarget(){return this._passParameters.heightManifoldTarget}set heightManifoldTarget(e){a(this._passParameters.heightManifoldTarget,e),this.requestRender(L.UPDATE)}get pointDistanceEnabled(){return this._pointDistanceEnabled}set pointDistanceEnabled(e){e!==this._pointDistanceEnabled&&(this._pointDistanceEnabled=e,this.requestRender(L.UPDATE))}get pointDistanceTarget(){return this._passParameters.pointDistanceTarget}set pointDistanceTarget(e){a(this._passParameters.pointDistanceTarget,e),this.requestRender(L.UPDATE)}get pointDistanceOrigin(){return this._passParameters.pointDistanceOrigin}set pointDistanceOrigin(e){a(this._passParameters.pointDistanceOrigin,e),this.requestRender(L.UPDATE)}get lineVerticalPlaneEnabled(){return this._lineVerticalPlaneEnabled}set lineVerticalPlaneEnabled(e){e!==this._lineVerticalPlaneEnabled&&(this._lineVerticalPlaneEnabled=e,this.requestRender(L.UPDATE))}get lineVerticalPlaneSegment(){return this._passParameters.lineVerticalPlaneSegment}set lineVerticalPlaneSegment(e){u(e,this._passParameters.lineVerticalPlaneSegment),this.requestRender(L.UPDATE)}get intersectsLineEnabled(){return this._intersectsLineEnabled}set intersectsLineEnabled(e){e!==this._intersectsLineEnabled&&(this._intersectsLineEnabled=e,this.requestRender(L.UPDATE))}get intersectsLineSegment(){return this._passParameters.intersectsLineSegment}set intersectsLineSegment(e){u(e,this._passParameters.intersectsLineSegment),this.requestRender(L.UPDATE)}get intersectsLineRadius(){return this._passParameters.intersectsLineRadius}set intersectsLineRadius(e){e!==this._passParameters.intersectsLineRadius&&(this._passParameters.intersectsLineRadius=e,this.requestRender(L.UPDATE))}get intersectsLineInfinite(){return this._intersectsLineInfinite}set intersectsLineInfinite(e){e!==this._intersectsLineInfinite&&(this._intersectsLineInfinite=e,this.requestRender(L.UPDATE))}get pathVerticalPlaneEnabled(){return this._pathVerticalPlaneEnabled}set pathVerticalPlaneEnabled(e){e!==this._pathVerticalPlaneEnabled&&(this._pathVerticalPlaneEnabled=e,null!=this._pathVerticalPlaneData&&this.requestRender(L.UPDATE))}set pathVerticalPlaneVertices(e){null==this._pathVerticalPlaneData&&(this._pathVerticalPlaneData=new b(this._passParameters.renderCoordsHelper)),this._pathVerticalPlaneData.vertices=e,this.pathVerticalPlaneEnabled&&this.requestRender(L.UPDATE)}set pathVerticalPlaneBuffers(e){null==this._pathVerticalPlaneData&&(this._pathVerticalPlaneData=new b(this._passParameters.renderCoordsHelper)),this._pathVerticalPlaneData.buffers=e,this.pathVerticalPlaneEnabled&&this.requestRender(L.UPDATE)}setParameters(e){C(this._passParameters,e)&&this.requestRender(L.UPDATE)}render(e){const t=e.find((({name:e})=>"laserline-color"===e));if(this.bindParameters.decorations===V.OFF)return t;const i=e.find((({name:e})=>"normals"===e)),s=this.renderingContext;this._passParameters.normals=i.getTexture();const n=()=>{(this.heightManifoldEnabled||this.pointDistanceEnabled||this.lineVerticalPlaneSegment||this.intersectsLineEnabled)&&this._renderUnified(),this.pathVerticalPlaneEnabled&&this._renderPath()};if(!this.contrastControlEnabled)return s.bindFramebuffer(t.fbo),n(),t;this._passParameters.colors=t.getTexture();const r=this.fboCache.acquire(t.fbo.width,t.fbo.height,"laser lines");s.unbindTexture(r.fbo?.colorTexture),s.bindFramebuffer(r.fbo),s.setClearColor(0,0,0,0),s.clear(A.COLOR|A.DEPTH),n(),this._blit??=new g(this._techniques,R.PremultipliedAlpha);const a=this._blit.blend(s,r,t,this.bindParameters,(()=>this.requestRender));return a.attachDepth(t.getAttachment(this.gl.DEPTH_STENCIL_ATTACHMENT)),r.release(),a}_renderUnified(){if(this._techniqueConfig.heightManifoldEnabled=this.heightManifoldEnabled,this._techniqueConfig.lineVerticalPlaneEnabled=this.lineVerticalPlaneEnabled,this._techniqueConfig.pointDistanceEnabled=this.pointDistanceEnabled,this._techniqueConfig.intersectsLineEnabled=this.intersectsLineEnabled,this._techniqueConfig.contrastControlEnabled=this.contrastControlEnabled,this._techniqueConfig.spherical=this.view.state.viewingMode===_.Global,this._technique=this._techniques.releaseAndAcquire(D,this._techniqueConfig,this._technique),!this._technique?.compiled)return void this.requestRender(L.UPDATE);const e=this.renderingContext;this._updatePassParameters(),e.bindTechnique(this._technique,this.bindParameters,this._passParameters),e.screen.draw()}_renderPath(){if(null==this._pathVerticalPlaneData)return;if(this._pathTechnique&&!this._pathTechnique.compiled)return void this.requestRender(L.UPDATE);const e=this.renderingContext;e.bindTechnique(this._pathTechnique,this.bindParameters,{...this._passParameters,origin:this._pathVerticalPlaneData.origin}),this._pathVerticalPlaneData.draw(e)}_updatePassParameters(){if(!this._intersectsLineEnabled)return;const e=this.bindParameters.camera;if(this._intersectsLineInfinite){if(o(m(this._passParameters.intersectsLineSegment.origin,this._passParameters.intersectsLineSegment.vector),U),U.c0=-Number.MAX_VALUE,!p(e.frustum,U))return;c(U,this._passParameters.lineStartWorld),d(U,this._passParameters.lineEndWorld)}else a(this._passParameters.lineStartWorld,this._passParameters.intersectsLineSegment.origin),h(this._passParameters.lineEndWorld,this._passParameters.intersectsLineSegment.origin,this._passParameters.intersectsLineSegment.vector)}get test(){}};e([n({constructOnly:!0})],j.prototype,"contrastControlEnabled",void 0),e([n({constructOnly:!0})],j.prototype,"isDecoration",void 0),e([n()],j.prototype,"produces",void 0),e([n()],j.prototype,"consumes",void 0),j=e([r("esri.views.3d.webgl-engine.effects.laserlines.LaserLineRenderer")],j);const U=l();export{j as LaserLineRenderer};
|
|
@@ -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{disposeMaybe as r}from"../../../../../core/maybe.js";import{throwIfAborted as t}from"../../../../../core/promiseUtils.js";import{watch as s,syncAndInitial as i}from"../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators/subclass.js";import{requestImage as n}from"../../../../../support/requestImageUtils.js";import{ColorFormat as u}from"../../../webgl/formats.js";import c from"../../../webgl/RenderNode.js";import{SMAABlendWeightsTechnique as l}from"./SMAABlendWeightsTechnique.js";import{SMAABlurTechnique as h}from"./SMAABlurTechnique.js";import{SMAAEdgeDetectTechnique as m}from"./SMAAEdgeDetectTechnique.js";import{SMAAPassParameters as d}from"./SMAAPassParameters.js";import{RenderRequestType as p}from"../../lib/basicInterfaces.js";import{PixelFormat as
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{disposeMaybe as r}from"../../../../../core/maybe.js";import{throwIfAborted as t}from"../../../../../core/promiseUtils.js";import{watch as s,syncAndInitial as i}from"../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators/subclass.js";import{requestImage as n}from"../../../../../support/requestImageUtils.js";import{ColorFormat as u}from"../../../webgl/formats.js";import c from"../../../webgl/RenderNode.js";import{SMAABlendWeightsTechnique as l}from"./SMAABlendWeightsTechnique.js";import{SMAABlurTechnique as h}from"./SMAABlurTechnique.js";import{SMAAEdgeDetectTechnique as m}from"./SMAAEdgeDetectTechnique.js";import{SMAAPassParameters as d}from"./SMAAPassParameters.js";import{RenderRequestType as p}from"../../lib/basicInterfaces.js";import{PixelFormat as b,TextureSamplingMode as T,FramebufferBit as f,TextureWrapMode as _}from"../../../../webgl/enums.js";import{Texture as x}from"../../../../webgl/Texture.js";import{TextureDescriptor as q}from"../../../../webgl/TextureDescriptor.js";let g=class extends c{constructor(e){super(e),this.produces="disabled",this.consumes={required:["aa-color","composite-color"]},this._areaTexture=null,this._searchTexture=null,this._smaaParameters=new d,this._edgeTechnique=e.techniques.acquire(m),this._blendTechnique=e.techniques.acquire(l),this._blurTechnique=e.techniques.acquire(h)}initialize(){this.addHandles([s((()=>this.isEnabled()),(e=>e?this.enable():this.disable()),i)])}async enable(){if(this.produces="aa-color",this._abortController||this._areaTexture&&this._searchTexture)return;this._abortController=new AbortController;const e=this._abortController.signal;try{const r=await import("./SMAAData.js");await this._loadTextures(r,e),this.requestRender(p.UPDATE)}catch{}this._abortController=null}async _loadTextures(e,r){t(r);const[s,i]=await Promise.allSettled([n(e.areaTexture,{signal:r}),n(e.searchTexure,{signal:r})]);if(t(r),"fulfilled"!==s.status||"fulfilled"!==i.status)return;const o=this.renderingContext;this._areaTexture=w(o,T.LINEAR,b.RGB,s.value),this._searchTexture=w(o,T.NEAREST,b.LUMINANCE,i.value)}disable(){this.produces="disabled"}destroy(){this._searchTexture=r(this._searchTexture),this._areaTexture=r(this._areaTexture),this._blurTechnique.release(),this._blendTechnique.release(),this._edgeTechnique.release()}render(e){const r=e.find((({name:e})=>"aa-color"===e));if(!(this._edgeTechnique.compiled&&this._blendTechnique.compiled&&this._blurTechnique.compiled&&this._areaTexture&&this._searchTexture))return this.requestRender(p.UPDATE),r;const t=e.find((({name:e})=>"composite-color"===e)),s=t.fbo.width,i=t.fbo.height,o=this.renderingContext;o.setViewport(0,0,s,i);const a=this.fboCache.acquire(s,i,"smaa edges",u.RG);o.unbindTexture(a.fbo?.colorTexture),o.bindFramebuffer(a.fbo),o.setClearColor(0,0,0,1),o.clear(f.COLOR),this._smaaParameters.color=t.getTexture(),o.bindTechnique(this._edgeTechnique,null,this._smaaParameters),o.screen.draw();const n=this.fboCache.acquire(s,i,"smaa blend");return o.unbindTexture(n.fbo?.colorTexture),o.bindFramebuffer(n.fbo),o.setClearColor(0,0,1,1),o.clear(f.COLOR),this._smaaParameters.inputTexture=a.getTexture(),this._smaaParameters.areaTexture=this._areaTexture,this._smaaParameters.searchTexture=this._searchTexture,o.bindTechnique(this._blendTechnique,null,this._smaaParameters),o.screen.draw(),a.release(),o.bindFramebuffer(r.fbo),o.setClearColor(0,1,0,1),o.clear(f.COLOR),this._smaaParameters.inputTexture=n.getTexture(),o.bindTechnique(this._blurTechnique,null,this._smaaParameters),o.screen.draw(),n.release(),r}};function w(e,r,t,s){const i=new q;return i.pixelFormat=t,i.wrapMode=_.CLAMP_TO_EDGE,i.width=s.width,i.height=s.height,i.samplingMode=r,new x(e,i,s)}e([o()],g.prototype,"produces",void 0),e([o()],g.prototype,"consumes",void 0),e([o({constructOnly:!0})],g.prototype,"isEnabled",void 0),e([o({constructOnly:!0})],g.prototype,"techniques",void 0),e([o()],g.prototype,"_abortController",void 0),g=e([a("esri.views.3d.webgl-engine.effects.smaa.SMAA")],g);export{g as SMAA};
|
|
@@ -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{clamp as r}from"../../../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../../../core/maybe.js";import{watch as t}from"../../../../../core/reactiveUtils.js";import{Milliseconds as i}from"../../../../../core/time.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators/subclass.js";import{set as n}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{ColorFormat as m}from"../../../webgl/formats.js";import c from"../../../webgl/RenderNode.js";import{distanceFadeEnd as u,distanceFadeStart as h}from"../../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{SSAOBlurTechnique as p}from"./SSAOBlurTechnique.js";import{noiseData as l}from"./SSAONoiseData.js";import{SSAOPassParameters as d,BlurDrawParameters as b}from"./SSAOParameters.js";import{SSAOTechnique as f}from"./SSAOTechnique.js";import{RenderRequestType as T}from"../../lib/basicInterfaces.js";import{g as
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{clamp as r}from"../../../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../../../core/maybe.js";import{watch as t}from"../../../../../core/reactiveUtils.js";import{Milliseconds as i}from"../../../../../core/time.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators/subclass.js";import{set as n}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{ColorFormat as m}from"../../../webgl/formats.js";import c from"../../../webgl/RenderNode.js";import{distanceFadeEnd as u,distanceFadeStart as h}from"../../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{SSAOBlurTechnique as p}from"./SSAOBlurTechnique.js";import{noiseData as l}from"./SSAONoiseData.js";import{SSAOPassParameters as d,BlurDrawParameters as b}from"./SSAOParameters.js";import{SSAOTechnique as f}from"./SSAOTechnique.js";import{RenderRequestType as T}from"../../lib/basicInterfaces.js";import{g as w}from"../../../../../chunks/SSAO.glsl.js";import{TextureWrapMode as _,PixelFormat as q,DepthStencilAttachment as x,FramebufferBit as P}from"../../../../webgl/enums.js";import{Texture as j}from"../../../../webgl/Texture.js";import{TextureDescriptor as S}from"../../../../webgl/TextureDescriptor.js";const g=2;let y=class extends c{constructor(e){super(e),this.consumes={required:["normals"]},this.produces="ssao",this.isEnabled=()=>!1,this._enableTime=i(0),this._passParameters=new d,this._drawParameters=new b}initialize(){const e=Uint8Array.from(atob(l),(e=>e.charCodeAt(0))),r=new S;r.wrapMode=_.CLAMP_TO_EDGE,r.pixelFormat=q.RGB,r.wrapMode=_.REPEAT,r.hasMipmap=!0,r.width=32,r.height=32,this._passParameters.noiseTexture=new j(this.renderingContext,r,e),this._ssaoTechnique=this.techniques.acquire(f),this._blurTechnique=this.techniques.acquire(p),this.addHandles(t((()=>this.isEnabled()),(()=>this._enableTime=i(0))))}destroy(){this._passParameters.noiseTexture=s(this._passParameters.noiseTexture),this._blurTechnique.release(),this._ssaoTechnique.release()}render(e){const s=this.bindParameters,t=e.find((({name:e})=>"normals"===e)),o=t?.getTexture(),a=t?.getTexture(x),c=this.fboCache,p=s.camera,l=p.fullViewport[2],d=p.fullViewport[3],b=Math.round(l/g),f=Math.round(d/g);if(!this._ssaoTechnique.compiled||!this._blurTechnique.compiled)return this._enableTime=i(performance.now()),this.requestRender(),c.acquire(b,f,"ssao",m.RED);0===this._enableTime&&(this._enableTime=i(performance.now()));const _=this.renderingContext,q=this.view.qualitySettings.fadeDuration,j=p.relativeElevation,S=r((u-j)/(u-h),0,1),y=q>0?Math.min(q,performance.now()-this._enableTime)/q:1,E=y*S;this._passParameters.normalTexture=o,this._passParameters.depthTexture=a,this._passParameters.projScale=1/p.computeScreenPixelSizeAtDist(1),this._passParameters.intensity=4*A/w(p)**6*E;const v=c.acquire(l,d,"ssao input",m.RG);_.unbindTexture(v.fbo.colorTexture),_.bindFramebuffer(v.fbo),_.setViewport(0,0,l,d),_.bindTechnique(this._ssaoTechnique,s,this._passParameters,this._drawParameters),_.screen.draw();const O=c.acquire(b,f,"ssao blur",m.RED);_.unbindTexture(O.fbo.colorTexture),_.bindFramebuffer(O.fbo),this._drawParameters.colorTexture=v.getTexture(),n(this._drawParameters.blurSize,0,g/d),_.bindTechnique(this._blurTechnique,s,this._passParameters,this._drawParameters),_.setViewport(0,0,b,f),_.screen.draw(),v.release();const R=c.acquire(b,f,"ssao",m.RED);return _.unbindTexture(R.fbo.colorTexture),_.bindFramebuffer(R.fbo),_.setViewport(0,0,l,d),_.setClearColor(1,1,1,0),_.clear(P.COLOR),this._drawParameters.colorTexture=O.getTexture(),n(this._drawParameters.blurSize,g/l,0),_.bindTechnique(this._blurTechnique,s,this._passParameters,this._drawParameters),_.setViewport(0,0,b,f),_.screen.draw(),_.setViewport4fv(p.fullViewport),O.release(),y<1&&this.requestRender(T.UPDATE),R}};e([o()],y.prototype,"consumes",void 0),e([o()],y.prototype,"produces",void 0),e([o({constructOnly:!0})],y.prototype,"techniques",void 0),e([o({constructOnly:!0})],y.prototype,"isEnabled",void 0),y=e([a("esri.views.3d.webgl-engine.effects.ssao.SSAO")],y);const A=.5;export{y as SSAO,g as blurSizePixels};
|
|
@@ -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 t}from"../../../../chunks/tslib.es6.js";import{releaseMaybe as e,disposeMaybe as r}from"../../../../core/maybe.js";import{watch as a}from"../../../../core/reactiveUtils.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{ViewingMode as o}from"../../../ViewingMode.js";import{createQuadVAO as n}from"./glUtil3D.js";import{SortedRenderGeometryRenderer as h}from"./SortedRenderGeometryRenderer.js";import{HeatmapPassParameters as m,HeatmapTechniqueConfiguration as p,HeatmapTechnique as l}from"../shaders/HeatmapTechnique.js";import{TextureWrapMode as c,PixelType as d,
|
|
5
|
+
import{_ as t}from"../../../../chunks/tslib.es6.js";import{releaseMaybe as e,disposeMaybe as r}from"../../../../core/maybe.js";import{watch as a}from"../../../../core/reactiveUtils.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{ViewingMode as o}from"../../../ViewingMode.js";import{createQuadVAO as n}from"./glUtil3D.js";import{SortedRenderGeometryRenderer as h}from"./SortedRenderGeometryRenderer.js";import{HeatmapPassParameters as m,HeatmapTechniqueConfiguration as p,HeatmapTechnique as l}from"../shaders/HeatmapTechnique.js";import{TextureWrapMode as c,PixelType as d,FramebufferBit as u}from"../../../webgl/enums.js";import{FramebufferObject as y}from"../../../webgl/FramebufferObject.js";import{Texture as _}from"../../../webgl/Texture.js";import{TextureDescriptor as g}from"../../../webgl/TextureDescriptor.js";import{vertexCount as f}from"../../../webgl/Util.js";let x=class extends h{constructor(t){super(t),this.pixelRatio=1,this._colorRampData=new Uint8ClampedArray(4),this.type="draped-heatmap",this._heatmapParameters=new m;const e=new g;e.pixelFormat=t.pixelFormat,e.internalFormat=t.internalFormat,e.dataType=t.dataType,e.samplingMode=t.samplingMode,e.wrapMode=c.CLAMP_TO_EDGE;const r=t.rendererContext.rctx;this._densityMap=new y(r,e),this._quad=n(r);const a=new p;a.usesHalfFloat=t.dataType!==d.FLOAT,this._technique=new l({rctx:r,viewingMode:o.Local},a)}initialize(){const t=this._colorRampData,e=new g(t.length/4,1);e.wrapMode=c.CLAMP_TO_EDGE,this._colorRamp=new _(this.rctx,e,t),this._heatmapParameters.densityMap=this._densityMap.colorTexture,this.addHandles(a((()=>[this.colorRampData,this.minDensity,this.maxDensity,this.fieldTotal,this.pixelRatio,this.searchRadius]),(()=>this.rendererContext.notifyContentChanged())))}destroy(){this._technique=e(this._technique),this._densityMap=r(this._densityMap),this._quad=r(this._quad),this._colorRamp=r(this._colorRamp)}get searchRadius(){return this._heatmapParameters.searchRadius}set searchRadius(t){t!==this._heatmapParameters.searchRadius&&(this._heatmapParameters.searchRadius=t,this.notifyChange("searchRadius"))}get minDensity(){return this._heatmapParameters.minDensity}set minDensity(t){t!==this._heatmapParameters.minDensity&&(this._heatmapParameters.minDensity=t,this.notifyChange("minDensity"))}get maxDensity(){return this._heatmapParameters.maxDensity}set maxDensity(t){t!==this._heatmapParameters.maxDensity&&(this._heatmapParameters.maxDensity=t,this.notifyChange("maxDensity"))}get fieldTotal(){return this._heatmapParameters.fieldTotal}set fieldTotal(t){this._heatmapParameters.fieldTotal=t,this.notifyChange("fieldTotal")}get colorRampData(){return this._colorRampData}set colorRampData(t){const{colorRamp:e}=this._heatmapParameters;if(null!=e&&t!==this._colorRampData){const r=e.descriptor.width,a=t.length/4;a!==r&&e.resize(a,1),e.setData(t)}this._colorRampData=t}get _colorRamp(){return this._heatmapParameters.colorRamp}set _colorRamp(t){this._heatmapParameters.colorRamp=t}get hasHighlights(){return!1}get hasWater(){return!1}get rendersOccludedDraped(){return!1}render(t){const e=this.sortedRenderers;if(0===e.length)return;const r=this.rctx.getBoundFramebufferObject(),a=this.rctx.getViewport(),{pixelRatio:i}=this,s=Math.ceil(a.width*i),o=Math.ceil(a.height*i);this._densityMap.resize(s,o),this.rctx.bindFramebuffer(this._densityMap),this.rctx.setViewport(0,0,s,o),this.rctx.clear(u.COLOR);let n=!1;e.forAll((e=>{const r=e.prepareTechnique(t);null!=r&&(e.renderNode(t,r),n=!0)})),this.rctx.bindFramebuffer(r),this.rctx.setViewport(a.x,a.y,a.width,a.height),n&&(this.rctx.bindVAO(this._quad),this.rctx.bindTechnique(this._technique,t.bindParameters,this._heatmapParameters),this.rctx.drawArrays(this._technique.primitiveType,0,f(this._quad,"geometry")))}};t([i()],x.prototype,"searchRadius",null),t([i()],x.prototype,"minDensity",null),t([i()],x.prototype,"maxDensity",null),t([i()],x.prototype,"fieldTotal",null),t([i()],x.prototype,"pixelRatio",void 0),t([i()],x.prototype,"colorRampData",null),t([i({constructOnly:!0})],x.prototype,"dataType",void 0),t([i({constructOnly:!0})],x.prototype,"samplingMode",void 0),t([i({constructOnly:!0})],x.prototype,"pixelFormat",void 0),t([i({constructOnly:!0})],x.prototype,"internalFormat",void 0),t([i()],x.prototype,"_colorRampData",void 0),x=t([s("esri.views.3d.webgl-engine.lib.DrapedHeatmapRenderer")],x);export{x as DrapedHeatmapRenderer};
|
|
@@ -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{releaseMaybe as t}from"../../../../core/maybe.js";import{c as e}from"../../../../chunks/vec42.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{DepthFormat as i}from"../../webgl/formats.js";import{ViewportSize as s}from"./BindParameters.js";import{
|
|
5
|
+
import{releaseMaybe as t}from"../../../../core/maybe.js";import{c as e}from"../../../../chunks/vec42.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{DepthFormat as i}from"../../webgl/formats.js";import{ViewportSize as s}from"./BindParameters.js";import{FramebufferBit as o}from"../../../webgl/enums.js";import{ensureAttachmentMaxSize as h}from"../../../webgl/FramebufferObject.js";class c{constructor(t){this._fbos=t,this._size=new s(0,0),this._clearColor=r()}dispose(){this._color=t(this._color),this.release()}initialize(t,r,i){this._size.width=t,this._size.height=r,h(this._size,this._fbos.rctx.parameters.maxTextureSize);const s=this._color;return this._color=null,this.release(),e(this._clearColor,i),s}release(){this._color?.detachDepth(),this._depth=t(this._depth)}renderWithoutDepth(t){this._bindTarget(this.color),t(),this._bindTarget(this.color,this.depth)}update(t){const e=this._ensureColor();e.attachDepth(this.depth),this._color=t(e)}bind(){const t=null==this._color;if(this._bindTarget(this.color,this.depth),t){const t=this._fbos.rctx;t.setClearStencil(0),t.setClearColor(this._clearColor[0],this._clearColor[1],this._clearColor[2],this._clearColor[3]),t.clear(o.COLOR|o.DEPTH|o.STENCIL)}}_bindTarget(t,e){t.attachDepth(e),this._fbos.rctx.bindFramebuffer(t.fbo)}_acquireColor(){return this._fbos.acquire(this._size.width,this._size.height,"composite-color")}_acquireDepth(){return this._fbos.acquireDepth(i.DEPTH_STENCIL_TEXTURE,this._size.width,this._size.height,"depth")}get size(){return this._size}get color(){return this._ensureColor()}get depth(){return this._depth??=this._acquireDepth(),this._depth}_ensureColor(){return this._color??=this._acquireColor(),this._color}}export{c as MainFramebuffer};
|
|
@@ -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 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};
|
|
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 P,ZEROS as R}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 L}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as F}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,FramebufferBit as Ae,TextureType as Pe,ColorAttachment as Re}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=P(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 F(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):R;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)>=L}),_)]}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 P=c?this._renderTransparentTerrain():null;P&&(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,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),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 R=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=R?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 L=this._renderNodes(C.MAGNIFIER,M);return l&&s===G.ON&&r===ee.Default&&!_&&(L=this._blitToDefault(L)),_?(L.attachDepth(i.depth),this._blitToDefault(this._renderNodes(w.FINAL,L)),L.detachDepth()):this._pluginInput.set(w.FINAL,L),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),this._renderHUDElements(H.Both)),t.clear(Ae.DEPTH),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(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(Re.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)):this._framebuffer.bind(),this._compositingHelper.compositeOIT(e,a.getTexture(),a.getTexture(Re.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/has.js";import{NestedMap as e}from"../../../../core/NestedMap.js";import{ScreenSpaceGeometry as r}from"../effects/ScreenSpaceGeometry.js";import{VaoCache as s}from"../materials/renderers/VaoCache.js";import{AppleAmdDriverHelper as t}from"../../../webgl/AppleAmdDriverHelper.js";import{RenderingContext as i}from"../../../webgl/RenderingContext.js";class o extends i{constructor(s,t){super(s,t),this.gl=s,this._vaoCaches=new e,this._appleAmdDriverHelper=null,this._refCount=1,this._newCache=t.newCache,this.screen=new r(this)}configure(e){super.configure(e),this._newCache=e.newCache}destroy(){this._vaoCaches?.forAll((e=>e.dispose())),this._vaoCaches?.clear(),--this._refCount>0||this.dispose()}ref(){++this._refCount}dispose(){super.dispose(),this._appleAmdDriverHelper?.dispose(),this.screen.destroy(),this._vaoCaches.forAll((e=>e.dispose())),this._vaoCaches.clear()}get newCache(){return this._newCache}getVaoCache(e,r){const t=Array.from(e).join("."),i=JSON.stringify(r),o=this._vaoCaches.get(t,i);if(o)return o;const a=new s(this,e,r);return this._vaoCaches.set(t,i,a),a}bindTechnique(e,r,s,t,i){return this.useProgram(e.program),this.setPipelineState(e.getPipeline(!!i)),e.program.bindPass(s,r),t&&e.program.bindDraw(
|
|
5
|
+
import"../../../../core/has.js";import{NestedMap as e}from"../../../../core/NestedMap.js";import{ScreenSpaceGeometry as r}from"../effects/ScreenSpaceGeometry.js";import{VaoCache as s}from"../materials/renderers/VaoCache.js";import{AppleAmdDriverHelper as t}from"../../../webgl/AppleAmdDriverHelper.js";import{RenderingContext as i}from"../../../webgl/RenderingContext.js";class o extends i{constructor(s,t){super(s,t),this.gl=s,this._vaoCaches=new e,this._appleAmdDriverHelper=null,this._refCount=1,this._newCache=t.newCache,this.screen=new r(this)}configure(e){super.configure(e),this._newCache=e.newCache}destroy(){this._vaoCaches?.forAll((e=>e.dispose())),this._vaoCaches?.clear(),--this._refCount>0||this.dispose()}ref(){++this._refCount}dispose(){super.dispose(),this._appleAmdDriverHelper?.dispose(),this.screen.destroy(),this._vaoCaches.forAll((e=>e.dispose())),this._vaoCaches.clear()}get newCache(){return this._newCache}getVaoCache(e,r){const t=Array.from(e).join("."),i=JSON.stringify(r),o=this._vaoCaches.get(t,i);if(o)return o;const a=new s(this,e,r);return this._vaoCaches.set(t,i,a),a}bindTechnique(e,r,s,t,i){return this.useProgram(e.program),this.setPipelineState(e.getPipeline(!!i)),s&&(e.program.bindPass(s,r),t&&e.program.bindDraw(r,s,t)),e.program}runAppleAmdDriverHelper(){this.driverTest.drawArraysRequiresIndicesTypeReset.result&&(this._appleAmdDriverHelper??=new t(this),this._appleAmdDriverHelper.run())}get test(){}}export{o as RenderingContext};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{equals as i}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{smoothstep as r}from"../../../../core/mathUtils.js";import{disposeMaybe as s,releaseMaybe as o}from"../../../../core/maybe.js";import{watch as a,syncAndInitial as n,sync as h}from"../../../../core/reactiveUtils.js";import{property as c}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as _}from"../../../../core/accessorSupport/decorators/subclass.js";import{G as u,c as l}from"../../../../chunks/vec32.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ReadShadowMapPassParameters as d}from"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{BindParameters as p}from"./BindParameters.js";import{zero as g}from"./depthRange.js";import{createQuadVAO as f}from"./glUtil3D.js";import{ShadowCastRenderer as b,shadowCastDisabledElevationThreshold as w,shadowCastDisableElevationMax as v,shadowCastDisableElevationMin as A}from"./ShadowCastRenderer.js";import{ShadowMap as R}from"./ShadowMap.js";import{S as y}from"../../../../chunks/ShadowCastAccumulate.glsl.js";import{ShadowCastAccumulateTechnique as C}from"../shaders/ShadowCastAccumulateTechnique.js";import{TaskPriority as
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{equals as i}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{smoothstep as r}from"../../../../core/mathUtils.js";import{disposeMaybe as s,releaseMaybe as o}from"../../../../core/maybe.js";import{watch as a,syncAndInitial as n,sync as h}from"../../../../core/reactiveUtils.js";import{property as c}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as _}from"../../../../core/accessorSupport/decorators/subclass.js";import{G as u,c as l}from"../../../../chunks/vec32.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ReadShadowMapPassParameters as d}from"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{BindParameters as p}from"./BindParameters.js";import{zero as g}from"./depthRange.js";import{createQuadVAO as f}from"./glUtil3D.js";import{ShadowCastRenderer as b,shadowCastDisabledElevationThreshold as w,shadowCastDisableElevationMax as v,shadowCastDisableElevationMin as A}from"./ShadowCastRenderer.js";import{ShadowMap as R}from"./ShadowMap.js";import{S as y}from"../../../../chunks/ShadowCastAccumulate.glsl.js";import{ShadowCastAccumulateTechnique as C}from"../shaders/ShadowCastAccumulateTechnique.js";import{TaskPriority as j}from"../../../support/Scheduler.js";import{PixelFormat as S,PixelType as F,SizedPixelFormat as x,TextureWrapMode as P,FramebufferBit as D}from"../../../webgl/enums.js";import{FramebufferObject as T}from"../../../webgl/FramebufferObject.js";import{TextureDescriptor as q}from"../../../webgl/TextureDescriptor.js";import{vertexCount as E}from"../../../webgl/Util.js";let M=class extends t{constructor(e,t,i,r,s,o){super({}),this.fbos=e,this._stage=i,this._prepareForShadowMapPass=r,this._renderToShadowMap=s,this._requestRender=o,this._progress=0,this._sampleCount=0,this._passParameters=new d,this._cachedLightDirections=[],this._depthRange=g,this._previewing=!1,this._cameraForcedForScreenshot=!1,this._shadowAccumulatorKey="shadowAccumulator",this._rctx=e.rctx,this._bindParameters=new p(new R(e,i.viewingMode),null),this._bindParameters.shadowMap.enabled=!0,this._vao=f(this._rctx),this._accumulationRenderer=new b(t,this._rctx,this,o);const c=this._stage.view.resourceController.scheduler;this.addHandles([c.registerTask(j.SHADOW_ACCUMULATOR,this),a((()=>i.renderView),(e=>{this.removeHandles(O),null!=e&&this.addHandles(e.events.on("force-camera-for-screenshot",(()=>this._cameraForcedForScreenshot=!0)),O)}),n),a((()=>this._previewing),(()=>this._requestRenderIfEnabled()),h)],this._shadowAccumulatorKey)}normalizeCtorArgs(){return{}}dispose(){this._disable(),this.removeHandles(this._shadowAccumulatorKey),this._accumulationRenderer=s(this._accumulationRenderer),this._bindParameters.shadowMap.dispose(),this._fbo=s(this._fbo),this._vao=s(this._vao),this._accumulationTechniqueCached=o(this._accumulationTechniqueCached),this._cachedLightDirections.length=0,this._sampleCount=0}get computedSamples(){return this._progress}get shadowCastTexture(){return this._fbo?.colorTexture}get isAccumulating(){return this._isPreviewing||this._isRefining}get _accumulationTechnique(){if(null==this._accumulationTechniqueCached){const e={rctx:this._rctx,viewingMode:this._stage.viewingMode};this._accumulationTechniqueCached=new C(e)}return this._accumulationTechniqueCached}get _isRefining(){return this._isActive&&!this._isDoneAccumulating&&!this._previewing}get _isPreviewing(){return this._isActive&&this._previewing}get _isActive(){return null!=this._fbo&&this._sampleCount>0}get canAccumulate(){return null!=this._bindParameters.depth&&this._depthRange!==g&&this._opacityFromElevation>w}get _isDoneAccumulating(){return this._progress>=this._sampleCount}get _lightDirections(){return this._cachedLightDirections}set _lightDirections(e){const t=this._cachedLightDirections;if(i(t,e,u))return;const r=Math.min(y,e.length);t.length=r,this._sampleCount=r;for(let i=0;i<r;++i)t[i]=l(t[i]??m(),e[i]);this._invalidate()}get _opacityFromElevation(){return this._accumulationRenderer.opacityFromElevation}set _opacityFromElevation(e){this._accumulationRenderer.opacityFromElevation=e}get running(){return this._isRefining&&this.canAccumulate&&this._progress>0}runTask(e){for(this._prepareForShadowMapPass(this._bindParameters);!e.done&&!this._isDoneAccumulating;)this._accumulateShadow(),e.madeProgress();this._requestRender()}renderAccumulation(e,t,i,r){if(this._depthRange=t,this._updateCamera(i),this._bindParameters.contentCamera=r,this._bindParameters.depth=e,this._passParameters.origin=this._bindParameters.camera.center,this.notifyChange("canAccumulate"),!this.isAccumulating||!this.canAccumulate)return!1;(this._previewing||0===this._progress||this._cameraForcedForScreenshot)&&this._clear();const s=this._cameraForcedForScreenshot?this._sampleCount:Math.min(L,this._sampleCount-this._progress);for(let o=0;o<s;++o)this._accumulateShadow();return this._cameraForcedForScreenshot=!1,this._requestRender(),s>0}render(e){this._accumulationRenderer.render(e)}setOptions(e){if(void 0!==e.enabled){const t=null!=this._fbo;e.enabled!==t&&(e.enabled?this._enable():this._disable())}void 0!==e.previewing&&(this._previewing=e.previewing),void 0!==e.lightDirections&&(this._lightDirections=e.lightDirections),this._accumulationRenderer.setOptions(e)}readAccumulatedShadow(e,t){return!this._isActive||!this._fbo||this._progress<1||e<0||e>=this._fbo.width||t<0||t>=this._fbo.height?0:(this._fbo.readPixels(e,t,1,1,S.RGBA,F.UNSIGNED_BYTE,U),U[0]/this._progress)}_enable(){this._progress=0;const e=new q;e.pixelFormat=S.RED,e.internalFormat=x.R8,e.wrapMode=P.CLAMP_TO_EDGE,this._fbo=new T(this._rctx,e),this._requestRender()}_disable(){this._fbo=s(this._fbo),this._requestRender()}_invalidate(){this._progress=0,this._requestRenderIfEnabled()}_clear(){this._rctx.bindFramebuffer(this._fbo),this._rctx.setClearColor(0,0,0,0),this._rctx.clear(D.COLOR),this._progress=0}_accumulateShadow(){this._renderToShadowMap(this._bindParameters,this._lightDirections[this._progress++],this._depthRange);const e=this._accumulationTechnique;this._rctx.bindFramebuffer(this._fbo),this._rctx.bindTechnique(e,this._bindParameters,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(e.primitiveType,0,E(this._vao,"geometry"))}_updateCamera(e){const t=this._fbo;if(null==t)return;const i=this._bindParameters.camera;e.equals(i)||i.copyFrom(e),t.resize(e.fullWidth,e.fullHeight),this._opacityFromElevation=1-r(A,v,e.relativeElevation)}_requestRenderIfEnabled(){this._fbo&&this._requestRender()}get test(){}};e([c()],M.prototype,"_progress",void 0),e([c()],M.prototype,"_sampleCount",void 0),e([c()],M.prototype,"_fbo",void 0),e([c()],M.prototype,"_depthRange",void 0),e([c()],M.prototype,"_previewing",void 0),e([c()],M.prototype,"_accumulationRenderer",void 0),e([c()],M.prototype,"_isRefining",null),e([c()],M.prototype,"_isActive",null),e([c()],M.prototype,"canAccumulate",null),e([c()],M.prototype,"_isDoneAccumulating",null),e([c()],M.prototype,"_opacityFromElevation",null),e([c()],M.prototype,"running",null),M=e([_("esri.views.3d.webgl-engine.lib.ShadowAccumulator")],M);const L=6,O="renderView",U=new Uint8Array(4);export{M as ShadowAccumulator};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import has from"../../../../core/has.js";import{clamp as t,lerp as s,acosClamped as e}from"../../../../core/mathUtils.js";import{releaseMaybe as i}from"../../../../core/maybe.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{translate as r,multiply as h,invert as o,lookAt as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as c,create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as d,add as u,scale as
|
|
5
|
+
import has from"../../../../core/has.js";import{clamp as t,lerp as s,acosClamped as e}from"../../../../core/mathUtils.js";import{releaseMaybe as i}from"../../../../core/maybe.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{translate as r,multiply as h,invert as o,lookAt as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as c,create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as d,add as u,scale as m,lerp as _,squaredDistance as f,subtract as g,dot as p,negate as x,normalize as b,copy as w}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as M}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{e as C,c as j,k as T,h as y,s as D}from"../../../../chunks/vec32.js";import{create as H}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as v,t as S}from"../../../../chunks/vec42.js";import{create as R}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ViewingMode as O}from"../../../ViewingMode.js";import{ColorFormat as E,DepthFormat as U}from"../../webgl/formats.js";import{CascadeCamera as F}from"./CascadeCamera.js";import{applyTextureResizeModulo as L,applyTextureResizeFloorModulo as Q}from"./textureUtils.js";import{assert as V,logWithBase as N,verify as A,rayRay2D as B}from"./Util.js";import{TextureType as I,FramebufferBit as W}from"../../../webgl/enums.js";import{Texture as z}from"../../../webgl/Texture.js";var P;!function(t){t[t.Highlight=0]="Highlight",t[t.ExcludeHighlight=1]="ExcludeHighlight"}(P||(P={}));class q{constructor(){this.camera=new F,this.lightMat=l()}}class k{constructor(){this.maxNumCascadesHighQuality=4,this.maxNumCascadesLowQuality=4,this.textureSizeModHighQuality=1.3,this.textureSizeModLowQuality=.9,this.splitSchemeLambda=0}}class G{constructor(t,s){this._fbos=t,this._viewingMode=s,this._enabled=!1,this._snapshots=new Array,this._textureHeight=0,this._numCascades=1,this.settings=new k,this._projectionView=l(),this._projectionViewInverse=l(),this._modelViewLight=l(),this._cascadeDistances=[0,0,0,0,0],this._usedCascadeDistances=R(),this._cascades=[new q,new q,new q,new q],this._lastOrigin=null,this._maxTextureWidth=Math.min(has("esri-mobile")?4096:16384,t.rctx.parameters.maxTextureSize)}dispose(){this.enabled=!1,this.disposeOffscreenBuffers()}get depthTexture(){return this._handle?.getTexture()}get _textureWidth(){return this._textureHeight*this._numCascades}get numCascades(){return this._numCascades}get cascadeDistances(){return v(this._usedCascadeDistances,this._cascadeDistances[0],this._numCascades>1?this._cascadeDistances[1]:1/0,this._numCascades>2?this._cascadeDistances[2]:1/0,this._numCascades>3?this._cascadeDistances[3]:1/0)}disposeOffscreenBuffers(){this._handle=i(this._handle),this._discardSnapshots()}set maxCascades(s){this.settings.maxNumCascadesHighQuality=t(Math.floor(s),1,4)}get maxCascades(){return this.settings.maxNumCascadesHighQuality}set enabled(t){this._enabled=t,t||this.disposeOffscreenBuffers()}get enabled(){return this._enabled}get ready(){return this._enabled&&null!=this.depthTexture}get cascades(){for(let t=0;t<this._numCascades;++t)it[t]=this._cascades[t];return it.length=this._numCascades,it}start(t,s,e,i,a){V(this.enabled);const{near:r,far:h}=Tt(e);this._computeCascadeDistances(r,h,i),this._textureHeight=this._computeTextureHeight(t,a,i),this._setupMatrices(t,s);const{viewMatrix:o,projectionMatrix:n}=t;for(let c=0;c<this._numCascades;++c)this._constructCascade(c,n,o,s);this._lastOrigin=null,this.clear()}finish(){V(this.enabled),this._handle?.detachDepth()}getShadowMapMatrices(t){if(!this._lastOrigin||!C(t,this._lastOrigin)){this._lastOrigin=this._lastOrigin||H(),j(this._lastOrigin,t);for(let s=0;s<this._numCascades;++s){r(at,this._cascades[s].lightMat,t);for(let t=0;t<16;++t)rt[16*s+t]=at[t]}}return rt}moveSnapshot(t){V(this.enabled),this._handle?.detachDepth(),this._snapshots[t]?.release(),this._snapshots[t]=this._handle,this._handle=null,this.clear()}copySnapshot(t){const s=this._handle?.getTexture()?.descriptor;if(!this.enabled||!s)return;this._snapshots[t]?.release();const{width:e,height:i}=s,a=t===P.Highlight?"shadow highlight snapshot":"shadow no highlight snapshot";this._snapshots[t]=this._fbos.acquire(e,i,a,E.RGBA4);const r=this._fbos.rctx;this._bindFbo();const h=r.bindTexture(this._snapshots[t]?.getTexture(),z.TEXTURE_UNIT_FOR_UPDATES);r.gl.copyTexSubImage2D(I.TEXTURE_2D,0,0,0,0,0,e,i),r.bindTexture(h,z.TEXTURE_UNIT_FOR_UPDATES)}getSnapshot(t){return this.enabled?this._snapshots[t]?.getTexture():null}clear(){const t=this._fbos.rctx;this._ensureFbo(),this._bindFbo(),t.setClearColor(1,1,1,1),t.clear(W.COLOR|W.DEPTH)}_computeTextureHeight(t,s,e){const i=Math.min(window.devicePixelRatio,s)/t.pixelRatio,a=e?this.settings.textureSizeModHighQuality:this.settings.textureSizeModLowQuality,r=L(Math.floor(Math.max(t.fullWidth,t.fullHeight)*i*a)),h=Math.min(this._maxTextureWidth,this._numCascades*r);return Q(h/this._numCascades)}_ensureFbo(){this._handle?.fbo?.width===this._textureWidth&&this._handle?.fbo.height===this._textureHeight||(this._handle?.release(),this._handle=this._fbos.acquire(this._textureWidth,this._textureHeight,"shadow map",E.RGBA4)),this._handle?.acquireDepth(U.DEPTH16_BUFFER)}_discardSnapshot(t){this._snapshots[t]=i(this._snapshots[t])}_discardSnapshots(){for(let t=0;t<this._snapshots.length;++t)this._discardSnapshot(t);this._snapshots.length=0}_bindFbo(){const t=this._fbos.rctx;t.unbindTexture(this.depthTexture),t.bindFramebuffer(this._handle?.fbo)}_constructCascade(t,s,e,i){const a=this._cascades[t],o=-this._cascadeDistances[t],n=-this._cascadeDistances[t+1],c=(s[10]*o+s[14])/Math.abs(s[11]*o+s[15]),l=(s[10]*n+s[14])/Math.abs(s[11]*n+s[15]);V(c<l);for(let r=0;r<8;++r){v(J,r%4==0||r%4==3?-1:1,r%4==0||r%4==1?-1:1,r<4?c:l,1);const t=K[r];S(t,J,this._projectionViewInverse),t[0]/=t[3],t[1]/=t[3],t[2]/=t[3]}T(et,K[0]),a.camera.viewMatrix=r(X,this._modelViewLight,et);for(let r=0;r<8;++r)y(K[r],K[r],a.camera.viewMatrix);let d=K[0][2],u=K[0][2];for(let r=1;r<8;++r)d=Math.min(d,K[r][2]),u=Math.max(u,K[r][2]);d-=200,u+=200,a.camera.near=-u,a.camera.far=-d,jt(e,i,d,u,a.camera),h(a.lightMat,a.camera.projectionMatrix,a.camera.viewMatrix);const m=this._textureHeight;a.camera.viewport=[t*m,0,m,m]}_setupMatrices(t,s){h(this._projectionView,t.projectionMatrix,t.viewMatrix),o(this._projectionViewInverse,this._projectionView);const e=this._viewingMode===O.Global?t.eye:D(et,0,0,1);n(this._modelViewLight,[0,0,0],[-s[0],-s[1],-s[2]],e)}_computeCascadeDistances(t,e,i){const a=i?this.settings.maxNumCascadesHighQuality:this.settings.maxNumCascadesLowQuality;this._numCascades=Math.min(1+Math.floor(N(e/t,4)),a);const r=(e-t)/this._numCascades,h=(e/t)**(1/this._numCascades);let o=t,n=t;for(let c=0;c<this._numCascades+1;++c)this._cascadeDistances[c]=s(o,n,this.settings.splitSchemeLambda),o*=h,n+=r}get test(){}}const X=l(),J=R(),K=[];for(let yt=0;yt<8;++yt)K.push(R());const Y=M(),Z=M(),$=M(),tt=M(),st=M(),et=H(),it=[],at=l(),rt=c.concat(c,c,c,c),ht=M(),ot=M(),nt=[M(),M(),M(),M()],ct=M(),lt=M(),dt=M(),ut=M(),mt=M(),_t=M(),ft=M();function gt(t,s,e,i,a,r,h,o){d(ht,0,0);for(let d=0;d<4;++d)u(ht,ht,t[d]);m(ht,ht,.25),d(ot,0,0);for(let d=4;d<8;++d)u(ot,ot,t[d]);m(ot,ot,.25),_(nt[0],t[4],t[5],.5),_(nt[1],t[5],t[6],.5),_(nt[2],t[6],t[7],.5),_(nt[3],t[7],t[4],.5);let n=0,c=f(nt[0],ht);for(let d=1;d<4;++d){const t=f(nt[d],ht);t<c&&(c=t,n=d)}g(ct,nt[n],t[n+4]);const l=ct[0];let M,C;ct[0]=-ct[1],ct[1]=l,g(lt,ot,ht),p(lt,ct)<0&&x(ct,ct),_(ct,ct,lt,e),b(ct,ct),M=C=p(g(dt,t[0],ht),ct);for(let d=1;d<8;++d){const s=p(g(dt,t[d],ht),ct);s<M?M=s:s>C&&(C=s)}w(i,ht),m(dt,ct,M-s),u(i,i,dt);let j=-1,T=1,y=0,D=0;for(let d=0;d<8;++d){g(ut,t[d],i),b(ut,ut);const s=ct[0]*ut[1]-ct[1]*ut[0];s>0?s>j&&(j=s,y=d):s<T&&(T=s,D=d)}A(j>0,"leftArea"),A(T<0,"rightArea"),m(mt,ct,M),u(mt,mt,ht),m(_t,ct,C),u(_t,_t,ht),ft[0]=-ct[1],ft[1]=ct[0];const H=B(i,t[D],_t,u(dt,_t,ft),1,a),v=B(i,t[y],_t,dt,1,r),S=B(i,t[y],mt,u(dt,mt,ft),1,h),R=B(i,t[D],mt,dt,1,o);A(H,"rayRay"),A(v,"rayRay"),A(S,"rayRay"),A(R,"rayRay")}function pt(t,s){return 3*s+t}const xt=M();function bt(t,s){return d(xt,t[s],t[s+3]),xt}const wt=M(),Mt=a();function Ct(t,s,e,i,a){g(wt,e,i),m(wt,wt,.5),Mt[0]=wt[0],Mt[1]=wt[1],Mt[2]=0,Mt[3]=wt[1],Mt[4]=-wt[0],Mt[5]=0,Mt[6]=wt[0]*wt[0]+wt[1]*wt[1],Mt[7]=wt[0]*wt[1]-wt[1]*wt[0],Mt[8]=1,Mt[pt(0,2)]=-p(bt(Mt,0),t),Mt[pt(1,2)]=-p(bt(Mt,1),t);let r=p(bt(Mt,0),e)+Mt[pt(0,2)],h=p(bt(Mt,1),e)+Mt[pt(1,2)],o=p(bt(Mt,0),i)+Mt[pt(0,2)],n=p(bt(Mt,1),i)+Mt[pt(1,2)];r=-(r+o)/(h+n),Mt[pt(0,0)]+=Mt[pt(1,0)]*r,Mt[pt(0,1)]+=Mt[pt(1,1)]*r,Mt[pt(0,2)]+=Mt[pt(1,2)]*r,r=1/(p(bt(Mt,0),e)+Mt[pt(0,2)]),h=1/(p(bt(Mt,1),e)+Mt[pt(1,2)]),Mt[pt(0,0)]*=r,Mt[pt(0,1)]*=r,Mt[pt(0,2)]*=r,Mt[pt(1,0)]*=h,Mt[pt(1,1)]*=h,Mt[pt(1,2)]*=h,Mt[pt(2,0)]=Mt[pt(1,0)],Mt[pt(2,1)]=Mt[pt(1,1)],Mt[pt(2,2)]=Mt[pt(1,2)],Mt[pt(1,2)]+=1,r=p(bt(Mt,1),s)+Mt[pt(1,2)],h=p(bt(Mt,2),s)+Mt[pt(2,2)],o=p(bt(Mt,1),e)+Mt[pt(1,2)],n=p(bt(Mt,2),e)+Mt[pt(2,2)],r=-.5*(r/h+o/n),Mt[pt(1,0)]+=Mt[pt(2,0)]*r,Mt[pt(1,1)]+=Mt[pt(2,1)]*r,Mt[pt(1,2)]+=Mt[pt(2,2)]*r,r=p(bt(Mt,1),s)+Mt[pt(1,2)],h=p(bt(Mt,2),s)+Mt[pt(2,2)],o=-h/r,Mt[pt(1,0)]*=o,Mt[pt(1,1)]*=o,Mt[pt(1,2)]*=o,a[0]=Mt[0],a[1]=Mt[1],a[2]=0,a[3]=Mt[2],a[4]=Mt[3],a[5]=Mt[4],a[6]=0,a[7]=Mt[5],a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=Mt[6],a[13]=Mt[7],a[14]=0,a[15]=Mt[8]}function jt(t,s,i,a,r){const h=1/K[0][3],o=1/K[4][3];V(h<o);let n=h+Math.sqrt(h*o);const c=Math.sin(e(t[2]*s[0]+t[6]*s[1]+t[10]*s[2]));n/=c,gt(K,n,c,Y,Z,$,tt,st),Ct(Y,Z,tt,st,r.projectionMatrix),r.projectionMatrix[10]=2/(i-a),r.projectionMatrix[14]=-(i+a)/(i-a)}function Tt(t){let{near:s,far:e}=t;return s<2&&(s=2),e<2&&(e=2),s>=e&&(s=2,e=4),{near:s,far:e}}export{G as ShadowMap,P as SnapshotSlot};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Collection.js";import{deg2rad as s}from"../../../../core/mathUtils.js";import{disposeMaybe as i}from"../../../../core/maybe.js";import{watch as r,initial as o}from"../../../../core/reactiveUtils.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{translate as h,fromTranslation as c,scale as l,mul as d}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{z as p,p as m}from"../../../../chunks/vec32.js";import{create as f,fromValues as w}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ShaderOutput as _}from"../core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as g,ConsumesDepth as v,ConsumesNone as x}from"../effects/RenderPlugin.js";import{RenderSlot as
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Collection.js";import{deg2rad as s}from"../../../../core/mathUtils.js";import{disposeMaybe as i}from"../../../../core/maybe.js";import{watch as r,initial as o}from"../../../../core/reactiveUtils.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{translate as h,fromTranslation as c,scale as l,mul as d}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{z as p,p as m}from"../../../../chunks/vec32.js";import{create as f,fromValues as w}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ShaderOutput as _}from"../core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as g,ConsumesDepth as v,ConsumesNone as x}from"../effects/RenderPlugin.js";import{RenderSlot as M}from"./RenderSlot.js";import{ViewshedShadowMap as b}from"./ViewshedShadowMap.js";import{V as j}from"../../../../chunks/Viewshed.glsl.js";import{ViewshedTechnique as P}from"../shaders/ViewshedTechnique.js";import{ViewshedTechniqueConfiguration as C}from"../shaders/ViewshedTechniqueConfiguration.js";let S=class extends g{get shadowMap(){return this._shadowMap}get enabled(){return this._viewsheds.length>0}get _contentPixelRatio(){return this.view.state.contentPixelRatio}constructor(e,s){super(e),this._pluginContext=null,this.renderHighQuality=!1,this._passParameters=new j,this._configuration=new C,this._viewsheds=new t,this.produces=new Map([[M.VIEWSHED,()=>!0]]),this._renderShadowMap=s}initialize(){this.addHandles([r((()=>this.view.resolutionScale),(e=>{const t=this._shadowMap;null!=t&&(t.settings.textureSizeQuality=e)}),o)])}destroy(){this.uninitializeRenderContext()}consumes(){return this.enabled?v:x}initializeRenderContext(e){this._pluginContext=e,this._shadowMap=new b(this.fboCache),this._shadowMap.enabled=!0}renderNode(e,t,s){const{bindParameters:i,rctx:r}=e;if(!this.enabled||!i.depth||null==s||null==this._pluginContext)return;const o=this._setupPassParameters(s),n=this._ensureTechnique(o,this._pluginContext.techniques);if(!n.compiled)return void this._pluginContext.requestRender();const a=e.rctx.getBoundFramebufferObject();for(const h of this._viewsheds){const t=this._renderViewshedShadowCubeMap(i,h),s=this._shadowMap;if(!t||null==s?.depthTexture||s.isTextureZero)continue;const o=this._setupViewshedParameters(h,i.camera);r.bindTechnique(n,i,o),e.rctx.bindFramebuffer(a),r.screen.draw()}}uninitializeRenderContext(){this._shadowMap=i(this._shadowMap),this._pluginContext?.techniques.release(this._technique),this._technique=this._pluginContext=null}updateViewsheds(e){const s=this._viewsheds,{removes:i,adds:r}=e;if(null!=i&&(t.isCollection(i)?s.removeMany(i):s.remove(i)),null!=r)if(t.isCollection(r)){const e=r.filter((e=>!s.includes(e)));s.addMany(e)}else s.includes(r)||s.add(r)}_ensureTechnique(e,t){return null!=this._technique&&this._configuration.hasNormals===e||(this._configuration.hasNormals=e,this._technique=t.releaseAndAcquire(P,this._configuration,this._technique)),this._technique}_renderViewshedShadowCubeMap(e,t){const s=this._shadowMap;if(!s?.enabled)return!1;const i=s.start(e.camera,t,this.renderHighQuality,this._contentPixelRatio);if(i)for(const r of s.faces)this._renderShadowMap(e,r,_.ViewshedShadow);return s.finish(),i}_setupPassParameters(e){return this._passParameters.shadowMap=this._shadowMap??this._passParameters.shadowMap,this._passParameters.normals=e.get("normals")?.getTexture(),null!=this._passParameters.normals}_setupViewshedParameters(e,t){const i=this._shadowMap;if(null==i)return this._passParameters;const r=this._passParameters,o=e.observerRenderSpace;r.localOrigin=o,r.fovs=[s(e.horizontalFieldOfView),s(e.verticalFieldOfView)],r.headingAndTilt=[s(e.heading),s(e.tiltParallelToSurface)],r.upVector=e.tiltedUpVector;const n=V(e.targetRenderSpace,o);r.targetVector=n;const a=new Array,c=new Array;for(let s=0;s<i.numActiveFaces;s++)h(R,i.viewshedViewMatrices[s],o),a.push(...R),y(i.viewshedProjectionMatrices[s],R,T),c.push(...T);return r.viewMatrices=a,r.projectionMatrices=c,r.volumeOffset=q(e,this.view,t.eye),r}get test(){return{viewsheds:this._viewsheds,shadowMap:this.shadowMap}}};function V(e,t){const s=f();return p(s,e,t)}function y(e,t,s){const i=w(.5,.5,.5);return c(s,i),l(s,s,i),d(s,s,e),d(s,s,t),s}function q(e,t,s){if(null==e)return 0;const{observerRenderSpace:i,targetRenderSpace:r}=e,o=m(s,i)>m(s,r)?e.observer:e.target;return t.pixelSizeAt(o)}e([n()],S.prototype,"_pluginContext",void 0),e([n()],S.prototype,"fboCache",void 0),e([n()],S.prototype,"view",void 0),e([n()],S.prototype,"shadowMap",null),e([n()],S.prototype,"_contentPixelRatio",null),S=e([a("esri.views.3d.webgl-engine.lib.Viewshed")],S);const R=u(),T=u();export{S as Viewshed,q as computeOffsetScale};
|