@arcgis/core 4.32.0-next.20241229 → 4.32.0-next.20241231

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 (32) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{0191142d5f55cc8cf37a.js → 6a4305eb1e52b80ecb5c.js} +4 -4
  3. package/assets/esri/core/workers/chunks/756c2f7c8659deab6c96.js.LICENSE.txt +1 -1
  4. package/assets/esri/core/workers/chunks/a100fb789d72410f8d4f.js.LICENSE.txt +1 -1
  5. package/assets/esri/core/workers/chunks/b1e4813f0c73fc2a483c.js.LICENSE.txt +1 -1
  6. package/assets/esri/core/workers/chunks/bf0a0ca7fdac98f06a89.js.LICENSE.txt +1 -1
  7. package/assets/esri/core/workers/chunks/{e16d2521f006724697c2.js → d82b3e2905cab511ff3a.js} +2 -2
  8. package/assets/esri/core/workers/chunks/{e16d2521f006724697c2.js.LICENSE.txt → d82b3e2905cab511ff3a.js.LICENSE.txt} +1 -1
  9. package/assets/esri/core/workers/chunks/e371f4f0eb3c22f222df.js +2 -0
  10. package/assets/esri/core/workers/chunks/{e1913990f30d285b3b15.js.LICENSE.txt → e371f4f0eb3c22f222df.js.LICENSE.txt} +1 -1
  11. package/assets/esri/core/workers/chunks/ebf9caf2dc8af89afec2.js.LICENSE.txt +1 -1
  12. package/chunks/ComponentShader.glsl.js +3 -3
  13. package/chunks/HighlightDownsample.glsl.js +22 -15
  14. package/chunks/HighlightToSingle.glsl.js +1 -1
  15. package/chunks/Terrain.glsl.js +1 -1
  16. package/core/has.js +1 -1
  17. package/interfaces.d.ts +14 -3
  18. package/package.json +2 -2
  19. package/rest/networks/support/ValidateNetworkTopologyResult.js +1 -1
  20. package/support/revision.js +1 -1
  21. package/views/3d/terrain/TerrainRenderer.js +1 -1
  22. package/views/3d/webgl-engine/core/shaderLibrary/HighlightCellGridScreenSpacePass.glsl.js +8 -4
  23. package/views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js +6 -6
  24. package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +4 -3
  25. package/views/3d/webgl-engine/core/shaderModules/ShaderBuilder.js +1 -1
  26. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  27. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  28. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  29. package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
  30. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  31. package/widgets/Popup.js +1 -1
  32. package/assets/esri/core/workers/chunks/e1913990f30d285b3b15.js +0 -2
@@ -2,7 +2,7 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{earth as e,mars as o,moon as r}from"../geometry/support/Ellipsoid.js";import{OverlayContent as a}from"../views/3d/terrain/OverlayContent.js";import{IntegratedMeshMode as i}from"../views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js";import{ComponentData as l,ComponentDataType as t}from"../views/3d/webgl-engine/collections/Component/Material/shader/ComponentData.glsl.js";import{VertexDiscardMode as n}from"../views/3d/webgl-engine/collections/Component/Material/shader/VertexDiscardMode.js";import{ForwardLinearDepth as d}from"../views/3d/webgl-engine/core/shaderLibrary/ForwardLinearDepth.glsl.js";import{ShaderOutput as s,isColorOrColorEmission as g}from"../views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SlicePass as m}from"../views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js";import{TextureCoordinateAttribute as c}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{VertexColor as v}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/VertexColor.glsl.js";import{VertexNormal as h}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/VertexNormal.glsl.js";import{VertexPosition as u}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/VertexPosition.glsl.js";import{OutputDepth as w}from"../views/3d/webgl-engine/core/shaderLibrary/output/OutputDepth.glsl.js";import{OutputHighlight as p}from"../views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js";import{computeFragmentNormals as b}from"../views/3d/webgl-engine/core/shaderLibrary/shading/ComputeFragmentNormals.glsl.js";import{ComputeMaterialColor as C}from"../views/3d/webgl-engine/core/shaderLibrary/shading/ComputeMaterialColor.glsl.js";import{ComputeNormalTexture as f}from"../views/3d/webgl-engine/core/shaderLibrary/shading/ComputeNormalTexture.glsl.js";import{EvaluateSceneLighting as y,addLightingGlobalFactor as x}from"../views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import{addMainLightIntensity as L}from"../views/3d/webgl-engine/core/shaderLibrary/shading/MainLighting.glsl.js";import{PBRMode as j,PhysicallyBasedRenderingParameters as O}from"../views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{ReadBaseColorTexture as S}from"../views/3d/webgl-engine/core/shaderLibrary/shading/ReadBaseColorTexture.glsl.js";import{ReadShadowMapPass as M}from"../views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{terrainDepthTest as N}from"../views/3d/webgl-engine/core/shaderLibrary/shading/TerrainDepthTest.glsl.js";import{OverlayIM as T,getIMColorTexture as $}from"../views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{alphaCutoff as A}from"../views/3d/webgl-engine/core/shaderLibrary/util/AlphaCutoff.js";import{DiscardOrAdjustAlphaDraw as W}from"../views/3d/webgl-engine/core/shaderLibrary/util/DiscardOrAdjustAlpha.glsl.js";import{EllipsoidMode as D}from"../views/3d/webgl-engine/core/shaderLibrary/util/EllipsoidMode.js";import{If as P,glsl as B}from"../views/3d/webgl-engine/core/shaderModules/interfaces.js";import{ShaderBuilder as R}from"../views/3d/webgl-engine/core/shaderModules/ShaderBuilder.js";import{Texture2DPassUniform as z}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";import{outputColorHighlightOID as E}from"../views/3d/webgl-engine/shaders/OutputColorHighlightOID.glsl.js";function H(H){const I=new R;I.include(u,H),I.include(h,H),I.include(v,H),I.include(c,H),I.include(d,H),I.include(l,H),I.include(W,H),I.fragment.include(m,H),I.include(S,H),I.include(N,H);const{vertex:V,fragment:F}=I,{output:_,pbrMode:G,hasNormalTexture:k,snowCover:q,receiveShadows:U,spherical:J,ellipsoidMode:K}=H,Q=G===j.Normal||G===j.Schematic;Q&&(I.include(O,H),k&&I.include(f,H));const X=_===s.Shadow||_===s.ShadowHighlight||_===s.ShadowExcludeHighlight,Y=X&&H.componentData===t.Varying,Z=H.integratedMeshMode===i.ColorOverlay||H.integratedMeshMode===i.ColorOverlayWithWater;if(Z){I.include(y,H),I.include(T,H);const a=K===D.Earth,i=K===D.Earth,l=a?e.radius:i?o.radius:r.radius;V.code.add(`\n ${P(J,`const float invRadius = ${B.float(1/l)};`)}\n vec2 projectOverlay(vec3 pos) { return pos.xy ${P(J,"/ (1.0 + invRadius * pos.z);")}; }`)}const ee=Z&&g(_)&&G===j.WaterOnIntegratedMesh;ee&&(I.varyings.add("tbnTangent","vec3"),I.varyings.add("tbnBiTangent","vec3"),I.varyings.add("groundNormal","vec3"));const oe=H.vertexDiscardMode===n.None,re=H.vertexDiscardMode===n.Opaque,ae=1-1/255;if(V.main.add(B`
5
+ import{earth as e,mars as o,moon as r}from"../geometry/support/Ellipsoid.js";import{OverlayContent as a}from"../views/3d/terrain/OverlayContent.js";import{IntegratedMeshMode as i}from"../views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js";import{ComponentData as l,ComponentDataType as t}from"../views/3d/webgl-engine/collections/Component/Material/shader/ComponentData.glsl.js";import{VertexDiscardMode as n}from"../views/3d/webgl-engine/collections/Component/Material/shader/VertexDiscardMode.js";import{ForwardLinearDepth as d}from"../views/3d/webgl-engine/core/shaderLibrary/ForwardLinearDepth.glsl.js";import{ShaderOutput as s,isColorOrColorEmission as g}from"../views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SlicePass as m}from"../views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js";import{TextureCoordinateAttribute as c}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{VertexColor as v}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/VertexColor.glsl.js";import{VertexNormal as h}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/VertexNormal.glsl.js";import{VertexPosition as u}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/VertexPosition.glsl.js";import{OutputDepth as w}from"../views/3d/webgl-engine/core/shaderLibrary/output/OutputDepth.glsl.js";import{OutputHighlight as p}from"../views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js";import{computeFragmentNormals as b}from"../views/3d/webgl-engine/core/shaderLibrary/shading/ComputeFragmentNormals.glsl.js";import{ComputeMaterialColor as C}from"../views/3d/webgl-engine/core/shaderLibrary/shading/ComputeMaterialColor.glsl.js";import{ComputeNormalTexture as f}from"../views/3d/webgl-engine/core/shaderLibrary/shading/ComputeNormalTexture.glsl.js";import{EvaluateSceneLighting as y,addLightingGlobalFactor as x}from"../views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import{addMainLightIntensity as L}from"../views/3d/webgl-engine/core/shaderLibrary/shading/MainLighting.glsl.js";import{PBRMode as j,PhysicallyBasedRenderingParameters as S}from"../views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{ReadBaseColorTexture as M}from"../views/3d/webgl-engine/core/shaderLibrary/shading/ReadBaseColorTexture.glsl.js";import{ReadShadowMapPass as O}from"../views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{terrainDepthTest as N}from"../views/3d/webgl-engine/core/shaderLibrary/shading/TerrainDepthTest.glsl.js";import{OverlayIM as T,getIMColorTexture as $}from"../views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{alphaCutoff as A}from"../views/3d/webgl-engine/core/shaderLibrary/util/AlphaCutoff.js";import{DiscardOrAdjustAlphaDraw as W}from"../views/3d/webgl-engine/core/shaderLibrary/util/DiscardOrAdjustAlpha.glsl.js";import{EllipsoidMode as D}from"../views/3d/webgl-engine/core/shaderLibrary/util/EllipsoidMode.js";import{If as P,glsl as B}from"../views/3d/webgl-engine/core/shaderModules/interfaces.js";import{ShaderBuilder as R}from"../views/3d/webgl-engine/core/shaderModules/ShaderBuilder.js";import{Texture2DPassUniform as z}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";import{outputColorHighlightOID as E}from"../views/3d/webgl-engine/shaders/OutputColorHighlightOID.glsl.js";function H(H){const I=new R;I.include(u,H),I.include(h,H),I.include(v,H),I.include(c,H),I.include(d,H),I.include(l,H),I.include(W,H),I.fragment.include(m,H),I.include(M,H),I.include(N,H);const{vertex:V,fragment:F}=I,{output:_,pbrMode:G,hasNormalTexture:k,snowCover:q,receiveShadows:U,spherical:J,ellipsoidMode:K}=H,Q=G===j.Normal||G===j.Schematic;Q&&(I.include(S,H),k&&I.include(f,H));const X=_===s.Shadow||_===s.ShadowHighlight||_===s.ShadowExcludeHighlight,Y=X&&H.componentData===t.Varying,Z=H.integratedMeshMode===i.ColorOverlay||H.integratedMeshMode===i.ColorOverlayWithWater;if(Z){I.include(y,H),I.include(T,H);const a=K===D.Earth,i=K===D.Earth,l=a?e.radius:i?o.radius:r.radius;V.code.add(`\n ${P(J,`const float invRadius = ${B.float(1/l)};`)}\n vec2 projectOverlay(vec3 pos) { return pos.xy ${P(J,"/ (1.0 + invRadius * pos.z);")}; }`)}const ee=Z&&g(_)&&G===j.WaterOnIntegratedMesh;ee&&(I.varyings.add("tbnTangent","vec3"),I.varyings.add("tbnBiTangent","vec3"),I.varyings.add("groundNormal","vec3"));const oe=H.vertexDiscardMode===n.None,re=H.vertexDiscardMode===n.Opaque,ae=1-1/255;if(V.main.add(B`
6
6
  bool castShadows;
7
7
  vec4 externalColor = forwardExternalColor(castShadows);
8
8
  ${P(Y,"if(!castShadows) { gl_Position = vec4(vec3(1e38), 1.0); return; }")}
@@ -32,7 +32,7 @@ import{earth as e,mars as o,moon as r}from"../geometry/support/Ellipsoid.js";imp
32
32
  tbnTangent = vec3(1.0, 0.0, 0.0);
33
33
  tbnBiTangent = vec3(0.0, 1.0, 0.0);`:""}
34
34
  ${Z?B`setOverlayVTC(projectOverlay(position));`:""}
35
- `),g(_))return I.include(C,H),I.include(b,H),I.include(y,H),I.include(E,H),U&&I.include(M,H),F.code.add(B`
35
+ `),g(_))return I.include(C,H),I.include(b,H),I.include(y,H),I.include(E,H),U&&I.include(O,H),F.code.add(B`
36
36
  float evaluateShadow() {
37
37
  return ${U?"readShadowMap(vPositionWorldCameraRelative, linearDepth)":"0.0"};
38
38
  }`),Z&&F.uniforms.add(new z("ovColorTex",((e,o)=>$(e,o)))),F.main.add(B`
@@ -102,7 +102,7 @@ import{earth as e,mars as o,moon as r}from"../geometry/support/Ellipsoid.js";imp
102
102
 
103
103
  ${P(ne,"outputDepth(linearDepth);")}
104
104
  ${P(ie,B`fragColor = vec4(vec3(0.5) + 0.5 * fragmentFaceNormalView, 1.0);`)}
105
- ${P(le,Z?"fragColor = getOverlayColorTexel(vtcOverlay);":"outputObjectAndLayerIdColor();")}
105
+ ${P(le,Z?"fragColor = getOverlayColorTexel();":"outputObjectAndLayerIdColor();")}
106
106
  ${P(te,B`${P(Z,B`
107
107
  vec2 overlayHighlightTexel = getAllOverlayHighlightValuesEncoded();
108
108
  outputAllHighlights(overlayHighlightTexel);`,B`calculateOcclusionAndOutputHighlight();`)}`)}`),I}const I=Object.freeze(Object.defineProperty({__proto__:null,build:H},Symbol.toStringTag,{value:"Module"}));export{I as C,H as b};
