@arcgis/core 5.1.0-next.67 → 5.1.0-next.68

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.
Files changed (132) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{2e1aecdf59ad3421bbad.js → 0e2e4cb34ac6aac88ebf.js} +1 -1
  3. package/assets/esri/core/workers/chunks/{38816f95e801f1c5bbad.js → 1c742bfe3b0aa51823d1.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{27262083d37fe623ca9c.js → 210629f3c28d4339c655.js} +1 -1
  5. package/assets/esri/core/workers/chunks/27643750dce502fedef3.js +1 -0
  6. package/assets/esri/core/workers/chunks/29878b52aa12b3815230.js +1 -0
  7. package/assets/esri/core/workers/chunks/{7fb9a5bc22d7581f1d20.js → 29b1a4ce7646b403008e.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{eb7392799a01c2a8497a.js → 2da62687ff678b690839.js} +1 -1
  9. package/assets/esri/core/workers/chunks/2fd4220131bfc3f5e2dd.js +1 -0
  10. package/assets/esri/core/workers/chunks/{a118de5a163ae42bee60.js → 333a0038d782d8a34d58.js} +1 -1
  11. package/assets/esri/core/workers/chunks/38328a785365c4783b1e.js +1 -0
  12. package/assets/esri/core/workers/chunks/{e268e5be096392c2e69b.js → 3eef3c2e94aa2a00d76a.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{a5b395e518e4c5fc95d0.js → 40d6ad030614099155cd.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{427183ea93e759943a78.js → 43678e08a3d9d51c2a6d.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{af007ec833ab49e4c958.js → 453280ea87a696a4df81.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{921c30b7f4dfc3e018d9.js → 4605a68e40c5c3ac6e3e.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{abd5c1d4b7b91d9ea1eb.js → 478879ba965798f61bf3.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{aa69cbaa38b49677ddff.js → 499b899bf88aaf29230d.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{8a0f254d45d00b293479.js → 49fb9c47070641bce9a9.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{f8eb14170f927aecfbc8.js → 4f9d027055f3a616173c.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{4e7b084f7104deea1ddb.js → 53b797e384be9628fc94.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{ff0cb1eec14d34214f12.js → 5fe97253f80c797fad7f.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{2f8ed1e7c1b10cb30972.js → 678c9f15712cf3d3bb9e.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{4005d37d03c834da7629.js → 68a313155ddc29bd024d.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{684ea7f75a7a5fb52cde.js → 6a21c9a4aeebe806ea39.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{0f196ec93925dfefc69a.js → 6bb090f3e5c18604cb39.js} +1 -1
  27. package/assets/esri/core/workers/chunks/73e000cc3c4da10e9937.js +1 -0
  28. package/assets/esri/core/workers/chunks/{79df97e3f5975b42dc4d.js → 75669912cddcb5db52c8.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{749c368f5cc2366716f1.js → 7bd1d624f4f4a11a31e8.js} +1 -1
  30. package/assets/esri/core/workers/chunks/7cadfd7444a2a05cf2fb.js +1 -0
  31. package/assets/esri/core/workers/chunks/{1515824f11ef5ab95378.js → 7d0350f459844162d3a7.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{4d069a0ebadb9c53b550.js → 7e39e9d4d68843b60e4c.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{8d5bc17557a31ed79ed8.js → 81750c5177d8d52a3e05.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{7d73472696ec76458758.js → 81b2985b83be8f8f1090.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{a8ef9ed9b59de95f2b23.js → 823127b23bec07e1f9d0.js} +2 -2
  36. package/assets/esri/core/workers/chunks/{b8bf3e8b8b870f69f231.js → 8969788c57bcc11bf77b.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{4e7bb224bde9e5039263.js → 8b8f391f27774aec6db9.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{0e90e9ea1ad587eb3495.js → 8ea4584e07ccc85caabd.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{6c40b3c2b9071edb758d.js → 8fb336c2066113300d0d.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{b5648a0b92cf1a2c81ad.js → 915a5e8aecf25f3bc72b.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{7ffcd308087c35adda04.js → 9bd713d96502ddc2ce25.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{9622a83b29acb768fcb5.js → a25acccda8febac71a3d.js} +1 -1
  43. package/assets/esri/core/workers/chunks/a30815a0155a3b8790b4.js +1 -0
  44. package/assets/esri/core/workers/chunks/{90cef6f96df7dc27db39.js → a43decc8ede8b4910553.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{dd26e3a29161ea411e41.js → a94bd20551c1179c7ec5.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{fa7ae035472540999721.js → b2120c4c56656be941ae.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{a59db907ec1e31002100.js → b85c9ceeece1bae67a16.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{c4e936879c6cb25cf586.js → b8a11d32a4847513619b.js} +1 -1
  49. package/assets/esri/core/workers/chunks/bbaf1d9835671c0165ca.js +1 -0
  50. package/assets/esri/core/workers/chunks/{cb9185ed31109781fe59.js → bc887bd62579dba81e2b.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{7e9b790fe01b89acdf6d.js → bcefdf9753d9d2f6f1be.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{927773ed23b1fc245bf7.js → be61ea8e1883b915bbb1.js} +1 -1
  53. package/assets/esri/core/workers/chunks/c02ba921c0a32d2021e3.js +1 -0
  54. package/assets/esri/core/workers/chunks/{9a95c28d4a3b3b4b2c50.js → c49c078be08c38a6088d.js} +1 -1
  55. package/assets/esri/core/workers/chunks/{d94dfb2ce31e59b3306b.js → c79827f879d1d58d3f1b.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{56036327e721f9c42b33.js → c7ca47f5d4b2f3885239.js} +1 -1
  57. package/assets/esri/core/workers/chunks/{d83ac66478a419e08af6.js → d3d9d40556c847bba1a7.js} +1 -1
  58. package/assets/esri/core/workers/chunks/{789357e0f79823f145dd.js → d4e55eb75fa4d3ac1e84.js} +1 -1
  59. package/assets/esri/core/workers/chunks/{fee31d9297648219375d.js → d8d7331600d93bbca2b4.js} +1 -1
  60. package/assets/esri/core/workers/chunks/{e907acaec4c62adac2f2.js → e0fe23019410dea8236b.js} +1 -1
  61. package/assets/esri/core/workers/chunks/{4f847a426973bd350c11.js → e5801b0f3893d4d4f5b0.js} +1 -1
  62. package/assets/esri/core/workers/chunks/{6ab8ed12d162d79a8c55.js → e62d08f5488a74cbda82.js} +1 -1
  63. package/assets/esri/core/workers/chunks/{b4fb4484fa39eede1f62.js → e66b9d00d02fc08cbb2d.js} +1 -1
  64. package/assets/esri/core/workers/chunks/{69520cad347947b09f21.js → ecb7ede6a8e6c05e4c6c.js} +1 -1
  65. package/assets/esri/core/workers/chunks/ef9d74f8d5a502fda809.js +1 -0
  66. package/assets/esri/core/workers/chunks/f0bc5e8e44d53b73d431.js +1 -0
  67. package/assets/esri/core/workers/chunks/f11ea0d3de93ec0392af.js +1 -0
  68. package/assets/esri/core/workers/chunks/{cc8e6d1eb90221103023.js → f1e5626a0cc1631a1efb.js} +1 -1
  69. package/assets/esri/core/workers/chunks/{afea4a4b072c329d3749.js → fc64ae69581e4c38fa8a.js} +1 -1
  70. package/assets/esri/core/workers/chunks/{3f8e8f83ebda07d29ca8.js → fd6bbe47773bbd9f7dd9.js} +1 -1
  71. package/assets/esri/core/workers/chunks/{8418ad9ad7b6481ebe82.js → ffb70e9358c0b171a315.js} +1 -1
  72. package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core-simd.wasm +0 -0
  73. package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core.wasm +0 -0
  74. package/chunks/arcgis-knowledge-client-core-simd.js +1 -1
  75. package/chunks/arcgis-knowledge-client-core.js +1 -1
  76. package/config.js +1 -1
  77. package/core/string.js +1 -1
  78. package/geometry/support/lineSegment.js +1 -1
  79. package/kernel.js +1 -1
  80. package/layers/GroupLayer.js +1 -1
  81. package/layers/SceneLayer.js +1 -1
  82. package/layers/VoxelWasmPerSceneView.js +1 -1
  83. package/layers/mixins/OperationalLayer.js +1 -1
  84. package/layers/support/arcgisLayers.js +1 -1
  85. package/layers/support/layersCreator.js +1 -1
  86. package/layers/support/{lazyLayerLoader.js → layersLoader.js} +1 -1
  87. package/layers/support/layersMapping.js +2 -0
  88. package/package.json +2 -2
  89. package/popup/Feature.d.ts +3 -3
  90. package/popup/Features.d.ts +1 -13
  91. package/popup/Features.js +1 -1
  92. package/popup/actionUtils.js +1 -1
  93. package/portal/support/portalLayers.js +1 -1
  94. package/rest/knowledgeGraph/GraphQueryResultHeader.js +1 -1
  95. package/rest/knowledgeGraph/wasmInterface/wasmToQueryResponseObjFactories.js +1 -1
  96. package/support/revision.js +1 -1
  97. package/views/2d/engine/webgl/mesh/factories/ResourceProxy.js +1 -1
  98. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  99. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  100. package/views/3d/support/gaussianSplatting/GaussianSplatIntersectionHandler.js +1 -1
  101. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizer.js +1 -1
  102. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  103. package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
  104. package/views/3d/webgl-engine/lib/RenderFeature.js +1 -1
  105. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  106. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  107. package/views/3d/webgl.js +1 -1
  108. package/views/SelectionManager.d.ts +1 -1
  109. package/views/VideoView.js +1 -1
  110. package/views/draw/DrawManipulator.js +1 -1
  111. package/views/draw/DrawManipulator3D.js +2 -0
  112. package/views/draw/DrawTool.js +1 -1
  113. package/views/draw/support/managers/InteractiveHandleManager.js +1 -1
  114. package/webscene/spec-certification/api.js +1 -1
  115. package/widgets/Compass/CompassViewModel.d.ts +1 -0
  116. package/widgets/Compass/CompassViewModel.js +1 -1
  117. package/widgets/Compass.js +1 -1
  118. package/assets/esri/core/workers/chunks/12294f8c32c34788b6de.js +0 -1
  119. package/assets/esri/core/workers/chunks/151c2766a4cacc6adbd6.js +0 -1
  120. package/assets/esri/core/workers/chunks/1984c0f037065acd21d3.js +0 -1
  121. package/assets/esri/core/workers/chunks/4fd1bf82939e3bb9bc03.js +0 -1
  122. package/assets/esri/core/workers/chunks/61794a861a9209b72622.js +0 -1
  123. package/assets/esri/core/workers/chunks/644dd906bee3ef465ec0.js +0 -1
  124. package/assets/esri/core/workers/chunks/6f079f1fd6d00d2d174c.js +0 -1
  125. package/assets/esri/core/workers/chunks/751f3cfb000045ac78bb.js +0 -1
  126. package/assets/esri/core/workers/chunks/a80eb704e75d13732878.js +0 -1
  127. package/assets/esri/core/workers/chunks/c72e90a952543d06d84b.js +0 -1
  128. package/assets/esri/core/workers/chunks/e9f2b573f482718306e6.js +0 -1
  129. package/assets/esri/core/workers/chunks/f62e42659b406435573d.js +0 -1
  130. package/layers/mixins/operationalLayerModuleMap.js +0 -2
  131. package/layers/mixins/operationalLayers.js +0 -2
  132. /package/assets/esri/core/workers/chunks/{a8ef9ed9b59de95f2b23.js.LICENSE.txt → 823127b23bec07e1f9d0.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{releaseMaybe as r}from"../../../../../core/maybe.js";import{property as t,subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{ZEROS as n}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{RenderNodeOutput as i}from"../../../webgl.js";import s from"../../../webgl/RenderNode.js";import{If as a,glsl as c}from"../../core/shaderModules/glsl.js";import{Pos2Locations as u}from"../../lib/DefaultVertexBufferLayouts.js";import{floatBlendReductionFactor as l}from"../../shaders/oitResolution.glsl.js";import{checkWebGLError as h}from"../../../../webgl/checkWebGLError.js";import{ColorAttachment0 as p,SizedPixelFormat as f,DataType as d}from"../../../../webgl/enums.js";let m=class extends s{constructor(e){super(e),this.destroyedCB=null,this.produces=i.FINAL,this.consumes={required:[i.FINAL]},this.clearColor=n,this._focusedFBOType=7,this._programs=new Map}destroy(){this._programs.clear(),this.destroyedCB()}render(e){const r=e.find(({name:e})=>e===i.FINAL);if(!this._focusedTexture)return r;const t=this.renderingContext,o=t.boundFramebuffer;t.bindFramebuffer(r.fbo),t.setClearColor(0,0,0,0),t.clear(16384);const n=this._focusedTexture.attachment,s=[v(n)],a=this._ensureProgram(t,!1,s);return t.useProgram(a),t.bindTexture(n,0),a.setUniform1i("colorTex0",0),a.setUniform1i("inputType",this._focusedFBOType),3===this._focusedFBOType&&a.setUniform2fv("nearFar",this.camera.nearFar),t.screen.draw(),t.bindFramebuffer(o),r}getDownscaledFBO(e,r,t,o,n){r&&(o=e.width,n=e.height);const i="linear depth"===t||t.includes("shadow"),s="overlay highlight"===t||"highlights"===t||"highlight mix"===t,a="highlight coverage"===t,c=e.colorTexture?.descriptor,u=c?.internalFormat,l=[],f=new Array,d=new Array;e.colorAttachments.forEach((r,t)=>{const o=e.getColorTexture(r);if(o){const e=v(o);l.push(e);const{descriptor:r}=o;"float"!==e||r.hasMipmap||r.isImmutable||(o.generateMipmap(),f[t]=!0)}if(t>0){const t=e.getColorTexture(r)?.descriptor.internalFormat;return void d.push(F(t))}d.push(i?0:s?1:a?2:F(u))});const m=this.renderingContext,{depthStencilTexture:g}=e,x=this._ensureProgram(m,null!=g,l),T=this.fboCache.acquire(o,n,"fbo visualizer");m.useProgram(x);const b=m.boundFramebuffer;m.bindFramebuffer(T.fbo);const C=[];e.colorAttachments.forEach((r,t)=>{const o=`colorTex${t.toFixed()}`;m.bindTexture(e.getColorTexture(r),t),x.setUniform1i(o,t),t>0&&T.acquireColor(p+t,5,"fbo visualizer"),C.push(r)});const R=g?.descriptor.linearFilterDepth??!1;if(g){const r=e.colorAttachments.length;g.setShadowFiltering(!1),m.bindTexture(g,r),x.setUniform1i("depthTex",r);const t=p+r;t>p&&T.acquireColor(t,5,"fbo visualizer"),C.push(t)}m.gl.drawBuffers(C),h(m.gl);const $=m.getViewport();return m.setViewport(0,0,o,n),m.setClearColor(0,0,0,0),m.clear(16384),m.setBlendingEnabled(!0),m.setBlendFunction(1,771),x.setUniform1iv("inputTypes",d.length>0?d:[7]),x.setUniform2fv("nearFar",this.camera.nearFar),m.screen.draw(),h(m.gl),m.bindFramebuffer(b),m.setViewport($.x,$.y,$.width,$.height),r&&(this._focusedTexture?.release(),this._focusedTexture=T.getAttachment(p),this._focusedTexture?.retain(),this._focusedFBOType=d[0]),e.colorAttachments.forEach((r,t)=>{if(f[t]){const t=e.getColorTexture(r);t?.clearMipmap()}}),g&&g.setShadowFiltering(R),T}clearFocusedFBO(){this._focusedTexture=r(this._focusedTexture)}getPreviewContent(e,r,t,o){const n=this.renderingContext,i=o.includes("\ndepth"),s=this.fboCache.acquire(e,r,"fbo visualizer"),a=n.boundFramebuffer;n.bindFramebuffer(s?.fbo);const c=n.getViewport();n.setViewport(0,0,e,r),n.setClearColor(this.clearColor[0],this.clearColor[1],this.clearColor[2],this.clearColor[3]),n.clear(16384),n.setBlendingEnabled(!0),n.setBlendFunction(1,771);const u=t.attachment,l=this._ensureProgram(n,!1,[v(u)]);n.useProgram(l),n.bindTexture(u,0),l.setUniform1i("colorTex0",0),l.setUniform1iv("inputTypes",[i||u.descriptor.internalFormat!==f.RGBA16F?7:5]),n.screen.draw();const p=new ImageData(new Uint8ClampedArray(e*r*4),e,r);return n.gl.readPixels(0,0,e,r,6408,d.UNSIGNED_BYTE,new Uint8Array(p.data.buffer)),h(n.gl),n.bindFramebuffer(a),n.setViewport(c.x,c.y,c.width,c.height),s?.release(),p}_ensureProgram(e,r,t){const o=x({hasDepthAttachment:r,colorSamplerTypes:t}),n=this._programs.get(o);if(n)return n;const i="#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 }",s=e=>{let r="";for(let t=0;t<e.length;++t){const o=e[t];r+=`layout(location = ${c.int(t)}) out vec4 fragColor${c.int(t)};\n uniform ${g(o)} colorTex${c.int(t)};`}return r},h=e=>e.reduce((e,r,t)=>e+`{\n int inputType = inputTypes[${t}];\n if (inputType == ${3..toFixed()}) {\n fragColor${t} = vec4(vec3(texture(colorTex${t}, uv).r), 1.0);\n } else if (inputType == ${4..toFixed()}) {\n fragColor${t} = vec4(texture(colorTex${t}, uv).rg, 0.0, 1.0);\n } else if (inputType == ${(0).toFixed()}) {\n float depth = 1.0 - ((-linearDepthFromTexture(colorTex${t}, uv) - nearFar[0]) / (nearFar[1] - nearFar[0]));\n fragColor${t} = vec4(vec3(depth), depth >= 0.999 ? 0.0 : 1.0);\n } else if (inputType == ${5..toFixed()}) {\n // Divide F16 by floatBlendOutputScale to get similar previews as in the OIT8 pipeline\n fragColor${t} = vec4(texture(colorTex${t}, uv).rgb, 1.0) / ${l.toFixed(1)};\n } else if (inputType == ${1..toFixed()}) {\n fragColor${t} = vec4(texture(colorTex${t}, uv)) * 255.0;\n fragColor${t} = vec4(fragColor${t}.rgb / fragColor${t}.a, fragColor${t}.a);\n } else if(inputType == ${2..toFixed()}) {\n vec2 texDim = vec2(textureSize(colorTex${t}, 0));\n ivec2 iuv = ivec2(uv*texDim);\n uvec2 hh = uvec2(texelFetch(colorTex${t},iuv,0).rg);\n fragColor${t} = vec4(\n ((hh & uvec2(0x55u)) != uvec2(0u)) ? 1.0 : 0.0,\n ((hh & uvec2(0xaau)) != uvec2(0u)) ? 1.0 : 0.0,\n 0.0,\n 1.0);\n } else {\n fragColor${t} = vec4(texture(colorTex${t}, uv));\n }\n }`,""),p=t.length,f=`#version 300 es\n precision highp float;\n precision highp usampler2D;\n\n in vec2 uv;\n ${s(t)}\n ${a(r,`layout(location = ${c.int(p)}) out vec4 fragDepth;\n uniform sampler2D depthTex;`)}\n\n uniform int inputTypes[${t.length||1}];\n uniform vec2 nearFar;\n\n // Factors to convert rgba back to float\n const vec4 RGBA_2_FLOAT_FACTORS = vec4(\n 255.0 / (256.0),\n 255.0 / (256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0 * 256.0)\n );\n\n\n float rgbaToFloat(vec4 rgba) {\n // Convert components from 0->1 back to 0->255 and then add the components together with their corresponding\n // fixed point factors, i.e. (256^1, 256^2, 256^3, 256^4)\n return dot(rgba, RGBA_2_FLOAT_FACTORS);\n }\n\n float linearDepthFromFloat(float depth) {\n depth = pow(depth, 0.2);\n return -(depth * (nearFar[1] - nearFar[0]) + nearFar[0]);\n }\n\n float linearDepthFromRGBA(vec4 depth) {\n return linearDepthFromFloat(rgbaToFloat(depth));\n }\n\n ${"float"===t[0]?"float linearDepthFromTexture(sampler2D depthTex, vec2 uv) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(depthTex, 0)));\n return linearDepthFromRGBA(texelFetch(depthTex, iuv, 0));\n }":"float linearDepthFromTexture(usampler2D depthTex, vec2 uv) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(depthTex, 0)));\n return linearDepthFromRGBA(vec4(texelFetch(depthTex, iuv, 0)) * 255.0);\n }"}\n\n void main() {\n ${h(t)}\n ${a(r,"float depth = 1.0 - pow(texture(depthTex, uv).r, 10.0);\n fragDepth = vec4(vec3(depth), depth < 0.000001 ? 0.0 : 1.0);")}\n }`,d=e.programCache.get(i,f,u);return this._programs.set(o,d),d}};function g(e){switch(e){case"float":return"sampler2D";case"uint":return"usampler2D";case"int":return"isampler2D"}}function v(e){if(!e)return"float";const{internalFormat:r}=e.descriptor;switch(r){case f.R8I:case f.R16I:case f.R32I:case f.RG8I:case f.RG16I:case f.RG32I:case f.RGB8I:case f.RGB16I:case f.RGB32I:case f.RGBA8I:case f.RGBA16I:case f.RGBA32I:return"int";case f.R8UI:case f.R16UI:case f.R32UI:case f.RG8UI:case f.RG16UI:case f.RG32UI:case f.RGB8UI:case f.RGB16UI:case f.RGB32UI:case f.RGBA8UI:case f.RGBA16UI:case f.RGBA32UI:return"uint";default:return"float"}}function x(e){const{hasDepthAttachment:r,colorSamplerTypes:t}=e;return`${r?"Depth":""}${t.reduceRight((e,r)=>e+`|C${r}`,"")}`}function F(e){switch(e){case f.R16F:case f.R32F:case f.R8:return 3;case f.RG8:return 4;case f.RGBA16F:return 5;case f.RG8UI:return 6;default:return 7}}e([t()],m.prototype,"destroyedCB",void 0),e([t()],m.prototype,"produces",void 0),e([t()],m.prototype,"consumes",void 0),e([t()],m.prototype,"clearColor",void 0),m=e([o("esri.views.3d.webgl-engine.effects.debug.RenderNodeVisualizerNode")],m);export{m as RenderNodeVisualizerNode};
2
+ import{__decorate as e}from"tslib";import{releaseMaybe as r}from"../../../../../core/maybe.js";import{property as t,subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{ZEROS as n}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{RenderNodeOutput as i}from"../../../webgl.js";import s from"../../../webgl/RenderNode.js";import{If as a,glsl as c}from"../../core/shaderModules/glsl.js";import{Pos2Locations as u}from"../../lib/DefaultVertexBufferLayouts.js";import{floatBlendReductionFactor as l}from"../../shaders/oitResolution.glsl.js";import{checkWebGLError as h}from"../../../../webgl/checkWebGLError.js";import{ColorAttachment0 as p,SizedPixelFormat as d,DataType as f}from"../../../../webgl/enums.js";let m=class extends s{constructor(e){super(e),this.destroyedCB=null,this.produces=i.FINAL,this.consumes={required:[i.FINAL]},this.clearColor=n,this._focusedFBOType=7,this._programs=new Map}destroy(){this._programs.clear(),this.destroyedCB()}render(e){const r=e.find(({name:e})=>e===i.FINAL);if(!this._focusedTexture)return r;const t=this.renderingContext,o=t.boundFramebuffer;t.bindFramebuffer(r.fbo),t.setClearColor(0,0,0,0),t.clear(16384);const n=this._focusedTexture.attachment,s=[v(n)],a=this._ensureProgram(t,!1,s);return t.useProgram(a),t.bindTexture(n,0),a.setUniform1i("colorTex0",0),a.setUniform1i("inputType",this._focusedFBOType),3===this._focusedFBOType&&a.setUniform2fv("nearFar",this.camera.nearFar),t.screen.draw(),t.bindFramebuffer(o),r}getDownscaledFBO(e,r,t,o,n){(t?.startsWith(`${r}\n`)??!1)&&(o=e.width,n=e.height);const i="linear depth"===r||r.includes("shadow"),s="overlay highlight"===r||"highlights"===r||"highlight mix"===r,a="highlight coverage"===r,c=e.colorTexture?.descriptor,u=c?.internalFormat,l=[],d=new Array,f=new Array;e.colorAttachments.forEach((r,t)=>{const o=e.getColorTexture(r);if(o){const e=v(o);l.push(e);const{descriptor:r}=o;"float"!==e||r.hasMipmap||r.isImmutable||(o.generateMipmap(),d[t]=!0)}if(t>0){const t=e.getColorTexture(r)?.descriptor.internalFormat;return void f.push(F(t))}f.push(i?0:s?1:a?2:F(u))});const m=this.renderingContext,{depthStencilTexture:g}=e,x=this._ensureProgram(m,null!=g,l),b=this.fboCache.acquire(o,n,"fbo visualizer");m.useProgram(x);const $=m.boundFramebuffer;m.bindFramebuffer(b.fbo);const C=[];e.colorAttachments.forEach((r,t)=>{const o=`colorTex${t.toFixed()}`;m.bindTexture(e.getColorTexture(r),t),x.setUniform1i(o,t),t>0&&b.acquireColor(p+t,5,"fbo visualizer"),C.push(r)});const R=g?.descriptor.linearFilterDepth??!1;if(g){const r=e.colorAttachments.length;g.setShadowFiltering(!1),m.bindTexture(g,r),x.setUniform1i("depthTex",r);const t=p+r;t>p&&b.acquireColor(t,5,"fbo visualizer"),C.push(t)}m.gl.drawBuffers(C),h(m.gl);const y=m.getViewport();return m.setViewport(0,0,o,n),m.setClearColor(0,0,0,0),m.clear(16384),m.setBlendingEnabled(!0),m.setBlendFunction(1,771),x.setUniform1iv("inputTypes",f.length>0?f:[7]),x.setUniform2fv("nearFar",this.camera.nearFar),m.screen.draw(),h(m.gl),m.bindFramebuffer($),m.setViewport(y.x,y.y,y.width,y.height),e.colorAttachments.forEach((o,n)=>{const i=e.getColorTexture(o);d[n]&&i?.clearMipmap(),t===T(r,e,o,!1)&&(this._focusedTexture?.release(),this._focusedTexture=b.getAttachment(o),this._focusedTexture?.retain(),this._focusedFBOType=f[n])}),g&&g.setShadowFiltering(R),b}clearFocusedFBO(){this._focusedTexture=r(this._focusedTexture)}getPreviewContent(e,r,t,o){const n=this.renderingContext,i=o.includes("\ndepth"),s=this.fboCache.acquire(e,r,"fbo visualizer"),a=n.boundFramebuffer;n.bindFramebuffer(s?.fbo);const c=n.getViewport();n.setViewport(0,0,e,r),n.setClearColor(this.clearColor[0],this.clearColor[1],this.clearColor[2],this.clearColor[3]),n.clear(16384),n.setBlendingEnabled(!0),n.setBlendFunction(1,771);const u=t.attachment,l=this._ensureProgram(n,!1,[v(u)]);n.useProgram(l),n.bindTexture(u,0),l.setUniform1i("colorTex0",0),l.setUniform1iv("inputTypes",[i||u.descriptor.internalFormat!==d.RGBA16F?7:5]),n.screen.draw();const p=new ImageData(new Uint8ClampedArray(e*r*4),e,r);return n.gl.readPixels(0,0,e,r,6408,f.UNSIGNED_BYTE,new Uint8Array(p.data.buffer)),h(n.gl),n.bindFramebuffer(a),n.setViewport(c.x,c.y,c.width,c.height),s?.release(),p}_ensureProgram(e,r,t){const o=x({hasDepthAttachment:r,colorSamplerTypes:t}),n=this._programs.get(o);if(n)return n;const i="#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 }",s=e=>{let r="";for(let t=0;t<e.length;++t){const o=e[t];r+=`layout(location = ${c.int(t)}) out vec4 fragColor${c.int(t)};\n uniform ${g(o)} colorTex${c.int(t)};`}return r},h=e=>e.reduce((e,r,t)=>e+`{\n int inputType = inputTypes[${t}];\n if (inputType == ${3..toFixed()}) {\n fragColor${t} = vec4(vec3(texture(colorTex${t}, uv).r), 1.0);\n } else if (inputType == ${4..toFixed()}) {\n fragColor${t} = vec4(texture(colorTex${t}, uv).rg, 0.0, 1.0);\n } else if (inputType == ${(0).toFixed()}) {\n float depth = 1.0 - ((-linearDepthFromTexture(colorTex${t}, uv) - nearFar[0]) / (nearFar[1] - nearFar[0]));\n fragColor${t} = vec4(vec3(depth), depth >= 0.999 ? 0.0 : 1.0);\n } else if (inputType == ${5..toFixed()}) {\n // Divide F16 by floatBlendOutputScale to get similar previews as in the OIT8 pipeline\n fragColor${t} = vec4(texture(colorTex${t}, uv).rgb, 1.0) / ${l.toFixed(1)};\n } else if (inputType == ${1..toFixed()}) {\n fragColor${t} = vec4(texture(colorTex${t}, uv)) * 255.0;\n fragColor${t} = vec4(fragColor${t}.rgb / fragColor${t}.a, fragColor${t}.a);\n } else if(inputType == ${2..toFixed()}) {\n vec2 texDim = vec2(textureSize(colorTex${t}, 0));\n ivec2 iuv = ivec2(uv*texDim);\n uvec2 hh = uvec2(texelFetch(colorTex${t},iuv,0).rg);\n fragColor${t} = vec4(\n ((hh & uvec2(0x55u)) != uvec2(0u)) ? 1.0 : 0.0,\n ((hh & uvec2(0xaau)) != uvec2(0u)) ? 1.0 : 0.0,\n 0.0,\n 1.0);\n } else {\n fragColor${t} = vec4(texture(colorTex${t}, uv));\n }\n }`,""),p=t.length,d=`#version 300 es\n precision highp float;\n precision highp usampler2D;\n\n in vec2 uv;\n ${s(t)}\n ${a(r,`layout(location = ${c.int(p)}) out vec4 fragDepth;\n uniform sampler2D depthTex;`)}\n\n uniform int inputTypes[${t.length||1}];\n uniform vec2 nearFar;\n\n // Factors to convert rgba back to float\n const vec4 RGBA_2_FLOAT_FACTORS = vec4(\n 255.0 / (256.0),\n 255.0 / (256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0 * 256.0)\n );\n\n\n float rgbaToFloat(vec4 rgba) {\n // Convert components from 0->1 back to 0->255 and then add the components together with their corresponding\n // fixed point factors, i.e. (256^1, 256^2, 256^3, 256^4)\n return dot(rgba, RGBA_2_FLOAT_FACTORS);\n }\n\n float linearDepthFromFloat(float depth) {\n depth = pow(depth, 0.2);\n return -(depth * (nearFar[1] - nearFar[0]) + nearFar[0]);\n }\n\n float linearDepthFromRGBA(vec4 depth) {\n return linearDepthFromFloat(rgbaToFloat(depth));\n }\n\n ${"float"===t[0]?"float linearDepthFromTexture(sampler2D depthTex, vec2 uv) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(depthTex, 0)));\n return linearDepthFromRGBA(texelFetch(depthTex, iuv, 0));\n }":"float linearDepthFromTexture(usampler2D depthTex, vec2 uv) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(depthTex, 0)));\n return linearDepthFromRGBA(vec4(texelFetch(depthTex, iuv, 0)) * 255.0);\n }"}\n\n void main() {\n ${h(t)}\n ${a(r,"float depth = 1.0 - pow(texture(depthTex, uv).r, 10.0);\n fragDepth = vec4(vec3(depth), depth < 0.000001 ? 0.0 : 1.0);")}\n }`,f=e.programCache.get(i,d,u);return this._programs.set(o,f),f}};function g(e){switch(e){case"float":return"sampler2D";case"uint":return"usampler2D";case"int":return"isampler2D"}}function v(e){if(!e)return"float";const{internalFormat:r}=e.descriptor;switch(r){case d.R8I:case d.R16I:case d.R32I:case d.RG8I:case d.RG16I:case d.RG32I:case d.RGB8I:case d.RGB16I:case d.RGB32I:case d.RGBA8I:case d.RGBA16I:case d.RGBA32I:return"int";case d.R8UI:case d.R16UI:case d.R32UI:case d.RG8UI:case d.RG16UI:case d.RG32UI:case d.RGB8UI:case d.RGB16UI:case d.RGB32UI:case d.RGBA8UI:case d.RGBA16UI:case d.RGBA32UI:return"uint";default:return"float"}}function x(e){const{hasDepthAttachment:r,colorSamplerTypes:t}=e;return`${r?"Depth":""}${t.reduceRight((e,r)=>e+`|C${r}`,"")}`}function F(e){switch(e){case d.R16F:case d.R32F:case d.R8:return 3;case d.RG8:return 4;case d.RGBA16F:return 5;case d.RG8UI:return 6;default:return 7}}function T(e,r,t,o){return o?`${e}\ndepth`:`${e}\n${b(r,t)}`}function b(e,r){return`${e.getColorTexture(r)?.debugName??"color"+(r-p)}`}e([t()],m.prototype,"destroyedCB",void 0),e([t()],m.prototype,"produces",void 0),e([t()],m.prototype,"consumes",void 0),e([t()],m.prototype,"clearColor",void 0),m=e([o("esri.views.3d.webgl-engine.effects.debug.RenderNodeVisualizerNode")],m);export{m as RenderNodeVisualizerNode,T as getAttachmentName};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{watch as t}from"../../../../core/reactiveUtils.js";import{property as i,subclass as s}from"../../../../core/accessorSupport/decorators.js";import{set as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{copy as r,set as o,scale as n,floor as h,subtract as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as m,set as c,positiveInfinity as u,equals as d}from"../../../../geometry/support/aaBoundingBox.js";import{InternalRenderCategory as _}from"../../webgl.js";import g from"../../webgl/RenderNode.js";import{G as f}from"../../../../chunks/GaussianSplat.glsl.js";import{G as P}from"../../../../chunks/GaussianSplatComposition.glsl.js";import{GaussianSplatCompositionTechnique as C}from"../shaders/GaussianSplatCompositionTechnique.js";import{GaussianSplatCompositionTechniqueConfiguration as b}from"../shaders/GaussianSplatCompositionTechniqueConfiguration.js";import{G as S}from"../../../../chunks/GaussianSplatDepthComposition.glsl.js";import{GaussianSplatDepthCompositionTechnique as v}from"../shaders/GaussianSplatDepthCompositionTechnique.js";import{GaussianSplatTechnique as x}from"../shaders/GaussianSplatTechnique.js";import{GaussianSplatTechniqueConfiguration as q}from"../shaders/GaussianSplatTechniqueConfiguration.js";import{ColorAttachment1 as w,DepthStencilAttachment as E,PrimitiveType as R}from"../../../webgl/enums.js";var T;let D=class extends g{static{T=this}constructor(e){super(e),this.produces=_.PRE_TRANSPARENT,this.consumes={required:[_.PRE_TRANSPARENT]},this._slicePlaneEnabled=!1,this.layerView=null,this._passParameters=new f,this._compositionPassParameters=new P,this._depthCompositionPassParameters=new S,this._compositionConfiguration=new b,this._clipBox=m(),this._previousCameraDirection=p(),this._previousSortRequestCameraDirection=p(),this._sortRequestDirectionEpsilon=.01,this._directionChangeEpsilon=.001,this._configuration=new q(e.view.state.isGlobal),c(this._clipBox,u)}async initialize(){this.addHandles([t(()=>this.view.state.camera,()=>this._onCameraChange()),t(()=>2===this.view.state.mode,()=>this.requestRender(1))])}precompile(){this._updateTechniqueConfiguration(),this.techniques.precompile(x,this._configuration),this._compositionConfiguration.hasEmission=this.bindParameters.hasEmission,this.techniques.precompile(C,this._compositionConfiguration),this.techniques.precompile(v)}render(e){const t=e.find(({name:e})=>e===this.produces);if(this._handleFading(),!this._data.visibleGaussians||!this._data.orderTexture.texture||!this._data.textureAtlas.texture)return t;const i=t.getAttachment(w);this._compositionConfiguration.hasEmission=null!=i;const s=this.techniques.getCompiled(x,this._configuration),a=this.techniques.getCompiled(C,this._compositionConfiguration),r=this.techniques.getCompiled(v);if(!s||!r||!a)return this.requestRender(1),t;const{fullWidth:o,fullHeight:n}=this.bindParameters.camera;this._prepareParameters(n,o);const h=this.renderingContext,l=this.fboCache,p=l.acquire(o,n,"gaussian color output"),m=t.getAttachment(E);p.attachDepth(m),this._renderGaussianColorAndDepth(p,s);const c=l.acquire(o,n,this.produces);return this._depthCompositionPassParameters.splatDepth=p.getTexture(w),c.attachDepth(t.getAttachment(E)),h.bindFramebuffer(c.fbo),h.bindTechnique(r,this.bindParameters,this._depthCompositionPassParameters),h.screen.draw(),this._compositionPassParameters.color=t.getTexture(),this._compositionPassParameters.splatColor=p.getTexture(),i?(c.acquireColor(w,8,"emissive"),this._compositionPassParameters.emission=t.getTexture(w)):this._compositionPassParameters.emission=null,h.bindFramebuffer(c.fbo),h.bindTechnique(a,this.bindParameters,this._compositionPassParameters),h.screen.draw(),p.release(),c}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(e){this._slicePlaneEnabled!==e&&(this._slicePlaneEnabled=e,this.requestRender(1))}set clippingBox(e){const t=e||u;this._hasSameClipBox(t)||(c(this._clipBox,t),this._data.requestSort(),this.requestRender(1))}get clippingBox(){return this._clippingEnabled?this._clipBox:null}get _clippingEnabled(){return!d(this._clipBox,u,(e,t)=>e===t)}get _fragmentShadowsEnabled(){return 2===this.view.state.mode}get _data(){return this.layerView.data}get _fadeHelper(){return this.layerView.fadeHelper}_updateTechniqueConfiguration(){this._configuration.alphaCutoff=this.view.qualitySettings.gaussianSplat.minimumOpacity,this._configuration.terrainDepthTest=this.bindParameters.terrainDepthTest,this._configuration.fadingEnabled=this._fadeHelper.fadingEnabled,this._configuration.receiveShadows=this.bindParameters.shadowMap.ready,this._configuration.fragmentShadows=this._configuration.receiveShadows&&this._fragmentShadowsEnabled,this._configuration.hasShadowHighlights=this._configuration.fragmentShadows&&this.bindParameters.hasShadowHighlights,this._configuration.clippingEnabled=this._clippingEnabled,this._configuration.hasSlicePlane=this._slicePlaneEnabled&&null!=this.bindParameters.slicePlane}destroy(){super.destroy()}_onCameraChange(){const e=this.view.state.camera.ray.direction;if(!this._directionChanged(e))return;if(r(this._previousCameraDirection,e),!this._shouldRequestSort(e))return;this._data.requestSort()&&r(this._previousSortRequestCameraDirection,e)}_directionChanged(e){return Math.abs(e[0]-this._previousCameraDirection[0])>this._directionChangeEpsilon||Math.abs(e[1]-this._previousCameraDirection[1])>this._directionChangeEpsilon||Math.abs(e[2]-this._previousCameraDirection[2])>this._directionChangeEpsilon}_shouldRequestSort(e){return Math.abs(e[0]-this._previousSortRequestCameraDirection[0])>this._sortRequestDirectionEpsilon||Math.abs(e[1]-this._previousSortRequestCameraDirection[1])>this._sortRequestDirectionEpsilon||Math.abs(e[2]-this._previousSortRequestCameraDirection[2])>this._sortRequestDirectionEpsilon}_prepareParameters(e,t){this._passParameters.splatOrder=this._data.orderTexture.texture,this._passParameters.splatFading=this._data.fadingTexture.texture,this._passParameters.splatAtlas=this._data.textureAtlas.texture;const i=Math.tan(.5*this.camera.fovY),s=i/e*t;a(this._passParameters.tanFov,s,i),this._passParameters.focalLength=e/(2*i);const o=this.view.qualitySettings.gaussianSplat.minimumSplatPixelRadius;this._passParameters.minSplatRadius=o*Math.sqrt(t*e)/Math.sqrt(2073600),r(this._passParameters.origin,this.bindParameters.camera.eye),this._prepareHighPrecisionCameraPosition(),this._updateSlicePlaneLocalOrigin(),this._updateClipUniforms()}_updateClipUniforms(){if(this._clippingEnabled){const[e,t,i,s,a,r]=this._clipBox,[n,h,l]=this.camera.eye;o(this._passParameters.clipMinCameraRelative,e-n,t-h,i-l),o(this._passParameters.clipMaxCameraRelative,s-n,a-h,r-l)}}_updateSlicePlaneLocalOrigin(){this._passParameters.slicePlaneLocalOrigin=this.camera.eye}_hasSameClipBox(e){return d(this._clipBox,e,(e,t)=>e===t)}_renderGaussianColorAndDepth(e,t){const i=this.renderingContext;e.acquireColor(w,5,"gaussian depth output"),i.bindFramebuffer(e.fbo),i.setClearColor(0,0,0,0),i.clear(16384),this.renderingContext.bindTechnique(t,this.bindParameters,this._passParameters),this.renderingContext.drawArraysInstanced(R.TRIANGLE_STRIP,0,4,this._data.visibleGaussians)}_prepareHighPrecisionCameraPosition(){n(this._passParameters.tileCameraPosition,this.camera.eye,1/T.tileSize),h(this._passParameters.tileCameraPosition,this._passParameters.tileCameraPosition),n(this._passParameters.cameraDelta,this._passParameters.tileCameraPosition,T.tileSize),l(this._passParameters.cameraDelta,this.camera.eye,this._passParameters.cameraDelta)}_handleFading(){if(0===this._fadeHelper.numFadingTiles)return void(this._previousFrameStart=null);this._previousFrameStart??=this.view.stage.renderer.renderContext.time;const e=this.view.stage?.renderer.renderContext.time-this._previousFrameStart;this._fadeHelper.updateAllTileFading(e),this._previousFrameStart=this.view.stage.renderer.renderContext.time,this._data.fadingTexture.updateTexture(this._data.textureAtlas.pageAllocator.pageCount)}static{this.tileSize=2.048}};e([i()],D.prototype,"produces",void 0),e([i()],D.prototype,"consumes",void 0),e([i({constructOnly:!0})],D.prototype,"layerView",void 0),D=T=e([s("esri.views.3d.webgl-engine.lib.GaussianSplatRenderNode")],D);export{D as GaussianSplatRenderNode};
2
+ import{__decorate as e}from"tslib";import{watch as t}from"../../../../core/reactiveUtils.js";import{property as i,subclass as s}from"../../../../core/accessorSupport/decorators.js";import{set as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{copy as r,set as o,scale as n,floor as h,subtract as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as m,set as c,positiveInfinity as u,equals as d}from"../../../../geometry/support/aaBoundingBox.js";import{InternalRenderCategory as _}from"../../webgl.js";import g from"../../webgl/RenderNode.js";import{G as f}from"../../../../chunks/GaussianSplat.glsl.js";import{G as P}from"../../../../chunks/GaussianSplatComposition.glsl.js";import{GaussianSplatCompositionTechnique as C}from"../shaders/GaussianSplatCompositionTechnique.js";import{GaussianSplatCompositionTechniqueConfiguration as b}from"../shaders/GaussianSplatCompositionTechniqueConfiguration.js";import{G as S}from"../../../../chunks/GaussianSplatDepthComposition.glsl.js";import{GaussianSplatDepthCompositionTechnique as v}from"../shaders/GaussianSplatDepthCompositionTechnique.js";import{GaussianSplatTechnique as x}from"../shaders/GaussianSplatTechnique.js";import{GaussianSplatTechniqueConfiguration as q}from"../shaders/GaussianSplatTechniqueConfiguration.js";import{ColorAttachment1 as w,DepthStencilAttachment as E,PrimitiveType as T}from"../../../webgl/enums.js";var D;let y=class extends g{static{D=this}constructor(e){super(e),this.produces=_.GAUSSIAN_SPLAT,this.consumes={required:[_.GAUSSIAN_SPLAT]},this._slicePlaneEnabled=!1,this.layerView=null,this._passParameters=new f,this._compositionPassParameters=new P,this._depthCompositionPassParameters=new S,this._compositionConfiguration=new b,this._clipBox=m(),this._previousCameraDirection=p(),this._previousSortRequestCameraDirection=p(),this._sortRequestDirectionEpsilon=.01,this._directionChangeEpsilon=.001,this._configuration=new q(e.view.state.isGlobal),c(this._clipBox,u)}async initialize(){this.addHandles([t(()=>this.view.state.camera,()=>this._onCameraChange()),t(()=>2===this.view.state.mode,()=>this.requestRender(1))])}precompile(){this._updateTechniqueConfiguration(),this.techniques.precompile(x,this._configuration),this._compositionConfiguration.hasEmission=this.bindParameters.hasEmission,this.techniques.precompile(C,this._compositionConfiguration),this.techniques.precompile(v)}render(e){const t=e.find(({name:e})=>e===this.produces);if(this._handleFading(),!this._data.visibleGaussians||!this._data.orderTexture.texture||!this._data.textureAtlas.texture)return t;const i=t.getAttachment(w);this._compositionConfiguration.hasEmission=null!=i;const s=this.techniques.getCompiled(x,this._configuration),a=this.techniques.getCompiled(C,this._compositionConfiguration),r=this.techniques.getCompiled(v);if(!s||!r||!a)return this.requestRender(1),t;const{fullWidth:o,fullHeight:n}=this.bindParameters.camera;this._prepareParameters(n,o);const h=this.renderingContext,l=this.fboCache,p=l.acquire(o,n,"gaussian color output"),m=t.getAttachment(E);p.attachDepth(m),this._renderGaussianColorAndDepth(p,s);const c=l.acquire(o,n,this.produces);return this._depthCompositionPassParameters.splatDepth=p.getTexture(w),c.attachDepth(t.getAttachment(E)),h.bindFramebuffer(c.fbo),h.bindTechnique(r,this.bindParameters,this._depthCompositionPassParameters),h.screen.draw(),this._compositionPassParameters.color=t.getTexture(),this._compositionPassParameters.splatColor=p.getTexture(),i?(c.acquireColor(w,8,"emissive"),this._compositionPassParameters.emission=t.getTexture(w)):this._compositionPassParameters.emission=null,h.bindFramebuffer(c.fbo),h.bindTechnique(a,this.bindParameters,this._compositionPassParameters),h.screen.draw(),p.release(),c}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(e){this._slicePlaneEnabled!==e&&(this._slicePlaneEnabled=e,this.requestRender(1))}set clippingBox(e){const t=e||u;this._hasSameClipBox(t)||(c(this._clipBox,t),this._data.requestSort(),this.requestRender(1))}get clippingBox(){return this._clippingEnabled?this._clipBox:null}get _clippingEnabled(){return!d(this._clipBox,u,(e,t)=>e===t)}get _fragmentShadowsEnabled(){return 2===this.view.state.mode}get _data(){return this.layerView.data}get _fadeHelper(){return this.layerView.fadeHelper}_updateTechniqueConfiguration(){this._configuration.alphaCutoff=this.view.qualitySettings.gaussianSplat.minimumOpacity,this._configuration.terrainDepthTest=this.bindParameters.terrainDepthTest,this._configuration.fadingEnabled=this._fadeHelper.fadingEnabled,this._configuration.receiveShadows=this.bindParameters.shadowMap.ready,this._configuration.fragmentShadows=this._configuration.receiveShadows&&this._fragmentShadowsEnabled,this._configuration.hasShadowHighlights=this._configuration.fragmentShadows&&this.bindParameters.hasShadowHighlights,this._configuration.clippingEnabled=this._clippingEnabled,this._configuration.hasSlicePlane=this._slicePlaneEnabled&&null!=this.bindParameters.slicePlane}destroy(){super.destroy()}_onCameraChange(){const e=this.view.state.camera.ray.direction;if(!this._directionChanged(e))return;if(r(this._previousCameraDirection,e),!this._shouldRequestSort(e))return;this._data.requestSort()&&r(this._previousSortRequestCameraDirection,e)}_directionChanged(e){return Math.abs(e[0]-this._previousCameraDirection[0])>this._directionChangeEpsilon||Math.abs(e[1]-this._previousCameraDirection[1])>this._directionChangeEpsilon||Math.abs(e[2]-this._previousCameraDirection[2])>this._directionChangeEpsilon}_shouldRequestSort(e){return Math.abs(e[0]-this._previousSortRequestCameraDirection[0])>this._sortRequestDirectionEpsilon||Math.abs(e[1]-this._previousSortRequestCameraDirection[1])>this._sortRequestDirectionEpsilon||Math.abs(e[2]-this._previousSortRequestCameraDirection[2])>this._sortRequestDirectionEpsilon}_prepareParameters(e,t){this._passParameters.splatOrder=this._data.orderTexture.texture,this._passParameters.splatFading=this._data.fadingTexture.texture,this._passParameters.splatAtlas=this._data.textureAtlas.texture;const i=Math.tan(.5*this.camera.fovY),s=i/e*t;a(this._passParameters.tanFov,s,i),this._passParameters.focalLength=e/(2*i);const o=this.view.qualitySettings.gaussianSplat.minimumSplatPixelRadius;this._passParameters.minSplatRadius=o*Math.sqrt(t*e)/Math.sqrt(2073600),r(this._passParameters.origin,this.bindParameters.camera.eye),this._prepareHighPrecisionCameraPosition(),this._updateSlicePlaneLocalOrigin(),this._updateClipUniforms()}_updateClipUniforms(){if(this._clippingEnabled){const[e,t,i,s,a,r]=this._clipBox,[n,h,l]=this.camera.eye;o(this._passParameters.clipMinCameraRelative,e-n,t-h,i-l),o(this._passParameters.clipMaxCameraRelative,s-n,a-h,r-l)}}_updateSlicePlaneLocalOrigin(){this._passParameters.slicePlaneLocalOrigin=this.camera.eye}_hasSameClipBox(e){return d(this._clipBox,e,(e,t)=>e===t)}_renderGaussianColorAndDepth(e,t){const i=this.renderingContext;e.acquireColor(w,5,"gaussian depth output"),i.bindFramebuffer(e.fbo),i.setClearColor(0,0,0,0),i.clear(16384),this.renderingContext.bindTechnique(t,this.bindParameters,this._passParameters),this.renderingContext.drawArraysInstanced(T.TRIANGLE_STRIP,0,4,this._data.visibleGaussians)}_prepareHighPrecisionCameraPosition(){n(this._passParameters.tileCameraPosition,this.camera.eye,1/D.tileSize),h(this._passParameters.tileCameraPosition,this._passParameters.tileCameraPosition),n(this._passParameters.cameraDelta,this._passParameters.tileCameraPosition,D.tileSize),l(this._passParameters.cameraDelta,this.camera.eye,this._passParameters.cameraDelta)}_handleFading(){if(0===this._fadeHelper.numFadingTiles)return void(this._previousFrameStart=null);this._previousFrameStart??=this.view.stage.renderer.renderContext.time;const e=this.view.stage?.renderer.renderContext.time-this._previousFrameStart;this._fadeHelper.updateAllTileFading(e),this._previousFrameStart=this.view.stage.renderer.renderContext.time,this._data.fadingTexture.updateTexture(this._data.textureAtlas.pageAllocator.pageCount)}static{this.tileSize=2.048}};e([i()],y.prototype,"produces",void 0),e([i()],y.prototype,"consumes",void 0),e([i({constructOnly:!0})],y.prototype,"layerView",void 0),y=D=e([s("esri.views.3d.webgl-engine.lib.GaussianSplatRenderNode")],y);export{y as GaussianSplatRenderNode};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import has from"../../../../core/has.js";import{NestedMap as t}from"../../../../core/NestedMap.js";function e(e){const r=new t;if(r.set(2,1,!0),r.set(2,5,!0),r.set(2,0,!0),r.set(2,3,!0),r.set(2,2,!0),r.set(2,9,!0),r.set(2,4,!0),has("global-illumination")&&(r.set(0,4,!0),r.set(1,4,!0)),"low"!==e&&(r.set(2,6,!0),r.set(2,7,!0)),"medium"===e)for(const t of s)r.set(0,t,!0),r.set(1,t,!0),r.set(2,t,!0);else if("high"===e)for(const t of o)r.set(0,t,!0),r.set(1,t,!0),r.set(2,t,!0);return r}const s=[10,8,1],o=[...s,0,3,4,5];export{e as setupFeatureDefaults};
2
+ import has from"../../../../core/has.js";import{NestedMap as t}from"../../../../core/NestedMap.js";function e(e){const r=new t;if(r.set(2,1,!0),r.set(2,5,!0),r.set(2,0,!0),r.set(2,3,!0),r.set(2,2,!0),r.set(2,9,!0),r.set(2,4,!0),has("global-illumination")&&(r.set(0,4,!0),r.set(1,4,!0)),"low"!==e&&(r.set(2,6,!0),r.set(2,7,!0),r.set(2,10,!0)),"medium"===e)for(const t of s)r.set(0,t,!0),r.set(1,t,!0),r.set(2,t,!0);else if("high"===e)for(const t of o)r.set(0,t,!0),r.set(1,t,!0),r.set(2,t,!0);return r}const s=[8,1],o=[...s,10,0,3,4,5];export{e as setupFeatureDefaults};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as s}from"../../../../core/asyncUtils.js";import has from"../../../../core/has.js";import{removeMaybe as r,abortMaybe as i,destroyMaybe as a,releaseMaybe as n,releaseReferencedMaybe as h}from"../../../../core/maybe.js";import{throwIfAborted as o}from"../../../../core/promiseUtils.js";import{watch as d,syncAndInitial as l,initial as _,sync as u}from"../../../../core/reactiveUtils.js";import{signal as m}from"../../../../core/signal.js";import{property as p,subclass as c}from"../../../../core/accessorSupport/decorators.js";import{equals as b,invert as f,multiply as g,copy as P}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as T,create as E}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as w}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as A,ZEROS as I}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as C}from"../../../../geometry/support/Indices.js";import{RenderNodeOutput as D,InternalRenderCategory as R,AllRenderNodeOutputs as S,AllInternalRenderNodeOutputs as O}from"../../webgl.js";import{minNearDistanceInMeters as F}from"../../state/NearFarHeuristic.js";import{debugFlags as x}from"../../support/debugFlags.js";import"../../webgl/ManagedDepthAttachment.js";import{FBOCache as y}from"../core/FBOCache.js";import{RenderPassManager as N}from"../core/renderPasses/RenderPassManager.js";import{isColor as H}from"../core/shaderLibrary/ShaderOutput.js";import{distanceFadeEnd as G}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{hasOit8Bit as v,hasEmissive8Bit as M}from"../effects/fboFormatUtils.js";import{RenderNodes as q}from"../effects/RenderNodes.js";import{RenderPluginManager as L}from"../effects/RenderPluginManager.js";import{WeatherFader as j}from"../effects/WeatherFader.js";import{innerAtmosphereFadeStart as B}from"../effects/atmosphere/atmosphereUtils.js";import{Blit as U}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as V,renderHighlightBuffer as k}from"../effects/highlight/Highlight.js";import{OITBlend as W}from"../effects/transparency/OITBlend.js";import{AnimationTimer as z}from"./AnimationTimer.js";import{AnimationTimeStep as Q}from"./AnimationTimeStep.js";import{BoundingInfo as Y}from"./BoundingInfo.js";import{Compositor as $}from"./Compositor.js";import{DepthRange as J}from"./DepthRange.js";import{depthRangeFromScene as K}from"./depthRangeUtils.js";import{MainFramebuffer as Z}from"./MainFramebuffer.js";import{RenderContext as X,defaultRenderOccludedMask as ee}from"./RenderContext.js";import{RendererBase as te}from"./RendererBase.js";import{setupFeatureDefaults as se}from"./RenderFeature.js";import{RenderPluginInput as re}from"./RenderPluginInput.js";import{ShadowAccumulator as ie}from"./ShadowAccumulator.js";import{ShadowMap as ae}from"./ShadowMap.js";import ne from"./SliceHelper.js";import{MergedRenderer as he}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as oe}from"../parts/renderUtils.js";import{RendererPerformanceInfo as de,PerformanceCategory as le}from"../statistics/RendererPerformanceInfo.js";import{ColorAttachment1 as _e,PixelType as ue,ColorAttachment2 as me,ColorAttachment0 as pe}from"../../../webgl/enums.js";let ce=class extends te{constructor(e,t,s,r,i){super({stage:e}),this._techniques=s,this._rctx=r,this._requestRender=i,this._pluginsHas={occludedHudElements:!1,hudElements:!1,water:!1},this.renderPassManager=new N,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=A(0,0,0,1),this._sliceHelper=new ne,this.sceneDepthRange=m(J.Infinite),this._state=m(2),this._hasGlobalIlluminationFlag=!!has("global-illumination"),this._hasOit8Bit=v(),this._hasEmissive8Bit=M(),this._hasAnimations=!1,this._animationTimestep=new Q,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=m(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new re,this._hasTransparentGeometry=!1,this._oitCallouts=!1,this._releaseNodeInputs=e=>{for(const t of Re)e.some(({name:e})=>e===t)&&this._pluginInput.release(t)},this._testsNeedsDepth=!1,this._fboCache=new y(r),this._compositor=new $(r,s),this._renderStateFeatures=m(se(e.view.qualityProfile));const a=new ae(this._fboCache,e.viewingMode);this._renderContext=new X(this._rctx,a,s),this._framebuffer=new Z(this._fboCache,this._bindParameters),this._performanceInfo=new de(this._rctx),this._blit=new U(s),this._shadowAccumulator=new ie(this.fboCache,s,e,e=>{const t=this.shadowsEnabled;a.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),a.enabled=t},(t,s,r)=>{const i=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,s,r,!0,i),this._renderShadowCascades(5,t.shadowMap),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)},i),this._nodes=new q(this._renderContext),this._plugins=new L({renderContext:this._renderContext,techniques:s,materials:t,requestRender:i,controller:e}),this._plugins.add(this.renderPassManager),this.weatherFader=new j({view:e.view,context:this._renderContext}),this.addHandles([d(()=>e.view.state.camera,()=>i(),l),d(()=>x.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},i()},_),d(()=>e.view.environment.background?.color,e=>{const t=e?e.toUnitRGBA():I;w(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),i()},l),d(()=>e.view.state.camera.relativeElevation,e=>this._inGlobeView=(e??1/0)>=G,l),d(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},u),d(()=>this._bindParameters.clouds.data?.state,()=>i(),u),d(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,i()},_),d(()=>"sun"===e.view.environment.lighting?.type,e=>{this._bindParameters.enableFillLights=e,this._requestRender()},l)])}destroy(){this._gpuTimerHandle=r(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowAccumulator.destroy(),this._shadowAccumulator=null,this._loadEdgeViewTask=i(this._loadEdgeViewTask),this._edgeView=a(this._edgeView),this.renderPassManager.dispose(),this.weatherFader=a(this.weatherFader),this._releaseFBOs(),this._disposeOffscreenBuffers(),this._fboCache.destroy(),this._fboCache=null,this._renderContext.destroy(),this._plugins.destroy(),this._pluginInput=null,this._oitBlendOrNil=null,this._nodes=null,this._framebuffer=null,this._performanceInfo=null,Y.prune(),he.prune(),C()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _oitBlend(){return this._oitBlendOrNil??=new W(this._techniques),this._oitBlendOrNil}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e){this._renderStateFeatures.value=se(e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,s){this._renderStateFeatures.mutate(r=>r.set(t,e,s)),this._requestRender()}get _highQualityTransparency(){return this.isFeatureEnabled(1)}get hasReflections(){return this._bindParameters.screenSpaceReflections.enabled=this._pluginsHas.water&&this.isFeatureEnabled(5),this._bindParameters.screenSpaceReflections.enabled}get _hasHighlights(){return this._plugins.produces(10,2,4,19,13,14,15)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(10,13,14,15)}get hasAmbientIllumination(){return this.isFeatureEnabled(4)&&!this._inGlobeView}get _hasGlobalIllumination(){return this.hasAmbientIllumination&&this._hasGlobalIlluminationFlag}get hasSMAA(){return this.isFeatureEnabled(0)}get _hasEmissions(){return this._hasEmissive8Bit||this.hasFloatBlend?this._plugins.hasEmissions:0}get hasFloatBlend(){return this._rctx.driverTest.floatBufferBlend.result&&this.isFeatureEnabled(10)}get oitEnabled(){return this.hasFloatBlend||this._hasOit8Bit}get highResolutionAtmosphere(){return this.isFeatureEnabled(3)}get fboCache(){return this._fboCache}_releaseFBOs(){this._bindParameters.terrainDepth=n(this._bindParameters.terrainDepth),this._bindParameters.geometryDepth=n(this._bindParameters.geometryDepth),this._bindParameters.hudOcclusion=n(this._bindParameters.hudOcclusion),this._bindParameters.depth=null}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._bindParameters.globalIllumination=n(this._bindParameters.globalIllumination),this._bindParameters.reprojection.lastFrameDepth=n(this._bindParameters.reprojection.lastFrameDepth),this._bindParameters.reprojection.lastFrameEmission=n(this._bindParameters.reprojection.lastFrameEmission),this._disposeBindBuffers()}_disposeBindBuffers(){this._bindParameters.shadowMap.disposeOutputs()}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._shadowAccumulator.readyToRun||this._plugins.updating||this.weatherFader?.readyToRun||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=s(async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");o(e);const s=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:ye(this.stage.view.resourceController)});return this.addHandles(d(()=>s.updating,()=>this._requestRender(),u)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(s)),this._edgeViewCallbacks.length=0,s})),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&&b(this._bindParameters.reprojection.matrix,T)}set _reprojectionMatrix(e){t(this._bindParameters.reprojection.matrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._bindParameters.shadowMap.enabled}setParameters(e){void 0!==e.shadowMap&&this._bindParameters.shadowMap.enabled!==e.shadowMap&&(this._bindParameters.shadowMap.enabled=e.shadowMap,this._requestRender()),e.shadowCast&&this._shadowAccumulator.setParameters(e.shadowCast)}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}rendererAdded(e){this._plugins.add(e)}rendererRemoved(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this.occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(8&this.plugins.renderOccludedFlags)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,10)}updateHasFlags(){const has=this._pluginsHas;has.occludedHudElements=this._plugins.produces(0,14),has.hudElements=has.occludedHudElements||this._plugins.produces(0,...we),has.water=this._plugins.produces(4,20),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new z(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const s=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==s&&(this._gpuTimerHandle=s?r(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,s,r=!1){try{return this._isRendering=!0,this._render(e,t,s,r)}catch(i){console.error(`Exception during rendering: ${i}:\n${i.stack}`)}finally{this._isRendering=!1}return new oe(this._pluginInput.get(D.FINAL),null)}_render(e,t,s,r){const i=0===s;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=i,this._disposeBindBuffers();const{camera:a,contentCamera:o,mode:d,alignPixelEnabled:l}=e;this._state.value=d,this._renderContext.time=t,this._bindParameters.output=0,this._bindParameters.emissions=this._hasEmissions,this._bindParameters.alignPixelEnabled=l,this._bindParameters.decorations=!r,this._bindParameters.mainDepth=null,this._bindParameters.useFloatBlend.value=this.hasFloatBlend;const _=!r||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=_?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(R.VIEWSHED),this._bindParameters.cutFillComputationEnabled=this._nodes.produces(R.CUTFILL_COMPUTATION),this._bindParameters.cutFillVisualizationEnabled=this._nodes.produces(R.CUTFILL_COLOR),this._renderOverlay(),a.setGLViewport(this._rctx);const u=this._framebuffer,m=u.initialize(a.fullWidth,a.fullHeight,this._backgroundColor);this.hasReflections?(m?.setName("last frame color"),this._bindParameters.reprojection.lastFrameColor=m):m?.release(),this._ensureBindParameters(a,o,t),this._plugins.sortTestsTransparentOrderedSlots(Ie),this._plugins.prepareRender(),this._bindParameters.hasShadowHighlights=this._needsShadowHighlight&&!r,this._hasTransparentGeometry=this._plugins.produces(0,...fe),this._precompilePrepasses(),this.performanceInfo.advance(le.PREPARE);const p=this._computeShadowDepthRange(a);this._pluginInput.set("normals",this._renderNormals()),this._renderAmbientIlluminationAndDepth(),this._renderShadowMap(a,o,this._bindParameters.lighting.mainLight.direction,p),this._renderShadowAccumulation(p,!i),this._oitCallouts=this._hasTransparentGeometry&&this.oitEnabled,u.bind(),this._bindParameters.mainDepth=u.depth.attachment,this._precompileShaders(),this._bindParameters.output=0;this._bindParameters.hasOpaqueEmissions||0===this._bindParameters.emissions?(this._renderOpaque(),this._renderPretransparent()):(this._bindParameters.emissions=0,this._renderOpaque(),this._renderPretransparent(),this._bindParameters.emissions=2),this._renderTransparent(),this._bindParameters.reprojection.lastFrameColor=n(this._bindParameters.reprojection.lastFrameColor),this.hasReflections&&(this._bindParameters.depth=h(this._bindParameters.depth)),this._bindParameters.shadowMap.disposeOutput(5),this._renderCutFillComputation(),this._pluginInput.set(R.FOCUSAREA,this._renderFocusAreaGeometry()),u.update(e=>this._renderNodes(R.TRANSPARENT_ENVIRONMENT,e)),u.update(e=>this._renderNodes(R.VIEWSHED,e)),u.update(e=>this._renderNodes(R.LASERLINES,e)),this._nodes.requireGeometryDepth&&(this._bindParameters.depth=h(this._bindParameters.depth)),u.update(e=>this._renderNodes(R.FOCUSAREA_COLOR,e)),u.update(e=>this._renderNodes(R.CUTFILL_COLOR,e)),this._pluginInput.release(R.FOCUSAREA),this._pluginInput.release(R.GROUND_DEPTH),u.update(e=>this._renderNodes(R.OCCLUDED,e)),this._pluginInput.set("highlights",this._renderHighlightPrepass());const c=2===s?this._renderObjectAndLayerIdColor():null;u.update(e=>this._renderNodes(D.COMPOSITE,e)),this._bindParameters.shadowMap.disposeOutputs(),this._bindParameters.shadowHighlight=n(this._bindParameters.shadowHighlight),this._hasGlobalIllumination&&this._hasEmissions&&(this._bindParameters.reprojection.lastFrameEmission=u.color.obtainAttachment(_e)),u.update(e=>this._renderNodes(R.ANTIALIASING,e));const b=this._hasPhotoshopTerrain||!this._hasTransparentGeometry?1:2;let f;return this._bindParameters.emissions=0,this._hasHUDHighlights&&u.update(e=>this._renderHUD(b,e)),u.update(e=>this._renderNodes(R.HIGHLIGHT_COLOR,e)),this._hasHUDHighlights||u.update(e=>this._renderHUD(b,e)),this._bindParameters.emissions=this._hasEmissions,u.update(e=>this._renderNodes(R.MAGNIFIER,e)),u.update(e=>this._renderNodes(D.FINAL,e)),i&&this._blit.toFramebuffer(this._rctx,u.color,this._bindParameters),this._hasGlobalIllumination&&(this._bindParameters.reprojection.lastFrameDepth=this._bindParameters.depth),this._testsNeedsDepth&&(this._bindParameters.depth=h(this._bindParameters.depth)),this._releaseFBOs(),u.releaseDepth(),this._bindParameters.reprojection.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),i||(f=u.color,f.retain(),this._releaseFBOs(),this._disposeOffscreenBuffers()),this.performanceInfo.finishFrame(),new oe(f,c)}_precompileShaders(){++this._plugins.context.techniques.precompiling,this._bindParameters.output=0;const e=this._bindParameters.hasEmission;this._precompileOpaqueGeometry(),this._nodes.precompile(e,R.OPAQUE_ENVIRONMENT,R.PRE_TRANSPARENT);2===this._bindParameters.emissions&&(this._bindParameters.emissions=0,this._precompileOpaqueGeometry(),this._bindParameters.emissions=2);const t=this._bindParameters;if(t.terrainDepthTest=t.cullAboveTerrain=this._needsTerrainDepth,this._bindParameters.output=3,this._plugins.precompile(...ge),this._bindParameters.output=0,this._plugins.precompile(...ge),this._hasTransparentGeometry){const e=this._pluginsHas.occludedHudElements;this._oitBlend.precompile(this._bindParameters,e,0),this._pluginsHas.hudElements&&this._oitBlend.precompile(this._bindParameters,!1,1)}this._hasTransparentGeometry&&(this._precompileTransparentGeometry(),this._hasPhotoshopTerrain&&(t.cullAboveTerrain=!1,this._precompileTransparentGeometry(),t.cullAboveTerrain=this._needsTerrainDepth)),this._nodes.precompile(e,R.FOCUSAREA);const s=this._hasPhotoshopTerrain&&!this._needsTerrainDepth;this._compositor.precompile(this._usesPremultipliedAlphaBlit,!!this._needsEdges,s,e),this._oitCallouts||this._plugins.precompile(16),t.terrainDepthTest=t.cullAboveTerrain=!1,this._nodes.precompile(e,R.TRANSPARENT_ENVIRONMENT,R.VIEWSHED,R.CUTFILL_COMPUTATION,R.CUTFILL_COLOR,R.LASERLINES,R.FOCUSAREA_COLOR,R.OCCLUDED,R.ANTIALIASING),t.highlightMixTexture=t.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(0),t.emissions=0,this._precompileHUD(0),this._precompileHUD(1),t.emissions=this._hasEmissions,this._hasHighlights&&(t.highlights.forEach((e,s)=>{t.highlightLevel=s,this._precompileAllGeometry(10),this._hasHUDHighlights&&this._plugins.precompile(14,13)}),t.highlightLevel=null,this._nodes.precompile(e,R.HIGHLIGHT_COLOR)),t.highlightMixTexture=null,this._nodes.precompile(e,D.COMPOSITE,R.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(9),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(R.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(le.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces("olid"))return null;const e=this._bindParameters.output;++this._techniques.precompiling;const{width:t,height:s}=this._framebuffer.size;let r=this.fboCache.acquire(t,s,"olid");return r.acquireDepth(13),r=this._nodes.render(r,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(le.OBJECT_AND_LAYER_ID_COLOR),this._bindParameters.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,s=0===e;if(s||t){const e=s?this.performanceInfo.elapsedTime:0;let r=0;t?r=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const i=Math.max(e,r);this._animationTimestep.frame(i,s)}}readMainDepth(e,t){const{mainDepth:s,camera:r}=this._bindParameters;if(!s)return;const i=this.fboCache.acquire(this._framebuffer.size.width,this._framebuffer.size.height,"linear depth");this._rctx.bindFramebuffer(i.fbo),r.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(I),this._compositor.blitDepthToLinearDepth(this._bindParameters,s),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),i.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,ue.UNSIGNED_BYTE,t),i.release()}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}get _needsEdges(){return this._edgeView?.shouldRender()?this._edgeView:null}_renderEdges(e){const t=this._needsEdges;if(!t)return;const{width:s,height:r}=this._framebuffer.size,i=this.fboCache.acquire(s,r,"edges"),a=this._bindParameters.geometryDepth,n=()=>t.render(this._bindParameters,e);this._renderToTargets(n,i,a??this._framebuffer.depth,I),this._framebuffer.bind(),this._compositor.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(1===e?le.OPAQUE_EDGES:le.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(this._renderContext.time),this._bindParameters.overlay&&this.performanceInfo.advance(le.OVERLAY)}_renderShadowMap(e,t,s,r){if(!this.shadowsEnabled)return;const i=this._bindParameters.shadowMap;if(i.start(e,s,r,this.isFeatureEnabled(6),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight){this._renderShadowCascades(6,i),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t);const s=this._bindParameters.output;this._bindParameters.output=0,this._bindParameters.shadowHighlight=this._nodes.produce(R.SHADOW_HIGHLIGHT,this._pluginInput),this._bindParameters.output=s,i.disposeOutput(6),i.clear(),this._renderShadowCascades(7,i)}else this._renderShadowCascades(5);e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this._needsShadowHighlight&&(this._bindParameters.depth=h(this._bindParameters.depth)),this.performanceInfo.advance(le.SHADOW_MAP)}_renderCutFillComputation(){this._nodes.produce(R.CUTFILL_COMPUTATION,this._pluginInput)?.release()}_precompileShadowCascades(e){0!==this._bindParameters.shadowMap.cascades.length&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._bindParameters.shadowMap){const s=this._bindParameters.output;t.bindFramebuffer();for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this.renderAllGeometry(e);t.finish(e),this._bindParameters.output=s}get _needsDepth(){return+this._nodes.requireGeometryDepth+ +this.hasReflections+ +this._hasGlobalIllumination+ +this._shadowAccumulator.accumulating+ +this._testsNeedsDepth}get _usesPremultipliedAlphaBlit(){return this._pluginsHas.hudElements&&this.oitEnabled||this._hasPhotoshopTerrain}_renderAmbientIlluminationAndDepth(){this._bindParameters.depth=n(this._bindParameters.depth);const e=this._pluginInput.get("normals");if(e){this._pluginInput.set(R.AMBIENT_ILLUMINATION,this._hasGlobalIlluminationFlag?this._renderGlobalIllumination():this._renderSSAO());const t=this._needsDepth;t?(this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(3),this._bindParameters.depth=e.obtainDepthTexture(),this._bindParameters.depth?.retain(t-1),this.performanceInfo.advance(le.DEPTH)):e.detachDepth(),this.hasAmbientIllumination&&this._pluginInput.release("normals")}else this._renderAllGeometryDepth()}_renderAllGeometryDepth(){const e=this._needsDepth;if(0===e)return;const{width:t,height:s}=this._framebuffer.size,r=this.fboCache.acquire(t,s,"geometry",13);this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(1280),this.renderAllGeometry(3),this._bindParameters.depth=r.obtainDepthTexture(),this._bindParameters.depth?.retain(e-1),r.release(),this.performanceInfo.advance(le.DEPTH)}_renderTerrainDepth(){if(this._bindParameters.terrainDepth=n(this._bindParameters.terrainDepth),this._bindParameters.terrainDepthTest=this._bindParameters.cullAboveTerrain=this._needsTerrainDepth,!this._needsTerrainDepth)return;const e=this._bindParameters.output;this._bindParameters.output=3;const{width:t,height:s}=this._framebuffer.size,r=this.fboCache.acquire(t,s,"terrain",13);this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(1280),this._renderTransparentGround(),this._bindParameters.terrainDepth=r.obtainDepthTexture(),r.release(),this._bindParameters.output=e}_renderGeometryDepth(){if(this._bindParameters.geometryDepth=n(this._bindParameters.geometryDepth),!this._needsTerrainDepth)return;const e=this._bindParameters.output,{width:t,height:s}=this._framebuffer.size,r=this.fboCache.acquire(t,s,"geometry",13);this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(1280),this._renderOpaqueAndTransparentGeometry(3),this._bindParameters.output=e,this._bindParameters.geometryDepth=r.obtainDepthTexture(),r.release()}get _needsShadowDepthRange(){return this._bindParameters.shadowMap.enabled||this._shadowAccumulator.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return J.Zero;const t=K(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal)return void(this.sceneDepthRange.value=J.Infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<B)return void(this.sceneDepthRange.value=J.Infinite);const t=e.clone();t.near=F,t.far=1e10;const s=K(t,this._plugins.plugins,this.stage.layers,1);s.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(s)||(this.sceneDepthRange.value=s)}get _normalsRequired(){return this._nodes.require("normals",...S,R.VIEWSHED,R.LASERLINES)+(this.hasAmbientIllumination?1:0)}_precompilePrepasses(){this._normalsRequired?(this._precompilePlugins(4,Pe),this._needsDepth&&this._precompilePlugins(3,Te)):this._needsDepth&&this._precompileAllGeometry(3),this.shadowsEnabled&&(this._needsShadowHighlight?(this._nodes.precompile(this._bindParameters.hasEmission,R.SHADOW_HIGHLIGHT),this._precompileShadowCascades(6),this._precompileShadowCascades(7)):this._precompileShadowCascades(5)),this._shadowAccumulator.active&&this._precompileAllGeometry(5),this.hasAmbientIllumination&&this._normalsRequired&&this._nodes.precompile(this._bindParameters.hasEmission,R.AMBIENT_ILLUMINATION)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const{width:t,height:s}=this._framebuffer.size,r=this.fboCache.acquire(t,s,"normals",5);r.acquireDepth(13),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(I,!0,!0),this._bindParameters.output=4,this._plugins.render(...Pe);const i=this._nodes.optional("normals",...S,R.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(le.NORMALS),r}_renderSSAO(){const e=this._pluginInput.get("normals");if(this.hasAmbientIllumination&&e)return this._bindParameters.ssao=this._nodes.produce(R.AMBIENT_ILLUMINATION,this._pluginInput),this._bindParameters.ssao&&this.performanceInfo.advance(le.AMBIENT_ILLUMINATION),this._bindParameters.ssao}_renderGlobalIllumination(){if(!this.hasAmbientIllumination)return void this._releaseGlobalIlluminationBuffers();const e=this._nodes.produce(R.AMBIENT_ILLUMINATION,this._pluginInput);return this._releaseGlobalIlluminationBuffers(),this._bindParameters.globalIllumination=e,this.performanceInfo.advance(le.AMBIENT_ILLUMINATION),e}_releaseGlobalIlluminationBuffers(){this._bindParameters.reprojection.lastFrameDepth=h(this._bindParameters.reprojection.lastFrameDepth),this._bindParameters.reprojection.lastFrameEmission=h(this._bindParameters.reprojection.lastFrameEmission),this._bindParameters.globalIllumination=h(this._bindParameters.globalIllumination)}_precompileAllGeometry(e){const t=this._bindParameters.output;this._bindParameters.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(...ge),this._bindParameters.output=t}renderAllGeometry(e){this._bindParameters.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentGround()}precompileSlots(e,...t){for(const s of t)this._bindParameters.slot=s,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const s of t)this._renderContext.renderOccludedMask=s,this.precompileSlots(e,...Ee);this._renderContext.renderOccludedMask=ee}renderSlots(e,...t){for(const s of t)this._bindParameters.slot=s,e.forAll(e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)})}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>1&&this._plugins.render(10),this.renderSlots(e,...Ee),this._renderContext.renderOccludedMask=ee}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Ce[e])}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(17),this.renderHUD(e),this._bindParameters.hudRenderStyle=e,this._plugins.render(15)}precompileViewshedShadowMap(){this._precompileAllGeometry(8)}precompileCutFillOrthographicReferenceDepth(){this._precompilePlugins(9,De)}_precompilePlugins(e,t){const s=this._bindParameters.output;this._bindParameters.output=e,this._plugins.precompile(...t),this._bindParameters.output=s}renderViewshedShadowMap(e){const{camera:t,contentCamera:s}=this._bindParameters,r=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(8),this._ensureBindParametersCamera(t,s),this._bindParameters.camera.setGLViewport(this._rctx),this._bindParameters.output=r}renderCutFillOrthographicReferenceDepth(e){const{camera:t,contentCamera:s}=this._bindParameters,r=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._bindParameters.output=9,this._plugins.render(...De),this._ensureBindParametersCamera(t,s),t.setGLViewport(this._rctx),this._bindParameters.output=r}get _needsGroundDepth(){return this._bindParameters.cutFillVisualizationEnabled}_blitGroundDepth(){if(!this._needsGroundDepth)return null;const{width:e,height:t}=this._framebuffer.size,s=this.fboCache.acquire(e,t,R.GROUND_DEPTH,13);return this._rctx.blitFramebuffer(this._framebuffer.color.fbo,s.fbo,256),this._framebuffer.bind(),s}_renderOpaqueAndTransparentGeometry(e){this._bindParameters.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithoutNormals(e){this._bindParameters.output=e,this._plugins.render(...Te)}_precompileOpaqueGeometry(){this._needsOpaquePass&&(this._plugins.precompile(...be),this._nodes.precompile(this._bindParameters.hasEmission,"opaque-color"))}_renderOpaqueGeometry(){this._plugins.render(...be)}_renderTransparentGeometry(){this._plugins.render(...fe),this._oitCallouts&&this._plugins.render(16)}get _hasPhotoshopTerrain(){return this._plugins.produces(0,6)}get _needsTerrainDepth(){return this._highQualityTransparency&&this._hasPhotoshopTerrain}_renderPhotoshopTerrain(){if(!this._hasPhotoshopTerrain)return null;const{width:e,height:t}=this._framebuffer.size,s=this.fboCache.acquire(e,t,"transparent terrain"),r=()=>this._plugins.render(6);return this._renderToTargets(r,s,this._framebuffer.depth,I),this.performanceInfo.advance(le.TRANSPARENT_TERRAIN),s}_renderTransparentGround(){this._plugins.render(...ge)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,0===e){const e=()=>this._plugins.render(16),{width:t,height:s}=this._framebuffer.size,r=this.fboCache.acquireDepth(this._hudDepthFormat,t,s,"line callouts");this._renderToTargets(e,this._framebuffer.color,r,void 0,!0,!0),r.release()}else this._plugins.render(16)}_precompileHUD(e){if(!this._pluginsHas.hudElements)return;const t=this._bindParameters.output,s=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this.oitEnabled?(this._bindParameters.output=1,this._plugins.precompile(...we),this._bindParameters.output=2,this._plugins.precompile(...we),this._bindParameters.output=0,this._oitBlend.precompile(this._bindParameters,!1,1)):(this._bindParameters.output=0,this._plugins.precompile(...we)),this._hasHighlights&&(this._bindParameters.output=10,this._plugins.precompile(...we)),this._bindParameters.output=t,this._bindParameters.hudRenderStyle=s}_renderHUD(e,t){if(!this._pluginsHas.hudElements)return t;if(this.oitEnabled){const s=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo);const r=!!t.getTexture(_e);this._compositor.compositePreMultipliedAlpha(this._bindParameters,s.getTexture(),r),s.release()}else if(this._bindParameters.output=0,0===e){const t=()=>this._renderHUDElements(e),{width:s,height:r}=this._framebuffer.size,i=this.fboCache.acquireDepth(this._hudDepthFormat,s,r,"hud");this._renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(this._hudDepthFormat),this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(256),this._renderHUDElements(e),t.detachDepth();return this.performanceInfo.advance(0===e?le.HUD_OCCLUDED:le.HUD),t}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(6,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:s}=this,{width:r,height:i}=this._framebuffer.size,{highlights:a}=s,n=a.length>V?3:1,h=e.acquire(r,i,"highlights",n);h.acquireDepth(13);const o=this._plugins.produces(10,0);return o&&this._framebuffer.color.fbo&&h.fbo&&t.blitFramebuffer(this._framebuffer.color.fbo,h.fbo,1024),t.bindFramebuffer(h.fbo),t.gl.clearBufferuiv(6144,0,[0,0,0,0]),o||t.clear(1024),this._bindParameters.output=10,t.bindFramebuffer(h.fbo),k(t,e,r,i,s,()=>this._renderHighlightGeometries()),h.detachDepth(),this.performanceInfo.advance(le.HIGHLIGHTS),h.retain(this._nodes.require("highlights",...O)+this._nodes.optional("highlights",...O)-1),h}_renderHighlightGeometries(){this._plugins.render(...Ae),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e,t){this._shadowAccumulator.updateDepthRange(e),this._bindParameters.output=0,this._shadowAccumulator.accumulating&&this._bindParameters.depth&&(this._shadowAccumulator.renderAccumulation(this._bindParameters,t)&&this.performanceInfo.advance(le.ACCUMULATED_SHADOWS),this._bindParameters.depth=h(this._bindParameters.depth))}_precompileTransparentGeometry(){this.oitEnabled&&H(this._bindParameters.output)?(this._bindParameters.output=1,this._plugins.precompile(...fe),this._oitCallouts&&this._plugins.precompile(16),this._bindParameters.output=2,this._plugins.precompile(...fe),this._oitCallouts&&this._plugins.precompile(16),this._bindParameters.output=0):this._plugins.precompile(...fe)}_renderOIT(e,t=2){const s=1===e,{width:r,height:i}=this._framebuffer.size,a=s?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=h.useFloatBlend.value?8:5,d=h.output;h.output=1;const l=s?"oit hud":"oit",_=this.fboCache.acquire(r,i,l,o),u=h.hasEmission&&(0===e||1!==t);u&&_.acquireColor(_e,o,"oit emissive");const m=u?me:_e;_.acquireColor(m,this.hasFloatBlend?7:0,"oit alpha"),s||_.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(_.fbo),this._rctx.clearFramebuffer([0,0,0,1]),u&&this._rctx.clearBuffer(1,I),a(),_.detachDepth(),h.output=2;const p=this.fboCache.acquire(r,i,s?"oit hud front":"oit front");u&&p.acquireColor(_e,o,"oit emissive front"),s?p.acquireDepth(this._hudDepthFormat):p.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(p.fbo),this._rctx.clearFramebuffer(I,s),a(),p.detachDepth();const c=this._pluginsHas.occludedHudElements&&!s;let b;return h.hudOcclusion=n(this._bindParameters.hudOcclusion),h.output=0,s?(b=this.fboCache.acquire(r,i,"oit hud composite"),this._rctx.bindFramebuffer(b.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):(c&&(this._framebuffer.color.acquireColor(m,0,"hud occlusion"),this._rctx.clearBuffer(m-pe,I)),this._framebuffer.bind()),this._oitBlend.blend(this._rctx,_,p,h,u,c,e),b?.detachDepth(),s||c&&(h.hudOcclusion=this._framebuffer.color.obtainAttachment(m)),p.release(),_.release(),h.output=d,b}get _hudDepthFormat(){return this.isFeatureEnabled(8)?13:12}get _needsOpaquePass(){return this.plugins.produces(0,...be)||this.plugins.produces(5,...be)||this.plugins.produces(3,3)}_renderOpaque(){const e=this._needsOpaquePass;e&&(this._plugins.render(0,1),this._pluginInput.set(R.GROUND_DEPTH,this._blitGroundDepth()),this._plugins.render(2,3));const t=this._framebuffer;this._renderTerrainDepth(),t.update(t=>this._renderNodes(D.OPAQUE,t,e)),this.fboCache.debugCallback?.(D.OPAQUE,t.color.fbo),t.update(e=>this._renderNodes(R.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(R.OPAQUE_ENVIRONMENT,t.color.fbo),this._renderEdges(1)}_renderPretransparent(){this._framebuffer.update(e=>this._renderNodes(R.PRE_TRANSPARENT,e)),this.fboCache.debugCallback?.(R.PRE_TRANSPARENT,this._framebuffer.color.fbo)}_renderTransparent(){const e=this._framebuffer;2===this._bindParameters.emissions&&e.ensureEmissionAttachment(),this._renderHiddenTransparentEdges(),this._hasTransparentGeometry&&(this.oitEnabled?this._renderOIT(0):this._renderTransparentGeometry()),e.update(e=>this._renderNodes(D.TRANSPARENT,e,this._hasTransparentGeometry)),this.fboCache.debugCallback?.(D.TRANSPARENT,e.color.fbo),this._renderGeometryDepth(),this._needsTerrainDepth||this._oitCallouts||this._plugins.render(16),this._renderEdges(0);const t=this._renderPhotoshopTerrain(),s=t?.getTexture();s&&this._renderHUD(0,e.color),this._bindParameters.cullAboveTerrain=!1,s&&(e.bind(),this._compositor.compositePreMultipliedAlpha(this._bindParameters,s),t?.release(),this._needsTerrainDepth&&(this._renderEdges(1),this._hasTransparentGeometry&&(this.oitEnabled?this._renderOIT(0):this._renderTransparentGeometry(),this.performanceInfo.advance(le.TRANSPARENT)),this._renderEdges(0))),this._bindParameters.ssao=n(this._bindParameters.ssao),this._needsTerrainDepth&&this._renderLineCallouts(1),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(le.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(9),this.performanceInfo.advance(le.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderNodes(e,t,s=!1){const r=t.name;if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return s&&this.performanceInfo.advance(e),t;this._fboCache.debugCallback?.(r,t.fbo);const i=this._nodes.render(t,this._pluginInput,this._releaseNodeInputs);return this.performanceInfo.advance(e),i}_ensureBindParameters(e,t,s){this._ensureBindParametersCamera(e,t),this._ensureBindParametersWeatherFader(s),this._ensureBindParametersScreenSpaceReflections(s),this._ensureBindParametersReprojection()}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersWeatherFader(e){1===this.stage.viewingMode&&(this._bindParameters.clouds.data&&(this._bindParameters.clouds.fade(this._bindParameters.camera,e,this.stage.view.qualitySettings.fadeDuration),this.weatherFader?.cleanupCubemap()),this._bindParameters.snowCover=this.weatherFader?.snowCover??0)}_ensureBindParametersScreenSpaceReflections(e){const{screenSpaceReflections:t}=this._bindParameters;if(this.hasReflections){null==this._ssrEnableTime&&(this._ssrEnableTime=e);const s=this.stage.view.qualitySettings.fadeDuration;t.fadeFactor=s>0?Math.min(s,e-this._ssrEnableTime)/s:1,t.fadeFactor<1&&this._requestRender()}else this._ssrEnableTime=null}_ensureBindParametersReprojection(){const{reprojection:e,camera:t}=this._bindParameters;if(!(this.hasReflections||this._hasGlobalIllumination))return void(this._reprojectionMatrix=T);const{lastFrameCamera:s}=e,r=!s.equals(t);if(r?(f(Oe,t.viewMatrix),f(Se,t.projectionMatrix),g(Fe,Oe,Se),g(Fe,s.viewMatrix,Fe),g(Fe,s.projectionMatrix,Fe),this._reprojectionMatrix=Fe):this._reprojectionMatrix=T,this._hasGlobalIllumination){const{viewMatrix:t}=e;r?(g(xe,s.viewMatrix,Oe),P(t,xe)):P(t,T)}}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,s,r){this._bindParameters.updateLighting(e,t,s,r),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0,clouds:this.weatherFader?.usedMemory??0}}_renderToTargets(e,t,s,r,i=!1,a=!1){t.attachDepth(s),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(r,i,a),e(),t.detachDepth()}get test(){}};e([p()],ce.prototype,"_inGlobeView",void 0),e([p({readOnly:!0})],ce.prototype,"hasAmbientIllumination",null),e([p({readOnly:!0})],ce.prototype,"highResolutionAtmosphere",null),e([p()],ce.prototype,"_edgeView",void 0),e([p()],ce.prototype,"updating",null),ce=e([c("esri.views.3d.webgl-engine.lib.Renderer")],ce);const be=[0,1,2,3],fe=[8,7,4,5],ge=[6,8,7],Pe=[0,1,2,4,...ge],Te=[3,5],Ee=[2,4,9],we=[17,13,15,14],Ae=[4,5,2,3,0,1,...ge],Ie=[4,9,5,12],Ce={0:[14],1:[13],2:[14,13],3:[14,13]},De=[0,1,...ge],Re=["normals","highlights"],Se=E(),Oe=E(),Fe=E(),xe=E();function ye(e){return t=>e.immediate.schedule(t)}export{ce as Renderer};
2
+ import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as s}from"../../../../core/asyncUtils.js";import has from"../../../../core/has.js";import{removeMaybe as r,abortMaybe as i,destroyMaybe as a,releaseMaybe as n,releaseReferencedMaybe as h}from"../../../../core/maybe.js";import{throwIfAborted as o}from"../../../../core/promiseUtils.js";import{watch as d,syncAndInitial as l,initial as _,sync as u}from"../../../../core/reactiveUtils.js";import{signal as m}from"../../../../core/signal.js";import{property as p,subclass as c}from"../../../../core/accessorSupport/decorators.js";import{equals as b,invert as f,multiply as g,copy as P}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as T,create as E}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as w}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as A,ZEROS as I}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as C}from"../../../../geometry/support/Indices.js";import{RenderNodeOutput as D,InternalRenderCategory as R,AllRenderNodeOutputs as O,AllInternalRenderNodeOutputs as S}from"../../webgl.js";import{minNearDistanceInMeters as F}from"../../state/NearFarHeuristic.js";import{debugFlags as x}from"../../support/debugFlags.js";import"../../webgl/ManagedDepthAttachment.js";import{FBOCache as y}from"../core/FBOCache.js";import{RenderPassManager as N}from"../core/renderPasses/RenderPassManager.js";import{isColor as G}from"../core/shaderLibrary/ShaderOutput.js";import{distanceFadeEnd as H}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{hasOit8Bit as v,hasEmissive8Bit as M}from"../effects/fboFormatUtils.js";import{RenderNodes as q}from"../effects/RenderNodes.js";import{RenderPluginManager as L}from"../effects/RenderPluginManager.js";import{WeatherFader as U}from"../effects/WeatherFader.js";import{innerAtmosphereFadeStart as j}from"../effects/atmosphere/atmosphereUtils.js";import{Blit as B}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as V,renderHighlightBuffer as k}from"../effects/highlight/Highlight.js";import{OITBlend as W}from"../effects/transparency/OITBlend.js";import{AnimationTimer as z}from"./AnimationTimer.js";import{AnimationTimeStep as Q}from"./AnimationTimeStep.js";import{BoundingInfo as Y}from"./BoundingInfo.js";import{Compositor as X}from"./Compositor.js";import{DepthRange as $}from"./DepthRange.js";import{depthRangeFromScene as J}from"./depthRangeUtils.js";import{MainFramebuffer as K}from"./MainFramebuffer.js";import{RenderContext as Z,defaultRenderOccludedMask as ee}from"./RenderContext.js";import{RendererBase as te}from"./RendererBase.js";import{setupFeatureDefaults as se}from"./RenderFeature.js";import{RenderPluginInput as re}from"./RenderPluginInput.js";import{ShadowAccumulator as ie}from"./ShadowAccumulator.js";import{ShadowMap as ae}from"./ShadowMap.js";import ne from"./SliceHelper.js";import{MergedRenderer as he}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as oe}from"../parts/renderUtils.js";import{RendererPerformanceInfo as de,PerformanceCategory as le}from"../statistics/RendererPerformanceInfo.js";import{ColorAttachment1 as _e,PixelType as ue,ColorAttachment2 as me,ColorAttachment0 as pe}from"../../../webgl/enums.js";let ce=class extends te{constructor(e,t,s,r,i){super({stage:e}),this._techniques=s,this._rctx=r,this._requestRender=i,this._pluginsHas={occludedHudElements:!1,hudElements:!1,water:!1},this.renderPassManager=new N,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=A(0,0,0,1),this._sliceHelper=new ne,this.sceneDepthRange=m($.Infinite),this._state=m(2),this._hasGlobalIlluminationFlag=!!has("global-illumination"),this._hasOit8Bit=v(),this._hasEmissive8Bit=M(),this._hasAnimations=!1,this._animationTimestep=new Q,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=m(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new re,this._hasTransparentGeometry=!1,this._oitCallouts=!1,this._releaseNodeInputs=e=>{for(const t of Re)e.some(({name:e})=>e===t)&&this._pluginInput.release(t)},this._testsNeedsDepth=!1,this._fboCache=new y(r),this._compositor=new X(r,s),this._renderStateFeatures=m(se(e.view.qualityProfile));const a=new ae(this._fboCache,e.viewingMode);this._renderContext=new Z(this._rctx,a,s),this._framebuffer=new K(this._fboCache,this._bindParameters),this._performanceInfo=new de(this._rctx),this._blit=new B(s),this._shadowAccumulator=new ie(this.fboCache,s,e,e=>{const t=this.shadowsEnabled;a.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),a.enabled=t},(t,s,r)=>{const i=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,s,r,!0,i),this._renderShadowCascades(5,t.shadowMap),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)},i),this._nodes=new q(this._renderContext),this._plugins=new L({renderContext:this._renderContext,techniques:s,materials:t,requestRender:i,controller:e}),this._plugins.add(this.renderPassManager),this.weatherFader=new U({view:e.view,context:this._renderContext}),this.addHandles([d(()=>e.view.state.camera,()=>i(),l),d(()=>x.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},i()},_),d(()=>e.view.environment.background?.color,e=>{const t=e?e.toUnitRGBA():I;w(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),i()},l),d(()=>e.view.state.camera.relativeElevation,e=>this._inGlobeView=(e??1/0)>=H,l),d(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},u),d(()=>this._bindParameters.clouds.data?.state,()=>i(),u),d(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,i()},_),d(()=>"sun"===e.view.environment.lighting?.type,e=>{this._bindParameters.enableFillLights=e,this._requestRender()},l)])}destroy(){this._gpuTimerHandle=r(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowAccumulator.destroy(),this._shadowAccumulator=null,this._loadEdgeViewTask=i(this._loadEdgeViewTask),this._edgeView=a(this._edgeView),this.renderPassManager.dispose(),this.weatherFader=a(this.weatherFader),this._releaseFBOs(),this._disposeOffscreenBuffers(),this._fboCache.destroy(),this._fboCache=null,this._renderContext.destroy(),this._plugins.destroy(),this._pluginInput=null,this._oitBlendOrNil=null,this._nodes=null,this._framebuffer=null,this._performanceInfo=null,Y.prune(),he.prune(),C()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _oitBlend(){return this._oitBlendOrNil??=new W(this._techniques),this._oitBlendOrNil}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e){this._renderStateFeatures.value=se(e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,s){this._renderStateFeatures.mutate(r=>r.set(t,e,s)),this._requestRender()}get _highQualityTransparency(){return this.isFeatureEnabled(1)}get hasReflections(){return this._bindParameters.screenSpaceReflections.enabled=this._pluginsHas.water&&this.isFeatureEnabled(5),this._bindParameters.screenSpaceReflections.enabled}get _hasHighlights(){return this._plugins.produces(10,2,4,19,13,14,15)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(10,13,14,15)}get hasAmbientIllumination(){return this.isFeatureEnabled(4)&&!this._inGlobeView}get _hasGlobalIllumination(){return this.hasAmbientIllumination&&this._hasGlobalIlluminationFlag}get hasSMAA(){return this.isFeatureEnabled(0)}get _hasEmissions(){return this._hasEmissive8Bit||this.hasFloatBlend?this._plugins.hasEmissions:0}get hasFloatBlend(){return this._rctx.driverTest.floatBufferBlend.result&&this.isFeatureEnabled(10)}get oitEnabled(){return this.hasFloatBlend||this._hasOit8Bit}get highResolutionAtmosphere(){return this.isFeatureEnabled(3)}get fboCache(){return this._fboCache}_releaseFBOs(){this._bindParameters.terrainDepth=n(this._bindParameters.terrainDepth),this._bindParameters.geometryDepth=n(this._bindParameters.geometryDepth),this._bindParameters.hudOcclusion=n(this._bindParameters.hudOcclusion),this._bindParameters.depth=null}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._bindParameters.globalIllumination=n(this._bindParameters.globalIllumination),this._bindParameters.reprojection.lastFrameDepth=n(this._bindParameters.reprojection.lastFrameDepth),this._bindParameters.reprojection.lastFrameEmission=n(this._bindParameters.reprojection.lastFrameEmission),this._disposeBindBuffers()}_disposeBindBuffers(){this._bindParameters.shadowMap.disposeOutputs()}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._shadowAccumulator.readyToRun||this._plugins.updating||this.weatherFader?.readyToRun||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=s(async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");o(e);const s=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:ye(this.stage.view.resourceController)});return this.addHandles(d(()=>s.updating,()=>this._requestRender(),u)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(s)),this._edgeViewCallbacks.length=0,s})),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&&b(this._bindParameters.reprojection.matrix,T)}set _reprojectionMatrix(e){t(this._bindParameters.reprojection.matrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._bindParameters.shadowMap.enabled}setParameters(e){void 0!==e.shadowMap&&this._bindParameters.shadowMap.enabled!==e.shadowMap&&(this._bindParameters.shadowMap.enabled=e.shadowMap,this._requestRender()),e.shadowCast&&this._shadowAccumulator.setParameters(e.shadowCast)}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}rendererAdded(e){this._plugins.add(e)}rendererRemoved(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this.occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(8&this.plugins.renderOccludedFlags)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,10)}updateHasFlags(){const has=this._pluginsHas;has.occludedHudElements=this._plugins.produces(0,14),has.hudElements=has.occludedHudElements||this._plugins.produces(0,...we),has.water=this._plugins.produces(4,20),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new z(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const s=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==s&&(this._gpuTimerHandle=s?r(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,s,r=!1){try{return this._isRendering=!0,this._render(e,t,s,r)}catch(i){console.error(`Exception during rendering: ${i}:\n${i.stack}`)}finally{this._isRendering=!1}return new oe(this._pluginInput.get(D.FINAL),null)}_render(e,t,s,r){const i=0===s;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=i,this._disposeBindBuffers();const{camera:a,contentCamera:o,mode:d,alignPixelEnabled:l}=e;this._state.value=d,this._renderContext.time=t,this._bindParameters.output=0,this._bindParameters.emissions=this._hasEmissions,this._bindParameters.alignPixelEnabled=l,this._bindParameters.decorations=!r,this._bindParameters.mainDepth=null,this._bindParameters.useFloatBlend.value=this.hasFloatBlend;const _=!r||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=_?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(R.VIEWSHED),this._bindParameters.cutFillComputationEnabled=this._nodes.produces(R.CUTFILL_COMPUTATION),this._bindParameters.cutFillVisualizationEnabled=this._nodes.produces(R.CUTFILL_COLOR),this._renderOverlay(),a.setGLViewport(this._rctx);const u=this._framebuffer,m=u.initialize(a.fullWidth,a.fullHeight,this._backgroundColor);this.hasReflections?(m?.setName("last frame color"),this._bindParameters.reprojection.lastFrameColor=m):m?.release(),this._ensureBindParameters(a,o,t),this._plugins.sortTestsTransparentOrderedSlots(Ie),this._plugins.prepareRender(),this._bindParameters.hasShadowHighlights=this._needsShadowHighlight&&!r,this._hasTransparentGeometry=this._plugins.produces(0,...fe),this._precompilePrepasses(),this.performanceInfo.advance(le.PREPARE);const p=this._computeShadowDepthRange(a);this._pluginInput.set("normals",this._renderNormals()),this._renderAmbientIlluminationAndDepth(),this._renderShadowMap(a,o,this._bindParameters.lighting.mainLight.direction,p),this._renderShadowAccumulation(p,!i),this._oitCallouts=this._hasTransparentGeometry&&this.oitEnabled,u.bind(),this._bindParameters.mainDepth=u.depth.attachment,this._precompileShaders(),this._bindParameters.output=0;this._bindParameters.hasOpaqueEmissions||0===this._bindParameters.emissions?(this._renderOpaque(),this._renderPreTransparent()):(this._bindParameters.emissions=0,this._renderOpaque(),this._renderPreTransparent(),this._bindParameters.emissions=2),this._renderTransparent(),this._bindParameters.reprojection.lastFrameColor=n(this._bindParameters.reprojection.lastFrameColor),this.hasReflections&&(this._bindParameters.depth=h(this._bindParameters.depth)),this._bindParameters.shadowMap.disposeOutput(5),this._renderCutFillComputation(),this._pluginInput.set(R.FOCUSAREA,this._renderFocusAreaGeometry()),u.update(e=>this._renderNodes(R.TRANSPARENT_ENVIRONMENT,e)),u.update(e=>this._renderNodes(R.VIEWSHED,e)),u.update(e=>this._renderNodes(R.LASERLINES,e)),this._nodes.requireGeometryDepth&&(this._bindParameters.depth=h(this._bindParameters.depth)),u.update(e=>this._renderNodes(R.FOCUSAREA_COLOR,e)),u.update(e=>this._renderNodes(R.CUTFILL_COLOR,e)),this._pluginInput.release(R.FOCUSAREA),this._pluginInput.release(R.GROUND_DEPTH),u.update(e=>this._renderNodes(R.OCCLUDED,e)),this._pluginInput.set("highlights",this._renderHighlightPrepass());const c=2===s?this._renderObjectAndLayerIdColor():null;u.update(e=>this._renderNodes(D.COMPOSITE,e)),this._bindParameters.shadowMap.disposeOutputs(),this._bindParameters.shadowHighlight=n(this._bindParameters.shadowHighlight),this._hasGlobalIllumination&&this._hasEmissions&&(this._bindParameters.reprojection.lastFrameEmission=u.color.obtainAttachment(_e)),u.update(e=>this._renderNodes(R.ANTIALIASING,e));const b=this._hasPhotoshopTerrain||!this._hasTransparentGeometry?1:2;let f;return this._bindParameters.emissions=0,this._hasHUDHighlights&&u.update(e=>this._renderHUD(b,e)),u.update(e=>this._renderNodes(R.HIGHLIGHT_COLOR,e)),this._hasHUDHighlights||u.update(e=>this._renderHUD(b,e)),this._bindParameters.emissions=this._hasEmissions,u.update(e=>this._renderNodes(R.MAGNIFIER,e)),u.update(e=>this._renderNodes(D.FINAL,e)),i&&this._blit.toFramebuffer(this._rctx,u.color,this._bindParameters),this._hasGlobalIllumination&&(this._bindParameters.reprojection.lastFrameDepth=this._bindParameters.depth),this._testsNeedsDepth&&(this._bindParameters.depth=h(this._bindParameters.depth)),this._releaseFBOs(),u.releaseDepth(),this._bindParameters.reprojection.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),i||(f=u.color,f.retain(),this._releaseFBOs(),this._disposeOffscreenBuffers()),this.performanceInfo.finishFrame(),new oe(f,c)}_precompileShaders(){++this._plugins.context.techniques.precompiling,this._bindParameters.output=0;const e=this._bindParameters.hasEmission;this._precompileOpaqueGeometry(),this._nodes.precompile(e,R.OPAQUE_ENVIRONMENT,R.GAUSSIAN_SPLAT,R.OPAQUE_OCCLUSION_QUERY,R.VOXEL);2===this._bindParameters.emissions&&(this._bindParameters.emissions=0,this._precompileOpaqueGeometry(),this._bindParameters.emissions=2);const t=this._bindParameters;if(t.terrainDepthTest=t.cullAboveTerrain=this._needsTerrainDepth,this._bindParameters.output=3,this._plugins.precompile(...ge),this._bindParameters.output=0,this._plugins.precompile(...ge),this._hasTransparentGeometry){const e=this._pluginsHas.occludedHudElements;this._oitBlend.precompile(this._bindParameters,e,0),this._pluginsHas.hudElements&&this._oitBlend.precompile(this._bindParameters,!1,1)}this._hasTransparentGeometry&&(this._precompileTransparentGeometry(),this._hasPhotoshopTerrain&&(t.cullAboveTerrain=!1,this._precompileTransparentGeometry(),t.cullAboveTerrain=this._needsTerrainDepth)),this._nodes.precompile(e,R.FOCUSAREA);const s=this._hasPhotoshopTerrain&&!this._needsTerrainDepth;this._compositor.precompile(this._usesPremultipliedAlphaBlit,!!this._needsEdges,s,e),this._oitCallouts||this._plugins.precompile(16),t.terrainDepthTest=t.cullAboveTerrain=!1,this._nodes.precompile(e,R.TRANSPARENT_ENVIRONMENT,R.VIEWSHED,R.CUTFILL_COMPUTATION,R.CUTFILL_COLOR,R.LASERLINES,R.FOCUSAREA_COLOR,R.OCCLUDED,R.ANTIALIASING),t.highlightMixTexture=t.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(0),t.emissions=0,this._precompileHUD(0),this._precompileHUD(1),t.emissions=this._hasEmissions,this._hasHighlights&&(t.highlights.forEach((e,s)=>{t.highlightLevel=s,this._precompileAllGeometry(10),this._hasHUDHighlights&&this._plugins.precompile(14,13)}),t.highlightLevel=null,this._nodes.precompile(e,R.HIGHLIGHT_COLOR)),t.highlightMixTexture=null,this._nodes.precompile(e,D.COMPOSITE,R.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(9),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(R.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(le.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces("olid"))return null;const e=this._bindParameters.output;++this._techniques.precompiling;const{width:t,height:s}=this._framebuffer.size;let r=this.fboCache.acquire(t,s,"olid");return r.acquireDepth(13),r=this._nodes.render(r,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(le.OBJECT_AND_LAYER_ID_COLOR),this._bindParameters.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,s=0===e;if(s||t){const e=s?this.performanceInfo.elapsedTime:0;let r=0;t?r=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const i=Math.max(e,r);this._animationTimestep.frame(i,s)}}readMainDepth(e,t){const{mainDepth:s,camera:r}=this._bindParameters;if(!s)return;const i=this.fboCache.acquire(this._framebuffer.size.width,this._framebuffer.size.height,"linear depth");this._rctx.bindFramebuffer(i.fbo),r.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(I),this._compositor.blitDepthToLinearDepth(this._bindParameters,s),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),i.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,ue.UNSIGNED_BYTE,t),i.release()}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}get _needsEdges(){return this._edgeView?.shouldRender()?this._edgeView:null}_renderEdges(e){const t=this._needsEdges;if(!t)return;const{width:s,height:r}=this._framebuffer.size,i=this.fboCache.acquire(s,r,"edges"),a=this._bindParameters.geometryDepth,n=()=>t.render(this._bindParameters,e);this._renderToTargets(n,i,a??this._framebuffer.depth,I),this._framebuffer.bind(),this._compositor.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(1===e?le.OPAQUE_EDGES:le.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(this._renderContext.time),this._bindParameters.overlay&&this.performanceInfo.advance(le.OVERLAY)}_renderShadowMap(e,t,s,r){if(!this.shadowsEnabled)return;const i=this._bindParameters.shadowMap;if(i.start(e,s,r,this.isFeatureEnabled(6),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight){this._renderShadowCascades(6,i),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t);const s=this._bindParameters.output;this._bindParameters.output=0,this._bindParameters.shadowHighlight=this._nodes.produce(R.SHADOW_HIGHLIGHT,this._pluginInput),this._bindParameters.output=s,i.disposeOutput(6),i.clear(),this._renderShadowCascades(7,i)}else this._renderShadowCascades(5);e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this._needsShadowHighlight&&(this._bindParameters.depth=h(this._bindParameters.depth)),this.performanceInfo.advance(le.SHADOW_MAP)}_renderCutFillComputation(){this._nodes.produce(R.CUTFILL_COMPUTATION,this._pluginInput)?.release()}_precompileShadowCascades(e){0!==this._bindParameters.shadowMap.cascades.length&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._bindParameters.shadowMap){const s=this._bindParameters.output;t.bindFramebuffer();for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this.renderAllGeometry(e);t.finish(e),this._bindParameters.output=s}get _needsDepth(){return+this._nodes.requireGeometryDepth+ +this.hasReflections+ +this._hasGlobalIllumination+ +this._shadowAccumulator.accumulating+ +this._testsNeedsDepth}get _usesPremultipliedAlphaBlit(){return this._pluginsHas.hudElements&&this.oitEnabled||this._hasPhotoshopTerrain}_renderAmbientIlluminationAndDepth(){this._bindParameters.depth=n(this._bindParameters.depth);const e=this._pluginInput.get("normals");if(e){this._pluginInput.set(R.AMBIENT_ILLUMINATION,this._hasGlobalIlluminationFlag?this._renderGlobalIllumination():this._renderSSAO());const t=this._needsDepth;t?(this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(3),this._bindParameters.depth=e.obtainDepthTexture(),this._bindParameters.depth?.retain(t-1),this.performanceInfo.advance(le.DEPTH)):e.detachDepth(),this.hasAmbientIllumination&&this._pluginInput.release("normals")}else this._renderAllGeometryDepth()}_renderAllGeometryDepth(){const e=this._needsDepth;if(0===e)return;const{width:t,height:s}=this._framebuffer.size,r=this.fboCache.acquire(t,s,"geometry",13);this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(1280),this.renderAllGeometry(3),this._bindParameters.depth=r.obtainDepthTexture(),this._bindParameters.depth?.retain(e-1),r.release(),this.performanceInfo.advance(le.DEPTH)}_renderTerrainDepth(){if(this._bindParameters.terrainDepth=n(this._bindParameters.terrainDepth),this._bindParameters.terrainDepthTest=this._bindParameters.cullAboveTerrain=this._needsTerrainDepth,!this._needsTerrainDepth)return;const e=this._bindParameters.output;this._bindParameters.output=3;const{width:t,height:s}=this._framebuffer.size,r=this.fboCache.acquire(t,s,"terrain",13);this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(1280),this._renderTransparentGround(),this._bindParameters.terrainDepth=r.obtainDepthTexture(),r.release(),this._bindParameters.output=e}_renderGeometryDepth(){if(this._bindParameters.geometryDepth=n(this._bindParameters.geometryDepth),!this._needsTerrainDepth)return;const e=this._bindParameters.output,{width:t,height:s}=this._framebuffer.size,r=this.fboCache.acquire(t,s,"geometry",13);this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(1280),this._renderOpaqueAndTransparentGeometry(3),this._bindParameters.output=e,this._bindParameters.geometryDepth=r.obtainDepthTexture(),r.release()}get _needsShadowDepthRange(){return this._bindParameters.shadowMap.enabled||this._shadowAccumulator.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return $.Zero;const t=J(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal)return void(this.sceneDepthRange.value=$.Infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<j)return void(this.sceneDepthRange.value=$.Infinite);const t=e.clone();t.near=F,t.far=1e10;const s=J(t,this._plugins.plugins,this.stage.layers,1);s.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(s)||(this.sceneDepthRange.value=s)}get _normalsRequired(){return this._nodes.require("normals",...O,R.VIEWSHED,R.LASERLINES)+(this.hasAmbientIllumination?1:0)}_precompilePrepasses(){this._normalsRequired?(this._precompilePlugins(4,Pe),this._needsDepth&&this._precompilePlugins(3,Te)):this._needsDepth&&this._precompileAllGeometry(3),this.shadowsEnabled&&(this._needsShadowHighlight?(this._nodes.precompile(this._bindParameters.hasEmission,R.SHADOW_HIGHLIGHT),this._precompileShadowCascades(6),this._precompileShadowCascades(7)):this._precompileShadowCascades(5)),this._shadowAccumulator.active&&this._precompileAllGeometry(5),this.hasAmbientIllumination&&this._normalsRequired&&this._nodes.precompile(this._bindParameters.hasEmission,R.AMBIENT_ILLUMINATION)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const{width:t,height:s}=this._framebuffer.size,r=this.fboCache.acquire(t,s,"normals",5);r.acquireDepth(13),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(I,!0,!0),this._bindParameters.output=4,this._plugins.render(...Pe);const i=this._nodes.optional("normals",...O,R.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(le.NORMALS),r}_renderSSAO(){const e=this._pluginInput.get("normals");if(this.hasAmbientIllumination&&e)return this._bindParameters.ssao=this._nodes.produce(R.AMBIENT_ILLUMINATION,this._pluginInput),this._bindParameters.ssao&&this.performanceInfo.advance(le.AMBIENT_ILLUMINATION),this._bindParameters.ssao}_renderGlobalIllumination(){if(!this.hasAmbientIllumination)return void this._releaseGlobalIlluminationBuffers();const e=this._nodes.produce(R.AMBIENT_ILLUMINATION,this._pluginInput);return this._releaseGlobalIlluminationBuffers(),this._bindParameters.globalIllumination=e,this.performanceInfo.advance(le.AMBIENT_ILLUMINATION),e}_releaseGlobalIlluminationBuffers(){this._bindParameters.reprojection.lastFrameDepth=h(this._bindParameters.reprojection.lastFrameDepth),this._bindParameters.reprojection.lastFrameEmission=h(this._bindParameters.reprojection.lastFrameEmission),this._bindParameters.globalIllumination=h(this._bindParameters.globalIllumination)}_precompileAllGeometry(e){const t=this._bindParameters.output;this._bindParameters.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(...ge),this._bindParameters.output=t}renderAllGeometry(e){this._bindParameters.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentGround()}precompileSlots(e,...t){for(const s of t)this._bindParameters.slot=s,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const s of t)this._renderContext.renderOccludedMask=s,this.precompileSlots(e,...Ee);this._renderContext.renderOccludedMask=ee}renderSlots(e,...t){for(const s of t)this._bindParameters.slot=s,e.forAll(e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)})}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>1&&this._plugins.render(10),this.renderSlots(e,...Ee),this._renderContext.renderOccludedMask=ee}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Ce[e])}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(17),this.renderHUD(e),this._bindParameters.hudRenderStyle=e,this._plugins.render(15)}precompileViewshedShadowMap(){this._precompileAllGeometry(8)}precompileCutFillOrthographicReferenceDepth(){this._precompilePlugins(9,De)}_precompilePlugins(e,t){const s=this._bindParameters.output;this._bindParameters.output=e,this._plugins.precompile(...t),this._bindParameters.output=s}renderViewshedShadowMap(e){const{camera:t,contentCamera:s}=this._bindParameters,r=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(8),this._ensureBindParametersCamera(t,s),this._bindParameters.camera.setGLViewport(this._rctx),this._bindParameters.output=r}renderCutFillOrthographicReferenceDepth(e){const{camera:t,contentCamera:s}=this._bindParameters,r=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._bindParameters.output=9,this._plugins.render(...De),this._ensureBindParametersCamera(t,s),t.setGLViewport(this._rctx),this._bindParameters.output=r}get _needsGroundDepth(){return this._bindParameters.cutFillVisualizationEnabled}_blitGroundDepth(){if(!this._needsGroundDepth)return null;const{width:e,height:t}=this._framebuffer.size,s=this.fboCache.acquire(e,t,R.GROUND_DEPTH,13);return this._rctx.blitFramebuffer(this._framebuffer.color.fbo,s.fbo,256),this._framebuffer.bind(),s}_renderOpaqueAndTransparentGeometry(e){this._bindParameters.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithoutNormals(e){this._bindParameters.output=e,this._plugins.render(...Te)}_precompileOpaqueGeometry(){this._needsOpaquePass&&(this._plugins.precompile(...be),this._nodes.precompile(this._bindParameters.hasEmission,"opaque-color"))}_renderOpaqueGeometry(){this._plugins.render(...be)}_renderTransparentGeometry(){this._plugins.render(...fe),this._oitCallouts&&this._plugins.render(16)}get _hasPhotoshopTerrain(){return this._plugins.produces(0,6)}get _needsTerrainDepth(){return this._highQualityTransparency&&this._hasPhotoshopTerrain}_renderPhotoshopTerrain(){if(!this._hasPhotoshopTerrain)return null;const{width:e,height:t}=this._framebuffer.size,s=this.fboCache.acquire(e,t,"transparent terrain"),r=()=>this._plugins.render(6);return this._renderToTargets(r,s,this._framebuffer.depth,I),this.performanceInfo.advance(le.TRANSPARENT_TERRAIN),s}_renderTransparentGround(){this._plugins.render(...ge)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,0===e){const e=()=>this._plugins.render(16),{width:t,height:s}=this._framebuffer.size,r=this.fboCache.acquireDepth(this._hudDepthFormat,t,s,"line callouts");this._renderToTargets(e,this._framebuffer.color,r,void 0,!0,!0),r.release()}else this._plugins.render(16)}_precompileHUD(e){if(!this._pluginsHas.hudElements)return;const t=this._bindParameters.output,s=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this.oitEnabled?(this._bindParameters.output=1,this._plugins.precompile(...we),this._bindParameters.output=2,this._plugins.precompile(...we),this._bindParameters.output=0,this._oitBlend.precompile(this._bindParameters,!1,1)):(this._bindParameters.output=0,this._plugins.precompile(...we)),this._hasHighlights&&(this._bindParameters.output=10,this._plugins.precompile(...we)),this._bindParameters.output=t,this._bindParameters.hudRenderStyle=s}_renderHUD(e,t){if(!this._pluginsHas.hudElements)return t;if(this.oitEnabled){const s=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo);const r=!!t.getTexture(_e);this._compositor.compositePreMultipliedAlpha(this._bindParameters,s.getTexture(),r),s.release()}else if(this._bindParameters.output=0,0===e){const t=()=>this._renderHUDElements(e),{width:s,height:r}=this._framebuffer.size,i=this.fboCache.acquireDepth(this._hudDepthFormat,s,r,"hud");this._renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(this._hudDepthFormat),this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(256),this._renderHUDElements(e),t.detachDepth();return this.performanceInfo.advance(0===e?le.HUD_OCCLUDED:le.HUD),t}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(6,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:s}=this,{width:r,height:i}=this._framebuffer.size,{highlights:a}=s,n=a.length>V?3:1,h=e.acquire(r,i,"highlights",n);h.acquireDepth(13);const o=this._plugins.produces(10,0);return o&&this._framebuffer.color.fbo&&h.fbo&&t.blitFramebuffer(this._framebuffer.color.fbo,h.fbo,1024),t.bindFramebuffer(h.fbo),t.gl.clearBufferuiv(6144,0,[0,0,0,0]),o||t.clear(1024),this._bindParameters.output=10,t.bindFramebuffer(h.fbo),k(t,e,r,i,s,()=>this._renderHighlightGeometries()),h.detachDepth(),this.performanceInfo.advance(le.HIGHLIGHTS),h.retain(this._nodes.require("highlights",...S)+this._nodes.optional("highlights",...S)-1),h}_renderHighlightGeometries(){this._plugins.render(...Ae),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e,t){this._shadowAccumulator.updateDepthRange(e),this._bindParameters.output=0,this._shadowAccumulator.accumulating&&this._bindParameters.depth&&(this._shadowAccumulator.renderAccumulation(this._bindParameters,t)&&this.performanceInfo.advance(le.ACCUMULATED_SHADOWS),this._bindParameters.depth=h(this._bindParameters.depth))}_precompileTransparentGeometry(){this.oitEnabled&&G(this._bindParameters.output)?(this._bindParameters.output=1,this._plugins.precompile(...fe),this._oitCallouts&&this._plugins.precompile(16),this._bindParameters.output=2,this._plugins.precompile(...fe),this._oitCallouts&&this._plugins.precompile(16),this._bindParameters.output=0):this._plugins.precompile(...fe)}_renderOIT(e,t=2){const s=1===e,{width:r,height:i}=this._framebuffer.size,a=s?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=h.useFloatBlend.value?8:5,d=h.output;h.output=1;const l=s?"oit hud":"oit",_=this.fboCache.acquire(r,i,l,o),u=h.hasEmission&&(0===e||1!==t);u&&_.acquireColor(_e,o,"oit emissive");const m=u?me:_e;_.acquireColor(m,this.hasFloatBlend?7:0,"oit alpha"),s||_.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(_.fbo),this._rctx.clearFramebuffer([0,0,0,1]),u&&this._rctx.clearBuffer(1,I),a(),_.detachDepth(),h.output=2;const p=this.fboCache.acquire(r,i,s?"oit hud front":"oit front");u&&p.acquireColor(_e,o,"oit emissive front"),s?p.acquireDepth(this._hudDepthFormat):p.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(p.fbo),this._rctx.clearFramebuffer(I,s),a(),p.detachDepth();const c=this._pluginsHas.occludedHudElements&&!s;let b;return h.hudOcclusion=n(this._bindParameters.hudOcclusion),h.output=0,s?(b=this.fboCache.acquire(r,i,"oit hud composite"),this._rctx.bindFramebuffer(b.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):(c&&(this._framebuffer.color.acquireColor(m,0,"hud occlusion"),this._rctx.clearBuffer(m-pe,I)),this._framebuffer.bind()),this._oitBlend.blend(this._rctx,_,p,h,u,c,e),b?.detachDepth(),s||c&&(h.hudOcclusion=this._framebuffer.color.obtainAttachment(m)),p.release(),_.release(),h.output=d,b}get _hudDepthFormat(){return this.isFeatureEnabled(8)?13:12}get _needsOpaquePass(){return this.plugins.produces(0,...be)||this.plugins.produces(5,...be)||this.plugins.produces(3,3)}_renderOpaque(){const e=this._needsOpaquePass;e&&(this._plugins.render(0,1),this._pluginInput.set(R.GROUND_DEPTH,this._blitGroundDepth()),this._plugins.render(2,3));const t=this._framebuffer;this._renderTerrainDepth(),t.update(t=>this._renderNodes(D.OPAQUE,t,e)),this.fboCache.debugCallback?.(D.OPAQUE,t.color.fbo),t.update(e=>this._renderNodes(R.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(R.OPAQUE_ENVIRONMENT,t.color.fbo),this._renderEdges(1)}_renderPreTransparent(){this._framebuffer.update(e=>this._renderNodes(R.GAUSSIAN_SPLAT,e)),this.fboCache.debugCallback?.(R.GAUSSIAN_SPLAT,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(R.OPAQUE_OCCLUSION_QUERY,e)),this.fboCache.debugCallback?.(R.OPAQUE_OCCLUSION_QUERY,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(R.VOXEL,e)),this.fboCache.debugCallback?.(R.VOXEL,this._framebuffer.color.fbo)}_renderTransparent(){const e=this._framebuffer;2===this._bindParameters.emissions&&e.ensureEmissionAttachment(),this._renderHiddenTransparentEdges(),this._hasTransparentGeometry&&(this.oitEnabled?this._renderOIT(0):this._renderTransparentGeometry()),e.update(e=>this._renderNodes(D.TRANSPARENT,e,this._hasTransparentGeometry)),this.fboCache.debugCallback?.(D.TRANSPARENT,e.color.fbo),this._renderGeometryDepth(),this._needsTerrainDepth||this._oitCallouts||this._plugins.render(16),this._renderEdges(0);const t=this._renderPhotoshopTerrain(),s=t?.getTexture();s&&this._renderHUD(0,e.color),this._bindParameters.cullAboveTerrain=!1,s&&(e.bind(),this._compositor.compositePreMultipliedAlpha(this._bindParameters,s),t?.release(),this._needsTerrainDepth&&(this._renderEdges(1),this._hasTransparentGeometry&&(this.oitEnabled?this._renderOIT(0):this._renderTransparentGeometry(),this.performanceInfo.advance(le.TRANSPARENT)),this._renderEdges(0))),this._bindParameters.ssao=n(this._bindParameters.ssao),this._needsTerrainDepth&&this._renderLineCallouts(1),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(le.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(9),this.performanceInfo.advance(le.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderNodes(e,t,s=!1){const r=t.name;if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return s&&this.performanceInfo.advance(e),t;this._fboCache.debugCallback?.(r,t.fbo);const i=this._nodes.render(t,this._pluginInput,this._releaseNodeInputs);return this.performanceInfo.advance(e),i}_ensureBindParameters(e,t,s){this._ensureBindParametersCamera(e,t),this._ensureBindParametersWeatherFader(s),this._ensureBindParametersScreenSpaceReflections(s),this._ensureBindParametersReprojection()}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersWeatherFader(e){1===this.stage.viewingMode&&(this._bindParameters.clouds.data&&(this._bindParameters.clouds.fade(this._bindParameters.camera,e,this.stage.view.qualitySettings.fadeDuration),this.weatherFader?.cleanupCubemap()),this._bindParameters.snowCover=this.weatherFader?.snowCover??0)}_ensureBindParametersScreenSpaceReflections(e){const{screenSpaceReflections:t}=this._bindParameters;if(this.hasReflections){null==this._ssrEnableTime&&(this._ssrEnableTime=e);const s=this.stage.view.qualitySettings.fadeDuration;t.fadeFactor=s>0?Math.min(s,e-this._ssrEnableTime)/s:1,t.fadeFactor<1&&this._requestRender()}else this._ssrEnableTime=null}_ensureBindParametersReprojection(){const{reprojection:e,camera:t}=this._bindParameters;if(!(this.hasReflections||this._hasGlobalIllumination))return void(this._reprojectionMatrix=T);const{lastFrameCamera:s}=e,r=!s.equals(t);if(r?(f(Se,t.viewMatrix),f(Oe,t.projectionMatrix),g(Fe,Se,Oe),g(Fe,s.viewMatrix,Fe),g(Fe,s.projectionMatrix,Fe),this._reprojectionMatrix=Fe):this._reprojectionMatrix=T,this._hasGlobalIllumination){const{viewMatrix:t}=e;r?(g(xe,s.viewMatrix,Se),P(t,xe)):P(t,T)}}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,s,r){this._bindParameters.updateLighting(e,t,s,r),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0,clouds:this.weatherFader?.usedMemory??0}}_renderToTargets(e,t,s,r,i=!1,a=!1){t.attachDepth(s),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(r,i,a),e(),t.detachDepth()}get test(){}};e([p()],ce.prototype,"_inGlobeView",void 0),e([p({readOnly:!0})],ce.prototype,"hasAmbientIllumination",null),e([p({readOnly:!0})],ce.prototype,"highResolutionAtmosphere",null),e([p()],ce.prototype,"_edgeView",void 0),e([p()],ce.prototype,"updating",null),ce=e([c("esri.views.3d.webgl-engine.lib.Renderer")],ce);const be=[0,1,2,3],fe=[8,7,4,5],ge=[6,8,7],Pe=[0,1,2,4,...ge],Te=[3,5],Ee=[2,4,9],we=[17,13,15,14],Ae=[4,5,2,3,0,1,...ge],Ie=[4,9,5,12],Ce={0:[14],1:[13],2:[14,13],3:[14,13]},De=[0,1,...ge],Re=["normals","highlights"],Oe=E(),Se=E(),Fe=E(),xe=E();function ye(e){return t=>e.immediate.schedule(t)}export{ce as Renderer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import t from"../../../../core/Logger.js";import{clamp as e}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as i}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as r,Seconds as s}from"../../../../core/time.js";import{copy as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{set as n,subtract as o,dot as l,scale as h,add as p,copy as m,length as c,distance as u,transformMat4 as f}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as g}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{ONES as b,create as _}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeFloat16Array as S}from"../../../../geometry/support/float16.js";import{distance2 as v,fromPoints as P,closestLineSegmentPoint as w,create as y}from"../../../../geometry/support/lineSegment.js";import{fromPoints as j,signedDistance as E,getNormal as T,create as z}from"../../../../geometry/support/plane.js";import{isHighlightOrOLID as A,isColor as O,isDepth as x,isColorHighlightOLIDOrDepth as C,is2DGeometryOutput as L}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as M}from"../effects/geometry/olidUtils.js";import V from"../lib/GLMaterial.js";import{Material as R}from"../lib/Material.js";import{isTranslationMatrix as F}from"../lib/Util.js";import{isImagePattern as N}from"./lineStippleUtils.js";import{VisualVariablePassParameters as k}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as U}from"./internal/bufferWriterUtils.js";import{r as D}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as B,RibbonLineTechnique as I}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as W}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as J}from"../../../../webscene/support/AlphaCutoff.js";class Y extends R{constructor(t,e){super(t,X),this.produces=new Map([[2,t=>A(t)||O(t)&&8===this.parameters.renderOccluded],[3,t=>x(t)],[11,t=>C(t)&&8===this.parameters.renderOccluded],[12,t=>C(t)&&8===this.parameters.renderOccluded],[4,t=>O(t)&&this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[9,t=>O(t)&&!this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[19,t=>L(t)]]),this._configuration=new W(e)}updateConfiguration(t){super.updateConfiguration(t);const e=19===t.slot,i=null!=this.parameters.stipplePattern&&null!=this.parameters.stippleTexture&&10!==t.output,r=i&&e&&this.parameters.isImagePattern();this._configuration.draped=e,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.stippleEnabled=i,this._configuration.stippleOffColorEnabled=i&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=i&&this.parameters.stipplePreferContinuous,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&Q(this.parameters.markerParameters),this._configuration.polygonOffsetIndex=this.parameters.polygonOffsetIndex,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.hasOccludees=t.hasOccludees,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.terrainDepthTest=t.terrainDepthTest&&O(t.output),this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=this.hasEmissions?1:0,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective&&!r,this._configuration.worldSizedImagePattern=r}get visible(){return this.parameters.color[3]>=J||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>J}get hasEmissions(){return this.parameters.emissiveStrength>0?8!==this.parameters.renderOccluded?2:1:0}setParameters(t,e){t.animation=this.parameters.animation,super.setParameters(t,e)}intersectDraped({attributes:t,screenToWorldRatio:i},r,s,a,n){if(!r.options.selectionMode)return;const o=t.get("size");let l=this.parameters.width;if(this.parameters.vvSize){const i=t.get("sizeFeatureAttribute").data[0];Number.isNaN(i)?l*=this.parameters.vvSize.fallback[0]:l*=e(this.parameters.vvSize.offset[0]+i*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else o&&(l*=o.data[0]);const h=s[0],p=s[1],m=(l/2+4)*i;let c=Number.MAX_VALUE,u=0;const f=t.get("position").data,d=K(this.parameters,t)?f.length-2:f.length-5;for(let g=0;g<d;g+=3){const t=f[g],i=f[g+1],r=(g+3)%f.length,s=h-t,a=p-i,n=f[r]-t,o=f[r+1]-i,l=e((n*s+o*a)/(n*n+o*o),0,1),m=n*l-s,d=o*l-a,b=m*m+d*d;b<c&&(c=b,u=g/3)}c<m*m&&a(n.distance,n.normal,u)}intersect(i,r,s,f,d,g){const{options:b,camera:_,rayBegin:S,rayEnd:y}=s;if(!b.selectionMode||!i.visible||!_)return;if(!F(r))return void t.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const z=i.attributes,A=z.get("position").data;let O=this.parameters.width;if(this.parameters.vvSize){const t=z.get("sizeFeatureAttribute").data[0];Number.isNaN(t)||(O*=e(this.parameters.vvSize.offset[0]+t*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0]))}else z.has("size")&&(O*=z.get("size").data[0]);const x=it;a(x,s.point);const C=O*_.pixelRatio/2+4*_.pixelRatio;n(ut[0],x[0]-C,x[1]+C,0),n(ut[1],x[0]+C,x[1]+C,0),n(ut[2],x[0]+C,x[1]-C,0),n(ut[3],x[0]-C,x[1]-C,0);for(let t=0;t<4;t++)if(!_.unprojectFromRenderScreen(ut[t],ft[t]))return;j(_.eye,ft[0],ft[1],dt),j(_.eye,ft[1],ft[2],gt),j(_.eye,ft[2],ft[3],bt),j(_.eye,ft[3],ft[0],_t);let L=Number.MAX_VALUE,M=0;const V=K(this.parameters,z)?A.length-2:A.length-5;for(let t=0;t<V;t+=3){Z[0]=A[t]+r[12],Z[1]=A[t+1]+r[13],Z[2]=A[t+2]+r[14];const e=(t+3)%A.length;if($[0]=A[e]+r[12],$[1]=A[e+1]+r[13],$[2]=A[e+2]+r[14],E(dt,Z)<0&&E(dt,$)<0||E(gt,Z)<0&&E(gt,$)<0||E(bt,Z)<0&&E(bt,$)<0||E(_t,Z)<0&&E(_t,$)<0)continue;const i=_.projectToRenderScreen(Z,rt),s=_.projectToRenderScreen($,st);if(null==i||null==s)continue;if(i[2]<0&&s[2]>0){o(tt,Z,$);const t=_.frustum,e=-E(t[4],Z)/l(tt,T(t[4]));if(h(tt,tt,e),p(Z,Z,tt),!_.projectToRenderScreen(Z,i))continue}else if(i[2]>0&&s[2]<0){o(tt,$,Z);const t=_.frustum,e=-E(t[4],$)/l(tt,T(t[4]));if(h(tt,tt,e),p($,$,tt),!_.projectToRenderScreen($,s))continue}else if(i[2]<0&&s[2]<0)continue;i[2]=0,s[2]=0;const a=v(P(i,s,ot),x);a<L&&(L=a,m(at,Z),m(nt,$),M=t/3)}if(L<C*C){let t=Number.MAX_VALUE;if(w(P(at,nt,ot),P(S,y,lt),et)){o(et,et,S);const e=c(et);h(et,et,1/e),t=e/u(S,y)}g(t,et,M)}}createBufferWriter(){return new G(B(this.parameters),this.parameters)}createGLMaterial(t){return new q(t)}validateParameters(t){"miter"!==t.join&&(t.miterLimit=0),null!=t.markerParameters&&(t.markerScale=t.markerParameters.width/t.width)}update(t){return!!this.parameters.hasAnimation&&(this.setParameters({timeElapsed:r(t.time)},!1),0!==t.dt)}}class q extends V{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(t){const{stipplePattern:e}=this._material.parameters;return this._stipplePattern!==e&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(e,this._stipplePattern)}),this._stipplePattern=e),this.getTechnique(I,t)}}class X extends k{constructor(){super(...arguments),this._width=0,this.color=b,this.join="miter",this.cap=0,this.miterLimit=5,this.writeDepth=!0,this.polygonOffset=0,this.polygonOffsetIndex=0,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1,this.timeElapsed=s(0),this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=s(0),this.endTime=s(1/0),this.emissiveStrength=0}get width(){return this.isImagePattern()?this.stipplePattern.width:this._width}set width(t){this._width=t}get transparent(){return this.color[3]<1||this.hasAnimation||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return 0!==this.animation}isImagePattern(){return N(this.stipplePattern)&&null!=this.stippleTexture}}class G{constructor(t,e){this.layout=t,this._parameters=e;const i=e.stipplePattern?1:0;switch(this._parameters.join){case"miter":case"bevel":this.numJoinSubdivisions=i;break;case"round":this.numJoinSubdivisions=D+i}}_isClosed(t){return K(this._parameters,t)}allocate(t){return this.layout.createBuffer(t)}elementCount(t){const e=2,i=t.get("position").indices.length/2+1,r=this._isClosed(t);let s=r?2:2*e;return s+=((r?i:i-1)-(r?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(t,e,i,r,s,a){const o=this.layout,l=i.get("position"),h=l.indices,p=l.data.length/3,c=i.get("distanceToStart")?.data;h&&h.length!==2*(p-1)&&console.warn("RibbonLineMaterial does not support indices");const d=o.fields.has("sizeFeatureAttribute");let b=1,_=null;if(d){const t=i.get("sizeFeatureAttribute");1===t.data.length?b=t.data[0]:_=t.data}else b=i.get("size")?.data[0]??1;let v=[1,1,1,1],P=0,w=null;const y=o.fields.has("colorFeatureAttribute");if(y){const t=i.get("colorFeatureAttribute");1===t.data.length?P=t.data[0]:w=t.data}else v=i.get("color")?.data??v;const j=i.get("timeStamps")?.data,E=j&&o.fields.has("timeStamps"),T=o.fields.has("opacityFeatureAttribute");let z=0,A=null;if(T){const t=i.get("opacityFeatureAttribute");1===t.data.length?z=t.data[0]:A=t.data}const O=new Float32Array(s.buffer),x=S(s.buffer),C=new Uint8Array(s.buffer),L=o.stride/4;let V=a*L;const R=V;let F=0;const N=c?(t,e,i)=>F=c[i]:(t,e,i)=>F+=u(t,e),k=O.BYTES_PER_ELEMENT/x.BYTES_PER_ELEMENT,D=4/k,B=M(),I=(t,e,i,s,a,n,o,l)=>{O[V++]=e[0],O[V++]=e[1],O[V++]=e[2],U(t,e,x,V*k),V+=D,U(i,e,x,V*k),V+=D,O[V++]=l;let h=V*k;if(x[h++]=a,x[h++]=n,V=Math.ceil(h/k),y)O[V]=w?.[o]??P;else{const t=Math.min(4*o,v.length-4),e=4*V;C[e]=255*v[t],C[e+1]=255*v[t+1],C[e+2]=255*v[t+2],C[e+3]=255*v[t+3]}if(V++,O[V++]=_?.[o]??b,T&&(O[V++]=A?.[o]??z),B){let t=4*V;r?(C[t++]=r[0],C[t++]=r[1],C[t++]=r[2],C[t++]=r[3]):(C[t++]=0,C[t++]=0,C[t++]=0,C[t++]=0),V=Math.ceil(.25*t)}E&&(h=V*k,x[h++]=s[0],x[h++]=s[1],x[h++]=s[2],x[h++]=s[3],V=Math.ceil(h/k))};V+=L,n(pt,l.data[0],l.data[1],l.data[2]),E&&g(ct,j[0],j[1],j[2],j[3]),t&&f(pt,pt,t);const W=this._isClosed(i);if(W){const e=l.data.length-3;n(ht,l.data[e],l.data[e+1],l.data[e+2]),t&&f(ht,ht,t)}else n(mt,l.data[3],l.data[4],l.data[5]),t&&f(mt,mt,t),I(pt,pt,mt,ct,1,-4,0,0),I(pt,pt,mt,ct,1,4,0,0),m(ht,pt),m(pt,mt),E&&g(ct,j[4],j[5],j[6],j[7]);const J=W?0:1,Y=W?p:p-1;for(let u=J;u<Y;u++){const e=(u+1)%p*3;n(mt,l.data[e],l.data[e+1],l.data[e+2]),t&&f(mt,mt,t),N(ht,pt,u),I(ht,pt,mt,ct,0,-1,u,F),I(ht,pt,mt,ct,0,1,u,F);const i=this.numJoinSubdivisions;for(let t=0;t<i;++t){const e=(t+1)/(i+1);I(ht,pt,mt,ct,e,-1,u,F),I(ht,pt,mt,ct,e,1,u,F)}if(I(ht,pt,mt,ct,1,-2,u,F),I(ht,pt,mt,ct,1,2,u,F),m(ht,pt),m(pt,mt),E){const t=(u+1)%p*4;g(ct,j[t],j[t+1],j[t+2],j[t+3])}}W?(n(mt,l.data[3],l.data[4],l.data[5]),t&&f(mt,mt,t),F=N(ht,pt,Y),I(ht,pt,mt,ct,0,-1,J,F),I(ht,pt,mt,ct,0,1,J,F)):(F=N(ht,pt,Y),I(ht,pt,pt,ct,0,-5,Y,F),I(ht,pt,pt,ct,0,5,Y,F)),H(O,R+L,O,R,L);return V=H(O,V-L,O,V,L),this._parameters.wireframe&&this._addWireframeVertices(s,R,V,L),null}_addWireframeVertices(t,e,i,r){const s=new Float32Array(t.buffer,i*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(t.buffer,e*Float32Array.BYTES_PER_ELEMENT,i-e);let n=0;const o=t=>n=H(a,t,s,n,r);for(let l=0;l<a.length-1;l+=2*r)o(l),o(l+2*r),o(l+1*r),o(l+2*r),o(l+1*r),o(l+3*r)}}function H(t,e,i,r,s){for(let a=0;a<s;a++)i[r++]=t[e++];return r}function K(t,e){if(!t.isClosed)return!1;return e.get("position").indices.length>2}function Q(t){return 1===t.anchor&&t.hideOnShortSegments&&"begin-end"===t.placement&&t.worldSpace}const Z=d(),$=d(),tt=d(),et=d(),it=d(),rt=i(),st=i(),at=d(),nt=d(),ot=y(),lt=y(),ht=d(),pt=d(),mt=d(),ct=_(),ut=[i(),i(),i(),i()],ft=[d(),d(),d(),d()],dt=z(),gt=z(),bt=z(),_t=z();export{X as Parameters,Y as RibbonLineMaterial};
2
+ import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as i}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as r,Seconds as s}from"../../../../core/time.js";import{copy as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{set as n,subtract as o,dot as l,scale as p,add as h,copy as c,length as m,distance as u,lerp as f,transformMat4 as d,normalize as g}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as S}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{ONES as _,create as v}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeFloat16Array as P}from"../../../../geometry/support/float16.js";import{fromPoints as w,distance2 as y,closestLineSegmentPoint as z,projectPointFraction as j,create as E}from"../../../../geometry/support/lineSegment.js";import{fromPoints as A,signedDistance as T,getNormal as x,create as C}from"../../../../geometry/support/plane.js";import{isHighlightOrOLID as O,isColor as M,isDepth as L,isColorHighlightOLIDOrDepth as R,is2DGeometryOutput as V}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as F}from"../effects/geometry/olidUtils.js";import N from"../lib/GLMaterial.js";import{Material as U}from"../lib/Material.js";import{ScreenSizePerspectiveEvaluator as k}from"../lib/screenSizePerspectiveUtils.js";import{isTranslationMatrix as W}from"../lib/Util.js";import{isImagePattern as D}from"./lineStippleUtils.js";import{VisualVariablePassParameters as B}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as I}from"./internal/bufferWriterUtils.js";import{r as J}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as Y,RibbonLineTechnique as q}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as X}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as G}from"../../../../webscene/support/AlphaCutoff.js";class H extends U{constructor(e,t){super(e,Q),this.produces=new Map([[2,e=>O(e)||M(e)&&8===this.parameters.renderOccluded],[3,e=>L(e)],[11,e=>R(e)&&8===this.parameters.renderOccluded],[12,e=>R(e)&&8===this.parameters.renderOccluded],[4,e=>M(e)&&this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[9,e=>M(e)&&!this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[19,e=>V(e)]]),this._configuration=new X(t)}updateConfiguration(e){super.updateConfiguration(e);const t=19===e.slot,i=null!=this.parameters.stipplePattern&&null!=this.parameters.stippleTexture&&10!==e.output,r=i&&t&&this.parameters.isImagePattern();this._configuration.draped=t,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.stippleEnabled=i,this._configuration.stippleOffColorEnabled=i&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=i&&this.parameters.stipplePreferContinuous,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&te(this.parameters.markerParameters),this._configuration.polygonOffsetIndex=this.parameters.polygonOffsetIndex,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.hasOccludees=e.hasOccludees,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.terrainDepthTest=e.terrainDepthTest&&M(e.output),this._configuration.cullAboveTerrain=e.cullAboveTerrain,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=this.hasEmissions?1:0,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective&&!r,this._configuration.worldSizedImagePattern=r}get visible(){return this.parameters.color[3]>=G||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>G}get hasEmissions(){return this.parameters.emissiveStrength>0?8!==this.parameters.renderOccluded?2:1:0}setParameters(e,t){e.animation=this.parameters.animation,super.setParameters(e,t)}intersectDraped({attributes:e,screenToWorldRatio:i},r,s,a,n){if(!r.options.selectionMode)return;const o=e.get("size");let l=this.parameters.width;if(this.parameters.vvSize){const i=e.get("sizeFeatureAttribute").data[0];Number.isNaN(i)?l*=this.parameters.vvSize.fallback[0]:l*=t(this.parameters.vvSize.offset[0]+i*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else o&&(l*=o.data[0]);const p=s[0],h=s[1],c=(l/2+4)*i;let m=Number.MAX_VALUE,u=0;const f=e.get("position").data,d=ee(this.parameters,e)?f.length-2:f.length-5;for(let g=0;g<d;g+=3){const e=f[g],i=f[g+1],r=(g+3)%f.length,s=p-e,a=h-i,n=f[r]-e,o=f[r+1]-i,l=t((n*s+o*a)/(n*n+o*o),0,1),c=n*l-s,d=o*l-a,b=c*c+d*d;b<m&&(m=b,u=g/3)}m<c*c&&a(n.distance,n.normal,u)}intersect(i,r,s,f,d,g){const{options:b,camera:S,rayBegin:_,rayEnd:v}=s;if(!b.selectionMode||!i.visible||!S)return;if(!W(r))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const P=i.attributes,j=P.get("position").data;let E=this.parameters.width;if(this.parameters.vvSize){const e=P.get("sizeFeatureAttribute").data[0];Number.isNaN(e)||(E*=t(this.parameters.vvSize.offset[0]+e*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0]))}else P.has("size")&&(E*=P.get("size").data[0]);const C=he;a(C,s.point);const O=E*S.pixelRatio,M=4*S.pixelRatio,L=O/2+M;n(Pe[0],C[0]-L,C[1]+L,0),n(Pe[1],C[0]+L,C[1]+L,0),n(Pe[2],C[0]+L,C[1]-L,0),n(Pe[3],C[0]-L,C[1]-L,0);for(let e=0;e<4;e++)if(!S.unprojectFromRenderScreen(Pe[e],we[e]))return;A(S.eye,we[0],we[1],ye),A(S.eye,we[1],we[2],ze),A(S.eye,we[2],we[3],je),A(S.eye,we[3],we[0],Ee);let R=Number.MAX_VALUE,V=0;const F=ee(this.parameters,P)?j.length-2:j.length-5;for(let e=0;e<F;e+=3){re[0]=j[e]+r[12],re[1]=j[e+1]+r[13],re[2]=j[e+2]+r[14];const t=(e+3)%j.length;if(se[0]=j[t]+r[12],se[1]=j[t+1]+r[13],se[2]=j[t+2]+r[14],T(ye,re)<0&&T(ye,se)<0||T(ze,re)<0&&T(ze,se)<0||T(je,re)<0&&T(je,se)<0||T(Ee,re)<0&&T(Ee,se)<0)continue;const i=S.projectToRenderScreen(re,ce),s=S.projectToRenderScreen(se,me);if(null==i||null==s)continue;if(i[2]<0&&s[2]>0){o(le,re,se);const e=S.frustum,t=-T(e[4],re)/l(le,x(e[4]));if(p(le,le,t),h(re,re,le),!S.projectToRenderScreen(re,i))continue}else if(i[2]>0&&s[2]<0){o(le,se,re);const e=S.frustum,t=-T(e[4],se)/l(le,x(e[4]));if(p(le,le,t),h(se,se,le),!S.projectToRenderScreen(se,s))continue}else if(i[2]<0&&s[2]<0)continue;i[2]=0,s[2]=0;const a=w(i,s,de),n=y(a,C);if(!(n>=R)){if(this.parameters.screenSizePerspective){const e=this.computeScreenSizePerspectiveWidth(a,re,se,C,S,E,M);if(n>=e*e)continue}R=n,c(ue,re),c(fe,se),V=e/3}}if(R<L*L){let e=Number.MAX_VALUE;if(z(w(ue,fe,de),w(_,v,ge),pe)){o(pe,pe,_);const t=m(pe);p(pe,pe,1/t),e=t/u(_,v)}g(e,pe,V)}}createBufferWriter(){return new Z(Y(this.parameters),this.parameters)}createGLMaterial(e){return new K(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}update(e){return!!this.parameters.hasAnimation&&(this.setParameters({timeElapsed:r(e.time)},!1),0!==e.dt)}computeScreenSizePerspectiveWidth(e,t,i,r,s,a,n){const o=j(e,r);f(ae,t,i,o),d(ne,ae,s.viewMatrix);const l=m(ne),p=this.computeCameraAbsCosAngle(ae,s,this._configuration.spherical);ie.update(p,l,this.parameters.screenSizePerspective,this.parameters.screenSizePerspectiveMinPixelReferenceSize);return ie.apply(a)*s.pixelRatio/2+n}computeCameraAbsCosAngle(e,t,i){return i?g(pe,e):n(pe,0,0,1),o(oe,e,t.eye),g(oe,oe),Math.abs(l(pe,oe))}}class K extends N{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){const{stipplePattern:t}=this._material.parameters;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(q,e)}}class Q extends B{constructor(){super(...arguments),this._width=0,this.color=_,this.join="miter",this.cap=0,this.miterLimit=5,this.writeDepth=!0,this.polygonOffset=0,this.polygonOffsetIndex=0,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1,this.timeElapsed=s(0),this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=s(0),this.endTime=s(1/0),this.emissiveStrength=0}get width(){return this.isImagePattern()?this.stipplePattern.width:this._width}set width(e){this._width=e}get transparent(){return this.color[3]<1||this.hasAnimation||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return 0!==this.animation}isImagePattern(){return D(this.stipplePattern)&&null!=this.stippleTexture}}class Z{constructor(e,t){this.layout=e,this._parameters=t;const i=t.stipplePattern?1:0;switch(this._parameters.join){case"miter":case"bevel":this.numJoinSubdivisions=i;break;case"round":this.numJoinSubdivisions=J+i}}_isClosed(e){return ee(this._parameters,e)}allocate(e){return this.layout.createBuffer(e)}elementCount(e){const t=2,i=e.get("position").indices.length/2+1,r=this._isClosed(e);let s=r?2:2*t;return s+=((r?i:i-1)-(r?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(e,t,i,r,s,a){const o=this.layout,l=i.get("position"),p=l.indices,h=l.data.length/3,m=i.get("distanceToStart")?.data;p&&p.length!==2*(h-1)&&console.warn("RibbonLineMaterial does not support indices");const f=o.fields.has("sizeFeatureAttribute");let g=1,b=null;if(f){const e=i.get("sizeFeatureAttribute");1===e.data.length?g=e.data[0]:b=e.data}else g=i.get("size")?.data[0]??1;let _=[1,1,1,1],v=0,w=null;const y=o.fields.has("colorFeatureAttribute");if(y){const e=i.get("colorFeatureAttribute");1===e.data.length?v=e.data[0]:w=e.data}else _=i.get("color")?.data??_;const z=i.get("timeStamps")?.data,j=z&&o.fields.has("timeStamps"),E=o.fields.has("opacityFeatureAttribute");let A=0,T=null;if(E){const e=i.get("opacityFeatureAttribute");1===e.data.length?A=e.data[0]:T=e.data}const x=new Float32Array(s.buffer),C=P(s.buffer),O=new Uint8Array(s.buffer),M=o.stride/4;let L=a*M;const R=L;let V=0;const N=m?(e,t,i)=>V=m[i]:(e,t,i)=>V+=u(e,t),U=x.BYTES_PER_ELEMENT/C.BYTES_PER_ELEMENT,k=4/U,W=F(),D=(e,t,i,s,a,n,o,l)=>{x[L++]=t[0],x[L++]=t[1],x[L++]=t[2],I(e,t,C,L*U),L+=k,I(i,t,C,L*U),L+=k,x[L++]=l;let p=L*U;if(C[p++]=a,C[p++]=n,L=Math.ceil(p/U),y)x[L]=w?.[o]??v;else{const e=Math.min(4*o,_.length-4),t=4*L;O[t]=255*_[e],O[t+1]=255*_[e+1],O[t+2]=255*_[e+2],O[t+3]=255*_[e+3]}if(L++,x[L++]=b?.[o]??g,E&&(x[L++]=T?.[o]??A),W){let e=4*L;r?(O[e++]=r[0],O[e++]=r[1],O[e++]=r[2],O[e++]=r[3]):(O[e++]=0,O[e++]=0,O[e++]=0,O[e++]=0),L=Math.ceil(.25*e)}j&&(p=L*U,C[p++]=s[0],C[p++]=s[1],C[p++]=s[2],C[p++]=s[3],L=Math.ceil(p/U))};L+=M,n(Se,l.data[0],l.data[1],l.data[2]),j&&S(ve,z[0],z[1],z[2],z[3]),e&&d(Se,Se,e);const B=this._isClosed(i);if(B){const t=l.data.length-3;n(be,l.data[t],l.data[t+1],l.data[t+2]),e&&d(be,be,e)}else n(_e,l.data[3],l.data[4],l.data[5]),e&&d(_e,_e,e),D(Se,Se,_e,ve,1,-4,0,0),D(Se,Se,_e,ve,1,4,0,0),c(be,Se),c(Se,_e),j&&S(ve,z[4],z[5],z[6],z[7]);const J=B?0:1,Y=B?h:h-1;for(let u=J;u<Y;u++){const t=(u+1)%h*3;n(_e,l.data[t],l.data[t+1],l.data[t+2]),e&&d(_e,_e,e),N(be,Se,u),D(be,Se,_e,ve,0,-1,u,V),D(be,Se,_e,ve,0,1,u,V);const i=this.numJoinSubdivisions;for(let e=0;e<i;++e){const t=(e+1)/(i+1);D(be,Se,_e,ve,t,-1,u,V),D(be,Se,_e,ve,t,1,u,V)}if(D(be,Se,_e,ve,1,-2,u,V),D(be,Se,_e,ve,1,2,u,V),c(be,Se),c(Se,_e),j){const e=(u+1)%h*4;S(ve,z[e],z[e+1],z[e+2],z[e+3])}}B?(n(_e,l.data[3],l.data[4],l.data[5]),e&&d(_e,_e,e),V=N(be,Se,Y),D(be,Se,_e,ve,0,-1,J,V),D(be,Se,_e,ve,0,1,J,V)):(V=N(be,Se,Y),D(be,Se,Se,ve,0,-5,Y,V),D(be,Se,Se,ve,0,5,Y,V)),$(x,R+M,x,R,M);return L=$(x,L-M,x,L,M),this._parameters.wireframe&&this._addWireframeVertices(s,R,L,M),null}_addWireframeVertices(e,t,i,r){const s=new Float32Array(e.buffer,i*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,i-t);let n=0;const o=e=>n=$(a,e,s,n,r);for(let l=0;l<a.length-1;l+=2*r)o(l),o(l+2*r),o(l+1*r),o(l+2*r),o(l+1*r),o(l+3*r)}}function $(e,t,i,r,s){for(let a=0;a<s;a++)i[r++]=e[t++];return r}function ee(e,t){if(!e.isClosed)return!1;return t.get("position").indices.length>2}function te(e){return 1===e.anchor&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}const ie=new k,re=b(),se=b(),ae=b(),ne=b(),oe=b(),le=b(),pe=b(),he=b(),ce=i(),me=i(),ue=b(),fe=b(),de=E(),ge=E(),be=b(),Se=b(),_e=b(),ve=v(),Pe=[i(),i(),i(),i()],we=[b(),b(),b(),b()],ye=C(),ze=C(),je=C(),Ee=C();export{Q as Parameters,H as RibbonLineMaterial};
package/views/3d/webgl.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import o from"../../Camera.js";import{rad2deg as e,deg2rad as r}from"../../core/mathUtils.js";import{create as t}from"../../core/libs/gl-matrix-2/factories/mat4f64.js";import{scale as i,add as n}from"../../core/libs/gl-matrix-2/math/vec3.js";import{create as a}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import l from"../../geometry/Point.js";import c from"../../geometry/SpatialReference.js";import{computeTranslationToOriginAndRotation as s}from"../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as m}from"../../geometry/projection/projectBuffer.js";import{projectPointToVector as p}from"../../geometry/projection/projectPointToVector.js";import{projectVectorToVector as u}from"../../geometry/projection/projectVectorToVector.js";import{cameraOnContentAlongViewDirection as f}from"./camera/intersectionUtils.js";import{directionToHeadingTilt as R,viewModeDependentUtil as d}from"./support/viewingModeUtils.js";const A={OPAQUE:"opaque-color",TRANSPARENT:"transparent-color",COMPOSITE:"composite-color",FINAL:"final-color"},T=[A.FINAL,A.COMPOSITE,A.OPAQUE,A.TRANSPARENT],N={ANTIALIASING:"aa-color",CUTFILL_COLOR:"cutfill-color",CUTFILL_COMPUTATION:"cutfill-computation",FOCUSAREA_COLOR:"focusarea-color",FOCUSAREA:"focusarea",GROUND_DEPTH:"ground-depth",PRE_TRANSPARENT:"pre-transparent",HIGHLIGHT_COLOR:"highlight-color",LASERLINES:"laserlines",MAGNIFIER:"magnifier",OCCLUDED:"occluded",OPAQUE_ENVIRONMENT:"opaque-environment",AMBIENT_ILLUMINATION:"ambient-illumination",SHADOW_HIGHLIGHT:"shadow-highlight",TRANSPARENT_ENVIRONMENT:"transparent-environment",VIEWSHED:"viewshed"},O=Array.from(Object.values(N)).concat(T);function E(o,e,r,t,i,n,a){return t=t||o.spatialReference,m(e,t,r,i,o.renderCoordsHelper.spatialReference,n,a)?i:null}function I(o,e,r,t,i,n,a){return n=n||o.spatialReference,m(e,o.renderCoordsHelper.spatialReference,r,t,n,i,a)?t:null}function g(o,e,r,i){return i||(i=t()),r=r||o.spatialReference,s(r,e,i,o.renderCoordsHelper.spatialReference)?i:null}function j(r,t,i){const n=r.renderSpatialReference,a=R(r,t.eye,t.viewForward,t.up,L);let s=r.spatialReference;return u(t.eye,n,h,s)||(s=c.WGS84,u(t.eye,n,h,s)),null==i?i=new o(new l(h,s),a.heading,a.tilt,e(t.fov)):(i.position.x=h[0],i.position.y=h[1],i.position.z=h[2],i.position.spatialReference=s,i.heading=a.heading,i.tilt=a.tilt,i.fov=e(t.fov)),i.layout.row=t.row,i.layout.rows=t.rows,i.layout.column=t.column,i.layout.columns=t.columns,i}function y(o,e){if(!e)return null;const t=o.renderSpatialReference,l=d(o).headingTiltToDirectionUp,c=a();if(!p(e.position,c,t))return null;const s=l(c,e.heading,e.tilt);i(s.direction,s.direction,o.state.camera.distance),n(s.direction,s.direction,c);const m=f(o,c,s.direction,s.up);return m.fov=r(e.fov),m.row=e.layout.row,m.rows=e.layout.rows,m.column=e.layout.column,m.columns=e.layout.columns,m}const h=a(),L={heading:0,tilt:0};export{O as AllInternalRenderNodeOutputs,T as AllRenderNodeOutputs,N as InternalRenderCategory,A as RenderNodeOutput,j as fromRenderCamera,I as fromRenderCoordinates,g as renderCoordinateTransformAt,y as toRenderCamera,E as toRenderCoordinates};
2
+ import o from"../../Camera.js";import{rad2deg as e,deg2rad as r}from"../../core/mathUtils.js";import{create as t}from"../../core/libs/gl-matrix-2/factories/mat4f64.js";import{scale as i,add as n}from"../../core/libs/gl-matrix-2/math/vec3.js";import{create as a}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import l from"../../geometry/Point.js";import c from"../../geometry/SpatialReference.js";import{computeTranslationToOriginAndRotation as s}from"../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as m}from"../../geometry/projection/projectBuffer.js";import{projectPointToVector as p}from"../../geometry/projection/projectPointToVector.js";import{projectVectorToVector as u}from"../../geometry/projection/projectVectorToVector.js";import{cameraOnContentAlongViewDirection as f}from"./camera/intersectionUtils.js";import{directionToHeadingTilt as A,viewModeDependentUtil as d}from"./support/viewingModeUtils.js";const O={OPAQUE:"opaque-color",TRANSPARENT:"transparent-color",COMPOSITE:"composite-color",FINAL:"final-color"},R=[O.FINAL,O.COMPOSITE,O.OPAQUE,O.TRANSPARENT],T={ANTIALIASING:"aa-color",CUTFILL_COLOR:"cutfill-color",CUTFILL_COMPUTATION:"cutfill-computation",FOCUSAREA_COLOR:"focusarea-color",FOCUSAREA:"focusarea",GAUSSIAN_SPLAT:"gaussian",GROUND_DEPTH:"ground-depth",HIGHLIGHT_COLOR:"highlight-color",LASERLINES:"laserlines",MAGNIFIER:"magnifier",OCCLUDED:"occluded",OPAQUE_OCCLUSION_QUERY:"opaque-occlusion-query",OPAQUE_ENVIRONMENT:"opaque-environment",AMBIENT_ILLUMINATION:"ambient-illumination",SHADOW_HIGHLIGHT:"shadow-highlight",TRANSPARENT_ENVIRONMENT:"transparent-environment",VOXEL:"voxel",VIEWSHED:"viewshed"},I=Array.from(Object.values(T)).concat(R);function E(o,e,r,t,i,n,a){return t=t||o.spatialReference,m(e,t,r,i,o.renderCoordsHelper.spatialReference,n,a)?i:null}function N(o,e,r,t,i,n,a){return n=n||o.spatialReference,m(e,o.renderCoordsHelper.spatialReference,r,t,n,i,a)?t:null}function g(o,e,r,i){return i||(i=t()),r=r||o.spatialReference,s(r,e,i,o.renderCoordsHelper.spatialReference)?i:null}function j(r,t,i){const n=r.renderSpatialReference,a=A(r,t.eye,t.viewForward,t.up,S);let s=r.spatialReference;return u(t.eye,n,L,s)||(s=c.WGS84,u(t.eye,n,L,s)),null==i?i=new o(new l(L,s),a.heading,a.tilt,e(t.fov)):(i.position.x=L[0],i.position.y=L[1],i.position.z=L[2],i.position.spatialReference=s,i.heading=a.heading,i.tilt=a.tilt,i.fov=e(t.fov)),i.layout.row=t.row,i.layout.rows=t.rows,i.layout.column=t.column,i.layout.columns=t.columns,i}function y(o,e){if(!e)return null;const t=o.renderSpatialReference,l=d(o).headingTiltToDirectionUp,c=a();if(!p(e.position,c,t))return null;const s=l(c,e.heading,e.tilt);i(s.direction,s.direction,o.state.camera.distance),n(s.direction,s.direction,c);const m=f(o,c,s.direction,s.up);return m.fov=r(e.fov),m.row=e.layout.row,m.rows=e.layout.rows,m.column=e.layout.column,m.columns=e.layout.columns,m}const L=a(),S={heading:0,tilt:0};export{I as AllInternalRenderNodeOutputs,R as AllRenderNodeOutputs,T as InternalRenderCategory,O as RenderNodeOutput,j as fromRenderCamera,N as fromRenderCoordinates,g as renderCoordinateTransformAt,y as toRenderCamera,E as toRenderCoordinates};
@@ -153,7 +153,7 @@ export default class SelectionManager extends EventedAccessor {
153
153
  * @returns A promise that resolves to an array of [LayerFeatureSet](https://developers.arcgis.com/javascript/latest/references/core/views/selection/types/#LayerFeatureSet), which includes the layer and the resulting features for that layer.
154
154
  * @name getSelectedFeatures
155
155
  */
156
- getSelectedFeatures(includeLayers: SelectableLayerWithObjectIds[] | undefined, queryParams: QueryProperties | undefined, queryTarget?: "layerView" | "layer"): Promise<LayerFeatureSet[]>;
156
+ getSelectedFeatures(includeLayers?: SelectableLayerWithObjectIds[], queryParams?: QueryProperties, queryTarget?: "layerView" | "layer"): Promise<LayerFeatureSet[]>;
157
157
  /**
158
158
  * Gets the active selection for the provided layer. If the layer is not part of the [sources](#sources) or has no active selection, this method returns `undefined`. Otherwise, it returns an array of selected features, which can be either [Graphic[]](https://developers.arcgis.com/javascript/latest/references/core/Graphic/) or [ObjectId](https://developers.arcgis.com/javascript/latest/references/core/views/types/#ObjectId)[] depending on the layer's capabilities. To retrieve the full graphic representations of selected features from a layer that supports only object ID selection, use the [getSelectedFeatures](#getSelectedFeatures) method. This method queries the layer using the selected object IDs and returns the corresponding feature graphics.
159
159
  *
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../Color.js";import i from"../Viewpoint.js";import s from"../core/Accessor.js";import{EventedMixin as r}from"../core/Evented.js";import{destroyMaybe as o}from"../core/maybe.js";import{EsriPromiseMixin as a}from"../core/Promise.js";import{watch as n,syncAndInitial as l,whenOnce as p,when as m}from"../core/reactiveUtils.js";import{property as h,cast as d,subclass as c}from"../core/accessorSupport/decorators.js";import{ensureClass as g}from"../core/accessorSupport/ensureType.js";import f from"../geometry/Extent.js";import y from"../geometry/Point.js";import u from"../geometry/SpatialReference.js";import{load as j,execute as w}from"../geometry/operators/projectOperator.js";import b from"../layers/support/ExtentAndRotationGeoreference.js";import{MediaElementView as v}from"../layers/support/MediaElementView.js";import _ from"../layers/support/TileInfo.js";import M from"../layers/support/VideoElement.js";import{DOMContainer as S}from"./DOMContainer.js";import{Viewport2DBaseMixin as C}from"./Viewport2DBaseMixin.js";import{Viewport2DMixin as V}from"./Viewport2DMixin.js";import x from"./2d/AnimationManager.js";import E from"./2d/MapViewConstraints.js";import"../core/RandomLCG.js";import"../core/Logger.js";import"../core/has.js";import"../core/scheduling.js";import"../core/mathUtils.js";import"../config.js";import"../symbols/cim/defaultCIMValues.js";import"../core/floatRGBA.js";import"../symbols/Font.js";import"../geometry/support/spatialReferenceUtils.js";import"../symbols/cim/effects/EffectAddControlPoints.js";import"../symbols/cim/effects/EffectArrow.js";import"../symbols/cim/effects/EffectBuffer.js";import"../symbols/cim/effects/EffectControlMeasureLine.js";import"../symbols/cim/effects/EffectCut.js";import"../symbols/cim/effects/EffectDashes.js";import"../symbols/cim/effects/EffectDonut.js";import"../symbols/cim/effects/EffectEnclosingPolygon.js";import"../symbols/cim/effects/EffectJog.js";import"../symbols/cim/effects/EffectMove.js";import"../symbols/cim/effects/EffectOffset.js";import"../symbols/cim/effects/EffectRadial.js";import"../symbols/cim/effects/EffectReverse.js";import"../symbols/cim/effects/EffectRotate.js";import"../symbols/cim/effects/EffectScale.js";import"../symbols/cim/effects/EffectSuppress.js";import"../symbols/cim/effects/EffectTaperedPolygon.js";import"../symbols/cim/effects/EffectWave.js";import"../symbols/cim/placements/PlacementAlongLineSameSize.js";import"../symbols/cim/placements/PlacementAtExtremities.js";import"../symbols/cim/placements/PlacementAtMeasuredUnits.js";import"../symbols/cim/placements/PlacementAtRatioPositions.js";import"../symbols/cim/placements/PlacementInsidePolygon.js";import"../symbols/cim/placements/PlacementOnLine.js";import"../symbols/cim/placements/PlacementOnVertices.js";import"../symbols/cim/placements/PlacementPolygonCenter.js";import"../symbols/dimensions/effects/LinearDimensionArrowEffect.js";import"../symbols/dimensions/effects/LinearDimensionExtensionLineEffect.js";import"../symbols/dimensions/effects/LinearDimensionLeaderLineEffect.js";import"../symbols/dimensions/effects/LinearDimensionLineEffect.js";import"../symbols/dimensions/effects/LinearDimensionPointEffect.js";import"../symbols/dimensions/effects/LinearDimensionTextEffect.js";import"../symbols/cim/constants.js";import"../core/libs/gl-matrix-2/factories/vec2f32.js";import"../geometry/Polygon.js";import"../symbols/support/defaults.js";import"../symbols/cim/OverrideHelper.js";import{Container as G}from"./2d/engine/Container.js";import"./2d/engine/webgl/shaders/BitBlitPrograms.js";import"./webgl/enums.js";import"./webgl/Program.js";import"./webgl/Util.js";import"./webgl/VertexAttributeLayouts.js";import"./webgl/BufferObject.js";import"../request.js";import"../core/urlUtils.js";import"./webgl/Texture.js";import"../core/pbf.js";import"./2d/engine/webgl/shaders/StencilPrograms.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/BlendShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/OpacityShader.js";import"./2d/engine/webgl/shaders/HighlightPrograms.js";import"./webgl/FramebufferObject.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/BlitShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/BloomShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/BlurShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/ColorizeShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/DropShadowShader.js";import"./2d/engine/webgl/meshing/SimpleMesh.js";import"./webgl/Renderbuffer.js";import"./2d/engine/webgl/PooledUint32Array.js";import"./2d/engine/webgl/Profiler.js";import"./2d/engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import"./2d/engine/webgl/number.js";import"./2d/engine/webgl/shaderGraph/techniques/animated/attributes.js";import"./2d/engine/webgl/mesh/templates/templateUtils.js";import"./2d/engine/webgl/shaderGraph/techniques/line/LineMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/ComplexFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/FillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/GradientFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/OutlineFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/PatternFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapMeshWriter.js";import"../geometry/support/aaBoundingBox.js";import"./2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/line/GradientStrokeMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/line/TexturedLineMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js";import"../core/sql/UnknownTimeZone.js";import"luxon";import"../intl/locale.js";import"../geometry/Geometry.js";import"../geometry/Multipoint.js";import"../geometry/Polyline.js";import"../layers/support/fieldUtils.js";import"../time/constants.js";import"./2d/engine/webgl/animations/instructions.js";import"./2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartMeshWriter.js";import"./webgl/checkWebGLError.js";import"./webgl/renderState.js";import"./webgl/testSVGPremultipliedAlpha.js";import{ManagedCanvas as D}from"./2d/engine/ManagedCanvas.js";import"../core/libs/gl-matrix-2/factories/vec4f32.js";import"./2d/engine/transitions/FadeTransition.js";import"./2d/engine/webgl/meshing/definitions.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/VideoScreenShader.js";import"./2d/LabelManager.js";import"./2d/layers/graphics/GraphicsView2D.js";import"./2d/engine/webgl/shaderGraph/techniques/clip/ClipTechnique.js";import"./2d/engine/webgl/AFeatureTile.js";import"./2d/engine/webgl/DisplayEntity.js";import"./2d/engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js";import"./2d/engine/webgl/cpuMapped/MappedMesh.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/TileDebugInfoShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/TileStencilShader.js";import"../core/libs/gl-matrix-2/factories/vec3f32.js";import"../geometry/support/normalizeUtils.js";import"./2d/layers/support/util.js";import P from"./2d/navigation/MapViewNavigation.js";import"../core/asyncUtils.js";import"../core/support/UpdatingHandles.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js";import"../core/units.js";import"../geometry/ellipsoidUtils.js";import"../geometry/spatialReferenceEllipsoidUtils.js";import"../geometry/operators/support/GeographicTransformation.js";import"../geometry/projection/projectors.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/GridShader.js";import"../geometry/support/geodesicConstants.js";import"../geometry/support/Ellipsoid.js";import{ViewStateManager as R}from"./2d/ViewStateManager.js";import q from"./2d/engine/webgl/Overlay.js";import z from"./2d/engine/webgl/OverlayContainer.js";import T from"./navigation/Navigation.js";import O from"./ui/DefaultUI.js";import L from"./ui/video/DefaultUIVideo.js";const W=new t("#000");let A;async function U(){const[,{ParentStage:e}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);A=e}const F=.01,k=["feature","geojson","csv","stream","ogc-feature","catalog","wfs","parquet","graphics","group"];let B=class extends(V(C(S(r(a(s)))))){constructor(e){super(e),this._isValid=!1,this._readyCycleForced=!1,this._prevZoomEnabled=!1,this._prevRotationEnabled=!1,this.stage=null,this.childStage=null,this._operationalDataView=null,this.operationalDataVisible=!1,this.map=null,this.navigation=new T,this.ready=!1,this.spatialReference=new u({wkid:0}),this.stateManager=new R({constraints:new E({view:this,minScale:1,maxScale:F})}),this.type="2d",this.ui=new L,this.view2dType="video",this.addHandles([n(()=>this.preconditionsReady,e=>e?this._startup():this._teardown()),n(()=>this.videoSize,([e,t])=>{this._extent&&e&&t&&(this._extent.xmax=e,this._extent.ymax=t)}),n(()=>this.size,e=>{this._operationalDataView&&this._operationalDataView.stateManager.resize(e[0],e[1])}),n(()=>[this.layer?.frameEffect,this._effectsContainer],()=>{this._effectsContainer&&(this._effectsContainer.effect=this.layer?.frameEffect??null)},l)])}initialize(){this._prevZoomEnabled="zoom"===this.navigation.actionMap.mouseWheel&&this.ui.components.includes("zoom"),this._prevRotationEnabled="rotate"===this.navigation.actionMap.dragSecondary&&this.ui.components.includes("compass"),this.addHandles([n(()=>[this.operationalDataVisible,this.childStage],()=>{this.childStage&&(this.childStage.videoScreenRenderer.visible=this.operationalDataVisible),this.operationalDataVisible&&(this.scale=1,this.rotation=0),this.navigation&&(this._prevZoomEnabled&&(this.navigation.actionMap.mouseWheel=this.operationalDataVisible?"none":"zoom",this.navigation.actionMap.dragPrimary=this.operationalDataVisible?"none":"pan",this.ui.components&&(this.ui.components=this.operationalDataVisible?this.ui.components.filter(e=>"zoom"!==e):[...new Set([...this.ui.components,"zoom"])])),this._prevRotationEnabled&&(this.navigation.actionMap.dragSecondary=this.operationalDataVisible?"none":"rotate",this.ui.components&&(this.ui.components=this.operationalDataVisible?this.ui.components.filter(e=>"compass"!==e):[...new Set([...this.ui.components,"compass"])])))},l)]),this.addResolvingPromise(U().then(()=>(this._isValid=!0,p(()=>this.ready))))}destroy(){this._teardown(),this.removeAllHandles(),this._set("preconditionsReady",!1),this.frameTask=o(this.frameTask),this.goToManager.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get constraintsInfo(){return{lods:null,spatialReference:this.spatialReference}}get layer(){return this._get("layer")}set layer(e){e!==this._get("layer")&&(this.constructed&&!this.destroyed&&(this._forceReadyCycle(),this.addResolvingPromise(p(()=>this.ready))),this._set("layer",e))}get preconditionsReady(){return!(!this._isValid||this._readyCycleForced||0===this.width||0===this.height||0===this.videoSize[0]||0===this.videoSize[1])}get rendering(){return this.stage?.renderRequested??!1}get scale(){return this.stateManager?.scale??0}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get videoSize(){if(!this.layer?.videoWidth||!this.layer?.videoHeight)return[0,0];const[e,t]=this.size,i=(this.layer?.videoWidth||0)/(this.layer?.videoHeight||0),s=t*i,r=e/i;return e/t>=1?i>=1?s<=e?[s,t]:[e,r]:r<=t?[e,r]:[s,t]:i>=1?r<=t?[e,r]:[s,t]:s<=e?[s,t]:[e,r]}async hitTest(e,t){return this._operationalDataView&&this._operationalDataView.ready?this._operationalDataView.hitTest(e,t):{screenPoint:e,results:[]}}_startup(){if(!this.layer)return;const e=this._getViewpoint();this.stateManager.startup(e,this.size,e.targetGeometry.spatialReference);const t={renderingOptions:this.renderingOptions,backgroundColor:W,groundControlPoints:()=>this.layer?.groundControlPoints,getSize:()=>this.videoSize},i=new A(this.surface,t,new D(this.surface));this.stage=i,this._prepareStage(this.stage),this.childStage=i.childStage,this._prepareChildStage(this.childStage);const s=new x({view:this});this._set("animationManager",s);const r=new P({view:this,animationManager:s});this._set("mapViewNavigation",r),this._updateConstraints(),this.frameTask.start(),this._set("ready",!0)}_teardown(){this.stage?.destroy(),this.stage=null,this._videoElementView=null,this._overlayContainer?.removeAllChildren(),this._overlayContainer=null,this.removeHandles("video-view"),this._set("ready",!1),this.stateManager?.teardown(),this.frameTask?.stop(),this.stationaryManager?.clear()}_getViewpoint(){return new i({targetGeometry:new y({x:this.videoSize[0]/2,y:this.videoSize[1]/2,spatialReference:this.spatialReference}),scale:1})}_prepareStage(e){this.addHandles([n(()=>this.stationary,t=>e.stationary=t,l),n(()=>this.state.id,()=>e.state=this.state,l),n(()=>this.renderingOptions,t=>e.renderingOptions=t,l)],"video-view"),this._extent=new f({xmin:0,ymin:0,xmax:this.videoSize[0],ymax:this.videoSize[1],spatialReference:{wkid:0}}),this._videoElementView=new v({element:new M({video:this.layer?.videoElement,georeference:new b({extent:this._extent}),autoplay:!1}),spatialReference:this.spatialReference});const t=new q(this._videoElementView);this._overlayContainer=new z,this._overlayContainer.addChild(t),this._effectsContainer=new G,this._effectsContainer.addChild(this._overlayContainer),this.stage.addChild(this._effectsContainer);const i=document.createElement("div");i.classList.add("esri-video-poster"),this.container?.classList.add("esri-video-view"),this.container?.appendChild(i)}_prepareChildStage(e){this.addHandles([n(()=>this.map,async t=>{if(!t)return;const{default:i}=await import("./video/VideoOperationalDataView.js");this._operationalDataView=new i({stage:e,layerViewFilter:e=>new Set(k).has(e.type),width:this.size[0],height:this.size[1],map:t}),p(()=>this._operationalDataView?.ready).then(()=>{e.videoScreenRenderer.visible=this.operationalDataVisible})},l),n(()=>this.layer?.groundControlPoints,async()=>{if(!this.layer?.groundControlPoints||!e.state)return;const t=this.layer.groundControlPoints,i=t?.length;if(!i)return;await j();const s=new Array(i),r=e.state.spatialReference;for(let e=0;e<i;e++){const{lat:i,lon:o}=t[e];s[e]=w(new y(o,i),r)}let o=1/0,a=1/0,n=-1/0,l=-1/0;for(const e of s)o=Math.min(o,e.x),a=Math.min(a,e.y),n=Math.max(n,e.x),l=Math.max(l,e.y);const p=f.fromJSON({xmin:o,ymin:a,xmax:n,ymax:l,spatialReference:r});await(this._operationalDataView?.goTo(p,{animate:!1}).catch(()=>{}))},l)])}_updateConstraints(){this._updateZoomConstraints(),this._updatePanConstraints()}_updateZoomConstraints(){const e=this.videoSize,t=Math.max(e[0]/this.size[0],e[1]/this.size[1]),i=[];for(let r=t;r>F;r/=2)i.push(r);i.push(F);const{lods:s}=_.create({scales:i});this.constraints.set({lods:s,minScale:t})}_updatePanConstraints(){const e=e=>{if(!e.targetGeometry)return e;const[t,i]=this.videoSize,s=t*e.scale/2,r=i*e.scale/2,o=e.targetGeometry.clone();return o.x=Math.max(s,Math.min(t-s,o.x)),o.y=Math.max(r,Math.min(i-r,o.y)),e.targetGeometry=o,e};this.constraints.customConstraints.add({constrain:e,applyPanConstraint:e})}_forceReadyCycle(){this.ready&&(m(()=>this.destroyed||!1===this.preconditionsReady,()=>this._readyCycleForced=!1,{once:!0}),this._readyCycleForced=!0)}};e([h()],B.prototype,"_overlayContainer",void 0),e([h()],B.prototype,"_isValid",void 0),e([h()],B.prototype,"_readyCycleForced",void 0),e([h()],B.prototype,"_effectsContainer",void 0),e([h()],B.prototype,"constraintsInfo",null),e([h()],B.prototype,"operationalDataVisible",void 0),e([h()],B.prototype,"layer",null),e([h()],B.prototype,"map",void 0),e([h({type:T,nonNullable:!0})],B.prototype,"navigation",void 0),e([h({readOnly:!0})],B.prototype,"preconditionsReady",null),e([h({readOnly:!0})],B.prototype,"ready",void 0),e([h({readOnly:!0})],B.prototype,"rendering",null),e([h()],B.prototype,"scale",null),e([h()],B.prototype,"spatialReference",void 0),e([h()],B.prototype,"stateManager",void 0),e([h()],B.prototype,"type",void 0),e([h(),d(e=>e instanceof O?e:g(L,e))],B.prototype,"ui",void 0),e([h({readOnly:!0})],B.prototype,"videoSize",null),e([h({readOnly:!0})],B.prototype,"view2dType",void 0),B=e([c("esri.views.VideoView")],B);const H=B;export{H as default};
2
+ import{__decorate as e}from"tslib";import t from"../Color.js";import i from"../Viewpoint.js";import s from"../core/Accessor.js";import{EventedMixin as r}from"../core/Evented.js";import{destroyMaybe as o}from"../core/maybe.js";import{EsriPromiseMixin as a}from"../core/Promise.js";import{watch as n,syncAndInitial as l,whenOnce as p,when as m}from"../core/reactiveUtils.js";import{property as h,cast as d,subclass as c}from"../core/accessorSupport/decorators.js";import{ensureClass as g}from"../core/accessorSupport/ensureType.js";import f from"../geometry/Extent.js";import y from"../geometry/Point.js";import u from"../geometry/SpatialReference.js";import{load as j,execute as w}from"../geometry/operators/projectOperator.js";import b from"../layers/support/ExtentAndRotationGeoreference.js";import{MediaElementView as v}from"../layers/support/MediaElementView.js";import _ from"../layers/support/TileInfo.js";import M from"../layers/support/VideoElement.js";import{DOMContainer as S}from"./DOMContainer.js";import{Viewport2DBaseMixin as C}from"./Viewport2DBaseMixin.js";import{Viewport2DMixin as V}from"./Viewport2DMixin.js";import x from"./2d/AnimationManager.js";import E from"./2d/MapViewConstraints.js";import"../core/RandomLCG.js";import"../core/Logger.js";import"../core/has.js";import"../core/scheduling.js";import"../core/mathUtils.js";import"../config.js";import"../symbols/cim/defaultCIMValues.js";import"../core/floatRGBA.js";import"../symbols/Font.js";import"../geometry/support/spatialReferenceUtils.js";import"../symbols/cim/effects/EffectAddControlPoints.js";import"../symbols/cim/effects/EffectArrow.js";import"../symbols/cim/effects/EffectBuffer.js";import"../symbols/cim/effects/EffectControlMeasureLine.js";import"../symbols/cim/effects/EffectCut.js";import"../symbols/cim/effects/EffectDashes.js";import"../symbols/cim/effects/EffectDonut.js";import"../symbols/cim/effects/EffectEnclosingPolygon.js";import"../symbols/cim/effects/EffectJog.js";import"../symbols/cim/effects/EffectMove.js";import"../symbols/cim/effects/EffectOffset.js";import"../symbols/cim/effects/EffectRadial.js";import"../symbols/cim/effects/EffectReverse.js";import"../symbols/cim/effects/EffectRotate.js";import"../symbols/cim/effects/EffectScale.js";import"../symbols/cim/effects/EffectSuppress.js";import"../symbols/cim/effects/EffectTaperedPolygon.js";import"../symbols/cim/effects/EffectWave.js";import"../symbols/cim/placements/PlacementAlongLineSameSize.js";import"../symbols/cim/placements/PlacementAtExtremities.js";import"../symbols/cim/placements/PlacementAtMeasuredUnits.js";import"../symbols/cim/placements/PlacementAtRatioPositions.js";import"../symbols/cim/placements/PlacementInsidePolygon.js";import"../symbols/cim/placements/PlacementOnLine.js";import"../symbols/cim/placements/PlacementOnVertices.js";import"../symbols/cim/placements/PlacementPolygonCenter.js";import"../symbols/dimensions/effects/LinearDimensionArrowEffect.js";import"../symbols/dimensions/effects/LinearDimensionExtensionLineEffect.js";import"../symbols/dimensions/effects/LinearDimensionLeaderLineEffect.js";import"../symbols/dimensions/effects/LinearDimensionLineEffect.js";import"../symbols/dimensions/effects/LinearDimensionPointEffect.js";import"../symbols/dimensions/effects/LinearDimensionTextEffect.js";import"../symbols/cim/constants.js";import"../core/libs/gl-matrix-2/factories/vec2f32.js";import"../geometry/Polygon.js";import"../symbols/support/defaults.js";import"../symbols/cim/OverrideHelper.js";import{Container as G}from"./2d/engine/Container.js";import"./2d/engine/webgl/shaders/BitBlitPrograms.js";import"./webgl/enums.js";import"./webgl/Program.js";import"./webgl/Util.js";import"./webgl/VertexAttributeLayouts.js";import"./webgl/BufferObject.js";import"../request.js";import"../core/urlUtils.js";import"./webgl/Texture.js";import"../core/pbf.js";import"./2d/engine/webgl/shaders/StencilPrograms.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/BlendShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/OpacityShader.js";import"./2d/engine/webgl/shaders/HighlightPrograms.js";import"./webgl/FramebufferObject.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/BlitShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/BloomShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/BlurShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/ColorizeShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/DropShadowShader.js";import"./2d/engine/webgl/meshing/SimpleMesh.js";import"./webgl/Renderbuffer.js";import"./2d/engine/webgl/PooledUint32Array.js";import"./2d/engine/webgl/Profiler.js";import"./2d/engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import"./2d/engine/webgl/number.js";import"./2d/engine/webgl/shaderGraph/techniques/animated/attributes.js";import"./2d/engine/webgl/mesh/templates/templateUtils.js";import"./2d/engine/webgl/shaderGraph/techniques/line/LineMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/ComplexFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/FillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/GradientFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/OutlineFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/PatternFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapMeshWriter.js";import"../geometry/support/aaBoundingBox.js";import"./2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/line/GradientStrokeMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/line/TexturedLineMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js";import"../core/sql/UnknownTimeZone.js";import"luxon";import"../intl/locale.js";import"../geometry/Geometry.js";import"../geometry/Multipoint.js";import"../geometry/Polyline.js";import"../layers/support/fieldUtils.js";import"../time/constants.js";import"./2d/engine/webgl/animations/instructions.js";import"./2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartMeshWriter.js";import"./webgl/checkWebGLError.js";import"./webgl/renderState.js";import"./webgl/testSVGPremultipliedAlpha.js";import{ManagedCanvas as D}from"./2d/engine/ManagedCanvas.js";import"../core/libs/gl-matrix-2/factories/vec4f32.js";import"./2d/engine/transitions/FadeTransition.js";import"./2d/engine/webgl/meshing/definitions.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/VideoScreenShader.js";import"./2d/LabelManager.js";import"./2d/layers/graphics/GraphicsView2D.js";import"./2d/engine/webgl/shaderGraph/techniques/clip/ClipTechnique.js";import"./2d/engine/webgl/AFeatureTile.js";import"./2d/engine/webgl/DisplayEntity.js";import"./2d/engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js";import"./2d/engine/webgl/cpuMapped/MappedMesh.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/TileDebugInfoShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/TileStencilShader.js";import"../core/libs/gl-matrix-2/factories/vec3f32.js";import"../geometry/support/normalizeUtils.js";import"./2d/layers/support/util.js";import P from"./2d/navigation/MapViewNavigation.js";import"../core/asyncUtils.js";import"../core/support/UpdatingHandles.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js";import"../core/units.js";import"../geometry/ellipsoidUtils.js";import"../geometry/spatialReferenceEllipsoidUtils.js";import"../geometry/operators/support/GeographicTransformation.js";import"../geometry/projection/projectors.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/GridShader.js";import"../geometry/support/geodesicConstants.js";import"../geometry/support/Ellipsoid.js";import{ViewStateManager as R}from"./2d/ViewStateManager.js";import q from"./2d/engine/webgl/Overlay.js";import z from"./2d/engine/webgl/OverlayContainer.js";import T from"./navigation/Navigation.js";import O from"./ui/DefaultUI.js";import L from"./ui/video/DefaultUIVideo.js";const W=new t("#000");let A;async function U(){const[,{ParentStage:e}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);A=e}const F=.01,k=["feature","geojson","csv","stream","ogc-feature","catalog","wfs","parquet","graphics","group"];let B=class extends(V(C(S(r(a(s)))))){constructor(e){super(e),this._isValid=!1,this._readyCycleForced=!1,this._prevZoomEnabled=!1,this._prevRotationEnabled=!1,this.stage=null,this.childStage=null,this._operationalDataView=null,this.operationalDataVisible=!1,this.map=null,this.navigation=new T,this.ready=!1,this.spatialReference=new u({wkid:0}),this.stateManager=new R({constraints:new E({view:this,minScale:1,maxScale:F})}),this.type="2d",this.ui=new L,this.view2dType="video",this.addHandles([n(()=>this.preconditionsReady,e=>e?this._startup():this._teardown()),n(()=>this.videoSize,([e,t])=>{this._extent&&e&&t&&(this._extent.xmax=e,this._extent.ymax=t)}),n(()=>this.size,e=>{this._operationalDataView&&this._operationalDataView.stateManager.resize(e[0],e[1])}),n(()=>[this.layer?.frameEffect,this._effectsContainer],()=>{this._effectsContainer&&(this._effectsContainer.effect=this.layer?.frameEffect??null)},l)])}initialize(){this._prevZoomEnabled="zoom"===this.navigation.actionMap.mouseWheel&&this.ui.components.includes("zoom"),this._prevRotationEnabled="rotate"===this.navigation.actionMap.dragSecondary&&this.ui.components.includes("compass"),this.addHandles([n(()=>[this.operationalDataVisible,this.childStage],()=>{this.childStage&&(this.childStage.videoScreenRenderer.visible=this.operationalDataVisible),this.operationalDataVisible&&(this.scale=1,this.rotation=0),this.navigation&&(this._prevZoomEnabled&&(this.navigation.actionMap.mouseWheel=this.operationalDataVisible?"none":"zoom",this.navigation.actionMap.dragPrimary=this.operationalDataVisible?"none":"pan",this.ui.components&&(this.ui.components=this.operationalDataVisible?this.ui.components.filter(e=>"zoom"!==e):[...new Set([...this.ui.components,"zoom"])])),this._prevRotationEnabled&&(this.navigation.actionMap.dragSecondary=this.operationalDataVisible?"none":"rotate",this.ui.components&&(this.ui.components=this.operationalDataVisible?this.ui.components.filter(e=>"compass"!==e):[...new Set([...this.ui.components,"compass"])])))},l)]),this.addResolvingPromise(U().then(()=>(this._isValid=!0,p(()=>this.ready))))}destroy(){this._teardown(),this.removeAllHandles(),this._set("preconditionsReady",!1),this.frameTask=o(this.frameTask),this.goToManager.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get constraintsInfo(){return{lods:null,spatialReference:this.spatialReference}}get layer(){return this._get("layer")}set layer(e){e!==this._get("layer")&&(this.constructed&&!this.destroyed&&(this._forceReadyCycle(),this.addResolvingPromise(p(()=>this.ready))),this._set("layer",e))}get preconditionsReady(){return!(!this._isValid||this._readyCycleForced||0===this.width||0===this.height||0===this.videoSize[0]||0===this.videoSize[1])}get rendering(){return this.stage?.renderRequested??!1}get scale(){return this.stateManager?.scale??0}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get videoSize(){if(!this.layer?.videoWidth||!this.layer?.videoHeight)return[0,0];const[e,t]=this.size,i=(this.layer?.videoWidth||0)/(this.layer?.videoHeight||0),s=t*i,r=e/i;return e/t>=1?i>=1?s<=e?[s,t]:[e,r]:r<=t?[e,r]:[s,t]:i>=1?r<=t?[e,r]:[s,t]:s<=e?[s,t]:[e,r]}async hitTest(e,t){return this._operationalDataView&&this._operationalDataView.ready?this._operationalDataView.hitTest(e,t):{screenPoint:e,results:[]}}_startup(){if(!this.layer)return;const e=this._getViewpoint();this.stateManager.startup(e,this.size,e.targetGeometry.spatialReference);const t={renderingOptions:this.renderingOptions,backgroundColor:W,groundControlPoints:()=>this.layer?.groundControlPoints,getSize:()=>this.videoSize},i=new A(this.surface,t,new D(this.surface));this.stage=i,this._prepareStage(this.stage),this.childStage=i.childStage,this._prepareChildStage(this.childStage);const s=new x({view:this});this._set("animationManager",s);const r=new P({view:this,animationManager:s});this._set("mapViewNavigation",r),this._updateConstraints(),this.frameTask.start(),this._set("ready",!0)}_teardown(){this.frameTask?.stop(),this.stationaryManager?.clear(),this.stage?.destroy(),this.stage=null,this._videoElementView=null,this._overlayContainer?.removeAllChildren(),this._overlayContainer=null,this.removeHandles("video-view"),this._set("ready",!1),this.stateManager?.ready&&this.stateManager.teardown()}_getViewpoint(){return new i({targetGeometry:new y({x:this.videoSize[0]/2,y:this.videoSize[1]/2,spatialReference:this.spatialReference}),scale:1})}_prepareStage(e){this.addHandles([n(()=>this.stationary,t=>e.stationary=t,l),n(()=>this.state.id,()=>e.state=this.state,l),n(()=>this.renderingOptions,t=>e.renderingOptions=t,l)],"video-view"),this._extent=new f({xmin:0,ymin:0,xmax:this.videoSize[0],ymax:this.videoSize[1],spatialReference:{wkid:0}}),this._videoElementView=new v({element:new M({video:this.layer?.videoElement,georeference:new b({extent:this._extent}),autoplay:!1}),spatialReference:this.spatialReference});const t=new q(this._videoElementView);this._overlayContainer=new z,this._overlayContainer.addChild(t),this._effectsContainer=new G,this._effectsContainer.addChild(this._overlayContainer),this.stage.addChild(this._effectsContainer);const i=document.createElement("div");i.classList.add("esri-video-poster"),this.container?.classList.add("esri-video-view"),this.container?.appendChild(i)}_prepareChildStage(e){this.addHandles([n(()=>this.map,async t=>{if(!t)return;const{default:i}=await import("./video/VideoOperationalDataView.js");this._operationalDataView=new i({stage:e,layerViewFilter:e=>new Set(k).has(e.type),width:this.size[0],height:this.size[1],map:t}),p(()=>this._operationalDataView?.ready).then(()=>{e.videoScreenRenderer.visible=this.operationalDataVisible})},l),n(()=>this.layer?.groundControlPoints,async()=>{if(!this.layer?.groundControlPoints||!e.state)return;const t=this.layer.groundControlPoints,i=t?.length;if(!i)return;await j();const s=new Array(i),r=e.state.spatialReference;for(let e=0;e<i;e++){const{lat:i,lon:o}=t[e];s[e]=w(new y(o,i),r)}let o=1/0,a=1/0,n=-1/0,l=-1/0;for(const e of s)o=Math.min(o,e.x),a=Math.min(a,e.y),n=Math.max(n,e.x),l=Math.max(l,e.y);const p=f.fromJSON({xmin:o,ymin:a,xmax:n,ymax:l,spatialReference:r});await(this._operationalDataView?.goTo(p,{animate:!1}).catch(()=>{}))},l)])}_updateConstraints(){this._updateZoomConstraints(),this._updatePanConstraints()}_updateZoomConstraints(){const e=this.videoSize,t=Math.max(e[0]/this.size[0],e[1]/this.size[1]),i=[];for(let r=t;r>F;r/=2)i.push(r);i.push(F);const{lods:s}=_.create({scales:i});this.constraints.set({lods:s,minScale:t})}_updatePanConstraints(){const e=e=>{if(!e.targetGeometry)return e;const[t,i]=this.videoSize,s=t*e.scale/2,r=i*e.scale/2,o=e.targetGeometry.clone();return o.x=Math.max(s,Math.min(t-s,o.x)),o.y=Math.max(r,Math.min(i-r,o.y)),e.targetGeometry=o,e};this.constraints.customConstraints.add({constrain:e,applyPanConstraint:e})}_forceReadyCycle(){this.ready&&(m(()=>this.destroyed||!1===this.preconditionsReady,()=>this._readyCycleForced=!1,{once:!0}),this._readyCycleForced=!0)}};e([h()],B.prototype,"_overlayContainer",void 0),e([h()],B.prototype,"_isValid",void 0),e([h()],B.prototype,"_readyCycleForced",void 0),e([h()],B.prototype,"_effectsContainer",void 0),e([h()],B.prototype,"constraintsInfo",null),e([h()],B.prototype,"operationalDataVisible",void 0),e([h()],B.prototype,"layer",null),e([h()],B.prototype,"map",void 0),e([h({type:T,nonNullable:!0})],B.prototype,"navigation",void 0),e([h({readOnly:!0})],B.prototype,"preconditionsReady",null),e([h({readOnly:!0})],B.prototype,"ready",void 0),e([h({readOnly:!0})],B.prototype,"rendering",null),e([h()],B.prototype,"scale",null),e([h()],B.prototype,"spatialReference",void 0),e([h()],B.prototype,"stateManager",void 0),e([h()],B.prototype,"type",void 0),e([h(),d(e=>e instanceof O?e:g(L,e))],B.prototype,"ui",void 0),e([h({readOnly:!0})],B.prototype,"videoSize",null),e([h({readOnly:!0})],B.prototype,"view2dType",void 0),B=e([c("esri.views.VideoView")],B);const H=B;export{H as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import e from"../../core/Accessor.js";import{EventEmitter as i}from"../../core/Evented.js";import{watch as r,sync as o}from"../../core/reactiveUtils.js";import{createScreenPoint as s}from"../../core/screenUtils.js";import{property as a,subclass as n}from"../../core/accessorSupport/decorators.js";let l=class extends e{constructor(t){super(t),this._visualSymbol=Symbol("manipulator-visual"),this.renderer=null,this.managedHandle=null,this.consumesClicks=!1,this.events=new i,this.interactive=!0,this.selectable=!1,this.grabbing=!1,this.dragging=!1,this.grabCursor="grabbing",this.hovering=!1,this.selected=!1,this.cursor="crosshair"}initialize(){super.initialize(),this.addHandles([r(()=>[this.managedHandle?.role,this._visualState,this.managedHandle?.outputMapPosition],()=>{this._updateVisual()},o)])}destroy(){this.renderer?.removeVisual(this._visualSymbol)}get _visualState(){return this.grabbing||this.following?"active":this.selected||this.hovering?"focused":"idle"}get grabbable(){return!!this.managedHandle?.grabbable}get following(){return!!this.managedHandle?.following}get test(){return{visualState:this._visualState}}grabbableForEvent(t){if("x"in t&&"y"in t&&this.grabbable){const e=s(t.x,t.y);return null!==this.intersectionDistance(e)}return!1}intersectionDistance(t){return this.following?0:this.renderer?.hitTestVisualDistance(t,this._visualSymbol)}attach(){this._updateVisual()}detach(){this.renderer?.removeVisual(this._visualSymbol)}onElevationChange(){}onViewChange(){}_updateVisual(){const t=this.managedHandle;this.renderer?.addOrUpdateVisual(this._visualSymbol,{role:"secondary"===t?.role?"controlPoint":"cursor",geometry:t?.outputMapPosition,state:this._visualState})}};t([a()],l.prototype,"_visualState",null),t([a({constructOnly:!0})],l.prototype,"renderer",void 0),t([a()],l.prototype,"managedHandle",void 0),t([a()],l.prototype,"consumesClicks",void 0),t([a()],l.prototype,"events",void 0),t([a()],l.prototype,"interactive",void 0),t([a()],l.prototype,"selectable",void 0),t([a()],l.prototype,"grabbable",null),t([a()],l.prototype,"grabbing",void 0),t([a()],l.prototype,"dragging",void 0),t([a()],l.prototype,"following",null),t([a()],l.prototype,"grabCursor",void 0),t([a()],l.prototype,"hovering",void 0),t([a()],l.prototype,"selected",void 0),t([a()],l.prototype,"cursor",void 0),l=t([n("esri.views.draw.DrawManipulator")],l);export{l as DrawManipulator};
2
+ import{__decorate as t}from"tslib";import e from"../../core/Accessor.js";import{EventEmitter as i}from"../../core/Evented.js";import{watch as r,sync as o}from"../../core/reactiveUtils.js";import{createScreenPoint as s}from"../../core/screenUtils.js";import{property as a,subclass as l}from"../../core/accessorSupport/decorators.js";import{getPointerType as n}from"./support/drawToolUtils.js";let d=class extends e{constructor(t){super(t),this._visualSymbol=Symbol("manipulator-visual"),this.renderer=null,this.managedHandle=null,this.consumesClicks=!1,this.events=new i,this.interactive=!0,this.selectable=!1,this.grabbing=!1,this.dragging=!1,this.grabCursor="grabbing",this.hovering=!1,this.selected=!1,this.cursor="crosshair"}initialize(){super.initialize(),this.addHandles([r(()=>[this.managedHandle?.role,this._visualState,this.managedHandle?.outputMapPosition],()=>{this._updateVisual()},o)])}destroy(){this.renderer?.removeVisual(this._visualSymbol)}get _visualState(){return this.grabbing||this.following?"active":this.selected||this.hovering?"focused":"idle"}get grabbable(){return!!this.managedHandle?.grabbable}get following(){return!!this.managedHandle?.following}get test(){return{visualState:this._visualState}}grabbableForEvent(t){if("x"in t&&"y"in t&&this.grabbable){const e=s(t.x,t.y),i=n(t);return null!==this.intersectionDistance(e,i)}return!1}intersectionDistance(t,e){return this.following?0:this.renderer?.hitTestVisualDistance(t,this._visualSymbol)}attach(){this._updateVisual()}detach(){this.renderer?.removeVisual(this._visualSymbol)}onElevationChange(){}onViewChange(){}_updateVisual(){const t=this.managedHandle;this.renderer?.addOrUpdateVisual(this._visualSymbol,{role:"secondary"===t?.role?"controlPoint":"cursor",geometry:t?.outputMapPosition,state:this._visualState})}};t([a()],d.prototype,"_visualState",null),t([a({constructOnly:!0})],d.prototype,"renderer",void 0),t([a()],d.prototype,"managedHandle",void 0),t([a()],d.prototype,"consumesClicks",void 0),t([a()],d.prototype,"events",void 0),t([a()],d.prototype,"interactive",void 0),t([a()],d.prototype,"selectable",void 0),t([a()],d.prototype,"grabbable",null),t([a()],d.prototype,"grabbing",void 0),t([a()],d.prototype,"dragging",void 0),t([a()],d.prototype,"following",null),t([a()],d.prototype,"grabCursor",void 0),t([a()],d.prototype,"hovering",void 0),t([a()],d.prototype,"selected",void 0),t([a()],d.prototype,"cursor",void 0),d=t([l("esri.views.draw.DrawManipulator")],d);export{d as DrawManipulator};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{multiplyOpacityToUnitRGBA as e}from"../../core/colorUtils.js";import{handlesGroup as t}from"../../core/handleUtils.js";import{watch as r,initial as i,syncAndInitial as s}from"../../core/reactiveUtils.js";import{createScreenPoint as a}from"../../core/screenUtils.js";import{Manipulator3D as o}from"../3d/interactive/Manipulator3D.js";import{createManipulatorMaterial as n}from"../3d/interactive/manipulatorUtils.js";import{RenderObject as l}from"../3d/interactive/RenderObject.js";import{createSphereGeometry as u}from"../3d/webgl-engine/lib/GeometryUtil.js";import{getPointerType as c}from"./support/drawToolUtils.js";class d extends o{constructor(a){const o=n(e(a.view.effectiveTheme.accentColor,1)),c=[new l(u(o,1,32,32))];super({view:a.view,renderObjects:c,available:!1,radius:5,collisionPriority:1}),this.consumesClicks=!1,this.cursor="crosshair",this.grabCursor="grabbing",this._visualSymbol=Symbol("manipulator-visual"),this.renderer=a.renderer,this.managedHandle=a.managedHandle,this._handles=t([r(()=>a.view.effectiveTheme.accentColor,t=>{o.setParameters({color:e(t,1)})},i),r(()=>{const e=this.managedHandle;return[e?.role,e?.outputMapPosition,e?.grabbable,e?.following]},()=>this._syncFromHandle(),s)])}destroy(){this._handles.remove(),this.renderer?.removeVisual(this._visualSymbol),super.destroy()}get grabbing(){return super.grabbing}set grabbing(e){super.grabbing=e,this._updateVisual()}get following(){return!!this.managedHandle?.following}get hovering(){return super.hovering}set hovering(e){super.hovering=e,this._updateVisual()}get selected(){return super.selected}set selected(e){super.selected=e,this._updateVisual()}grabbableForEvent(e){if(!e)return this.grabbable;const t=a(e.x,e.y);return this.grabbable&&null!=this.intersectionDistance(t,c(e))}intersectionDistance(e,t){return this.following?0:super.intersectionDistance(e,t)}attach(e){super.attach(e),this._updateVisual()}detach(e){this.renderer?.removeVisual(this._visualSymbol),super.detach(e)}get _visualState(){return this.grabbing||this.following?"active":this.selected||this.hovering?"focused":"idle"}get _visualRole(){return"secondary"===this.managedHandle?.role?"controlPoint":"cursor"}_syncFromHandle(){const e=this.managedHandle,t=e?.outputMapPosition;this.available=!!t,this.grabbable=!!e?.grabbable,t&&(this.location=t),this._updateVisual()}_updateVisual(){this.renderer?.addOrUpdateVisual(this._visualSymbol,{role:this._visualRole,geometry:this.managedHandle?.outputMapPosition,state:this._visualState})}}export{d as DrawManipulator3D};