@@ -2,23 +2,30 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{ScreenSpacePass as e}from"../views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js";import{NoParameters as r,glsl as t}from"../views/3d/webgl-engine/core/shaderModules/interfaces.js";import{ShaderBuilder as i}from"../views/3d/webgl-engine/core/shaderModules/ShaderBuilder.js";import{Texture2DDrawUniform as n}from"../views/3d/webgl-engine/core/shaderModules/Texture2DDrawUniform.js";class o extends r{}function a(){const r=new i,{outputs:o,fragment:a}=r;return r.include(e),a.uniforms.add(new n("textureInput",(e=>e.input))),a.constants.add("outlineWidth","int",Math.ceil(c)),a.constants.add("cellSize","int",l),o.add("fragGrid","vec2"),a.main.add(t`vec2 inputTextureSize = vec2(textureSize(textureInput, 0));
6
- vec2 cellBottomLeftCornerInput = floor(gl_FragCoord.xy) * vec2(cellSize);
7
- vec2 coordMid = (cellBottomLeftCornerInput + 0.5 * vec2(cellSize)) / inputTextureSize;
8
- vec2 commonValue = texture(textureInput, coordMid).rg;
9
- int margin = outlineWidth;
10
- float marginSquare = float(margin*margin);
11
- for(int y = -margin; y <= cellSize + margin; y+=2) {
5
+ import{ScreenSpacePass as e}from"../views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js";import{NoParameters as t,glsl as i}from"../views/3d/webgl-engine/core/shaderModules/interfaces.js";import{ShaderBuilder as r}from"../views/3d/webgl-engine/core/shaderModules/ShaderBuilder.js";import{Texture2DDrawUniform as l}from"../views/3d/webgl-engine/core/shaderModules/Texture2DDrawUniform.js";class u extends t{}function o(){const t=new r,{outputs:u,fragment:o}=t;return t.include(e),o.uniforms.add(new l("textureInput",(e=>e.input))),o.constants.add("outlineWidth","int",Math.ceil(n)),o.constants.add("cellSize","int",c),u.add("fragGrid","vec2"),o.main.add(i`ivec2 inputTextureSize = textureSize(textureInput, 0);
6
+ ivec2 cellBottomLeftCornerInput = ivec2(floor(gl_FragCoord.xy) * vec2(cellSize));
7
+ ivec2 coordMid = cellBottomLeftCornerInput + ivec2(cellSize >> 1);
8
+ uvec2 centreTexel = uvec2( texelFetch(textureInput, coordMid, 0).rg * 255.0) & uvec2(0x55u);
9
+ float marginSquare = float(outlineWidth*outlineWidth);
10
+ uvec2 outputValue = centreTexel & uvec2(0x55u);
11
+ for(int y = -outlineWidth; y <= cellSize + outlineWidth; y+=2) {
12
12
  int dy = y < 0 ? -y : y > cellSize ? y-cellSize : 0;
13
- int xMargin = dy > 0 ? int(ceil(sqrt(marginSquare - float(dy*dy)))) : margin;
13
+ int xMargin = dy > 0 ? int(ceil(sqrt(marginSquare - float(dy*dy)))) : outlineWidth;
14
14
  for(int x = -xMargin; x <= cellSize + xMargin; x+=2) {
15
- vec2 coord = (cellBottomLeftCornerInput + vec2(x, y)) / inputTextureSize;
16
- vec2 value = texture(textureInput, coord).rg;
17
- if (value != commonValue){
18
- fragGrid = vec2(1.0, 1.0);
19
- return;
15
+ ivec2 coord = cellBottomLeftCornerInput + ivec2(x, y);
16
+ uvec2[4] texels = uvec2[4] (
17
+ uvec2(texelFetch(textureInput,coord+ivec2(0,0),0).rg * 255.0) & uvec2(0x55u),
18
+ uvec2(texelFetch(textureInput,coord+ivec2(1,0),0).rg * 255.0) & uvec2(0x55u),
19
+ uvec2(texelFetch(textureInput,coord+ivec2(0,1),0).rg * 255.0) & uvec2(0x55u),
20
+ uvec2(texelFetch(textureInput,coord+ivec2(1,1),0).rg * 255.0) & uvec2(0x55u)
21
+ );
22
+ if (texels[0] == texels[1] && texels[1] == texels[2] && texels[2] == texels[3] && texels[3] == centreTexel) {
23
+ continue;
20
24
  }
25
+ for (int i=0; i<4; ++i){
26
+ outputValue |= ((texels[i] ^ centreTexel) << 1);
27
+ outputValue |= texels[i];
21
28
  }
22
29
  }
23
- bool hasAny = commonValue != vec2(0.0);
24
- fragGrid = vec2(hasAny ? 1.0 : 0.0, 0.0);`),r}const l=32,c=9,u=.4,d=Object.freeze(Object.defineProperty({__proto__:null,HighlightDownsampleDrawParameters:o,blurSize:u,build:a,gridCellPixelSize:l,outlineSize:c},Symbol.toStringTag,{value:"Module"}));export{o as H,d as a,u as b,a as c,l as g,c as o};
30
+ }
31
+ fragGrid = vec2(outputValue) / 255.0;`),t}const c=32,n=9,a=.4,d=Object.freeze(Object.defineProperty({__proto__:null,HighlightDownsampleDrawParameters:u,blurSize:a,build:o,gridCellPixelSize:c,outlineSize:n},Symbol.toStringTag,{value:"Module"}));export{u as H,d as a,a as b,o as c,c as g,n as o};
@@ -2,7 +2,7 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{HighlightCellGridScreenSpacePass as e}from"../views/3d/webgl-engine/core/shaderLibrary/HighlightCellGridScreenSpacePass.glsl.js";import{HighlightReadBitmap as i}from"../views/3d/webgl-engine/core/shaderLibrary/HighlightReadBitmap.glsl.js";import{IntegerPassUniform as r}from"../views/3d/webgl-engine/core/shaderModules/IntegerPassUniform.js";import{glsl as l}from"../views/3d/webgl-engine/core/shaderModules/interfaces.js";import{ShaderBuilder as g}from"../views/3d/webgl-engine/core/shaderModules/ShaderBuilder.js";import{Texture2DPassUniform as t}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";function s(){const s=new g;s.include(e),s.include(i);const{fragment:o}=s;return s.outputs.add("fragSingleHighlight","vec2",0),o.uniforms.add(new t("highlightTexture",(e=>e.highlightTexture)),new r("highlightLevel",(e=>e.highlightLevel))).main.add(l`ivec2 iuv = ivec2(gl_FragCoord.xy);
5
+ import{HighlightCellGridScreenSpacePass as e}from"../views/3d/webgl-engine/core/shaderLibrary/HighlightCellGridScreenSpacePass.glsl.js";import{HighlightReadBitmap as i}from"../views/3d/webgl-engine/core/shaderLibrary/HighlightReadBitmap.glsl.js";import{IntegerPassUniform as r}from"../views/3d/webgl-engine/core/shaderModules/IntegerPassUniform.js";import{glsl as l}from"../views/3d/webgl-engine/core/shaderModules/interfaces.js";import{ShaderBuilder as g}from"../views/3d/webgl-engine/core/shaderModules/ShaderBuilder.js";import{Texture2DPassUniform as t}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";function s(){const s=new g;s.include(e),s.include(i);const{fragment:o}=s;return s.outputs.add("fragSingleHighlight","vec2",0),o.uniforms.add(new t("highlightTexture",(e=>e.highlightTexture)),new r("highlightLevel",(e=>e.highlightLevel))),o.main.add(l`ivec2 iuv = ivec2(gl_FragCoord.xy);
6
6
  vec2 inputTexel = texelFetch(highlightTexture, iuv, 0).rg;
7
7
  uint bits = readLevelBits(inputTexel, highlightLevel);
8
8
  bool hasHighlight = (bits & 1u) == 1u;
@@ -112,4 +112,4 @@ return (min(min(c.r, c.g), c.b) + max(max(c.r, c.g), c.b)) * 0.5;
112
112
  vec2 overlayHighlightTexel = getAllOverlayHighlightValuesEncoded();
113
113
  outputAllHighlights(overlayHighlightTexel);`,"calculateOcclusionAndOutputHighlight();")}
114
114
  `)}if(G===d.ObjectAndLayerIdColor)if(re)r.pbrMode=O.Disabled,i.include(P,r),r.pbrMode=R,M.main.add(F`gl_Position = transformPosition(proj, view, position);
115
- setOverlayVTC(getUV0());`),B.main.add(F`fragColor = getOverlayColorTexel(vtcOverlay);`);else{const e=X===t.Opaque;M.main.add(F`${U(e,"gl_Position = transformPosition(proj, view, position);")}`),B.main.add(F`fragColor = vec4(0.0);`)}return i}const I=r(),q=i(),G=Object.freeze(Object.defineProperty({__proto__:null,TerrainPassParameters:B,build:E},Symbol.toStringTag,{value:"Module"}));export{B as T,G as a,E as b};
115
+ setOverlayVTC(getUV0());`),B.main.add(F`fragColor = getOverlayColorTexel();`);else{const e=X===t.Opaque;M.main.add(F`${U(e,"gl_Position = transformPosition(proj, view, position);")}`),B.main.add(F`fragColor = vec4(0.0);`)}return i}const I=r(),q=i(),G=Object.freeze(Object.defineProperty({__proto__:null,TerrainPassParameters:B,build:E},Symbol.toStringTag,{value:"Module"}));export{B as T,G as a,E as b};
package/core/has.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- let e;function has(a){return"function"==typeof e[a]?e[a]=e[a](globalThis):e[a]}e=globalThis.dojoConfig?.has||globalThis.esriConfig?.has?{...globalThis.dojoConfig?.has,...globalThis.esriConfig?.has}:{},has.add=(a,d,o,i)=>{(i||void 0===e[a])&&(e[a]=d),o&&has(a)},has.cache=e,has.add("big-integer-warning-enabled",!0),has.add("esri-deprecation-warnings",!0),has.add("esri-tests-disable-screenshots",!1),has.add("esri-tests-use-full-window",!1),has.add("esri-tests-post-to-influx",!0),has.add("esri-cim-animations-enable-status","enabled"),has.add("esri-cim-animations-spotlight",!1),has.add("esri-cim-animations-freeze-time",!1),has.add("enable-feature:multiple-highlights",!1),(()=>{has.add("host-webworker",void 0!==globalThis.WorkerGlobalScope&&self instanceof globalThis.WorkerGlobalScope);const e="undefined"!=typeof window&&"undefined"!=typeof location&&"undefined"!=typeof document&&window.location===location&&window.document===document;if(has.add("host-browser",e),has.add("host-node","object"==typeof globalThis.process&&globalThis.process.versions?.node&&globalThis.process.versions.v8),has.add("dom",e),has("host-browser")){const e=navigator,a=e.userAgent,d=e.appVersion,o=parseFloat(d);if(has.add("wp",parseFloat(a.split("Windows Phone")[1])||void 0),has.add("msapp",parseFloat(a.split("MSAppHost/")[1])||void 0),has.add("khtml",d.includes("Konqueror")?o:void 0),has.add("edge",parseFloat(a.split("Edge/")[1])||void 0),has.add("opr",parseFloat(a.split("OPR/")[1])||void 0),has.add("webkit",!has("wp")&&!has("edge")&&parseFloat(a.split("WebKit/")[1])||void 0),has.add("chrome",!has("edge")&&!has("opr")&&parseFloat(a.split("Chrome/")[1])||void 0),has.add("android",!has("wp")&&parseFloat(a.split("Android ")[1])||void 0),has.add("safari",!d.includes("Safari")||has("wp")||has("chrome")||has("android")||has("edge")||has("opr")?void 0:parseFloat(d.split("Version/")[1])),has.add("mac",d.includes("Macintosh")),!has("wp")&&/(iPhone|iPod|iPad)/.test(a)){const e=RegExp.$1.replace(/P/,"p"),d=/OS ([\d_]+)/.test(a)?RegExp.$1:"1",o=parseFloat(d.replace(/_/,".").replaceAll("_",""));has.add(e,o),has.add("ios",o)}has("webkit")||(!a.includes("Gecko")||has("wp")||has("khtml")||has("edge")||has.add("mozilla",o),has("mozilla")&&has.add("ff",parseFloat(a.split("Firefox/")[1]||a.split("Minefield/")[1])||void 0))}})(),(()=>{if(globalThis.navigator){const e=navigator.userAgent,a=/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini|IEMobile/i.test(e),d=/iPhone/i.test(e);a&&has.add("esri-mobile",a),d&&has.add("esri-iPhone",d),has.add("esri-geolocation",!!navigator.geolocation)}has.add("esri-wasm","WebAssembly"in globalThis),has.add("esri-performance-mode-frames-between-render",20),has.add("esri-force-performance-mode",!1),has.add("esri-shared-array-buffer",(()=>{const e="SharedArrayBuffer"in globalThis,a=!1===globalThis.crossOriginIsolated;return e&&!a})),has.add("wasm-simd",(()=>{const e=[0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11];return WebAssembly.validate(new Uint8Array(e))})),has.add("esri-atomics","Atomics"in globalThis),has.add("esri-workers","Worker"in globalThis),has.add("web-feat:cache","caches"in globalThis),has.add("esri-workers-arraybuffer-transfer",!has("safari")||Number(has("safari"))>=12),has.add("workers-pool-size",8),has.add("featurelayer-simplify-thresholds",[.5,.5,.5,.5]),has.add("featurelayer-simplify-payload-size-factors",[1,1,4]),has.add("featurelayer-fast-triangulation-enabled",!0),has.add("featurelayer-animation-enabled",!0),has.add("featurelayer-snapshot-enabled",!0),has.add("featurelayer-snapshot-point-min-threshold",8e4),has.add("featurelayer-snapshot-point-max-threshold",4e5),has.add("featurelayer-snapshot-point-coverage",.1),has.add("featurelayer-query-max-depth",4),has.add("featurelayer-query-pausing-enabled",!1),has.add("featurelayer-advanced-symbols",!1),has.add("featurelayer-pbf",!0),has.add("featurelayer-pbf-statistics",!1),has.add("feature-layers-workers",!0),has.add("feature-polyline-generalization-factor",1),has.add("mapview-transitions-duration",200),has.add("mapview-essential-goto-duration",200),has.add("mapview-srswitch-adjust-rotation-scale-threshold",24e6),has.add("mapserver-pbf-version-support",10.81),has.add("mapservice-popup-identify-max-tolerance",20),has("host-webworker")||has("host-browser")&&(has.add("esri-csp-restrictions",(()=>{try{new Function}catch{return!0}return!1})),has.add("esri-image-decode",(()=>{if("decode"in new Image){const e=new Image;return e.src='data:image/svg+xml;charset=UTF-8,<svg version="1.1" xmlns="http://www.w3.org/2000/svg"></svg>',void e.decode().then((()=>{has.add("esri-image-decode",!0,!0,!0)})).catch((()=>{has.add("esri-image-decode",!1,!0,!0)}))}return!1})),has.add("esri-url-encodes-apostrophe",(()=>{const e=window.document.createElement("a");return e.href="?'",e.href.includes("?%27")})))})();export{has as default};
5
+ let e;function has(a){return"function"==typeof e[a]?e[a]=e[a](globalThis):e[a]}e=globalThis.dojoConfig?.has||globalThis.esriConfig?.has?{...globalThis.dojoConfig?.has,...globalThis.esriConfig?.has}:{},has.add=(a,d,o,i)=>{(i||void 0===e[a])&&(e[a]=d),o&&has(a)},has.cache=e,has.add("big-integer-warning-enabled",!0),has.add("esri-deprecation-warnings",!0),has.add("esri-tests-disable-screenshots",!1),has.add("esri-tests-use-full-window",!1),has.add("esri-tests-post-to-influx",!0),has.add("esri-cim-animations-enable-status","enabled"),has.add("esri-cim-animations-spotlight",!1),has.add("esri-cim-animations-freeze-time",!1),has.add("enable-feature:multiple-highlights",!0),(()=>{has.add("host-webworker",void 0!==globalThis.WorkerGlobalScope&&self instanceof globalThis.WorkerGlobalScope);const e="undefined"!=typeof window&&"undefined"!=typeof location&&"undefined"!=typeof document&&window.location===location&&window.document===document;if(has.add("host-browser",e),has.add("host-node","object"==typeof globalThis.process&&globalThis.process.versions?.node&&globalThis.process.versions.v8),has.add("dom",e),has("host-browser")){const e=navigator,a=e.userAgent,d=e.appVersion,o=parseFloat(d);if(has.add("wp",parseFloat(a.split("Windows Phone")[1])||void 0),has.add("msapp",parseFloat(a.split("MSAppHost/")[1])||void 0),has.add("khtml",d.includes("Konqueror")?o:void 0),has.add("edge",parseFloat(a.split("Edge/")[1])||void 0),has.add("opr",parseFloat(a.split("OPR/")[1])||void 0),has.add("webkit",!has("wp")&&!has("edge")&&parseFloat(a.split("WebKit/")[1])||void 0),has.add("chrome",!has("edge")&&!has("opr")&&parseFloat(a.split("Chrome/")[1])||void 0),has.add("android",!has("wp")&&parseFloat(a.split("Android ")[1])||void 0),has.add("safari",!d.includes("Safari")||has("wp")||has("chrome")||has("android")||has("edge")||has("opr")?void 0:parseFloat(d.split("Version/")[1])),has.add("mac",d.includes("Macintosh")),!has("wp")&&/(iPhone|iPod|iPad)/.test(a)){const e=RegExp.$1.replace(/P/,"p"),d=/OS ([\d_]+)/.test(a)?RegExp.$1:"1",o=parseFloat(d.replace(/_/,".").replaceAll("_",""));has.add(e,o),has.add("ios",o)}has("webkit")||(!a.includes("Gecko")||has("wp")||has("khtml")||has("edge")||has.add("mozilla",o),has("mozilla")&&has.add("ff",parseFloat(a.split("Firefox/")[1]||a.split("Minefield/")[1])||void 0))}})(),(()=>{if(globalThis.navigator){const e=navigator.userAgent,a=/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini|IEMobile/i.test(e),d=/iPhone/i.test(e);a&&has.add("esri-mobile",a),d&&has.add("esri-iPhone",d),has.add("esri-geolocation",!!navigator.geolocation)}has.add("esri-wasm","WebAssembly"in globalThis),has.add("esri-performance-mode-frames-between-render",20),has.add("esri-force-performance-mode",!1),has.add("esri-shared-array-buffer",(()=>{const e="SharedArrayBuffer"in globalThis,a=!1===globalThis.crossOriginIsolated;return e&&!a})),has.add("wasm-simd",(()=>{const e=[0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11];return WebAssembly.validate(new Uint8Array(e))})),has.add("esri-atomics","Atomics"in globalThis),has.add("esri-workers","Worker"in globalThis),has.add("web-feat:cache","caches"in globalThis),has.add("esri-workers-arraybuffer-transfer",!has("safari")||Number(has("safari"))>=12),has.add("workers-pool-size",8),has.add("featurelayer-simplify-thresholds",[.5,.5,.5,.5]),has.add("featurelayer-simplify-payload-size-factors",[1,1,4]),has.add("featurelayer-fast-triangulation-enabled",!0),has.add("featurelayer-animation-enabled",!0),has.add("featurelayer-snapshot-enabled",!0),has.add("featurelayer-snapshot-point-min-threshold",8e4),has.add("featurelayer-snapshot-point-max-threshold",4e5),has.add("featurelayer-snapshot-point-coverage",.1),has.add("featurelayer-query-max-depth",4),has.add("featurelayer-query-pausing-enabled",!1),has.add("featurelayer-advanced-symbols",!1),has.add("featurelayer-pbf",!0),has.add("featurelayer-pbf-statistics",!1),has.add("feature-layers-workers",!0),has.add("feature-polyline-generalization-factor",1),has.add("mapview-transitions-duration",200),has.add("mapview-essential-goto-duration",200),has.add("mapview-srswitch-adjust-rotation-scale-threshold",24e6),has.add("mapserver-pbf-version-support",10.81),has.add("mapservice-popup-identify-max-tolerance",20),has("host-webworker")||has("host-browser")&&(has.add("esri-csp-restrictions",(()=>{try{new Function}catch{return!0}return!1})),has.add("esri-image-decode",(()=>{if("decode"in new Image){const e=new Image;return e.src='data:image/svg+xml;charset=UTF-8,<svg version="1.1" xmlns="http://www.w3.org/2000/svg"></svg>',void e.decode().then((()=>{has.add("esri-image-decode",!0,!0,!0)})).catch((()=>{has.add("esri-image-decode",!1,!0,!0)}))}return!1})),has.add("esri-url-encodes-apostrophe",(()=>{const e=window.document.createElement("a");return e.href="?'",e.href.includes("?%27")})))})();export{has as default};
package/interfaces.d.ts CHANGED
@@ -60959,7 +60959,6 @@ declare namespace __esri {
60959
60959
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-networks-support-ValidateNetworkTopologyResult.html Read more...}
60960
60960
  */
60961
60961
  interface ValidateNetworkTopologyResult {
60962
- dirtyAreaCount: number;
60963
60962
  discoveredSubnetworks: Subnetwork[];
60964
60963
  exceededTransferLimit: boolean;
60965
60964
  fullUpdate: boolean;
@@ -86095,7 +86094,7 @@ declare namespace __esri {
86095
86094
  */
86096
86095
  getVersionInfoExtended(): Promise<VersionInfoExtendedJSON>;
86097
86096
  /**
86098
- * Method used to get a list of versions.
86097
+ * Returns all versions accessible to the currently logged-in user.
86099
86098
  *
86100
86099
  * @param refresh If refresh is true, a new REST call will be made to the server to get the available versions.
86101
86100
  *
@@ -106220,6 +106219,12 @@ declare namespace __esri {
106220
106219
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Features.html#promises Read more...}
106221
106220
  */
106222
106221
  promises: Promise<any>[];
106222
+ /**
106223
+ * The feature that the widget has drilled into.
106224
+ *
106225
+ * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Features.html#selectedDrillInFeature Read more...}
106226
+ */
106227
+ readonly selectedDrillInFeature: Graphic;
106223
106228
  /**
106224
106229
  * The selected feature accessed by the Features widget.
106225
106230
  *
@@ -114925,6 +114930,12 @@ declare namespace __esri {
114925
114930
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#promises Read more...}
114926
114931
  */
114927
114932
  promises: Promise<any>[];
114933
+ /**
114934
+ * The feature that the widget has drilled into.
114935
+ *
114936
+ * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#selectedDrillInFeature Read more...}
114937
+ */
114938
+ readonly selectedDrillInFeature: Graphic;
114928
114939
  /**
114929
114940
  * The selected feature accessed by the popup.
114930
114941
  *
@@ -126353,7 +126364,7 @@ declare namespace __esri {
126353
126364
  */
126354
126365
  deleteVersion(featureServerUrl: string, versionName: string, versionGuid: string): Promise<boolean>;
126355
126366
  /**
126356
- * Returns an array of versions.
126367
+ * Returns all versions accessible to the currently logged-in user.
126357
126368
  *
126358
126369
  * @param featureServerUrl The url of a feature service.
126359
126370
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.32.0-next.20241229",
3
+ "version": "4.32.0-next.20241231",
4
4
  "homepage": "https://js.arcgis.com",
5
5
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
6
6
  "keywords": [
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "@esri/arcgis-html-sanitizer": "~4.1.0",
29
- "@esri/calcite-components": "~3.0.0-next.81",
29
+ "@esri/calcite-components": "~3.0.0-next.82",
30
30
  "@vaadin/grid": "~24.6.0",
31
31
  "@zip.js/zip.js": "~2.7.54",
32
32
  "luxon": "~3.5.0",
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/JSONSupport.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";let s=class extends t{constructor(e){super(e),this.moment=null,this.fullUpdate=!1,this.validateErrorsCreated=!1,this.dirtyAreaCount=null,this.exceededTransferLimit=null,this.serviceEdits=null,this.discoveredSubnetworks=null}};e([o({type:Date,json:{type:Number,write:{writer:(e,t)=>{t.moment=e?e.getTime():null}}}})],s.prototype,"moment",void 0),e([o({type:Boolean,json:{write:!0}})],s.prototype,"fullUpdate",void 0),e([o({type:Boolean,json:{write:!0}})],s.prototype,"validateErrorsCreated",void 0),e([o({type:Number,json:{write:!0}})],s.prototype,"dirtyAreaCount",void 0),e([o({type:Boolean,json:{write:!0}})],s.prototype,"exceededTransferLimit",void 0),e([o({type:[Object],json:{write:!0}})],s.prototype,"serviceEdits",void 0),e([o({type:[Object],json:{write:!0}})],s.prototype,"discoveredSubnetworks",void 0),s=e([r("esri.rest.networks.support.ValidateNetworkTopologyResult")],s);const i=s;export{i as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import o from"../../../core/JSONSupport.js";import{property as t}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";let s=class extends o{constructor(e){super(e),this.moment=null,this.fullUpdate=!1,this.validateErrorsCreated=!1,this.exceededTransferLimit=null,this.serviceEdits=null,this.discoveredSubnetworks=null}};e([t({type:Date,json:{type:Number,write:{writer:(e,o)=>{o.moment=e?e.getTime():null}}}})],s.prototype,"moment",void 0),e([t({type:Boolean,json:{write:!0}})],s.prototype,"fullUpdate",void 0),e([t({type:Boolean,json:{write:!0}})],s.prototype,"validateErrorsCreated",void 0),e([t({type:Boolean,json:{write:!0}})],s.prototype,"exceededTransferLimit",void 0),e([t({type:[Object],json:{write:!0}})],s.prototype,"serviceEdits",void 0),e([t({type:[Object],json:{write:!0}})],s.prototype,"discoveredSubnetworks",void 0),s=e([r("esri.rest.networks.support.ValidateNetworkTopologyResult")],s);const i=s;export{i as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- const c="20241229",d="6f2aeabc77930f3507de4bdc256bc0a0494d2c3d";export{c as buildDate,d as commitHash};
5
+ const e="20241231",c="e6534b54d149f8ed46bcac7cce881504e01ae5b1";export{e as buildDate,c as commitHash};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import has from"../../../core/has.js";import{disposeMaybe as i}from"../../../core/maybe.js";import{MemCachePool as r}from"../../../core/MemCachePool.js";import s from"../../../core/ObjectPool.js";import{watch as n,sync as a}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{IDENTITY as c}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{d,i as h,f as u}from"../../../chunks/vec32.js";import{ZEROS as _,fromValues as f,create as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as g,ZEROS as m}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as b,set as y}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as T}from"../../../geometry/support/buffer/BufferView.js";import{ViewingMode as R}from"../../ViewingMode.js";import{TextureUpdate as x}from"./interfaces.js";import{LayerClass as O}from"./LayerClass.js";import{OverlayContent as v}from"./OverlayContent.js";import{overlayRenderOccludedFlag as w}from"./OverlayRenderer.js";import{PatchRenderData as P}from"./PatchRenderData.js";import{RenderOrder as D}from"./RenderOrder.js";import{TerrainAttributesCache as S}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as E}from"./terrainUtils.js";import{TileRenderer as C}from"./TileRenderer.js";import{TileUpdate as A}from"./TileUpdate.js";import{IteratorPreorder as j,sortTiles as N,compareTiles as B}from"./tileUtils.js";import{TransparencyMode as I}from"./TransparencyMode.js";import{componentMinimalSizeForIntersectionData as q,ComponentIntersectionData as F}from"../webgl-engine/collections/Component/ComponentIntersectionData.js";import{ShaderOutput as U}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{TileBlendInput as G}from"../webgl-engine/core/shaderLibrary/terrain/TileBlendInput.js";import{SyncRenderPlugin as M,ConsumesDepth as L,ConsumesNone as k}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as z}from"../webgl-engine/lib/Attribute.js";import{RenderRequestType as V}from"../webgl-engine/lib/basicInterfaces.js";import{createEmptyTexture as H}from"../webgl-engine/lib/glUtil3D.js";import{newIntersectorResult as Y}from"../webgl-engine/lib/Intersector.js";import{IntersectorType as Q,StoreResults as W}from"../webgl-engine/lib/IntersectorInterfaces.js";import{RenderOccludedFlag as X}from"../webgl-engine/lib/Material.js";import{intersectAabbInvDirBefore as K,intersectTriangles as Z,MeshIntersectionOptions as J}from"../webgl-engine/lib/RayIntersections.js";import{RenderSlot as $}from"../webgl-engine/lib/RenderSlot.js";import{getSettings as ee}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as te}from"../webgl-engine/lib/VertexAttribute.js";import{terrainId as ie,getVerticalOffsetTerrain as re}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as se}from"../webgl-engine/materials/DrawParameters.js";import{T as ne}from"../../../chunks/Terrain.glsl.js";import{TerrainTechnique as ae}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as oe}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as le}from"../../webgl/enums.js";const ce=7,de=10,he=b();let ue=class extends M{get _isGlobal(){return this._stage.viewingMode===R.Global}get _techniques(){return this._context.techniques}get _rctx(){return this._context.renderContext.rctx}constructor(e,t,i,n,a){super({}),this._overlayRenderer=e,this._stage=t,this._allTiles=i,this._ellipsoidRadius=n,this.type=Q.TERRAIN,this.isGround=!0,this._passParameters=new ne,this._drawParameters=new se,this._renderDataPool=new s(P),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new j,this._castShadows=!1,this._inViewshed=!1,this._emptyTex=null,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.renderOccludedFlags=X.Occlude,this.produces=new Map([[$.OPAQUE_TERRAIN,()=>this._produces()&&this.transparency===I.Opaque],[$.TRANSPARENT_TERRAIN,()=>this._produces()&&(this.transparency===I.Transparent||this.transparency===I.InvisibleWithDraped)],[$.OCCLUDED_TERRAIN,()=>this._produces()]]),this._tileSize=256,this._configuration=new oe(t.viewingMode===R.Global),this._tileTextureCache=new r(((e,t)=>a.newCache(e,t)),"TileTexture"),this.tileGeometryCache=new S(a)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this),this.addHandles(n((()=>this._overlayRenderer.rendersOccludedDraped),(e=>{this.renderOccludedFlags=e?w:X.Occlude,this.setNeedsRender()}),a))}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy()}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}consumes(){return this._overlayRenderer.hasWater?L:k}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}updateHeading(e){this._tileRenderer?.updateHeading(e)}set transparency(e){this._configuration.transparencyMode!==e&&(this._configuration.transparencyMode=e,this.setNeedsRender())}get transparency(){return this._configuration.transparencyMode}get renderPatchBorders(){return this._configuration.tileBorders}set renderPatchBorders(e){this._configuration.tileBorders!==e&&(this._configuration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get visualizeNormals(){return this._configuration.visualizeNormals}set visualizeNormals(e){this._configuration.visualizeNormals!==e&&(this._configuration.visualizeNormals=e,this.setNeedsRender(),this.notifyChange("visualizeNormals"))}get cullBackFaces(){return this._configuration.backfaceCullingEnabled}set cullBackFaces(e){this._configuration.backfaceCullingEnabled!==e&&(this._configuration.backfaceCullingEnabled=e,this.notifyChange("cullBackFaces"),this.setNeedsRender())}set renderOrder(e){this._set("renderOrder",e),this._setSortingDirty()}get layerUid(){return ie}get slicePlaneEnabled(){return this._configuration.hasSlicePlane}set slicePlaneEnabled(e){this._configuration.hasSlicePlane!==e&&(this._configuration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._configuration.textureFadingEnabled!==e&&(this._configuration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._configuration.pbrMode!==e&&(this._configuration.pbrMode=e,this.setNeedsRender())}setDebugScreenSizePerspective(e){this._configuration.screenSizePerspective!==e&&(this._configuration.screenSizePerspective=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}set tileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}get tileSize(){return this._tileSize}_ensureRenderData(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._ensureRenderData(e),this.updateTileGeometryState(e),this.reuseTextureFromParent(e)||this.updateTileTexture(e,A.TEXTURE_FADING)}reuseTextureFromParent(e){const t=e.parent;if(!t)return!1;const i=g(1&e.lij[2]?.5:0,1&e.lij[1]?0:.5,.5,.5);return t.renderData?.reuseTexture(e.renderData,i)??!1}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,t===A.TEXTURE_FADING?x.FADING:x.UNFADED),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[O.ELEVATION])i.pendingUpdates&=~A.GEOMETRY;e.resetPendingUpdate(A.GEOMETRY);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.loaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=de-ce,i=Math.max(0,Math.floor((e.level-t)/ce)*ce);if(this._isGlobal&&0===i)return _;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=V.UPDATE){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=V.UPDATE){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=V.UPDATE){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new C({rctx:this._rctx,tileSize:this._tileSize,techniques:this._techniques,cache:this._tileTextureCache}),this.updateTileBackground(),this._emptyTex=H(this._rctx)}uninitializeRenderContext(){this._emptyTex=i(this._emptyTex),this._tileRenderer=i(this._tileRenderer)}intersect(e,t,i,r){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&this.transparency!==I.Opaque)return;const s=_e,n=fe;d(s,r,i),h(n,1/s[0],1/s[1],1/s[2]);const a=e.results.min,o=e.results.max,l=e.results.ground,_=e.options.store===W.MIN,f=!!e.results.ground.target,p=re(e.verticalOffset),g=e.tolerance;let m,b=_&&null!=a.dist?a.dist:1/0;const R=e.options,x=R.normalRequired||!R.backfacesTerrain,O=new J(!1,x),v=h=>{const f=h.renderData;if(!f?.vao)return;const v=f.geometry;y(he,v.boundingBox);const w=f.localOrigin;null!=p&&(p.localOrigin=w,p.applyToAabb(he));const P=he;if(pe[0]=i[0]-w[0],pe[1]=i[1]-w[1],pe[2]=i[2]-w[2],!K(P,pe,n,g,b))return;const D=(e,t,i)=>{e.set(this.type,h,t,i,c),b=_&&null!=a.dist?a.dist:1/0},S=(n,c,d)=>{if((!x||null!=d)&&n>=0&&(R.backfacesTerrain||u(d,s)<0)&&(R.invisibleTerrain||!R.selectionMode||null==t||t(i,r,n))){if((null==l.dist||n<l.dist)&&D(l,n,d),R.isFiltered)return;R.store===W.ALL&&(null==m?(m=Y(e.ray),D(m,n,d),e.results.all.push(m)):n<m.dist&&D(m,n,d)),(null==a.dist||n<a.dist)&&D(a,n,d),R.store!==W.MIN&&(null==o.dist||n>o.dist)&&D(o,n,d)}},E=ge;d(E,r,w);const{indices:C,indexCount:A}=v,j=v.vertexAttributes,N=j.getField(te.POSITION,T),B=new z(N.typedBuffer,3,j.stride/4),I=A/3;if(!p&&I>q){const e=h.renderData;null==e.intersectionData&&(e.intersectionData=new F(C,0,I,B)),e.intersectionData.intersectRay(pe,E,O,S)}else Z(pe,E,0,I,C,B,p,O,S)},w=this._rootTiles;if(null!=w){(()=>{const t=this._tileIterator;t.reset(w);const r=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||r&&e.intersectsClippingArea)||null==p&&!e.intersectsRay(i,s,g,b)||f&&this._useStencilForTile(e)?t.skipSubtree():v(e)})()}}processScaleRangeQueries(e,t){if(!t.done)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._visiblePatchesByOrigin.values())for(const i of t)null!=i.renderData?.textureReference&&e.queriesForTile(i);e.process(),t.madeProgress()}}acquireTechniques(e){const t=!!has("enable-feature:terrain-shadows")&&e.bind.shadowMap.enabled;t!==this._castShadows&&(this._castShadows=t,this._patchesByOriginDirty=!0);const i=e.bind.viewshedEnabled;if(this._inViewshed!==i&&(this._inViewshed=i,this._patchesByOriginDirty=!0),e.bind.slot===$.OCCLUDED_TERRAIN){if(!(e.renderOccludedMask&w))return null}else{const t=this.transparency===I.Opaque?$.OPAQUE_TERRAIN:$.TRANSPARENT_TERRAIN;if(e.bind.slot!==t)return null}if(this.transparency===I.Invisible)return null;switch(this._configuration.screenSpaceReflections=this._configuration.cloudReflections=this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._configuration.overlayMode=this._overlayRenderer.mode,e.output){case U.Color:case U.ColorEmission:return this._configuration.screenSpaceReflections=null!=e.bind.ssr.lastFrameColor,this._configuration.cloudReflections=null!=e.bind.clouds.data,this._configuration.receiveShadows=e.bind.shadowMap.ready,this._configuration.receiveAmbientOcclusion=null!=e.bind.ssao,this._acquireTechnique(e.output,e.bind.slot===$.OCCLUDED_TERRAIN);case U.Shadow:case U.ShadowExcludeHighlight:return this._castShadows?this._acquireTechnique(U.Shadow,!1):null;case U.ViewshedShadow:return this._inViewshed?this._acquireTechnique(U.ViewshedShadow,!1):null;case U.Depth:case U.Normal:return this._acquireTechnique(e.output,!1);case U.ObjectAndLayerIdColor:return this._acquireTechnique(U.ObjectAndLayerIdColor,!1);case U.Highlight:return this._overlayRenderer.hasHighlights?this._acquireTechnique(U.Highlight,!1):null}return null}render(e,t){switch(this._updatePatchGroups(),t.useStencil=!1,e.output){case U.Color:case U.ColorEmission:{const i=e.bind.slot===$.OCCLUDED_TERRAIN?v.Occluded:v.Color;this._renderMaterialPass(e,t,i);break}case U.Depth:case U.Normal:this._renderAuxiliaryPass(e,t,v.Color,this._visiblePatchesByOrigin);break;case U.Highlight:this._overlayRenderer.hasHighlights&&this._overlayRenderer.renders(v.Highlight)&&this._renderAuxiliaryPass(e,t,v.Highlight,this._visiblePatchesByOrigin);break;case U.Shadow:case U.ShadowExcludeHighlight:case U.ViewshedShadow:this._renderAuxiliaryPass(e,t,null,this._allPatchesByOrigin);break;case U.ObjectAndLayerIdColor:this._renderAuxiliaryPass(e,t,v.ObjectAndLayerIdColor,this._visiblePatchesByOrigin)}}updateTileBackground(e){if(null==this._tileRenderer)return;const i=this._tileRenderer;let r;if(null!=e){const i=t.toUnitRGBA(e);r=f(i[0]||0,i[1]||0,i[2]||0)}i.setBackground(r),this._allTiles.forAll((e=>i.updateTileTexture(e,x.FADING))),this._configuration.tileBlendInput=i.backgroundIsGrid?G.GridComposite:null!=i.backgroundColor?G.ColorComposite:G.LayerOnly,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty&&this.renderOrder!==D.NONE){const e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(const i of e)N(this.renderOrder,i,t);e.sort(((e,t)=>B(e[0],t[0],this.renderOrder))),this._visiblePatchesByOrigin=new Map(e.map((e=>[e[0].renderData.localOrigin,e]))),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this._tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),i=e.renderData;if(!i){this._numTilesCulled++;continue}const r=i.localOrigin;if(this._castShadows||this._inViewshed){let t=this._allPatchesByOrigin.get(r);t||(t=[],this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let s=this._visiblePatchesByOrigin.get(r);s||(s=[],this._visiblePatchesByOrigin.set(r,s)),s.push(e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,i,r){const s=e.rctx;this._passParameters.overlayContent=i,s.bindTechnique(t,e.bind,this._passParameters);const n=this._stencilEnabledLayerExtents.length>0;r.forEach((r=>{this._drawParameters.origin=r[0].renderData.localOrigin,t.program.bindDraw(e.bind,this._passParameters,this._drawParameters);for(let s=0;s<r.length;s++)this._renderPatch(e,t,r[s],le.TRIANGLES,n,i)})),e.rctx.bindVAO(null)}_renderMaterialPass(e,t,i){const{rctx:r}=e;this._passParameters.overlayContent=i,r.bindTechnique(t,e.bind,this._passParameters),this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;const s=e.bind.camera,n=t.program;if(this._configuration.screenSizePerspective&&this.pointsOfInterest){const e=ee(this._stage.viewingMode,this._ellipsoidRadius),t=this.pointsOfInterest.centerOnSurfaceFrequent.distance;e.update({distance:t,fovY:s.fovY})}const a=this._stencilEnabledLayerExtents.length>0,o=i===v.Occluded;o&&(n.bindTexture("tex",this._emptyTex),n.setUniform3fv("textureOpacities",_),n.setUniform4fv("texOffsetAndScale",m));const l=null!=this._tileRenderer?.backgroundColor?this._tileRenderer.backgroundColor:_;this._configuration.tileBlendInput===G.ColorComposite&&n.setUniform3fv("backgroundColor",l);const c=this.wireframe?le.LINES:le.TRIANGLES;this._configuration.textureFadingEnabled&&n.bindTexture("texNext",this._emptyTex);const d=this._visiblePatchesByOrigin;for(const h of d.values()){const r=h[0].renderData.localOrigin;this._drawParameters.origin=r,t.program.bindDraw(e.bind,this._passParameters,this._drawParameters),this._numOriginsRendered++;for(const s of h){const r=s.renderData,l=r.textureReference;if(null!=l){if(!o){n.setUniform4fv("texOffsetAndScale",l.offsetAndScale),n.bindTexture("tex",l.texture.texture);const e=r.textureFadeFactor,t=e<1?r.nextTextureReference:null;this._configuration.textureFadingEnabled&&null!=t&&e<1?(n.setUniform1f("fadeFactor",e),n.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),n.setUniform3fv("nextTexOpacities",t.opacities),n.bindTexture("texNext",t.texture.texture)):n.setUniform1f("fadeFactor",1),r.textureIsFading&&this.setNeedsRender(),n.setUniform3fv("textureOpacities",l.opacities)}this._renderPatch(e,t,s,c,a,i),s.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}e.rctx.bindVAO(null)}_renderPatch(e,t,i,r,s,n){const a=i.renderData,o=a.vao,l=o?.indexBuffer;if(!o||null==l)return void(E&&console.error("Rendered tile with no indices: ",i.lij," : ",a));const c=t.program;null==n||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(c,a.overlay),s&&(t.useStencil=this._useStencilForTile(i),e.rctx.setPipelineState(t.getPipeline()));const d=a.geometry.indexCount;e.rctx.bindVAO(o),c.assertCompatibleVertexAttributeLocations(o),e.rctx.drawElements(r,d,l.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_acquireTechnique(e,t){return this._configuration.output=e,this._configuration.renderOccluded=t,this._techniques.acquire(ae,this._configuration)}get test(){}};e([o({readOnly:!0})],ue.prototype,"_isGlobal",null),e([o()],ue.prototype,"renderOccludedFlags",void 0),e([o({value:!1})],ue.prototype,"renderingDisabled",null),e([o({value:!0})],ue.prototype,"visible",null),e([o()],ue.prototype,"renderPatchBorders",null),e([o()],ue.prototype,"visualizeNormals",null),e([o()],ue.prototype,"cullBackFaces",null),e([o({value:D.FRONT_TO_BACK})],ue.prototype,"renderOrder",null),e([o()],ue.prototype,"wireframe",null),ue=e([l("esri.views.3d.terrain.TerrainRenderer")],ue);const _e=p(),fe=p(),pe=p(),ge=p();export{ue as TerrainRenderer};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import has from"../../../core/has.js";import{disposeMaybe as i}from"../../../core/maybe.js";import{MemCachePool as r}from"../../../core/MemCachePool.js";import s from"../../../core/ObjectPool.js";import{watch as n,sync as a}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{IDENTITY as c}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{d,i as h,f as u}from"../../../chunks/vec32.js";import{ZEROS as _,fromValues as f,create as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as g,ZEROS as m}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as b,set as y}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as T}from"../../../geometry/support/buffer/BufferView.js";import{ViewingMode as R}from"../../ViewingMode.js";import{TextureUpdate as x}from"./interfaces.js";import{LayerClass as O}from"./LayerClass.js";import{OverlayContent as v}from"./OverlayContent.js";import{overlayRenderOccludedFlag as w}from"./OverlayRenderer.js";import{PatchRenderData as P}from"./PatchRenderData.js";import{RenderOrder as D}from"./RenderOrder.js";import{TerrainAttributesCache as S}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as E}from"./terrainUtils.js";import{TileRenderer as C}from"./TileRenderer.js";import{TileUpdate as A}from"./TileUpdate.js";import{IteratorPreorder as j,sortTiles as N,compareTiles as B}from"./tileUtils.js";import{TransparencyMode as I}from"./TransparencyMode.js";import{componentMinimalSizeForIntersectionData as q,ComponentIntersectionData as F}from"../webgl-engine/collections/Component/ComponentIntersectionData.js";import{ShaderOutput as U}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{TileBlendInput as G}from"../webgl-engine/core/shaderLibrary/terrain/TileBlendInput.js";import{SyncRenderPlugin as L,ConsumesDepth as M,ConsumesNone as k}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as z}from"../webgl-engine/lib/Attribute.js";import{RenderRequestType as V}from"../webgl-engine/lib/basicInterfaces.js";import{createEmptyTexture as H}from"../webgl-engine/lib/glUtil3D.js";import{newIntersectorResult as Y}from"../webgl-engine/lib/Intersector.js";import{IntersectorType as Q,StoreResults as W}from"../webgl-engine/lib/IntersectorInterfaces.js";import{RenderOccludedFlag as X}from"../webgl-engine/lib/Material.js";import{intersectAabbInvDirBefore as K,intersectTriangles as Z,MeshIntersectionOptions as J}from"../webgl-engine/lib/RayIntersections.js";import{RenderSlot as $}from"../webgl-engine/lib/RenderSlot.js";import{getSettings as ee}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as te}from"../webgl-engine/lib/VertexAttribute.js";import{terrainId as ie,getVerticalOffsetTerrain as re}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as se}from"../webgl-engine/materials/DrawParameters.js";import{T as ne}from"../../../chunks/Terrain.glsl.js";import{TerrainTechnique as ae}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as oe}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as le}from"../../webgl/enums.js";const ce=7,de=10,he=b();let ue=class extends L{get _isGlobal(){return this._stage.viewingMode===R.Global}get _techniques(){return this._context.techniques}get _rctx(){return this._context.renderContext.rctx}constructor(e,t,i,n,a){super({}),this._overlayRenderer=e,this._stage=t,this._allTiles=i,this._ellipsoidRadius=n,this.type=Q.TERRAIN,this.isGround=!0,this._passParameters=new ne,this._drawParameters=new se,this._renderDataPool=new s(P),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new j,this._castShadows=!1,this._inViewshed=!1,this._emptyTex=null,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.renderOccludedFlags=X.Occlude,this.produces=new Map([[$.OPAQUE_TERRAIN,()=>this._produces()&&this.transparency===I.Opaque],[$.TRANSPARENT_TERRAIN,()=>this._produces()&&(this.transparency===I.Transparent||this.transparency===I.InvisibleWithDraped)],[$.OCCLUDED_TERRAIN,()=>this._produces()]]),this._tileSize=256,this._configuration=new oe(t.viewingMode===R.Global),this._tileTextureCache=new r(((e,t)=>a.newCache(e,t)),"TileTexture"),this.tileGeometryCache=new S(a)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this),this.addHandles(n((()=>this._overlayRenderer.rendersOccludedDraped),(e=>{this.renderOccludedFlags=e?w:X.Occlude,this.setNeedsRender()}),a))}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy()}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}consumes(){return this._overlayRenderer.hasWater?M:k}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}updateHeading(e){this._tileRenderer?.updateHeading(e)}set transparency(e){this._configuration.transparencyMode!==e&&(this._configuration.transparencyMode=e,this.setNeedsRender())}get transparency(){return this._configuration.transparencyMode}get renderPatchBorders(){return this._configuration.tileBorders}set renderPatchBorders(e){this._configuration.tileBorders!==e&&(this._configuration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get visualizeNormals(){return this._configuration.visualizeNormals}set visualizeNormals(e){this._configuration.visualizeNormals!==e&&(this._configuration.visualizeNormals=e,this.setNeedsRender(),this.notifyChange("visualizeNormals"))}get cullBackFaces(){return this._configuration.backfaceCullingEnabled}set cullBackFaces(e){this._configuration.backfaceCullingEnabled!==e&&(this._configuration.backfaceCullingEnabled=e,this.notifyChange("cullBackFaces"),this.setNeedsRender())}set renderOrder(e){this._set("renderOrder",e),this._setSortingDirty()}get layerUid(){return ie}get slicePlaneEnabled(){return this._configuration.hasSlicePlane}set slicePlaneEnabled(e){this._configuration.hasSlicePlane!==e&&(this._configuration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._configuration.textureFadingEnabled!==e&&(this._configuration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._configuration.pbrMode!==e&&(this._configuration.pbrMode=e,this.setNeedsRender())}setDebugScreenSizePerspective(e){this._configuration.screenSizePerspective!==e&&(this._configuration.screenSizePerspective=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}set tileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}get tileSize(){return this._tileSize}_ensureRenderData(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._ensureRenderData(e),this.updateTileGeometryState(e),this.reuseTextureFromParent(e)||this.updateTileTexture(e,A.TEXTURE_FADING)}reuseTextureFromParent(e){const t=e.parent;if(!t)return!1;const i=g(1&e.lij[2]?.5:0,1&e.lij[1]?0:.5,.5,.5);return t.renderData?.reuseTexture(e.renderData,i)??!1}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,t===A.TEXTURE_FADING?x.FADING:x.UNFADED),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[O.ELEVATION])i.pendingUpdates&=~A.GEOMETRY;e.resetPendingUpdate(A.GEOMETRY);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.loaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=de-ce,i=Math.max(0,Math.floor((e.level-t)/ce)*ce);if(this._isGlobal&&0===i)return _;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=V.UPDATE){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=V.UPDATE){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=V.UPDATE){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new C({rctx:this._rctx,tileSize:this._tileSize,techniques:this._techniques,cache:this._tileTextureCache}),this.updateTileBackground(),this._emptyTex=H(this._rctx)}uninitializeRenderContext(){this._emptyTex=i(this._emptyTex),this._tileRenderer=i(this._tileRenderer)}intersect(e,t,i,r){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&this.transparency!==I.Opaque)return;const s=_e,n=fe;d(s,r,i),h(n,1/s[0],1/s[1],1/s[2]);const a=e.results.min,o=e.results.max,l=e.results.ground,_=e.options.store===W.MIN,f=!!e.results.ground.target,p=re(e.verticalOffset),g=e.tolerance;let m,b=_&&null!=a.dist?a.dist:1/0;const R=e.options,x=R.normalRequired||!R.backfacesTerrain,O=new J(!1,x),v=h=>{const f=h.renderData;if(!f?.vao)return;const v=f.geometry;y(he,v.boundingBox);const w=f.localOrigin;null!=p&&(p.localOrigin=w,p.applyToAabb(he));const P=he;if(pe[0]=i[0]-w[0],pe[1]=i[1]-w[1],pe[2]=i[2]-w[2],!K(P,pe,n,g,b))return;const D=(e,t,i)=>{e.set(this.type,h,t,i,c),b=_&&null!=a.dist?a.dist:1/0},S=(n,c,d)=>{if((!x||null!=d)&&n>=0&&(R.backfacesTerrain||u(d,s)<0)&&(R.invisibleTerrain||!R.selectionMode||null==t||t(i,r,n))){if((null==l.dist||n<l.dist)&&D(l,n,d),R.isFiltered)return;R.store===W.ALL&&(null==m?(m=Y(e.ray),D(m,n,d),e.results.all.push(m)):n<m.dist&&D(m,n,d)),(null==a.dist||n<a.dist)&&D(a,n,d),R.store!==W.MIN&&(null==o.dist||n>o.dist)&&D(o,n,d)}},E=ge;d(E,r,w);const{indices:C,indexCount:A}=v,j=v.vertexAttributes,N=j.getField(te.POSITION,T),B=new z(N.typedBuffer,3,j.stride/4),I=A/3;if(!p&&I>q){const e=h.renderData;null==e.intersectionData&&(e.intersectionData=new F(C,0,I,B)),e.intersectionData.intersectRay(pe,E,O,S)}else Z(pe,E,0,I,C,B,p,O,S)},w=this._rootTiles;if(null!=w){(()=>{const t=this._tileIterator;t.reset(w);const r=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||r&&e.intersectsClippingArea)||null==p&&!e.intersectsRay(i,s,g,b)||f&&this._useStencilForTile(e)?t.skipSubtree():v(e)})()}}processScaleRangeQueries(e,t){if(!t.done)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._visiblePatchesByOrigin.values())for(const i of t)null!=i.renderData?.textureReference&&e.queriesForTile(i);e.process(),t.madeProgress()}}acquireTechniques(e){const t=!!has("enable-feature:terrain-shadows")&&e.bind.shadowMap.enabled;t!==this._castShadows&&(this._castShadows=t,this._patchesByOriginDirty=!0);const i=e.bind.viewshedEnabled;if(this._inViewshed!==i&&(this._inViewshed=i,this._patchesByOriginDirty=!0),e.bind.slot===$.OCCLUDED_TERRAIN){if(!(e.renderOccludedMask&w))return null}else{const t=this.transparency===I.Opaque?$.OPAQUE_TERRAIN:$.TRANSPARENT_TERRAIN;if(e.bind.slot!==t)return null}if(this.transparency===I.Invisible)return null;switch(this._configuration.screenSpaceReflections=this._configuration.cloudReflections=this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._configuration.overlayMode=this._overlayRenderer.mode,e.output){case U.Color:case U.ColorEmission:return this._configuration.screenSpaceReflections=null!=e.bind.ssr.lastFrameColor,this._configuration.cloudReflections=null!=e.bind.clouds.data,this._configuration.receiveShadows=e.bind.shadowMap.ready,this._configuration.receiveAmbientOcclusion=null!=e.bind.ssao,this._acquireTechnique(e.output,e.bind.slot===$.OCCLUDED_TERRAIN);case U.Shadow:case U.ShadowExcludeHighlight:return this._castShadows?this._acquireTechnique(U.Shadow,!1):null;case U.ViewshedShadow:return this._inViewshed?this._acquireTechnique(U.ViewshedShadow,!1):null;case U.Depth:case U.Normal:return this._acquireTechnique(e.output,!1);case U.ObjectAndLayerIdColor:return this._acquireTechnique(U.ObjectAndLayerIdColor,!1);case U.Highlight:return this._overlayRenderer.hasHighlights?this._acquireTechnique(U.Highlight,!1):null}return null}render(e,t){switch(this._updatePatchGroups(),t.useStencil=!1,e.output){case U.Color:case U.ColorEmission:{const i=e.bind.slot===$.OCCLUDED_TERRAIN?v.Occluded:v.Color;this._renderMaterialPass(e,t,i);break}case U.Depth:case U.Normal:this._renderAuxiliaryPass(e,t,v.Color,this._visiblePatchesByOrigin);break;case U.Highlight:this._overlayRenderer.hasHighlights&&this._overlayRenderer.renders(v.Highlight)&&0===e.bind.highlightLevel&&this._renderAuxiliaryPass(e,t,v.Highlight,this._visiblePatchesByOrigin);break;case U.Shadow:case U.ShadowExcludeHighlight:case U.ViewshedShadow:this._renderAuxiliaryPass(e,t,null,this._allPatchesByOrigin);break;case U.ObjectAndLayerIdColor:this._renderAuxiliaryPass(e,t,v.ObjectAndLayerIdColor,this._visiblePatchesByOrigin)}}updateTileBackground(e){if(null==this._tileRenderer)return;const i=this._tileRenderer;let r;if(null!=e){const i=t.toUnitRGBA(e);r=f(i[0]||0,i[1]||0,i[2]||0)}i.setBackground(r),this._allTiles.forAll((e=>i.updateTileTexture(e,x.FADING))),this._configuration.tileBlendInput=i.backgroundIsGrid?G.GridComposite:null!=i.backgroundColor?G.ColorComposite:G.LayerOnly,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty&&this.renderOrder!==D.NONE){const e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(const i of e)N(this.renderOrder,i,t);e.sort(((e,t)=>B(e[0],t[0],this.renderOrder))),this._visiblePatchesByOrigin=new Map(e.map((e=>[e[0].renderData.localOrigin,e]))),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this._tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),i=e.renderData;if(!i){this._numTilesCulled++;continue}const r=i.localOrigin;if(this._castShadows||this._inViewshed){let t=this._allPatchesByOrigin.get(r);t||(t=[],this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let s=this._visiblePatchesByOrigin.get(r);s||(s=[],this._visiblePatchesByOrigin.set(r,s)),s.push(e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,i,r){const s=e.rctx;this._passParameters.overlayContent=i,s.bindTechnique(t,e.bind,this._passParameters);const n=this._stencilEnabledLayerExtents.length>0;r.forEach((r=>{this._drawParameters.origin=r[0].renderData.localOrigin,t.program.bindDraw(e.bind,this._passParameters,this._drawParameters);for(let s=0;s<r.length;s++)this._renderPatch(e,t,r[s],le.TRIANGLES,n,i)})),e.rctx.bindVAO(null)}_renderMaterialPass(e,t,i){const{rctx:r}=e;this._passParameters.overlayContent=i,r.bindTechnique(t,e.bind,this._passParameters),this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;const s=e.bind.camera,n=t.program;if(this._configuration.screenSizePerspective&&this.pointsOfInterest){const e=ee(this._stage.viewingMode,this._ellipsoidRadius),t=this.pointsOfInterest.centerOnSurfaceFrequent.distance;e.update({distance:t,fovY:s.fovY})}const a=this._stencilEnabledLayerExtents.length>0,o=i===v.Occluded;o&&(n.bindTexture("tex",this._emptyTex),n.setUniform3fv("textureOpacities",_),n.setUniform4fv("texOffsetAndScale",m));const l=null!=this._tileRenderer?.backgroundColor?this._tileRenderer.backgroundColor:_;this._configuration.tileBlendInput===G.ColorComposite&&n.setUniform3fv("backgroundColor",l);const c=this.wireframe?le.LINES:le.TRIANGLES;this._configuration.textureFadingEnabled&&n.bindTexture("texNext",this._emptyTex);const d=this._visiblePatchesByOrigin;for(const h of d.values()){const r=h[0].renderData.localOrigin;this._drawParameters.origin=r,t.program.bindDraw(e.bind,this._passParameters,this._drawParameters),this._numOriginsRendered++;for(const s of h){const r=s.renderData,l=r.textureReference;if(null!=l){if(!o){n.setUniform4fv("texOffsetAndScale",l.offsetAndScale),n.bindTexture("tex",l.texture.texture);const e=r.textureFadeFactor,t=e<1?r.nextTextureReference:null;this._configuration.textureFadingEnabled&&null!=t&&e<1?(n.setUniform1f("fadeFactor",e),n.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),n.setUniform3fv("nextTexOpacities",t.opacities),n.bindTexture("texNext",t.texture.texture)):n.setUniform1f("fadeFactor",1),r.textureIsFading&&this.setNeedsRender(),n.setUniform3fv("textureOpacities",l.opacities)}this._renderPatch(e,t,s,c,a,i),s.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}e.rctx.bindVAO(null)}_renderPatch(e,t,i,r,s,n){const a=i.renderData,o=a.vao,l=o?.indexBuffer;if(!o||null==l)return void(E&&console.error("Rendered tile with no indices: ",i.lij," : ",a));const c=t.program;null==n||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(c,a.overlay),s&&(t.useStencil=this._useStencilForTile(i),e.rctx.setPipelineState(t.getPipeline()));const d=a.geometry.indexCount;e.rctx.bindVAO(o),c.assertCompatibleVertexAttributeLocations(o),e.rctx.drawElements(r,d,l.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_acquireTechnique(e,t){return this._configuration.output=e,this._configuration.renderOccluded=t,this._techniques.acquire(ae,this._configuration)}get test(){}};e([o({readOnly:!0})],ue.prototype,"_isGlobal",null),e([o()],ue.prototype,"renderOccludedFlags",void 0),e([o({value:!1})],ue.prototype,"renderingDisabled",null),e([o({value:!0})],ue.prototype,"visible",null),e([o()],ue.prototype,"renderPatchBorders",null),e([o()],ue.prototype,"visualizeNormals",null),e([o()],ue.prototype,"cullBackFaces",null),e([o({value:D.FRONT_TO_BACK})],ue.prototype,"renderOrder",null),e([o()],ue.prototype,"wireframe",null),ue=e([l("esri.views.3d.terrain.TerrainRenderer")],ue);const _e=p(),fe=p(),pe=p(),ge=p();export{ue as TerrainRenderer};
@@ -2,16 +2,20 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{Integer2PassUniform as e}from"../shaderModules/Integer2PassUniform.js";import{glsl as l}from"../shaderModules/interfaces.js";import{Texture2DPassUniform as i}from"../shaderModules/Texture2DPassUniform.js";import{g as t}from"../../../../../chunks/HighlightDownsample.glsl.js";function o(o){const{vertex:c}=o;c.uniforms.add(new i("coverageTexture",(e=>e.coverageTexture)),new e("highlightRenderCellCount",(e=>[e.horizontalCellCount,e.verticalCellCount])),new e("highlightTextureResolution",(e=>[e.highlightTexture.descriptor.width,e.highlightTexture.descriptor.height]))),c.constants.add("cellSize","int",t),o.varyings.add("sUV","vec2"),o.varyings.add("vOutlinePossible","float"),c.code.add(l`const ivec2 cellVertices[4] = ivec2[4](ivec2(0,0), ivec2(1,0), ivec2(0,1), ivec2(1,1));`),c.main.add(l`int cellIndex = gl_InstanceID;
5
+ import{Integer2PassUniform as e}from"../shaderModules/Integer2PassUniform.js";import{IntegerPassUniform as l}from"../shaderModules/IntegerPassUniform.js";import{glsl as i}from"../shaderModules/interfaces.js";import{Texture2DPassUniform as t}from"../shaderModules/Texture2DPassUniform.js";import{g as n}from"../../../../../chunks/HighlightDownsample.glsl.js";function o(o){const{vertex:c}=o;c.uniforms.add(new t("coverageTexture",(e=>e.coverageTexture)),new e("highlightRenderCellCount",(e=>[e.horizontalCellCount,e.verticalCellCount])),new e("highlightTextureResolution",(e=>[e.highlightTexture.descriptor.width,e.highlightTexture.descriptor.height])),new l("highlightLevel",(e=>e.highlightLevel))),c.constants.add("cellSize","int",n),o.varyings.add("sUV","vec2"),o.varyings.add("vOutlinePossible","float"),c.code.add(i`const ivec2 cellVertices[4] = ivec2[4](ivec2(0,0), ivec2(1,0), ivec2(0,1), ivec2(1,1));`),c.main.add(i`int cellIndex = gl_InstanceID;
6
6
  int cellX = cellIndex % highlightRenderCellCount[0];
7
7
  int cellY = (cellIndex - cellX) / highlightRenderCellCount[0];
8
8
  ivec2 cellPos = ivec2(cellX, cellY);
9
- vec4 cov = texelFetch(coverageTexture, cellPos, 0);
10
- if (cov.r == 0.0) {
9
+ uvec2 covTexel = uvec2(texelFetch(coverageTexture, cellPos, 0).rg * 255.0);
10
+ int channelIndex = (highlightLevel >> 2) & 3;
11
+ uint channelValue = covTexel[channelIndex];
12
+ int highlightIndex = (highlightLevel & 3) << 1;
13
+ bool covered = ((channelValue >> highlightIndex) & 1u) == 1u;
14
+ if (!covered) {
11
15
  gl_Position = vec4(0.0);
12
16
  return;
13
17
  }
14
- vOutlinePossible = cov.g;
18
+ vOutlinePossible = (((channelValue >> highlightIndex) & 2u) == 2u) ? 1.0 : 0.0;
15
19
  ivec2 iPosInCell = cellVertices[gl_VertexID];
16
20
  vec2 sPos = vec2(cellPos * cellSize + iPosInCell * (cellSize));
17
21
  vec2 vPos = sPos / vec2(highlightTextureResolution);
@@ -2,7 +2,7 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{ShaderOutput as i}from"../ShaderOutput.js";import{Integer2PassUniform as e}from"../../shaderModules/Integer2PassUniform.js";import{IntegerPassUniform as t}from"../../shaderModules/IntegerPassUniform.js";import{glsl as h}from"../../shaderModules/interfaces.js";import{Texture2DPassUniform as l}from"../../shaderModules/Texture2DPassUniform.js";function g(g,d){const{fragment:c}=g;d.output===i.Highlight?(c.uniforms.add(new l("depthTexture",((i,e)=>e.mainDepth)),new l("highlightTexture",((i,e)=>e.highlightMixTexture)),new t("highlightLevel",((i,e)=>e.highlightLevel??0)),new e("highlightMixOrigin",((i,e)=>e.highlightMixOrigin))),g.outputs.add("fragHighlight","vec2",0),c.code.add(h`vec2 getAccumulatedHighlight() {
5
+ import{ShaderOutput as i}from"../ShaderOutput.js";import{Integer2PassUniform as e}from"../../shaderModules/Integer2PassUniform.js";import{IntegerPassUniform as t}from"../../shaderModules/IntegerPassUniform.js";import{glsl as h}from"../../shaderModules/interfaces.js";import{Texture2DPassUniform as l}from"../../shaderModules/Texture2DPassUniform.js";function g(g,d){const{fragment:u}=g;d.output===i.Highlight?(u.uniforms.add(new l("depthTexture",((i,e)=>e.mainDepth)),new l("highlightTexture",((i,e)=>e.highlightMixTexture)),new t("highlightLevel",((i,e)=>e.highlightLevel??0)),new e("highlightMixOrigin",((i,e)=>e.highlightMixOrigin))),g.outputs.add("fragHighlight","vec2",0),u.code.add(h`vec2 getAccumulatedHighlight() {
6
6
  return texelFetch(highlightTexture, ivec2(gl_FragCoord.xy) - highlightMixOrigin, 0).rg;
7
7
  }
8
8
  void outputHighlight(bool occluded) {
@@ -30,10 +30,10 @@ return gl_FragCoord.z > sceneDepth + 5e-7;
30
30
  }
31
31
  void calculateOcclusionAndOutputHighlight() {
32
32
  outputHighlight(isHighlightOccluded());
33
- }`),d.canHaveOverlay&&(c.constants.add("occlusionAndMask","int",85),c.code.add(h`void outputAllHighlights(vec2 highlightToAdd) {
33
+ }`),d.canHaveOverlay&&(u.constants.add("occlusionAndMask","int",85),u.code.add(h`void outputAllHighlights(vec2 highlightToAdd) {
34
34
  if (highlightToAdd == vec2(0.0)) { discard; }
35
- int occludedOrMask = isHighlightOccluded() ? 0xaa : 0;
36
- ivec2 added = ivec2(highlightToAdd * 255.0);
37
- ivec2 masked = (added & ivec2(occlusionAndMask)) | (ivec2(occludedOrMask) & (added<<1));
35
+ uint occludedOrMask = isHighlightOccluded() ? 0xaau : 0u;
36
+ uvec2 added = uvec2(highlightToAdd * 255.0);
37
+ uvec2 masked = (added & uvec2(occlusionAndMask)) | (uvec2(occludedOrMask) & (added<<1));
38
38
  fragHighlight = vec2(masked) / 255.0;
39
- }`))):c.code.add(h`void calculateOcclusionAndOutputHighlight() {}`)}export{g as OutputHighlight};
39
+ }`))):u.code.add(h`void calculateOcclusionAndOutputHighlight() {}`)}export{g as OutputHighlight};
@@ -15,7 +15,8 @@ bool isValid1 = isValid(texCoords.zw, vec2(0.0, 0.0));
15
15
  return mix(color1 * float(isValid1), color0, float(isValid0));
16
16
  }`),a.code.add(y`vec4 getCombinedOverlayColor() {
17
17
  return overlayOpacity * getOverlayColor(ovColorTex, vtcOverlay);
18
- }`),a.code.add(y`vec4 getOverlayColorTexel(vec4 texCoords) {
18
+ }`),a.code.add(y`vec4 getOverlayColorTexel() {
19
+ vec4 texCoords = vtcOverlay;
19
20
  vec2 texDim = vec2(textureSize(ovColorTex, 0));
20
21
  vec4 color0 = texelFetch(ovColorTex, ivec2(vec2(texCoords.x * 0.5, texCoords.y) * texDim), 0);
21
22
  vec4 color1 = texelFetch(ovColorTex, ivec2(vec2(texCoords.z * 0.5 + 0.5, texCoords.w) * texDim), 0);
@@ -28,8 +29,8 @@ vec2 uvInner = texCoords.xy;
28
29
  vec2 uvOuter = texCoords.zw;
29
30
  bool isValidInner = isValid(uvInner, fwidth(uvInner));
30
31
  bool isValidOuter = isValid(uvOuter, vec2(0.0, 0.0));
31
- vec2 texelCoordInner = vec2(uvInner.x * 0.5, uvInner.y);
32
- vec2 texelCoordOuter = vec2(uvOuter.x * 0.5 + 0.5, uvOuter.y);
32
+ vec2 texelCoordInner = uvInner * vec2(0.5, 1.0);
33
+ vec2 texelCoordOuter = uvOuter * vec2(0.5, 1.0) + vec2(0.5,0.0);
33
34
  vec2 texDim = vec2(textureSize(ovColorTex, 0));
34
35
  vec2 texelValueInner = texelFetch(ovColorTex, ivec2(texelCoordInner * texDim), 0).rg;
35
36
  vec2 texelValueOuter = texelFetch(ovColorTex, ivec2(texelCoordOuter * texDim), 0).rg;
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../../core/Error.js";import"../../../../../core/has.js";import t from"../../../../../core/Logger.js";import{BindType as r}from"../shaderTechnique/BindType.js";import{assert as n}from"../../lib/Util.js";const s=()=>t.getLogger("esri.views.3d.webgl-engine.core.shaderModules.shaderBuilder");class i{constructor(){this._includedModules=new Map}include(e,t){this._includedModules.has(e)?this._includedModules.get(e):(this._includedModules.set(e,t),e(this.builder,t))}}class o extends i{constructor(){super(...arguments),this.vertex=new h,this.fragment=new h,this.attributes=new m,this.varyings=new _,this.extensions=new d,this.outputs=new l}get fragmentUniforms(){return this.fragment.uniforms.entries}get builder(){return this}generate(e){const t=this.extensions.generateSource(e),r=this.attributes.generateSource(e),n=this.varyings.generateSource(e),s="vertex"===e?this.vertex:this.fragment,i=s.uniforms.generateSource(),o=s.code.generateSource(),a=s.main.generateSource(),u="vertex"===e?S:f,c=s.constants.generateSource(),h=this.outputs.generateSource(e);return`#version 300 es\n${t.join("\n")}\n\n${u}\n\n${c.join("\n")}\n\n${i.join("\n")}\n\n${r.join("\n")}\n\n${n.join("\n")}\n\n${h.join("\n")}\n\n${o.join("\n")}\n\n${a.join("\n")}`}generateBindPass(e){const t=new Map;this.vertex.uniforms.entries.forEach((e=>{const n=e.bind[r.Pass];n&&t.set(e.name,n)})),this.fragment.uniforms.entries.forEach((e=>{const n=e.bind[r.Pass];n&&t.set(e.name,n)}));const n=Array.from(t.values()),s=n.length;return(t,r)=>{for(let i=0;i<s;++i)n[i](e,t,r)}}generateBindDraw(e){const t=new Map;this.vertex.uniforms.entries.forEach((e=>{const n=e.bind[r.Draw];n&&t.set(e.name,n)})),this.fragment.uniforms.entries.forEach((e=>{const n=e.bind[r.Draw];n&&t.set(e.name,n)}));const n=Array.from(t.values()),s=n.length;return(t,r,i)=>{for(let o=0;o<s;++o)n[o](e,i,t,r)}}}class a{constructor(e){this._stage=e,this._entries=new Map}add(...e){for(const t of e)this._add(t);return this._stage}get(e){return this._entries.get(e)}_add(t){if(null!=t){if(this._entries.has(t.name)&&!this._entries.get(t.name).equals(t))throw new e(`Duplicate uniform name ${t.name} for different uniform type`);this._entries.set(t.name,t)}else s().error(`Trying to add null Uniform from ${(new Error).stack}.`)}generateSource(){return Array.from(this._entries.values()).map((e=>null!=e.arraySize?`uniform ${e.type} ${e.name}[${e.arraySize}];`:`uniform ${e.type} ${e.name};`))}get entries(){return Array.from(this._entries.values())}}class u{constructor(e){this._stage=e,this._bodies=new Array}add(e){return this._bodies.push(e),this._stage}generateSource(){if(this._bodies.length>0)return[`void main() {\n ${this._bodies.join("\n")||""} \n}`];throw new e("Shader does not contain main function body.")}}class c{constructor(e){this._stage=e,this._entries=new Array}add(e){return this._entries.push(e),this._stage}generateSource(){return this._entries}}class h extends i{constructor(){super(...arguments),this.uniforms=new a(this),this.main=new u(this),this.code=new c(this),this.constants=new g(this)}get builder(){return this}}class m{constructor(){this._entries=new Array}add(e,t){this._entries.push([e,t])}generateSource(e){return"fragment"===e?[]:this._entries.map((e=>`in ${e[1]} ${e[0]};`))}}class _{constructor(){this._entries=new Map}add(e,t){this._entries.has(e)&&n(this._entries.get(e)===t),this._entries.set(e,t)}generateSource(e){const t=new Array;return this._entries.forEach(((r,n)=>t.push("vertex"===e?`out ${r} ${n};`:`in ${r} ${n};`))),t}}class d{constructor(){this._entries=new Set}add(e){this._entries.add(e)}generateSource(e){const t="vertex"===e?d.ALLOWLIST_VERTEX:d.ALLOWLIST_FRAGMENT;return Array.from(this._entries).filter((e=>t.includes(e))).map((e=>`#extension ${e} : enable`))}}d.ALLOWLIST_FRAGMENT=["GL_EXT_shader_texture_lod","GL_OES_standard_derivatives"],d.ALLOWLIST_VERTEX=[];class l{constructor(){this._entries=new Map}add(e,t,r=0){const s=this._entries.get(r);s?n(s.name===e&&s.type===t,`Fragment shader output location ${r} occupied`):this._entries.set(r,{name:e,type:t})}generateSource(e){if("vertex"===e)return[];0===this._entries.size&&this._entries.set(0,{name:l.DEFAULT_NAME,type:l.DEFAULT_TYPE});const t=new Array;return this._entries.forEach(((e,r)=>t.push(`layout(location = ${r}) out ${e.type} ${e.name};`))),t}}l.DEFAULT_TYPE="vec4",l.DEFAULT_NAME="fragColor";class g{constructor(e){this._stage=e,this._entries=new Set}add(e,t,r){let n="ERROR_CONSTRUCTOR_STRING";switch(t){case"float":n=g._numberToFloatStr(r);break;case"int":n=g._numberToIntStr(r);break;case"bool":n=r.toString();break;case"vec2":n=`vec2(${g._numberToFloatStr(r[0])}, ${g._numberToFloatStr(r[1])})`;break;case"vec3":n=`vec3(${g._numberToFloatStr(r[0])}, ${g._numberToFloatStr(r[1])}, ${g._numberToFloatStr(r[2])})`;break;case"vec4":n=`vec4(${g._numberToFloatStr(r[0])}, ${g._numberToFloatStr(r[1])}, ${g._numberToFloatStr(r[2])}, ${g._numberToFloatStr(r[3])})`;break;case"ivec2":n=`ivec2(${g._numberToIntStr(r[0])}, ${g._numberToIntStr(r[1])})`;break;case"ivec3":n=`ivec3(${g._numberToIntStr(r[0])}, ${g._numberToIntStr(r[1])}, ${g._numberToIntStr(r[2])})`;break;case"ivec4":n=`ivec4(${g._numberToIntStr(r[0])}, ${g._numberToIntStr(r[1])}, ${g._numberToIntStr(r[2])}, ${g._numberToIntStr(r[3])})`;break;case"mat2":case"mat3":case"mat4":n=`${t}(${Array.prototype.map.call(r,(e=>g._numberToFloatStr(e))).join(", ")})`}return this._entries.add(`const ${t} ${e} = ${n};`),this._stage}static _numberToIntStr(e){return e.toFixed(0)}static _numberToFloatStr(e){return Number.isInteger(e)?e.toFixed(1):e.toString()}generateSource(){return Array.from(this._entries)}}const f="#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n precision highp sampler2D;\n#else\n precision mediump float;\n precision mediump sampler2D;\n#endif",S="precision highp float;\nprecision highp sampler2D;";export{c as Code,i as Includes,u as Main,o as ShaderBuilder,h as Stage,a as Uniforms};
5
+ import e from"../../../../../core/Error.js";import"../../../../../core/has.js";import t from"../../../../../core/Logger.js";import{BindType as r}from"../shaderTechnique/BindType.js";import{assert as n}from"../../lib/Util.js";const s=()=>t.getLogger("esri.views.3d.webgl-engine.core.shaderModules.shaderBuilder");class i{constructor(){this._includedModules=new Map}include(e,t){this._includedModules.has(e)?this._includedModules.get(e):(this._includedModules.set(e,t),e(this.builder,t))}}class o extends i{constructor(){super(...arguments),this.vertex=new h,this.fragment=new h,this.attributes=new m,this.varyings=new _,this.extensions=new d,this.outputs=new l}get fragmentUniforms(){return this.fragment.uniforms.entries}get builder(){return this}generate(e){const t=this.extensions.generateSource(e),r=this.attributes.generateSource(e),n=this.varyings.generateSource(e),s="vertex"===e?this.vertex:this.fragment,i=s.uniforms.generateSource(),o=s.code.generateSource(),a=s.main.generateSource(),u="vertex"===e?p:f,c=s.constants.generateSource(),h=this.outputs.generateSource(e);return`#version 300 es\n${t.join("\n")}\n\n${u}\n\n${c.join("\n")}\n\n${i.join("\n")}\n\n${r.join("\n")}\n\n${n.join("\n")}\n\n${h.join("\n")}\n\n${o.join("\n")}\n\n${a.join("\n")}`}generateBindPass(e){const t=new Map;this.vertex.uniforms.entries.forEach((e=>{const n=e.bind[r.Pass];n&&t.set(e.name,n)})),this.fragment.uniforms.entries.forEach((e=>{const n=e.bind[r.Pass];n&&t.set(e.name,n)}));const n=Array.from(t.values()),s=n.length;return(t,r)=>{for(let i=0;i<s;++i)n[i](e,t,r)}}generateBindDraw(e){const t=new Map;this.vertex.uniforms.entries.forEach((e=>{const n=e.bind[r.Draw];n&&t.set(e.name,n)})),this.fragment.uniforms.entries.forEach((e=>{const n=e.bind[r.Draw];n&&t.set(e.name,n)}));const n=Array.from(t.values()),s=n.length;return(t,r,i)=>{for(let o=0;o<s;++o)n[o](e,i,t,r)}}}class a{constructor(e){this._stage=e,this._entries=new Map}add(...e){for(const t of e)this._add(t);return this._stage}get(e){return this._entries.get(e)}_add(t){if(null!=t){if(this._entries.has(t.name)&&!this._entries.get(t.name).equals(t))throw new e(`Duplicate uniform name ${t.name} for different uniform type`);this._entries.set(t.name,t)}else s().error(`Trying to add null Uniform from ${(new Error).stack}.`)}generateSource(){return Array.from(this._entries.values()).map((e=>null!=e.arraySize?`uniform ${e.type} ${e.name}[${e.arraySize}];`:`uniform ${e.type} ${e.name};`))}get entries(){return Array.from(this._entries.values())}}class u{constructor(e){this._stage=e,this._bodies=new Array}add(e){return this._bodies.push(e),this._stage}generateSource(){if(this._bodies.length>0)return[`void main() {\n ${this._bodies.join("\n")||""} \n}`];throw new e("Shader does not contain main function body.")}}class c{constructor(e){this._stage=e,this._entries=new Array}add(e){return this._entries.push(e),this._stage}generateSource(){return this._entries}}class h extends i{constructor(){super(...arguments),this.uniforms=new a(this),this.main=new u(this),this.code=new c(this),this.constants=new g(this)}get builder(){return this}}class m{constructor(){this._entries=new Array}add(e,t){this._entries.push([e,t])}generateSource(e){return"fragment"===e?[]:this._entries.map((e=>`in ${e[1]} ${e[0]};`))}}class _{constructor(){this._entries=new Map}add(e,t){this._entries.has(e)&&n(this._entries.get(e)===t),this._entries.set(e,t)}generateSource(e){const t=new Array;return this._entries.forEach(((r,n)=>t.push("vertex"===e?`out ${r} ${n};`:`in ${r} ${n};`))),t}}class d{constructor(){this._entries=new Set}add(e){this._entries.add(e)}generateSource(e){const t="vertex"===e?d.ALLOWLIST_VERTEX:d.ALLOWLIST_FRAGMENT;return Array.from(this._entries).filter((e=>t.includes(e))).map((e=>`#extension ${e} : enable`))}}d.ALLOWLIST_FRAGMENT=["GL_EXT_shader_texture_lod","GL_OES_standard_derivatives"],d.ALLOWLIST_VERTEX=[];class l{constructor(){this._entries=new Map}add(e,t,r=0){const s=this._entries.get(r);s?n(s.name===e&&s.type===t,`Fragment shader output location ${r} occupied`):this._entries.set(r,{name:e,type:t})}generateSource(e){if("vertex"===e)return[];0===this._entries.size&&this._entries.set(0,{name:l.DEFAULT_NAME,type:l.DEFAULT_TYPE});const t=new Array;return this._entries.forEach(((e,r)=>t.push(`layout(location = ${r}) out ${e.type} ${e.name};`))),t}}l.DEFAULT_TYPE="vec4",l.DEFAULT_NAME="fragColor";class g{constructor(e){this._stage=e,this._entries=new Set}add(e,t,r){let n="ERROR_CONSTRUCTOR_STRING";switch(t){case"float":n=g._numberToFloatStr(r);break;case"int":n=g._numberToIntStr(r);break;case"bool":n=r.toString();break;case"vec2":n=`vec2(${g._numberToFloatStr(r[0])}, ${g._numberToFloatStr(r[1])})`;break;case"vec3":n=`vec3(${g._numberToFloatStr(r[0])}, ${g._numberToFloatStr(r[1])}, ${g._numberToFloatStr(r[2])})`;break;case"vec4":n=`vec4(${g._numberToFloatStr(r[0])}, ${g._numberToFloatStr(r[1])}, ${g._numberToFloatStr(r[2])}, ${g._numberToFloatStr(r[3])})`;break;case"ivec2":n=`ivec2(${g._numberToIntStr(r[0])}, ${g._numberToIntStr(r[1])})`;break;case"ivec3":n=`ivec3(${g._numberToIntStr(r[0])}, ${g._numberToIntStr(r[1])}, ${g._numberToIntStr(r[2])})`;break;case"ivec4":n=`ivec4(${g._numberToIntStr(r[0])}, ${g._numberToIntStr(r[1])}, ${g._numberToIntStr(r[2])}, ${g._numberToIntStr(r[3])})`;break;case"mat2":case"mat3":case"mat4":n=`${t}(${Array.prototype.map.call(r,(e=>g._numberToFloatStr(e))).join(", ")})`}return this._entries.add(`const ${t} ${e} = ${n};`),this._stage}static _numberToIntStr(e){return e.toFixed(0)}static _numberToFloatStr(e){return Number.isInteger(e)?e.toFixed(1):e.toString()}generateSource(){return Array.from(this._entries)}}const f="#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n precision highp int;\n precision highp sampler2D;\n#else\n precision mediump float;\n precision mediump int;\n precision mediump sampler2D;\n#endif",p="precision highp float;\nprecision highp sampler2D;";export{c as Code,i as Includes,u as Main,o as ShaderBuilder,h as Stage,a as Uniforms};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import{property as r}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators/subclass.js";import{ZEROS as t}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{RenderCategory as n}from"../../../webgl.js";import{ColorFormat as i}from"../../../webgl/formats.js";import s from"../../../webgl/RenderNode.js";import{alphaCutoff as a}from"../../core/shaderLibrary/util/AlphaCutoff.js";import{If as c,glsl as l}from"../../core/shaderModules/interfaces.js";import{Default3D as u}from"../../lib/DefaultVertexAttributeLocations.js";import{FramebufferBit as p,ColorAttachment as d,BlendFactor as f,SizedPixelFormat as h,PixelFormat as m,DataType as T}from"../../../../webgl/enums.js";let v=class extends s{constructor(e){super(e),this.destroyedCB=null,this.produces=n.FINAL,this.consumes={required:[n.FINAL]},this.clearColor=t,this._focusedFBOType=0,this._program=new Map}destroy(){this._program.forEach((e=>e.dispose())),this._program.clear(),this.destroyedCB()}render(e){const r=e.find((({name:e})=>e===n.FINAL));if(!this._focusedFBO)return r;const o=this.renderingContext;o.bindFramebuffer(r.fbo),o.setClearColor(0,0,0,0),o.clear(p.COLOR);const t=this._ensureShader(o,!1,0);return o.useProgram(t),o.bindTexture(this._focusedFBO.getTexture(),0),t.setUniform1i("colorTex",0),t.setUniform1i("inputType",this._focusedFBOType),3===this._focusedFBOType&&t.setUniform2fv("nearFar",this.camera.nearFar),o.screen.draw(),r}getDownscaledFBO(e,r,o,t,n,s){o===g.ON&&(n=e.width,s=e.height);const a=this.renderingContext,{colorTexture:c,depthStencilTexture:l}=e,u=c?.descriptor,m=this._ensureShader(a,null!=l,r),T=this.fboCache.acquire(n,s,"fbo visualizer"),v=!u?.hasMipmap&&!u?.isImmutable;v&&c?.generateMipmap(),a.useProgram(m),a.bindFramebuffer(T.fbo);let F=0;const x=[d.COLOR_ATTACHMENT0],C=null!=l;if(a.bindTexture(c,F),m.setUniform1i("colorTex",F),l){F++,a.bindTexture(l,F),m.setUniform1i("depthTex",F);const e=d.COLOR_ATTACHMENT0+F;T.acquireColor(e,i.RGBA,"depth to color"),x.push(e)}for(let p=0;p<r;p++){F++;const r=d.COLOR_ATTACHMENT0+F,o=C?1:0;a.bindTexture(e.getColorTexture(r-o),F),m.setUniform1i("colorTex"+(F-o-1),F),T.acquireColor(r,i.RGBA),x.push(r)}a.gl.drawBuffers(x);const b=a.getViewport();a.setViewport(0,0,n,s),a.setClearColor(0,0,0,0),a.clear(p.COLOR),a.setBlendingEnabled(!0),a.setBlendFunction(f.ONE,f.ONE_MINUS_SRC_ALPHA);const O="linear-depth"===t||t.includes("shadow"),_=u?.internalFormat,A=O?3:_===h.R16F||_===h.R32F||_===h.R8?1:_===h.RG8?2:_===h.RGBA16F?4:0;return m.setUniform1i("inputType",A),O&&m.setUniform2fv("nearFar",this.camera.nearFar),a.screen.draw(),a.bindFramebuffer(null),a.setViewport(b.x,b.y,b.width,b.height),o===g.ON&&(this._focusedFBO=T,this._focusedFBOType=A),v&&e.colorTexture?.clearMipmap(),T}clearFocusedFBO(){this._focusedFBO=null}getPreviewContent(e,r,o,t){if(!o)return null;const n=this.renderingContext,i=this.fboCache.acquire(e,r,"fbo visualizer");n.bindFramebuffer(i?.fbo),n.setClearColor(this.clearColor[0],this.clearColor[1],this.clearColor[2],this.clearColor[3]),n.clear(p.COLOR),n.setBlendingEnabled(!0),n.setBlendFunction(f.ONE,f.ONE_MINUS_SRC_ALPHA),n.setViewport(0,0,e,r);const s=this._ensureShader(n,!1,0);n.useProgram(s),n.bindTexture(o.getColorTexture(t),0),s.setUniform1i("colorTex",0),s.setUniform1i("inputType",0),n.screen.draw();const a=new ImageData(new Uint8ClampedArray(e*r*4),e,r);return n.gl.readPixels(0,0,e,r,m.RGBA,T.UNSIGNED_BYTE,new Uint8Array(a.data.buffer)),n.bindFramebuffer(null),i?.release(),a}_ensureShader(e,r,o){const t={hasDepth:r,attachments:o},n=this._program.get(t);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,r)=>{let o="";const t=e?2:1;for(let n=0;n<r;n++)o+=`layout(location = ${l.int(t+n)}) out vec4 fragColor${l.int(n)};\n uniform sampler2D colorTex${l.int(n)};`;return o},p=e=>{let r="";for(let o=0;o<e;o++)r+=`fragColor${l.int(o)} = texture(colorTex${l.int(o)}, uv);`;return r},d=`#version 300 es\n precision highp float;\n\n in vec2 uv;\n uniform sampler2D colorTex;\n layout(location = 0) out vec4 fragColor;\n ${c(r,"layout(location = 1) out vec4 fragDepth;\n uniform sampler2D depthTex;")}\n ${s(r,o)}\n uniform int inputType;\n uniform vec2 nearFar;\n\n // Factors to convert rgba back to float\n const vec4 RGBA_2_FLOAT_FACTORS = vec4(\n 255.0 / (256.0),\n 255.0 / (256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0 * 256.0)\n );\n\n\n float 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 linearDepthFromTexture(sampler2D depthTex, vec2 uv) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(depthTex, 0)));\n return linearDepthFromRGBA(texelFetch(depthTex, iuv, 0));\n }\n\n void main() {\n vec4 color;\n if(inputType == 1) {\n color = vec4(vec3(texture(colorTex, uv).r), 1.0);\n } else if(inputType == 2) {\n color = vec4(texture(colorTex, uv).rg, 0.0, 1.0);\n } else if(inputType == 3) {\n float depth = 1.0 - (-linearDepthFromTexture(colorTex, uv) / (nearFar[1] - nearFar[0]));\n color = vec4(vec3(depth), depth >= 0.999 ? 0.0 : 1.0);\n } else if(inputType == 4) {\n color = texture(colorTex, uv);\n color = vec4(color.rgb / color.a, color.a);\n } else {\n color = texture(colorTex, uv);\n }\n\n\n if(color.a < ${l.float(a)})\n discard;\n else {\n fragColor = color;\n ${c(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 ${c(o>0,p(o))}\n }\n }`;return this._program.set(t,e.programCache.acquire(i,d,u)),this._program.get(t)}};var g;e([r()],v.prototype,"destroyedCB",void 0),e([r()],v.prototype,"produces",void 0),e([r()],v.prototype,"consumes",void 0),e([r()],v.prototype,"clearColor",void 0),v=e([o("esri.views.3d.webgl-engine.effects.debug.RenderNodeVisualizerNode")],v),function(e){e[e.ON=0]="ON",e[e.OFF=1]="OFF"}(g||(g={}));export{g as FocusState,v as RenderNodeVisualizerNode};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import{property as r}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators/subclass.js";import{ZEROS as t}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{RenderCategory as n}from"../../../webgl.js";import{ColorFormat as i}from"../../../webgl/formats.js";import s from"../../../webgl/RenderNode.js";import{alphaCutoff as c}from"../../core/shaderLibrary/util/AlphaCutoff.js";import{If as a,glsl as l}from"../../core/shaderModules/interfaces.js";import{Default3D as u}from"../../lib/DefaultVertexAttributeLocations.js";import{FramebufferBit as h,ColorAttachment as p,BlendFactor as d,SizedPixelFormat as f,PixelFormat as m,DataType as v}from"../../../../webgl/enums.js";let x=class extends s{constructor(e){super(e),this.destroyedCB=null,this.produces=n.FINAL,this.consumes={required:[n.FINAL]},this.clearColor=t,this._focusedFBOType=0,this._program=new Map}destroy(){this._program.forEach((e=>e.dispose())),this._program.clear(),this.destroyedCB()}render(e){const r=e.find((({name:e})=>e===n.FINAL));if(!this._focusedFBO)return r;const o=this.renderingContext;o.bindFramebuffer(r.fbo),o.setClearColor(0,0,0,0),o.clear(h.COLOR);const t=this._ensureShader(o,!1,0);return o.useProgram(t),o.bindTexture(this._focusedFBO.getTexture(),0),t.setUniform1i("colorTex",0),t.setUniform1i("inputType",this._focusedFBOType),3===this._focusedFBOType&&t.setUniform2fv("nearFar",this.camera.nearFar),o.screen.draw(),r}getDownscaledFBO(e,r,o,t,n,s){o===g.ON&&(n=e.width,s=e.height);const c=this.renderingContext,{colorTexture:a,depthStencilTexture:l}=e,u=a?.descriptor,m=this._ensureShader(c,null!=l,r),v=this.fboCache.acquire(n,s,"fbo visualizer"),x=!u?.hasMipmap&&!u?.isImmutable;x&&a?.generateMipmap(),c.useProgram(m),c.bindFramebuffer(v.fbo);let T=0;const F=[p.COLOR_ATTACHMENT0],C=null!=l;if(c.bindTexture(a,T),m.setUniform1i("colorTex",T),l){T++,c.bindTexture(l,T),m.setUniform1i("depthTex",T);const e=p.COLOR_ATTACHMENT0+T;v.acquireColor(e,i.RGBA,"depth to color"),F.push(e)}for(let h=0;h<r;h++){T++;const r=p.COLOR_ATTACHMENT0+T,o=C?1:0;c.bindTexture(e.getColorTexture(r-o),T),m.setUniform1i("colorTex"+(T-o-1),T),v.acquireColor(r,i.RGBA),F.push(r)}c.gl.drawBuffers(F);const b=c.getViewport();c.setViewport(0,0,n,s),c.setClearColor(0,0,0,0),c.clear(h.COLOR),c.setBlendingEnabled(!0),c.setBlendFunction(d.ONE,d.ONE_MINUS_SRC_ALPHA);const O="linear-depth"===t||t.includes("shadow"),_="overlay highlight"===t||"highlights"===t||"highlight mix"===t,y="highlight coverage"===t,A=u?.internalFormat,B=O?3:_?5:y?6:A===f.R16F||A===f.R32F||A===f.R8?1:A===f.RG8?2:A===f.RGBA16F?4:0;return m.setUniform1i("inputType",B),O&&m.setUniform2fv("nearFar",this.camera.nearFar),c.screen.draw(),c.bindFramebuffer(null),c.setViewport(b.x,b.y,b.width,b.height),o===g.ON&&(this._focusedFBO=v,this._focusedFBOType=B),x&&e.colorTexture?.clearMipmap(),v}clearFocusedFBO(){this._focusedFBO=null}getPreviewContent(e,r,o,t){if(!o)return null;const n=this.renderingContext,i=this.fboCache.acquire(e,r,"fbo visualizer");n.bindFramebuffer(i?.fbo),n.setClearColor(this.clearColor[0],this.clearColor[1],this.clearColor[2],this.clearColor[3]),n.clear(h.COLOR),n.setBlendingEnabled(!0),n.setBlendFunction(d.ONE,d.ONE_MINUS_SRC_ALPHA),n.setViewport(0,0,e,r);const s=this._ensureShader(n,!1,0);n.useProgram(s),n.bindTexture(o.getColorTexture(t),0),s.setUniform1i("colorTex",0),s.setUniform1i("inputType",0),n.screen.draw();const c=new ImageData(new Uint8ClampedArray(e*r*4),e,r);return n.gl.readPixels(0,0,e,r,m.RGBA,v.UNSIGNED_BYTE,new Uint8Array(c.data.buffer)),n.bindFramebuffer(null),i?.release(),c}_ensureShader(e,r,o){const t={hasDepth:r,attachments:o},n=this._program.get(t);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,r)=>{let o="";const t=e?2:1;for(let n=0;n<r;n++)o+=`layout(location = ${l.int(t+n)}) out vec4 fragColor${l.int(n)};\n uniform sampler2D colorTex${l.int(n)};`;return o},h=e=>{let r="";for(let o=0;o<e;o++)r+=`fragColor${l.int(o)} = texture(colorTex${l.int(o)}, uv);`;return r},p=`#version 300 es\n precision highp float;\n\n in vec2 uv;\n uniform sampler2D colorTex;\n layout(location = 0) out vec4 fragColor;\n ${a(r,"layout(location = 1) out vec4 fragDepth;\n uniform sampler2D depthTex;")}\n ${s(r,o)}\n uniform int inputType;\n uniform vec2 nearFar;\n\n // Factors to convert rgba back to float\n const vec4 RGBA_2_FLOAT_FACTORS = vec4(\n 255.0 / (256.0),\n 255.0 / (256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0 * 256.0)\n );\n\n\n float 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 linearDepthFromTexture(sampler2D depthTex, vec2 uv) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(depthTex, 0)));\n return linearDepthFromRGBA(texelFetch(depthTex, iuv, 0));\n }\n\n void main() {\n vec4 color;\n if(inputType == 1) {\n color = vec4(vec3(texture(colorTex, uv).r), 1.0);\n } else if(inputType == 2) {\n color = vec4(texture(colorTex, uv).rg, 0.0, 1.0);\n } else if(inputType == 3) {\n float depth = 1.0 - (-linearDepthFromTexture(colorTex, uv) / (nearFar[1] - nearFar[0]));\n color = vec4(vec3(depth), depth >= 0.999 ? 0.0 : 1.0);\n } else if(inputType == 4) {\n color = texture(colorTex, uv);\n color = vec4(color.rgb / color.a, color.a);\n } else if(inputType == 5) {\n vec2 texDim = vec2(textureSize(colorTex, 0));\n ivec2 iuv = ivec2(uv*texDim);\n vec2 hh = texelFetch(colorTex,iuv,0).rg;\n uvec2 uhh = uvec2(vec2(hh) * 255.0);\n color = vec4(\n ((uhh.x & 0x3u) != 0u) ? 1.0 : 0.0, \n ((uhh.x & 0xcu) != 0u) ? 1.0 : 0.0,\n ((uhh.y & 0xfu) != 0u) ? 1.0 : 0.0, \n 1.0);\n } else if(inputType == 6) {\n vec2 texDim = vec2(textureSize(colorTex, 0));\n ivec2 iuv = ivec2(uv*texDim);\n uvec2 hh = uvec2(texelFetch(colorTex,iuv,0).rg * 255.0);\n color = 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 color = texture(colorTex, uv);\n }\n\n\n if(color.a < ${l.float(c)})\n discard;\n else {\n fragColor = color;\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 ${a(o>0,h(o))}\n }\n }`;return this._program.set(t,e.programCache.acquire(i,p,u)),this._program.get(t)}};var g;e([r()],x.prototype,"destroyedCB",void 0),e([r()],x.prototype,"produces",void 0),e([r()],x.prototype,"consumes",void 0),e([r()],x.prototype,"clearColor",void 0),x=e([o("esri.views.3d.webgl-engine.effects.debug.RenderNodeVisualizerNode")],x),function(e){e[e.ON=0]="ON",e[e.OFF=1]="OFF"}(g||(g={}));export{g as FocusState,x as RenderNodeVisualizerNode};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import has from"../../../../../core/has.js";import{releaseMaybe as t,disposeMaybe as r}from"../../../../../core/maybe.js";import{watch as i,initial as s}from"../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as l}from"../../../../../core/accessorSupport/decorators/subclass.js";import{set as h}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{ZEROS as n}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{InternalRenderCategory as a}from"../../../webgl.js";import{ColorFormat as c}from"../../../webgl/formats.js";import g from"../../../webgl/RenderNode.js";import{HighlightApplyTechnique as u}from"./HighlightApplyTechnique.js";import{HighlightDownsampleTechnique as p}from"./HighlightDownsampleTechnique.js";import{HighlightPassParameters as m}from"./HighlightPassParameters.js";import{HighlightToSingleTechnique as d}from"./HighlightToSingleTechnique.js";import{SingleHighlightApplyTechnique as f}from"./SingleHighlightApplyTechnique.js";import{SingleHighlightBlurTechnique as b}from"./SingleHighlightBlurTechnique.js";import{RenderRequestType as T}from"../../lib/basicInterfaces.js";import{Default3D as x}from"../../lib/DefaultVertexAttributeLocations.js";import{NoVertex as w}from"../../lib/DefaultVertexBufferLayouts.js";import{VertexArrayObject as C}from"../../lib/VertexArrayObject.js";import{H as _,g as v}from"../../../../../chunks/HighlightDownsample.glsl.js";import{S as q}from"../../../../../chunks/SingleHighlightBlur.glsl.js";import{BufferObject as j}from"../../../../webgl/BufferObject.js";import{PixelFormat as H,TextureSamplingMode as P,FramebufferBit as R,Usage as D,TextureType as O,PrimitiveType as y,DataType as S}from"../../../../webgl/enums.js";import{Texture as A}from"../../../../webgl/Texture.js";import{TextureDescriptor as M}from"../../../../webgl/TextureDescriptor.js";let I=class extends g{constructor(e){super(e),this.produces=a.HIGHLIGHTS,this.consumes={required:[a.HIGHLIGHTS,"highlights"]},this._useMultipleHighlights=!!has("enable-feature:multiple-highlights"),this._downsampleDrawParameters=new _,this._passParameters=new m,this._singleHighlightBlurDrawParameters=new q,this._grid=new E,e.techniques.precompile(p),this._useMultipleHighlights?e.techniques.precompile(u):(e.techniques.precompile(d),e.techniques.precompile(b),e.techniques.precompile(f))}initialize(){this.addHandles([i((()=>this._updateOptionsTexture()),(()=>{}),s)])}destroy(){this._grid.coverage=t(this._grid.coverage),this._grid.vao=r(this._grid.vao),this._passParameters.highlightOptionsTexture=t(this._passParameters.highlightOptionsTexture)}_updateOptionsTexture(){if(null==this._passParameters.highlightOptionsTexture){const e=new M(16,2);e.internalFormat=H.RGBA,e.samplingMode=P.NEAREST,this._passParameters.highlightOptionsTexture=new A(this.renderingContext,e,null)}this._passParameters.highlightOptionsTexture.setData(G(this.view.state.highlights)),this.requestRender(T.UPDATE)}render(e){const t=e.find((({name:e})=>e===a.HIGHLIGHTS)),{techniques:r,bindParameters:i,_passParameters:s,renderingContext:o}=this;if(!i.decorations)return t;const l=r.acquire(p);if(!l.compiled)return l.release(),this.requestRender(T.UPDATE),t;const h=e.find((({name:e})=>"highlights"===e)).getTexture(),n=()=>{this._gridUpdateResources(h);const e=this._gridComputeCoverage(l,h,i);l.release();const{horizontalCellCount:t,verticalCellCount:r}=e;return s.horizontalCellCount=t,s.verticalCellCount=r,s.coverageTexture=e.coverage?.getTexture(),e},c=e=>{const t=e.verticalCellCount*e.horizontalCellCount;o.bindVAO(e.vao),o.drawElementsInstanced(y.TRIANGLES,6,S.UNSIGNED_BYTE,0,t)},{camera:g}=i,u=()=>{o.bindFramebuffer(t.fbo),o.setViewport4fv(g.fullViewport)};return this._useMultipleHighlights?this._renderMultiple(h,n,c,u):this._renderSingle(h,n,c,u),s.highlightTexture=null,s.coverageTexture=null,t}_renderMultiple(e,t,r,i){const{techniques:s,bindParameters:o,_passParameters:l,renderingContext:h}=this,n=s.acquire(u);if(!n.compiled)return n.release(),void this.requestRender(T.UPDATE);const a=t();l.highlightTexture=e,l.pixelRatio=o.camera.pixelRatio,h.bindTechnique(n,o,l),i(),r(a),n.release()}_renderSingle(e,t,r,i){const{fboCache:s,techniques:o,bindParameters:l,_passParameters:n,renderingContext:a}=this,g=o.acquire(d),u=o.acquire(b),p=o.acquire(f);if(!p.compiled||!u.compiled||!g.compiled)return p.release(),u.release(),g.release(),void this.requestRender(T.UPDATE);const m=t(),{width:x,height:w}=e.descriptor;n.highlightTexture=e;const{camera:C}=l,{fullWidth:_,fullHeight:v,pixelRatio:q}=C,j=Math.ceil(_/q),H=Math.ceil(v/q),{_singleHighlightBlurDrawParameters:P}=this;for(let d=0;d<l.highlights.length;++d){n.highlightLevel=d,a.setClearColor(0,0,0,0);const e=s.acquire(x,w,"single highlight",c.RG);a.bindFramebuffer(e.fbo),a.setViewport(0,0,x,w),a.clear(R.COLOR),a.bindTechnique(g,l,n),r(m),P.blurInput=e.getTexture(),h(P.blurSize,1/j,0);const t=s.acquire(j,H,"single highlight blur h",c.RG);a.unbindTexture(t.fbo?.colorTexture),a.bindFramebuffer(t.fbo),a.setViewport(0,0,j,H),a.clear(R.COLOR),a.bindTechnique(u,l,n,P),r(m),e.release(),h(P.blurSize,0,1/H),n.singleHighlightBlurTexture=t.getTexture(),i(),a.bindTechnique(p,l,n,P),r(m),t.release()}g.release(),u.release(),p.release()}_gridUpdateResources(e){const t=this._grid,{width:r,height:i}=e.descriptor;if(t.horizontalCellCount=Math.ceil(r/v),t.verticalCellCount=Math.ceil(i/v),t.vao)return;const s=this.renderingContext,o=j.createIndex(s,D.STATIC_DRAW,B);t.vao=new C(s,x,new Map([["geometry",w]]),new Map([["geometry",j.createVertex(s,D.STATIC_DRAW)]]),o)}_gridComputeCoverage(e,t,r){const i=this.renderingContext,s=this._grid,o=t.descriptor,l=Math.ceil(o.width/v),h=Math.ceil(o.height/v);this._downsampleDrawParameters.input=t,s.coverage?.release();const n=this.fboCache.acquire(l,h,"highlight coverage",c.RG);return s.coverage=n,i.bindFramebuffer(n.fbo),i.bindTechnique(e,r,this._passParameters,this._downsampleDrawParameters),i.setViewport(0,0,l,h),i.screen.draw(),s}get test(){}};e([o()],I.prototype,"produces",void 0),e([o()],I.prototype,"consumes",void 0),e([o({constructOnly:!0})],I.prototype,"techniques",void 0),I=e([l("esri.views.3d.webgl-engine.effects.highlight.Highlight")],I);class E{constructor(){this.coverage=null,this.vao=null,this.verticalCellCount=0,this.horizontalCellCount=0,this.viewportWidth=0,this.viewportHeight=0}}function G(e){const t=new Uint8Array(128);let r=0;for(const i of e){const e=i.options,s=4*r,o=4*r+64;++r;const{color:l}=e,h=e.haloColor??l;t[s+0]=l.r,t[s+1]=l.g,t[s+2]=l.b,t[s+3]=e.fillOpacity*l.a*255,t[o+0]=h.r,t[o+1]=h.g,t[o+2]=h.b,t[o+3]=e.haloOpacity*h.a*255}return t}let L=0;function U(e){let t=0;for(const{name:i,options:s}of e){t+=i.length;const{color:e,fillOpacity:r,haloColor:o,haloOpacity:l}=s;t+=e.r+e.g+e.b+e.a+r,t+=o?o.r+o.g+o.b+o.a+l:0}const r=e.at(0);if(r){const{shadowOpacity:e,shadowDifference:i,shadowColor:s}=r.options;t+=e+i+s.r+s.g+s.b+s.a}return L+++(t>=0?0:1)}const B=new Uint8Array([0,1,2,2,1,3]);function V(e,t,r,i,s,o=0){const l=i.highlights,a=l.length>1?t.acquire(r.width,r.height,"highlight mix",c.RG):null;if(a){const t=e.getBoundFramebufferObject();e.bindFramebuffer(a.fbo),e.clearFramebuffer(n),e.bindFramebuffer(t)}const g=a?.getTexture();i.highlightMixTexture=g,h(i.highlightMixOrigin,o,0),l.forEach(((t,l)=>{l>0&&(e.bindTexture(g,0),e.gl.copyTexSubImage2D(O.TEXTURE_2D,0,0,0,o,0,r.width,r.height),e.bindTexture(null,0)),e.clear(R.DEPTH),i.highlightLevel=l,s()})),i.highlightLevel=i.highlightMixTexture=null,a?.release()}export{I as Highlight,V as renderHighlightBuffer,U as trackHighlightOptions};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import"../../../../../core/has.js";import{releaseMaybe as t,disposeMaybe as r}from"../../../../../core/maybe.js";import{watch as i,initial as s}from"../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as l}from"../../../../../core/accessorSupport/decorators/subclass.js";import{set as h}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{ZEROS as n}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{InternalRenderCategory as a}from"../../../webgl.js";import{ColorFormat as c}from"../../../webgl/formats.js";import g from"../../../webgl/RenderNode.js";import{HighlightApplyTechnique as u}from"./HighlightApplyTechnique.js";import{HighlightDownsampleTechnique as p}from"./HighlightDownsampleTechnique.js";import{HighlightPassParameters as m}from"./HighlightPassParameters.js";import{HighlightToSingleTechnique as d}from"./HighlightToSingleTechnique.js";import{SingleHighlightApplyTechnique as f}from"./SingleHighlightApplyTechnique.js";import{SingleHighlightBlurTechnique as b}from"./SingleHighlightBlurTechnique.js";import{RenderRequestType as T}from"../../lib/basicInterfaces.js";import{Default3D as x}from"../../lib/DefaultVertexAttributeLocations.js";import{NoVertex as w}from"../../lib/DefaultVertexBufferLayouts.js";import{VertexArrayObject as C}from"../../lib/VertexArrayObject.js";import{H as _,g as v}from"../../../../../chunks/HighlightDownsample.glsl.js";import{S as q}from"../../../../../chunks/SingleHighlightBlur.glsl.js";import{BufferObject as j}from"../../../../webgl/BufferObject.js";import{PixelFormat as H,TextureSamplingMode as P,FramebufferBit as R,Usage as D,TextureType as O,PrimitiveType as y,DataType as S}from"../../../../webgl/enums.js";import{Texture as A}from"../../../../webgl/Texture.js";import{TextureDescriptor as M}from"../../../../webgl/TextureDescriptor.js";let I=class extends g{constructor(e){super(e),this.produces=a.HIGHLIGHTS,this.consumes={required:[a.HIGHLIGHTS,"highlights"]},this._useMultipleHighlights=!1,this._downsampleDrawParameters=new _,this._passParameters=new m,this._singleHighlightBlurDrawParameters=new q,this._grid=new E,e.techniques.precompile(p),this._useMultipleHighlights?e.techniques.precompile(u):(e.techniques.precompile(d),e.techniques.precompile(b),e.techniques.precompile(f))}initialize(){this.addHandles([i((()=>this._updateOptionsTexture()),(()=>{}),s)])}destroy(){this._grid.coverage=t(this._grid.coverage),this._grid.vao=r(this._grid.vao),this._passParameters.highlightOptionsTexture=t(this._passParameters.highlightOptionsTexture)}_updateOptionsTexture(){if(null==this._passParameters.highlightOptionsTexture){const e=new M(16,2);e.internalFormat=H.RGBA,e.samplingMode=P.NEAREST,this._passParameters.highlightOptionsTexture=new A(this.renderingContext,e,null)}this._passParameters.highlightOptionsTexture.setData(G(this.view.state.highlights)),this.requestRender(T.UPDATE)}render(e){const t=e.find((({name:e})=>e===a.HIGHLIGHTS)),{techniques:r,bindParameters:i,_passParameters:s,renderingContext:o}=this;if(!i.decorations)return t;const l=r.acquire(p);if(!l.compiled)return l.release(),this.requestRender(T.UPDATE),t;const h=e.find((({name:e})=>"highlights"===e)).getTexture(),n=()=>{this._gridUpdateResources(h);const e=this._gridComputeCoverage(l,h,i);l.release();const{horizontalCellCount:t,verticalCellCount:r}=e;return s.horizontalCellCount=t,s.verticalCellCount=r,s.coverageTexture=e.coverage?.getTexture(),e},c=e=>{const t=e.verticalCellCount*e.horizontalCellCount;o.bindVAO(e.vao),o.drawElementsInstanced(y.TRIANGLES,6,S.UNSIGNED_BYTE,0,t)},{camera:g}=i,u=()=>{o.bindFramebuffer(t.fbo),o.setViewport4fv(g.fullViewport)};return this._useMultipleHighlights?this._renderMultiple(h,n,c,u):this._renderSingle(h,n,c,u),s.highlightTexture=null,s.coverageTexture=null,t}_renderMultiple(e,t,r,i){const{techniques:s,bindParameters:o,_passParameters:l,renderingContext:h}=this,n=s.acquire(u);if(!n.compiled)return n.release(),void this.requestRender(T.UPDATE);const a=t();l.highlightTexture=e,l.pixelRatio=o.camera.pixelRatio,h.bindTechnique(n,o,l),i(),r(a),n.release()}_renderSingle(e,t,r,i){const{fboCache:s,techniques:o,bindParameters:l,_passParameters:n,renderingContext:a}=this,g=o.acquire(d),u=o.acquire(b),p=o.acquire(f);if(!p.compiled||!u.compiled||!g.compiled)return p.release(),u.release(),g.release(),void this.requestRender(T.UPDATE);const m=t(),{width:x,height:w}=e.descriptor;n.highlightTexture=e;const{camera:C}=l,{fullWidth:_,fullHeight:v,pixelRatio:q}=C,j=Math.ceil(_/q),H=Math.ceil(v/q),{_singleHighlightBlurDrawParameters:P}=this;for(let d=0;d<l.highlights.length;++d){n.highlightLevel=d,a.setClearColor(0,0,0,0);const e=s.acquire(x,w,"single highlight",c.RG);a.bindFramebuffer(e.fbo),a.setViewport(0,0,x,w),a.clear(R.COLOR),a.bindTechnique(g,l,n),r(m),P.blurInput=e.getTexture(),h(P.blurSize,1/j,0);const t=s.acquire(j,H,"single highlight blur h",c.RG);a.unbindTexture(t.fbo?.colorTexture),a.bindFramebuffer(t.fbo),a.setViewport(0,0,j,H),a.clear(R.COLOR),a.bindTechnique(u,l,n,P),r(m),e.release(),h(P.blurSize,0,1/H),n.singleHighlightBlurTexture=t.getTexture(),i(),a.bindTechnique(p,l,n,P),r(m),t.release()}g.release(),u.release(),p.release()}_gridUpdateResources(e){const t=this._grid,{width:r,height:i}=e.descriptor;if(t.horizontalCellCount=Math.ceil(r/v),t.verticalCellCount=Math.ceil(i/v),t.vao)return;const s=this.renderingContext,o=j.createIndex(s,D.STATIC_DRAW,B);t.vao=new C(s,x,new Map([["geometry",w]]),new Map([["geometry",j.createVertex(s,D.STATIC_DRAW)]]),o)}_gridComputeCoverage(e,t,r){const i=this.renderingContext,s=this._grid,o=t.descriptor,l=Math.ceil(o.width/v),h=Math.ceil(o.height/v);this._downsampleDrawParameters.input=t,s.coverage?.release();const n=this.fboCache.acquire(l,h,"highlight coverage",c.RG);return s.coverage=n,i.bindFramebuffer(n.fbo),i.bindTechnique(e,r,this._passParameters,this._downsampleDrawParameters),i.setViewport(0,0,l,h),i.screen.draw(),s}get test(){}};e([o()],I.prototype,"produces",void 0),e([o()],I.prototype,"consumes",void 0),e([o({constructOnly:!0})],I.prototype,"techniques",void 0),I=e([l("esri.views.3d.webgl-engine.effects.highlight.Highlight")],I);class E{constructor(){this.coverage=null,this.vao=null,this.verticalCellCount=0,this.horizontalCellCount=0,this.viewportWidth=0,this.viewportHeight=0}}function G(e){const t=new Uint8Array(128);let r=0;for(const i of e){const e=i.options,s=4*r,o=4*r+64;++r;const{color:l}=e,h=e.haloColor??l;t[s+0]=l.r,t[s+1]=l.g,t[s+2]=l.b,t[s+3]=e.fillOpacity*l.a*255,t[o+0]=h.r,t[o+1]=h.g,t[o+2]=h.b,t[o+3]=e.haloOpacity*h.a*255}return t}let L=0;function U(e){let t=0;for(const{name:i,options:s}of e){t+=i.length;const{color:e,fillOpacity:r,haloColor:o,haloOpacity:l}=s;t+=e.r+e.g+e.b+e.a+r,t+=o?o.r+o.g+o.b+o.a+l:0}const r=e.at(0);if(r){const{shadowOpacity:e,shadowDifference:i,shadowColor:s}=r.options;t+=e+i+s.r+s.g+s.b+s.a}return L+++(t>=0?0:1)}const B=new Uint8Array([0,1,2,2,1,3]);function V(e,t,r,i,s,o=0){const l=i.highlights,a=l.length>1?t.acquire(r.width,r.height,"highlight mix",c.RG):null;if(a){const t=e.getBoundFramebufferObject();e.bindFramebuffer(a.fbo),e.clearFramebuffer(n),e.bindFramebuffer(t)}const g=a?.getTexture();i.highlightMixTexture=g,h(i.highlightMixOrigin,o,0),l.forEach(((t,l)=>{l>0&&(e.bindTexture(g,0),e.gl.copyTexSubImage2D(O.TEXTURE_2D,0,0,0,o,0,r.width,r.height),e.bindTexture(null,0)),e.clear(R.DEPTH),i.highlightLevel=l,s()})),i.highlightLevel=null,i.highlightMixTexture=null,a?.release()}export{I as Highlight,V as renderHighlightBuffer,U as trackHighlightOptions};