@arcgis/core 5.1.0-next.57 → 5.1.0-next.58

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 (46) hide show
  1. package/applications/Components/SelectionOperation.d.ts +2 -2
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/{278eecd729bed2832702.js → 45b7266580f9ce4fab6c.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{992e74570b76f3f9e52e.js → 666e1e79fcb309b0b9b1.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{4afddb66242438b38df0.js → 6c571008bee8376ea50a.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{ea068f75397c3b3337ec.js → 92fb6519b01d110ee947.js} +136 -129
  7. package/chunks/ScreenSpaceShadowHighlight.glsl.js +6 -0
  8. package/chunks/ShadowCastAccumulate.glsl.js +1 -1
  9. package/chunks/ShadowHighlight.glsl.js +15 -8
  10. package/config.js +1 -1
  11. package/kernel.js +1 -1
  12. package/networks/support/jsonTypes.d.ts +6 -0
  13. package/package.json +1 -1
  14. package/rest/networks/support/FunctionResult.d.ts +6 -0
  15. package/rest/networks/support/FunctionResult.js +1 -1
  16. package/support/revision.js +1 -1
  17. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  18. package/views/3d/terrain/TerrainRenderer.js +1 -1
  19. package/views/3d/terrain/TerrainSurface.js +1 -1
  20. package/views/3d/webgl/RenderNode.js +1 -1
  21. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  22. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  23. package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +28 -50
  24. package/views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRendering.glsl.js +46 -22
  25. package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js +18 -13
  26. package/views/3d/webgl-engine/effects/highlight/ScreenSpaceShadowHighlight.glsl.js +2 -0
  27. package/views/3d/webgl-engine/effects/highlight/ScreenSpaceShadowHighlightRenderNode.js +2 -0
  28. package/views/3d/webgl-engine/effects/highlight/ScreenSpaceShadowHighlightTechnique.js +2 -0
  29. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
  30. package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
  31. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  32. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  33. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  34. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  35. package/views/3d/webgl-engine/materials/PathTechniqueConfiguration.js +1 -1
  36. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  37. package/views/3d/webgl-engine/materials/WaterTechniqueConfiguration.js +1 -1
  38. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  39. package/views/3d/webgl-engine/shaders/DefaultMaterialTechniqueConfiguration.js +1 -1
  40. package/views/3d/webgl-engine/shaders/ReceiveShadowsConfiguration.js +1 -1
  41. package/views/3d/webgl-engine/shaders/TerrainTechniqueConfiguration.js +1 -1
  42. package/views/3d/webgl.js +1 -1
  43. package/views/selection/types.d.ts +9 -0
  44. package/widgets/support/Selector2D/SelectionOperation.d.ts +191 -0
  45. package/widgets/support/Selector2D/SelectionOperation.js +1 -1
  46. package/widgets/support/Selector2D/types.d.ts +139 -0
@@ -1,65 +1,89 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{AnalyticalSkyModel as e}from"./AnalyticalSkyModel.glsl.js";import{PiUtils as o}from"./PiUtils.glsl.js";import{glsl as t}from"../../shaderModules/glsl.js";function n(n,a){n.include(o),1!==a.pbrMode&&2!==a.pbrMode&&5!==a.pbrMode&&6!==a.pbrMode||(n.code.add(t`float normalDistribution(float NdotH, float roughness)
2
+ import{AnalyticalSkyModel as e}from"./AnalyticalSkyModel.glsl.js";import{Gamma as o}from"./Gamma.glsl.js";import{PiUtils as t}from"./PiUtils.glsl.js";import{glsl as n}from"../../shaderModules/glsl.js";function a(a,i){a.include(o),a.include(t),1!==i.pbrMode&&2!==i.pbrMode&&5!==i.pbrMode&&6!==i.pbrMode||(a.code.add(n`float normalDistribution(float NdotH, float roughness)
3
3
  {
4
4
  float a = NdotH * roughness;
5
5
  float b = roughness / (1.0 - NdotH * NdotH + a * a);
6
6
  return b * b * INV_PI;
7
- }`),n.code.add(t`const vec4 c0 = vec4(-1.0, -0.0275, -0.572, 0.022);
7
+ }`),a.code.add(n`const vec4 c0 = vec4(-1.0, -0.0275, -0.572, 0.022);
8
8
  const vec4 c1 = vec4( 1.0, 0.0425, 1.040, -0.040);
9
9
  const vec2 c2 = vec2(-1.04, 1.04);
10
10
  vec2 prefilteredDFGAnalytical(float roughness, float NdotV) {
11
11
  vec4 r = roughness * c0 + c1;
12
12
  float a004 = min(r.x * r.x, exp2(-9.28 * NdotV)) * r.x + r.y;
13
13
  return c2 * a004 + r.zw;
14
- }`)),1!==a.pbrMode&&2!==a.pbrMode||(n.include(e),n.code.add(t`struct PBRShadingInfo
14
+ }`),a.code.add(n`struct PBRShadingInfo
15
15
  {
16
16
  float NdotV;
17
+ float NdotL;
17
18
  float LdotH;
18
- float NdotNG;
19
- float RdotNG;
19
+ float NdotUP;
20
+ float RdotUP;
20
21
  float NdotAmbDir;
21
22
  float NdotH_Horizon;
23
+ float NdotH;
22
24
  vec3 skyRadianceToSurface;
23
25
  vec3 groundRadianceToSurface;
24
26
  vec3 skyIrradianceToSurface;
25
27
  vec3 groundIrradianceToSurface;
28
+ vec3 reflectedView;
26
29
  float averageAmbientRadiance;
27
- float ssao;
28
30
  vec3 albedoLinear;
29
31
  vec3 f0;
30
32
  vec3 f90;
31
33
  vec3 diffuseColor;
32
34
  float metalness;
33
35
  float roughness;
34
- };`),n.code.add(t`vec3 evaluateEnvironmentIllumination(PBRShadingInfo inputs) {
35
- vec3 indirectDiffuse = evaluateDiffuseIlluminationHemisphere(inputs.groundIrradianceToSurface, inputs.skyIrradianceToSurface, inputs.NdotNG);
36
- vec3 indirectSpecular = evaluateSpecularIlluminationHemisphere(inputs.groundRadianceToSurface, inputs.skyRadianceToSurface, inputs.RdotNG, inputs.roughness);
36
+ };`),a.code.add(n`void calculateCommonInputs(out PBRShadingInfo inputs, vec3 normal, vec3 viewDirection, vec3 upDirection, vec3 albedo) {
37
+ vec3 h = normalize(mainLightDirection - viewDirection);
38
+ inputs.NdotV = clamp(abs(dot(normal, -viewDirection)), 0.001, 1.0);
39
+ inputs.NdotUP = clamp(dot(normal, upDirection), -1.0, 1.0);
40
+ inputs.reflectedView = normalize(reflect(-viewDirection, normal));
41
+ inputs.RdotUP = clamp(dot(inputs.reflectedView, upDirection), -1.0, 1.0);
42
+ inputs.albedoLinear = linearizeGamma(albedo);
43
+ inputs.NdotH = clamp(dot(normal, h), 0.0, 1.0);
44
+ inputs.NdotL = clamp(dot(normal, mainLightDirection), 0.001, 1.0);
45
+ }`)),1!==i.pbrMode&&2!==i.pbrMode||(a.include(e),a.code.add(n`vec3 evaluateEnvironmentIllumination(PBRShadingInfo inputs) {
46
+ vec3 indirectDiffuse = evaluateDiffuseIlluminationHemisphere(inputs.groundIrradianceToSurface, inputs.skyIrradianceToSurface, inputs.NdotUP);
47
+ vec3 indirectSpecular = evaluateSpecularIlluminationHemisphere(inputs.groundRadianceToSurface, inputs.skyRadianceToSurface, inputs.RdotUP, inputs.roughness);
37
48
  vec3 diffuseComponent = inputs.diffuseColor * indirectDiffuse * INV_PI;
38
49
  vec2 dfg = prefilteredDFGAnalytical(inputs.roughness, inputs.NdotV);
39
50
  vec3 specularColor = inputs.f0 * dfg.x + inputs.f90 * dfg.y;
40
51
  vec3 specularComponent = specularColor * indirectSpecular;
41
52
  return (diffuseComponent + specularComponent);
42
- }`))}function a(e,n){e.include(o),e.code.add(t`
53
+ }`),a.code.add(n`void calculatePBRInputs(out PBRShadingInfo inputs, vec3 normal, vec3 viewDirection, vec3 upDirection, vec3 albedo, vec3 mrr) {
54
+ calculateCommonInputs(inputs, normal, viewDirection, upDirection, albedo);
55
+ inputs.metalness = mrr[0];
56
+ inputs.roughness = clamp(mrr[1] * mrr[1], 0.001, 0.99);
57
+ inputs.f0 = (0.16 * mrr[2] * mrr[2]) * (1.0 - inputs.metalness) + inputs.albedoLinear * inputs.metalness;
58
+ inputs.f90 = vec3(clamp(dot(inputs.f0, vec3(50.0 * 0.33)), 0.0, 1.0));
59
+ inputs.diffuseColor = inputs.albedoLinear * (vec3(1.0) - inputs.f0) * (1.0 - inputs.metalness);
60
+ }`)),5!==i.pbrMode&&6!==i.pbrMode||a.code.add(n`const vec3 fresnelReflectionSimplified = vec3(0.04);
61
+ void calculateSimplifiedInputs(out PBRShadingInfo inputs, vec3 normal, vec3 viewDirection, vec3 upDirection, vec3 albedo) {
62
+ calculateCommonInputs(inputs, normal, viewDirection, upDirection, albedo);
63
+ float lightness = 0.3 * inputs.albedoLinear[0] + 0.5 * inputs.albedoLinear[1] + 0.2 * inputs.albedoLinear[2];
64
+ inputs.f0 = (0.85 * lightness + 0.15) * fresnelReflectionSimplified;
65
+ inputs.f90 = vec3(clamp(dot(inputs.f0, vec3(50.0 * 0.33)), 0.0, 1.0));
66
+ }`)}function i(e,o){e.include(t),e.code.add(n`
43
67
  struct PBRShadingWater {
44
- float NdotL; // cos angle between normal and light direction
45
- float NdotV; // cos angle between normal and view direction
46
- float NdotH; // cos angle between normal and half vector
47
- float VdotH; // cos angle between view direction and half vector
48
- float LdotH; // cos angle between light direction and half vector
49
- float VdotN; // cos angle between view direction and normal vector
68
+ float NdotL; // cos angle between normal and light direction
69
+ float NdotV; // cos angle between normal and view direction
70
+ float NdotH; // cos angle between normal and half vector
71
+ float VdotH; // cos angle between view direction and half vector
72
+ float LdotH; // cos angle between light direction and half vector
73
+ float VdotN; // cos angle between view direction and normal vector
50
74
  };
51
75
 
52
- float dtrExponent = ${n.useCustomDTRExponentForWater?"2.2":"2.0"};
53
- `),e.code.add(t`vec3 fresnelReflection(float angle, vec3 f0, float f90) {
76
+ float dtrExponent = ${o.useCustomDTRExponentForWater?"2.2":"2.0"};
77
+ `),e.code.add(n`vec3 fresnelReflection(float angle, vec3 f0, float f90) {
54
78
  return f0 + (f90 - f0) * pow(1.0 - angle, 5.0);
55
- }`),e.code.add(t`float normalDistributionWater(float NdotH, float roughness) {
79
+ }`),e.code.add(n`float normalDistributionWater(float NdotH, float roughness) {
56
80
  float r2 = roughness * roughness;
57
81
  float NdotH2 = NdotH * NdotH;
58
82
  float denom = pow((NdotH2 * (r2 - 1.0) + 1.0), dtrExponent) * PI;
59
83
  return r2 / denom;
60
- }`),e.code.add(t`float geometricOcclusionKelemen(float LoH) {
84
+ }`),e.code.add(n`float geometricOcclusionKelemen(float LoH) {
61
85
  return 0.25 / (LoH * LoH);
62
- }`),e.code.add(t`vec3 brdfSpecularWater(in PBRShadingWater props, float roughness, vec3 F0, float F0Max) {
86
+ }`),e.code.add(n`vec3 brdfSpecularWater(in PBRShadingWater props, float roughness, vec3 F0, float F0Max) {
63
87
  vec3 F = fresnelReflection(props.VdotH, F0, F0Max);
64
88
  float dSun = normalDistributionWater(props.NdotH, roughness);
65
89
  float V = geometricOcclusionKelemen(props.LdotH);
@@ -67,4 +91,4 @@ float diffusionSunHaze = mix(roughness + 0.045, roughness + 0.385, 1.0 - props.V
67
91
  float strengthSunHaze = 1.2;
68
92
  float dSunHaze = normalDistributionWater(props.NdotH, diffusionSunHaze) * strengthSunHaze;
69
93
  return ((dSun + dSunHaze) * V) * F;
70
- }`)}export{n as PhysicallyBasedRendering,a as PhysicallyBasedRenderingWater};
94
+ }`)}export{a as PhysicallyBasedRendering,i as PhysicallyBasedRenderingWater};
@@ -1,18 +1,23 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{create as a}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ForwardLinearDepthToReadShadowMap as o}from"../ForwardLinearDepthToReadShadowMap.glsl.js";import{calculateUVZShadowPass as e,calculateUVZShadowDraw as d,ReadShadowMapOrigin as t}from"./calculateUVZShadow.glsl.js";import{ShadowmapFiltering as r}from"./ShadowmapFiltering.glsl.js";import{BooleanBindUniform as i}from"../../shaderModules/BooleanBindUniform.js";import{FloatBindUniform as s}from"../../shaderModules/FloatBindUniform.js";import{If as l,glsl as n}from"../../shaderModules/glsl.js";import{Texture2DShadowBindUniform as h}from"../../shaderModules/Texture2DShadowBindUniform.js";import{NoParameters as w}from"../../../../../webgl/NoParameters.js";class u extends t{}class c extends w{constructor(){super(...arguments),this.origin=a()}}function p(a,o){o.receiveShadows&&a.include(e),m(a,o)}function f(a,o){o.receiveShadows&&a.include(d),m(a,o)}function m(a,e){a.fragment.uniforms.add(new s("lightingGlobalFactor",a=>a.lighting.globalFactor));const{receiveShadows:d,spherical:t}=e;a.include(o,e),d&&g(a),a.fragment.code.add(n`
2
+ import{create as a}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ForwardLinearDepthToReadShadowMap as e}from"../ForwardLinearDepthToReadShadowMap.glsl.js";import{calculateUVZShadowPass as o,calculateUVZShadowDraw as r,ReadShadowMapOrigin as t}from"./calculateUVZShadow.glsl.js";import{ShadowmapFiltering as d}from"./ShadowmapFiltering.glsl.js";import{FloatBindUniform as i}from"../../shaderModules/FloatBindUniform.js";import{If as s,glsl as n}from"../../shaderModules/glsl.js";import{Texture2DBindUniform as l}from"../../shaderModules/Texture2DBindUniform.js";import{Texture2DShadowBindUniform as h}from"../../shaderModules/Texture2DShadowBindUniform.js";import{NoParameters as c}from"../../../../../webgl/NoParameters.js";class w extends t{}class u extends c{constructor(){super(...arguments),this.origin=a()}}function g(a,e){e.receiveShadows&&a.include(o),p(a,e)}function m(a,e){e.receiveShadows&&a.include(r),p(a,e)}function p(a,o){a.fragment.uniforms.add(new i("lightingGlobalFactor",a=>a.lighting.globalFactor));const{hasShadowHighlights:r,receiveShadows:t,spherical:d}=o;a.include(e,o),t&&f(a,r),a.fragment.code.add(n`
3
3
  float readShadow(float additionalAmbientScale, vec3 vpos) {
4
- return ${d?"max(lightingGlobalFactor * (1.0 - additionalAmbientScale), readShadowMap(vpos, linearDepth))":l(t,"lightingGlobalFactor * (1.0 - additionalAmbientScale)","0.0")};
4
+ return ${t?"max(lightingGlobalFactor * (1.0 - additionalAmbientScale), readShadowMap(vpos, linearDepth))":s(d,"lightingGlobalFactor * (1.0 - additionalAmbientScale)","0.0")};
5
5
  }
6
- `)}function g(a){a.include(r),S(a),a.fragment.code.add(n`float readShadowMap(const in vec3 _worldPos, float _linearDepth) {
6
+ `)}function f(a,e){a.include(d),S(a,e),a.fragment.code.add(n`float readShadowMap(const in vec3 _worldPos, float _linearDepth) {
7
7
  vec3 uvzShadow = calculateUVZShadow(_worldPos, _linearDepth, textureSize(shadowMap, 0));
8
8
  return readShadowMaps(uvzShadow);
9
- }`)}function S(a){a.include(r),a.fragment.uniforms.add(new i("singleShadowMap",({shadowMap:a})=>!!a.getOutput(5)),new h("shadowMap",({shadowMap:a})=>a.getOutput(5)??a.getOutput(7)),new h("shadowMapHighlight",({shadowMap:a})=>a.getOutput(5)??a.getOutput(6))).code.add(n`float readShadowMaps(const in vec3 uvzShadow) {
10
- if (uvzShadow.z < 0.0) {
11
- return 0.0;
12
- }
13
- float shadow1 = readShadowMapUVZ(uvzShadow, shadowMap);
14
- if (singleShadowMap)
15
- return shadow1;
16
- float shadow2 = readShadowMapUVZ(uvzShadow, shadowMapHighlight);
17
- return shadow1 > shadow2 ? shadow1 : shadow2;
18
- }`)}export{f as ReadShadowMapDraw,u as ReadShadowMapDrawParameters,p as ReadShadowMapPass,c as ReadShadowMapPassParameters,S as readShadowMaps};
9
+ }`)}function S(a,e){a.include(d),a.fragment.uniforms.add(new h("shadowMap",({shadowMap:a})=>a.getOutput(5)??a.getOutput(7))),e&&a.fragment.uniforms.add(new l("screenSpaceShadowHighlight",({screenSpaceShadowHighlightFbo:a})=>a?.getTexture())),a.fragment.code.add(n`
10
+ float readShadowMaps(const in vec3 uvzShadow) {
11
+ if (uvzShadow.z < 0.0) {
12
+ return 0.0;
13
+ }
14
+
15
+ float shadow1 = readShadowMapUVZ(uvzShadow, shadowMap);
16
+ // screenSpaceShadowHighlight is generated in camera screen space and assumes a
17
+ ${s(e,n`
18
+ // matching full-resolution receiver viewport when this helper is used.
19
+ float shadow2 = texelFetch(screenSpaceShadowHighlight, ivec2(gl_FragCoord.xy), 0).r;
20
+ return shadow1 > shadow2 ? shadow1 : shadow2;
21
+ `,n`return shadow1;`)}
22
+ }
23
+ `)}export{m as ReadShadowMapDraw,w as ReadShadowMapDrawParameters,g as ReadShadowMapPass,u as ReadShadowMapPassParameters,S as readShadowMaps};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/shading/calculateUVZShadowFromDepth.glsl.js";import"../../core/shaderLibrary/shading/ShadowmapFiltering.glsl.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Texture2DBindUniform.js";import"../../core/shaderModules/Texture2DShadowBindUniform.js";import"../../../../webgl/ShaderBuilder.js";export{b as build}from"../../../../../chunks/ScreenSpaceShadowHighlight.glsl.js";
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{__decorate as e}from"tslib";import{property as r,subclass as t}from"../../../../../core/accessorSupport/decorators.js";import{ZEROS as s}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{InternalRenderCategory as i}from"../../../webgl.js";import o from"../../../webgl/RenderNode.js";import{ReadShadowMapPassParameters as a}from"../../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{ScreenSpaceShadowHighlightTechnique as h}from"./ScreenSpaceShadowHighlightTechnique.js";let n=class extends o{get requireGeometryDepth(){return this.bindParameters.hasShadowHighlights}constructor(e){super(e),this.produces=i.SCREEN_SPACE_SHADOW_HIGHLIGHT,this._passParameters=new a}precompile(){this.bindParameters.hasShadowHighlights&&this.techniques.precompile(h)}render(){const e=this.bindParameters,r=e.hasShadowHighlights,t=null!=e.depth,o=null!=e.shadowMap.getOutput(6);if(!(r&&t&&o))return;const a=this.techniques.getCompiled(h);if(!a)return void this.requestRender(1);const{camera:n}=e,c=this.fboCache.acquire(n.fullWidth,n.fullHeight,i.SCREEN_SPACE_SHADOW_HIGHLIGHT,0);this._passParameters.origin=n.center;const d=this.renderingContext;return d.bindFramebuffer(c.fbo),d.clearFramebuffer(s),n.setGLViewport(d),d.bindTechnique(a,e,this._passParameters),d.screen.draw(),c}};e([r()],n.prototype,"produces",void 0),n=e([t("esri.views.3d.webgl-engine.effects.highlight.ScreenSpaceShadowHighlightRenderNode")],n);export{n as ScreenSpaceShadowHighlightRenderNode};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{__decorate as e}from"tslib";import{subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{ReloadableShader as i}from"../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as o}from"../../core/shaderTechnique/ShaderTechnique.js";import{S as s}from"../../../../../chunks/ScreenSpaceShadowHighlight.glsl.js";import{PrimitiveType as t}from"../../../../webgl/enums.js";import{makePipelineState as h}from"../../../../webgl/renderState.js";let c=class extends o{constructor(){super(...arguments),this.shader=new i(s,()=>import("./ScreenSpaceShadowHighlight.glsl.js")),this.primitiveType=t.TRIANGLE_STRIP}initializePipeline(){return h({colorWrite:{r:!0,g:!1,b:!1,a:!1}})}};c=e([r("esri.views.3d.webgl-engine.effects.highlight.ScreenSpaceShadowHighlightTechnique")],c);export{c as ScreenSpaceShadowHighlightTechnique};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{smoothstep as t,clamp as i}from"../../../../../core/mathUtils.js";import{watch as s,syncAndInitial as a}from"../../../../../core/reactiveUtils.js";import{property as r,subclass as h}from"../../../../../core/accessorSupport/decorators.js";import{normalize as o,set as c,dot as n}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as p}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{RenderNodeOutput as d}from"../../../webgl.js";import m from"../../../webgl/RenderNode.js";import{ShadowHighlightPassParameters as l,ShadowHighlightTechnique as u}from"./ShadowHighlightTechnique.js";import{defaultShadowOpacity as g,defaultShadowDifference as f,defaultShadowColor as _}from"../../../../support/HighlightDefaults.js";const w=1/512,O=4e4,y=5e4;let P=class extends m{constructor(e){super(e),this.produces=d.COMPOSITE,this.consumes={required:[d.COMPOSITE,"highlights"]},this._passParameters=new l,this._maxOpacity=1,this._shadowDifference=.2}initialize(){this.addHandles([s(()=>this.view.defaultHighlight?.shadowOpacity,e=>{this._passParameters.shadowOpacity=e??g,this._updateOccludedShadowOpacity(),this._ensureMaxOpacity()},a),s(()=>this.view.defaultHighlight?.shadowDifference,e=>{this._shadowDifference=e??f,this._updateOccludedShadowOpacity(),this._ensureMaxOpacity()},a),s(()=>this.view.defaultHighlight?.shadowColor,e=>{this._passParameters.shadowColor=(e??_).toUnitRGBA(),this._ensureMaxOpacity()},a)])}_updateOccludedShadowOpacity(){this._passParameters.occludedShadowOpacity=this._passParameters.shadowOpacity*(1-this._shadowDifference)}_ensureMaxOpacity(){const e=Math.max(this._passParameters.shadowOpacity,this._passParameters.occludedShadowOpacity);this._maxOpacity=e*this._passParameters.shadowColor[3],this.requestRender(1)}precompile(){this._ensureIfVisible()&&this.techniques.precompile(u)}render(e){const t=e.find(({name:e})=>e===d.COMPOSITE),i=this.bindParameters;if(!this._ensureIfVisible())return t;const s=this.techniques.getCompiled(u);if(!s)return this.requestRender(1),t;this._passParameters.highlightTexture=e.find(({name:e})=>"highlights"===e)?.getTexture(),this._passParameters.origin=i.camera.center;const a=this.renderingContext,r=t.obtainDepthTexture();return a.bindFramebuffer(t.fbo),a.bindTechnique(s,i,this._passParameters),a.screen.draw(),t.attachDepth(r),r?.release(),t}_ensureIfVisible(){const e=this.bindParameters;if(!e.hasShadowHighlights||!e.mainDepth)return!1;const{camera:s,lighting:a}=e;this._passParameters.opacityElevation=1-t(O,y,s.relativeElevation);const r=1===this.viewingMode?o(b,s.center):c(b,0,0,1),h=n(r,a.mainLight.direction);return this._passParameters.dayNightTerminator=t(0,1,i(30*h,0,1)),this._maxOpacity*this._passParameters.opacityElevation*this._passParameters.dayNightTerminator>=w}};e([r()],P.prototype,"produces",void 0),e([r()],P.prototype,"consumes",void 0),e([r({constructOnly:!0})],P.prototype,"viewingMode",void 0),P=e([h("esri.views.3d.webgl-engine.effects.highlight.ShadowHighlight")],P);const b=p();export{P as ShadowHighlight};
2
+ import{__decorate as e}from"tslib";import{smoothstep as t,clamp as i}from"../../../../../core/mathUtils.js";import{watch as s,syncAndInitial as a}from"../../../../../core/reactiveUtils.js";import{property as r,subclass as h}from"../../../../../core/accessorSupport/decorators.js";import{normalize as o,set as c,dot as n}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as p}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{RenderNodeOutput as d}from"../../../webgl.js";import m from"../../../webgl/RenderNode.js";import{ShadowHighlightPassParameters as l,ShadowHighlightTechnique as u}from"./ShadowHighlightTechnique.js";import{defaultShadowOpacity as g,defaultShadowDifference as f,defaultShadowColor as w}from"../../../../support/HighlightDefaults.js";const _=1/512,O=4e4,y=5e4;let P=class extends m{constructor(e){super(e),this.produces=d.COMPOSITE,this.consumes={required:[d.COMPOSITE,"highlights"]},this._passParameters=new l,this._maxOpacity=1,this._shadowDifference=.2}initialize(){this.addHandles([s(()=>this.view.defaultHighlight?.shadowOpacity,e=>{this._passParameters.shadowOpacity=e??g,this._updateOccludedShadowOpacity(),this._ensureMaxOpacity()},a),s(()=>this.view.defaultHighlight?.shadowDifference,e=>{this._shadowDifference=e??f,this._updateOccludedShadowOpacity(),this._ensureMaxOpacity()},a),s(()=>this.view.defaultHighlight?.shadowColor,e=>{this._passParameters.shadowColor=(e??w).toUnitRGBA(),this._ensureMaxOpacity()},a)])}_updateOccludedShadowOpacity(){this._passParameters.occludedShadowOpacity=this._passParameters.shadowOpacity*(1-this._shadowDifference)}_ensureMaxOpacity(){const e=Math.max(this._passParameters.shadowOpacity,this._passParameters.occludedShadowOpacity);this._maxOpacity=e*this._passParameters.shadowColor[3],this.requestRender(1)}precompile(){this._ensureIfVisible()&&this.techniques.precompile(u)}render(e){const t=e.find(({name:e})=>e===d.COMPOSITE),i=this.bindParameters;if(!this._ensureIfVisible())return t;const s=this.techniques.getCompiled(u);if(!s)return this.requestRender(1),t;this._passParameters.highlightTexture=e.find(({name:e})=>"highlights"===e)?.getTexture(),this._passParameters.origin=i.camera.center;const a=this.renderingContext,r=t.obtainDepthTexture();return a.bindFramebuffer(t.fbo),a.bindTechnique(s,i,this._passParameters),a.screen.draw(),t.attachDepth(r),r?.release(),t}_ensureIfVisible(){const e=this.bindParameters;if(!e.hasShadowHighlights||!e.mainDepth||!e.screenSpaceShadowHighlightFbo?.getTexture())return!1;const{camera:s,lighting:a}=e;this._passParameters.opacityElevation=1-t(O,y,s.relativeElevation);const r=1===this.viewingMode?o(b,s.center):c(b,0,0,1),h=n(r,a.mainLight.direction);return this._passParameters.dayNightTerminator=t(0,1,i(30*h,0,1)),this._maxOpacity*this._passParameters.opacityElevation*this._passParameters.dayNightTerminator>=_}};e([r()],P.prototype,"produces",void 0),e([r()],P.prototype,"consumes",void 0),e([r({constructOnly:!0})],P.prototype,"viewingMode",void 0),P=e([h("esri.views.3d.webgl-engine.effects.highlight.ShadowHighlight")],P);const b=p();export{P as ShadowHighlight};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import"../../../../../core/has.js";import{disposeMaybe as t}from"../../../../../core/maybe.js";import{property as i,subclass as n}from"../../../../../core/accessorSupport/decorators.js";import{copy as s,add as r}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromRay as a,getStart as l,getEnd as h,create as o}from"../../../../../geometry/support/clipRay.js";import{intersectClipRay as c}from"../../../../../geometry/support/frustum.js";import{copy as d}from"../../../../../geometry/support/lineSegment.js";import{wrap as p}from"../../../../../geometry/support/ray.js";import{InternalRenderCategory as u}from"../../../webgl.js";import m from"../../../webgl/RenderNode.js";import{Blit as _}from"../blit/Blit.js";import{LaserlinePathData as g}from"./LaserlinePathData.js";import{LaserlinePathPassParameters as b,LaserlinePathTechnique as f}from"./LaserlinePathTechnique.js";import{LaserlinePathTechniqueConfiguration as P}from"./LaserlinePathTechniqueConfiguration.js";import{LaserlineTechnique as E}from"./LaserlineTechnique.js";import{LaserlineTechniqueConfiguration as q}from"./LaserlineTechniqueConfiguration.js";import{updateParameters as L}from"../../materials/internal/MaterialUtil.js";let V=class extends m{constructor(e){super(e),this.isDecoration=!0,this.produces=u.LASERLINES,this.consumes={required:[u.LASERLINES,"normals"]},this.requireGeometryDepth=!0,this._configuration=new q,this._pathTechniqueConfiguration=new P,this._heightManifoldEnabled=!1,this._pointDistanceEnabled=!1,this._lineVerticalPlaneEnabled=!1,this._intersectsLineEnabled=!1,this._intersectsLineInfinite=!1,this._pathVerticalPlaneEnabled=!1,this._passParameters=new b;const t=e.view.stage.renderView.techniques,i=new P;i.contrastControlEnabled=e.contrastControlEnabled,t.precompile(f,i)}initialize(){this._passParameters.renderCoordsHelper=this.view.renderCoordsHelper,this._pathTechniqueConfiguration.spherical=1===this.view.state.viewingMode,this._pathTechniqueConfiguration.contrastControlEnabled=this.contrastControlEnabled,this._techniques.precompile(f,this._pathTechniqueConfiguration),this._blit=new _(this._techniques,2)}destroy(){this._pathVerticalPlaneData=t(this._pathVerticalPlaneData),this._blit=null}get _techniques(){return this.view.stage.renderView.techniques}get heightManifoldEnabled(){return this._heightManifoldEnabled}set heightManifoldEnabled(e){this._heightManifoldEnabled!==e&&(this._heightManifoldEnabled=e,this.requestRender(1))}get heightManifoldTarget(){return this._passParameters.heightManifoldTarget}set heightManifoldTarget(e){s(this._passParameters.heightManifoldTarget,e),this.requestRender(1)}get pointDistanceEnabled(){return this._pointDistanceEnabled}set pointDistanceEnabled(e){e!==this._pointDistanceEnabled&&(this._pointDistanceEnabled=e,this.requestRender(1))}get pointDistanceTarget(){return this._passParameters.pointDistanceTarget}set pointDistanceTarget(e){s(this._passParameters.pointDistanceTarget,e),this.requestRender(1)}get pointDistanceOrigin(){return this._passParameters.pointDistanceOrigin}set pointDistanceOrigin(e){s(this._passParameters.pointDistanceOrigin,e),this.requestRender(1)}get lineVerticalPlaneEnabled(){return this._lineVerticalPlaneEnabled}set lineVerticalPlaneEnabled(e){e!==this._lineVerticalPlaneEnabled&&(this._lineVerticalPlaneEnabled=e,this.requestRender(1))}get lineVerticalPlaneSegment(){return this._passParameters.lineVerticalPlaneSegment}set lineVerticalPlaneSegment(e){d(e,this._passParameters.lineVerticalPlaneSegment),this.requestRender(1)}get intersectsLineEnabled(){return this._intersectsLineEnabled}set intersectsLineEnabled(e){e!==this._intersectsLineEnabled&&(this._intersectsLineEnabled=e,this.requestRender(1))}get intersectsLineSegment(){return this._passParameters.intersectsLineSegment}set intersectsLineSegment(e){d(e,this._passParameters.intersectsLineSegment),this.requestRender(1)}get intersectsLineInfinite(){return this._intersectsLineInfinite}set intersectsLineInfinite(e){e!==this._intersectsLineInfinite&&(this._intersectsLineInfinite=e,this.requestRender(1))}get pathVerticalPlaneEnabled(){return this._pathVerticalPlaneEnabled}set pathVerticalPlaneEnabled(e){e!==this._pathVerticalPlaneEnabled&&(this._pathVerticalPlaneEnabled=e,null!=this._pathVerticalPlaneData&&this.requestRender(1))}set pathVerticalPlaneVertices(e){null==this._pathVerticalPlaneData&&(this._pathVerticalPlaneData=new g(this._passParameters.renderCoordsHelper)),this._pathVerticalPlaneData.vertices=e,this.pathVerticalPlaneEnabled&&this.requestRender(1)}set pathVerticalPlaneBuffers(e){null==this._pathVerticalPlaneData&&(this._pathVerticalPlaneData=new g(this._passParameters.renderCoordsHelper)),this._pathVerticalPlaneData.buffers=e,this.pathVerticalPlaneEnabled&&this.requestRender(1)}setParameters(e){L(this._passParameters,e)&&this.requestRender(1)}precompile(){this._acquireTechnique(),this._blit?.precompile(),this.pathVerticalPlaneEnabled&&this._pathVerticalPlaneData&&this._techniques.precompile(f,this._pathTechniqueConfiguration)}render(e){const t=e.find(({name:e})=>e===this.produces);if(this.isDecoration&&!this.bindParameters.decorations||null==this._blit)return t;const i=this.renderingContext,n=e.find(({name:e})=>"normals"===e);if(this._passParameters.normals=n?.getTexture(),!this.contrastControlEnabled)return i.bindFramebuffer(t.fbo),this._renderLaserLines(),t;this._passParameters.colors=t.getTexture();const s=this.fboCache.acquire(t.fbo.width,t.fbo.height,"laser lines");return i.bindFramebuffer(s.fbo),i.setClearColor(0,0,0,0),i.clear(16640),this._renderLaserLines(),i.unbindTexture(t.getTexture()),this._blit.blend(i,s,t,this.bindParameters)||this.requestRender(1),s.release(),t}_renderLaserLines(){(this.heightManifoldEnabled||this.pointDistanceEnabled||this.lineVerticalPlaneSegment||this.intersectsLineEnabled)&&this._renderUnified(),this.pathVerticalPlaneEnabled&&this._renderPath()}_acquireTechnique(){return this._configuration.heightManifoldEnabled=this.heightManifoldEnabled,this._configuration.lineVerticalPlaneEnabled=this.lineVerticalPlaneEnabled,this._configuration.pointDistanceEnabled=this.pointDistanceEnabled,this._configuration.intersectsLineEnabled=this.intersectsLineEnabled,this._configuration.contrastControlEnabled=this.contrastControlEnabled,this._configuration.spherical=1===this.view.state.viewingMode,this._techniques.getCompiled(E,this._configuration)}_renderUnified(){if(!this._updatePassParameters())return;const e=this._acquireTechnique();if(e){const t=this.renderingContext;t.bindTechnique(e,this.bindParameters,this._passParameters),t.screen.draw()}else this.requestRender(1)}_renderPath(){if(null==this._pathVerticalPlaneData)return;const e=this._techniques.get(f,this._pathTechniqueConfiguration);if(e.compiled){const t=this.renderingContext;this._passParameters.origin=this._pathVerticalPlaneData.origin,t.bindTechnique(e,this.bindParameters,this._passParameters),this._pathVerticalPlaneData.draw(t)}else this.requestRender(1)}_updatePassParameters(){if(!this._intersectsLineEnabled)return!0;const e=this.bindParameters.camera,t=this._passParameters;if(this._intersectsLineInfinite){if(a(p(t.intersectsLineSegment.origin,t.intersectsLineSegment.vector),D),D.c0=-Number.MAX_VALUE,!c(e.frustum,D))return!1;l(D,t.lineStartWorld),h(D,t.lineEndWorld)}else s(t.lineStartWorld,t.intersectsLineSegment.origin),r(t.lineEndWorld,t.intersectsLineSegment.origin,t.intersectsLineSegment.vector);return!0}get test(){}};e([i({constructOnly:!0})],V.prototype,"contrastControlEnabled",void 0),e([i()],V.prototype,"isDecoration",void 0),e([i()],V.prototype,"produces",void 0),e([i()],V.prototype,"consumes",void 0),V=e([n("esri.views.3d.webgl-engine.effects.laserlines.LaserLineRenderer")],V);const D=o();export{V as LaserLineRenderer};
2
+ import{__decorate as e}from"tslib";import"../../../../../core/has.js";import{disposeMaybe as t}from"../../../../../core/maybe.js";import{property as i,subclass as n}from"../../../../../core/accessorSupport/decorators.js";import{copy as s,add as r}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromRay as a,getStart as l,getEnd as h,create as o}from"../../../../../geometry/support/clipRay.js";import{intersectClipRay as c}from"../../../../../geometry/support/frustum.js";import{copy as d}from"../../../../../geometry/support/lineSegment.js";import{wrap as p}from"../../../../../geometry/support/ray.js";import{InternalRenderCategory as u}from"../../../webgl.js";import m from"../../../webgl/RenderNode.js";import{Blit as _}from"../blit/Blit.js";import{LaserlinePathData as g}from"./LaserlinePathData.js";import{LaserlinePathPassParameters as b,LaserlinePathTechnique as f}from"./LaserlinePathTechnique.js";import{LaserlinePathTechniqueConfiguration as P}from"./LaserlinePathTechniqueConfiguration.js";import{LaserlineTechnique as E}from"./LaserlineTechnique.js";import{LaserlineTechniqueConfiguration as q}from"./LaserlineTechniqueConfiguration.js";import{updateParameters as L}from"../../materials/internal/MaterialUtil.js";let V=class extends m{get requireGeometryDepth(){return!0}constructor(e){super(e),this.isDecoration=!0,this.produces=u.LASERLINES,this.consumes={required:[u.LASERLINES,"normals"]},this._configuration=new q,this._pathTechniqueConfiguration=new P,this._heightManifoldEnabled=!1,this._pointDistanceEnabled=!1,this._lineVerticalPlaneEnabled=!1,this._intersectsLineEnabled=!1,this._intersectsLineInfinite=!1,this._pathVerticalPlaneEnabled=!1,this._passParameters=new b;const t=e.view.stage.renderView.techniques,i=new P;i.contrastControlEnabled=e.contrastControlEnabled,t.precompile(f,i)}initialize(){this._passParameters.renderCoordsHelper=this.view.renderCoordsHelper,this._pathTechniqueConfiguration.spherical=1===this.view.state.viewingMode,this._pathTechniqueConfiguration.contrastControlEnabled=this.contrastControlEnabled,this._techniques.precompile(f,this._pathTechniqueConfiguration),this._blit=new _(this._techniques,2)}destroy(){this._pathVerticalPlaneData=t(this._pathVerticalPlaneData),this._blit=null}get _techniques(){return this.view.stage.renderView.techniques}get heightManifoldEnabled(){return this._heightManifoldEnabled}set heightManifoldEnabled(e){this._heightManifoldEnabled!==e&&(this._heightManifoldEnabled=e,this.requestRender(1))}get heightManifoldTarget(){return this._passParameters.heightManifoldTarget}set heightManifoldTarget(e){s(this._passParameters.heightManifoldTarget,e),this.requestRender(1)}get pointDistanceEnabled(){return this._pointDistanceEnabled}set pointDistanceEnabled(e){e!==this._pointDistanceEnabled&&(this._pointDistanceEnabled=e,this.requestRender(1))}get pointDistanceTarget(){return this._passParameters.pointDistanceTarget}set pointDistanceTarget(e){s(this._passParameters.pointDistanceTarget,e),this.requestRender(1)}get pointDistanceOrigin(){return this._passParameters.pointDistanceOrigin}set pointDistanceOrigin(e){s(this._passParameters.pointDistanceOrigin,e),this.requestRender(1)}get lineVerticalPlaneEnabled(){return this._lineVerticalPlaneEnabled}set lineVerticalPlaneEnabled(e){e!==this._lineVerticalPlaneEnabled&&(this._lineVerticalPlaneEnabled=e,this.requestRender(1))}get lineVerticalPlaneSegment(){return this._passParameters.lineVerticalPlaneSegment}set lineVerticalPlaneSegment(e){d(e,this._passParameters.lineVerticalPlaneSegment),this.requestRender(1)}get intersectsLineEnabled(){return this._intersectsLineEnabled}set intersectsLineEnabled(e){e!==this._intersectsLineEnabled&&(this._intersectsLineEnabled=e,this.requestRender(1))}get intersectsLineSegment(){return this._passParameters.intersectsLineSegment}set intersectsLineSegment(e){d(e,this._passParameters.intersectsLineSegment),this.requestRender(1)}get intersectsLineInfinite(){return this._intersectsLineInfinite}set intersectsLineInfinite(e){e!==this._intersectsLineInfinite&&(this._intersectsLineInfinite=e,this.requestRender(1))}get pathVerticalPlaneEnabled(){return this._pathVerticalPlaneEnabled}set pathVerticalPlaneEnabled(e){e!==this._pathVerticalPlaneEnabled&&(this._pathVerticalPlaneEnabled=e,null!=this._pathVerticalPlaneData&&this.requestRender(1))}set pathVerticalPlaneVertices(e){null==this._pathVerticalPlaneData&&(this._pathVerticalPlaneData=new g(this._passParameters.renderCoordsHelper)),this._pathVerticalPlaneData.vertices=e,this.pathVerticalPlaneEnabled&&this.requestRender(1)}set pathVerticalPlaneBuffers(e){null==this._pathVerticalPlaneData&&(this._pathVerticalPlaneData=new g(this._passParameters.renderCoordsHelper)),this._pathVerticalPlaneData.buffers=e,this.pathVerticalPlaneEnabled&&this.requestRender(1)}setParameters(e){L(this._passParameters,e)&&this.requestRender(1)}precompile(){this._acquireTechnique(),this._blit?.precompile(),this.pathVerticalPlaneEnabled&&this._pathVerticalPlaneData&&this._techniques.precompile(f,this._pathTechniqueConfiguration)}render(e){const t=e.find(({name:e})=>e===this.produces);if(this.isDecoration&&!this.bindParameters.decorations||null==this._blit)return t;const i=this.renderingContext,n=e.find(({name:e})=>"normals"===e);if(this._passParameters.normals=n?.getTexture(),!this.contrastControlEnabled)return i.bindFramebuffer(t.fbo),this._renderLaserLines(),t;this._passParameters.colors=t.getTexture();const s=this.fboCache.acquire(t.fbo.width,t.fbo.height,"laser lines");return i.bindFramebuffer(s.fbo),i.setClearColor(0,0,0,0),i.clear(16640),this._renderLaserLines(),i.unbindTexture(t.getTexture()),this._blit.blend(i,s,t,this.bindParameters)||this.requestRender(1),s.release(),t}_renderLaserLines(){(this.heightManifoldEnabled||this.pointDistanceEnabled||this.lineVerticalPlaneSegment||this.intersectsLineEnabled)&&this._renderUnified(),this.pathVerticalPlaneEnabled&&this._renderPath()}_acquireTechnique(){return this._configuration.heightManifoldEnabled=this.heightManifoldEnabled,this._configuration.lineVerticalPlaneEnabled=this.lineVerticalPlaneEnabled,this._configuration.pointDistanceEnabled=this.pointDistanceEnabled,this._configuration.intersectsLineEnabled=this.intersectsLineEnabled,this._configuration.contrastControlEnabled=this.contrastControlEnabled,this._configuration.spherical=1===this.view.state.viewingMode,this._techniques.getCompiled(E,this._configuration)}_renderUnified(){if(!this._updatePassParameters())return;const e=this._acquireTechnique();if(e){const t=this.renderingContext;t.bindTechnique(e,this.bindParameters,this._passParameters),t.screen.draw()}else this.requestRender(1)}_renderPath(){if(null==this._pathVerticalPlaneData)return;const e=this._techniques.get(f,this._pathTechniqueConfiguration);if(e.compiled){const t=this.renderingContext;this._passParameters.origin=this._pathVerticalPlaneData.origin,t.bindTechnique(e,this.bindParameters,this._passParameters),this._pathVerticalPlaneData.draw(t)}else this.requestRender(1)}_updatePassParameters(){if(!this._intersectsLineEnabled)return!0;const e=this.bindParameters.camera,t=this._passParameters;if(this._intersectsLineInfinite){if(a(p(t.intersectsLineSegment.origin,t.intersectsLineSegment.vector),D),D.c0=-Number.MAX_VALUE,!c(e.frustum,D))return!1;l(D,t.lineStartWorld),h(D,t.lineEndWorld)}else s(t.lineStartWorld,t.intersectsLineSegment.origin),r(t.lineEndWorld,t.intersectsLineSegment.origin,t.intersectsLineSegment.vector);return!0}get test(){}};e([i({constructOnly:!0})],V.prototype,"contrastControlEnabled",void 0),e([i()],V.prototype,"isDecoration",void 0),e([i()],V.prototype,"produces",void 0),e([i()],V.prototype,"consumes",void 0),V=e([n("esri.views.3d.webgl-engine.effects.laserlines.LaserLineRenderer")],V);const D=o();export{V as LaserLineRenderer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{releaseMaybe as t}from"../../../../core/maybe.js";import{signal as i}from"../../../../core/signal.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import h from"../../webgl/RenderCamera.js";import{isColor as s}from"../core/shaderLibrary/ShaderOutput.js";import{CloudsParameters as r}from"../effects/clouds/CloudsParameters.js";import{ReprojectionUniforms as n}from"./ReprojectionUniforms.js";import{ScreenSpaceReflectionsUniforms as l}from"./ScreenSpaceReflectionsUniforms.js";import{SceneLighting as o}from"../lighting/SceneLighting.js";class g{constructor(t,i){this.width=t,this.height=i}}const a=5e5;class c{constructor(t,s){this._rctx=t,this.shadowMap=s,this._output=0,this.slot=2,this.slicePlane=null,this.hasOccludees=!1,this.hasEmission=!1,this.useFloatBlend=i(!0),this.enableFillLights=!0,this.alignPixelEnabled=!1,this.decorations=!0,this.overlayStretch=1,this.viewshedEnabled=!1,this.cutFillComputationEnabled=!1,this.cutFillVisualizationEnabled=!1,this._camera=new h,this._inverseViewport=e(),this._oldLighting=new o,this._newLighting=new o,this._fadedLighting=new o,this._lighting=this._newLighting,this.screenSpaceReflections=new l,this.reprojection=new n,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.highlights=new Array,this.highlightOrderMap=new Map,this.highlightMixOrigin=e(),this.highlightMixTexture=null,this.hudRenderStyle=0,this.snowCover=0,this.clouds=new r,this.hasShadowHighlights=!1}destroy(){this._camera=null,this.contentCamera=null,this.depth=t(this.depth),this.geometryDepth=null,this.mainDepth=null,this.overlay=null,this.ssao=null,this.terrainDepth=null,this.shadowMap?.dispose()}get output(){return this._output}set output(t){this._output!==t&&(this._output=t,this._rctx.resetDrawBuffers(t))}get camera(){return this._camera}set camera(t){this._camera=t,this._inverseViewport[0]=1/t.fullViewport[2],this._inverseViewport[1]=1/t.fullViewport[3]}get enableOITOffset(){return 1===this.output&&this.camera.relativeElevation<a}get inverseViewport(){return this._inverseViewport}get lighting(){return this._lighting}fadeLighting(){switch(this.clouds.fadeFactor){case 0:this._lighting=this._oldLighting;break;default:this._fadedLighting.lerpLighting(this._oldLighting,this._newLighting,this.clouds.fadeFactor),this._lighting=this._fadedLighting;break;case 1:this._lighting=this._newLighting,this._oldLighting.copyFrom(this._newLighting)}}updateLighting(t,i,e,h){this._oldLighting.copyFrom(this.lighting),this._newLighting.noonFactor=i,this._newLighting.globalFactor=e,this._newLighting.set(t),this._oldLighting.updateLegacy(),1===h&&this.clouds.requestFade(),this.fadeLighting()}get hasScreenSpaceReflections(){return s(this.output)&&this.screenSpaceReflections.enabled&&null!=this.reprojection.lastFrameColor}get highlight(){return null==this.highlightLevel?null:this.highlights[this.highlightLevel]}get depth(){return this._depth}set depth(t){t&&(t.name="geometry depth"),this._depth=t}get occluder(){return 11===this.slot||12===this.slot?this.slot:null}}export{c as BindParameters,g as ViewportSize};
2
+ import{releaseMaybe as t}from"../../../../core/maybe.js";import{signal as i}from"../../../../core/signal.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import h from"../../webgl/RenderCamera.js";import{isColor as s}from"../core/shaderLibrary/ShaderOutput.js";import{CloudsParameters as r}from"../effects/clouds/CloudsParameters.js";import{ReprojectionUniforms as n}from"./ReprojectionUniforms.js";import{ScreenSpaceReflectionsUniforms as l}from"./ScreenSpaceReflectionsUniforms.js";import{SceneLighting as o}from"../lighting/SceneLighting.js";class g{constructor(t,i){this.width=t,this.height=i}}const a=5e5;class c{constructor(t,s){this._rctx=t,this.shadowMap=s,this._output=0,this.slot=2,this.slicePlane=null,this.hasOccludees=!1,this.hasEmission=!1,this.useFloatBlend=i(!0),this.enableFillLights=!0,this.alignPixelEnabled=!1,this.decorations=!0,this.overlayStretch=1,this.viewshedEnabled=!1,this.cutFillComputationEnabled=!1,this.cutFillVisualizationEnabled=!1,this._camera=new h,this._inverseViewport=e(),this._oldLighting=new o,this._newLighting=new o,this._fadedLighting=new o,this._lighting=this._newLighting,this.screenSpaceReflections=new l,this.reprojection=new n,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.highlights=new Array,this.highlightOrderMap=new Map,this.highlightMixOrigin=e(),this.highlightMixTexture=null,this.hudRenderStyle=0,this.snowCover=0,this.clouds=new r,this.hasShadowHighlights=!1}destroy(){this._camera=null,this.contentCamera=null,this.depth=t(this.depth),this.geometryDepth=null,this.mainDepth=null,this.overlay=null,this.ssao=null,this.screenSpaceShadowHighlightFbo=t(this.screenSpaceShadowHighlightFbo),this.terrainDepth=null,this.shadowMap?.dispose()}get output(){return this._output}set output(t){this._output!==t&&(this._output=t,this._rctx.resetDrawBuffers(t))}get camera(){return this._camera}set camera(t){this._camera=t,this._inverseViewport[0]=1/t.fullViewport[2],this._inverseViewport[1]=1/t.fullViewport[3]}get enableOITOffset(){return 1===this.output&&this.camera.relativeElevation<a}get inverseViewport(){return this._inverseViewport}get lighting(){return this._lighting}fadeLighting(){switch(this.clouds.fadeFactor){case 0:this._lighting=this._oldLighting;break;default:this._fadedLighting.lerpLighting(this._oldLighting,this._newLighting,this.clouds.fadeFactor),this._lighting=this._fadedLighting;break;case 1:this._lighting=this._newLighting,this._oldLighting.copyFrom(this._newLighting)}}updateLighting(t,i,e,h){this._oldLighting.copyFrom(this.lighting),this._newLighting.noonFactor=i,this._newLighting.globalFactor=e,this._newLighting.set(t),this._oldLighting.updateLegacy(),1===h&&this.clouds.requestFade(),this.fadeLighting()}get hasScreenSpaceReflections(){return s(this.output)&&this.screenSpaceReflections.enabled&&null!=this.reprojection.lastFrameColor}get highlight(){return null==this.highlightLevel?null:this.highlights[this.highlightLevel]}get depth(){return this._depth}set depth(t){t&&(t.name="geometry depth"),this._depth=t}get occluder(){return 11===this.slot||12===this.slot?this.slot:null}}export{c as BindParameters,g as ViewportSize};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import"../../../../core/has.js";import{removeMaybe as s,abortMaybe as i,destroyMaybe as a,releaseMaybe as n,releaseReferencedMaybe as h}from"../../../../core/maybe.js";import{throwIfAborted as o}from"../../../../core/promiseUtils.js";import{watch as d,syncAndInitial as l,initial as _,sync as u}from"../../../../core/reactiveUtils.js";import{signal as p}from"../../../../core/signal.js";import{property as m,subclass as c}from"../../../../core/accessorSupport/decorators.js";import{equals as f,invert as g,multiply as b}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as P,create as T}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as E}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as w,ZEROS as C}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as A}from"../../../../geometry/support/Indices.js";import{RenderNodeOutput as D,InternalRenderCategory as R,AllRenderNodeOutputs as S,AllInternalRenderNodeOutputs as I}from"../../webgl.js";import{minNearDistanceInMeters as O}from"../../state/NearFarHeuristic.js";import{debugFlags as x}from"../../support/debugFlags.js";import"../../webgl/ManagedDepthAttachment.js";import{FBOCache as F}from"../core/FBOCache.js";import{RenderPassManager as y}from"../core/renderPasses/RenderPassManager.js";import{isColor as N}from"../core/shaderLibrary/ShaderOutput.js";import{distanceFadeEnd as v}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{hasOit8Bit as H,hasEmissive8Bit as M}from"../effects/fboFormatUtils.js";import{RenderNodes as G}from"../effects/RenderNodes.js";import{RenderPluginManager as q}from"../effects/RenderPluginManager.js";import{WeatherFader as L}from"../effects/WeatherFader.js";import{innerAtmosphereFadeStart as U}from"../effects/atmosphere/atmosphereUtils.js";import{Blit as j}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as B,renderHighlightBuffer as V}from"../effects/highlight/Highlight.js";import{OITBlend as k}from"../effects/transparency/OITBlend.js";import{AnimationTimer as z}from"./AnimationTimer.js";import{AnimationTimeStep as W}from"./AnimationTimeStep.js";import{BoundingInfo as Q}from"./BoundingInfo.js";import{Compositor as Y}from"./Compositor.js";import{DepthRange as $}from"./DepthRange.js";import{depthRangeFromScene as J}from"./depthRangeUtils.js";import{MainFramebuffer as K}from"./MainFramebuffer.js";import{RenderContext as Z,defaultRenderOccludedMask as X}from"./RenderContext.js";import{RendererBase as ee}from"./RendererBase.js";import{setupFeatureDefaults as te}from"./RenderFeature.js";import{RenderPluginInput as re}from"./RenderPluginInput.js";import{ShadowAccumulator as se}from"./ShadowAccumulator.js";import{ShadowMap as ie}from"./ShadowMap.js";import ae from"./SliceHelper.js";import{MergedRenderer as ne}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as he}from"../parts/renderUtils.js";import{RendererPerformanceInfo as oe,PerformanceCategory as de}from"../statistics/RendererPerformanceInfo.js";import{PixelType as le,ColorAttachment1 as _e,ColorAttachment2 as ue,ColorAttachment0 as pe}from"../../../webgl/enums.js";let me=class extends ee{constructor(e,t,r,s,i){super({stage:e}),this._techniques=r,this._rctx=s,this._requestRender=i,this._pluginsHas={occludedHudElements:!1,hudElements:!1,water:!1},this.renderPassManager=new y,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=w(0,0,0,1),this._sliceHelper=new ae,this.sceneDepthRange=p($.Infinite),this._state=p(2),this._hasOit8Bit=H(),this._hasEmissive8Bit=M(),this._hasAnimations=!1,this._animationTimestep=new W,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=p(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new re,this._hasTransparentGeometry=!1,this._oitCallouts=!1,this._releaseNodeInputs=e=>{for(const t of Re)e.some(({name:e})=>e===t)&&this._pluginInput.release(t)},this._testsNeedsDepth=!1,this._fboCache=new F(s),this._compositor=new Y(s,r),this._renderStateFeatures=p(te(e.view.qualityProfile));const a=new ie(this._fboCache,e.viewingMode);this._renderContext=new Z(this._rctx,a,r),this._framebuffer=new K(this._fboCache,this._bindParameters),this._performanceInfo=new oe(this._rctx),this._blit=new j(r),this._shadowAccumulator=new se(this.fboCache,r,e,e=>{const t=this.shadowsEnabled;a.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),a.enabled=t},(t,r,s)=>{const i=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,r,s,!0,i),this._renderShadowCascades(5,t.shadowMap),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)},i),this._nodes=new G(this._renderContext),this._plugins=new q({renderContext:this._renderContext,techniques:r,materials:t,requestRender:i,controller:e}),this._plugins.add(this.renderPassManager),this.weatherFader=new L({view:e.view,context:this._renderContext}),this.addHandles([d(()=>e.view.state.camera,()=>i(),l),d(()=>x.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},i()},_),d(()=>e.view.environment.background?.color,e=>{const t=e?e.toUnitRGBA():C;E(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),i()},l),d(()=>e.view.state.camera.relativeElevation,e=>this._inGlobeView=(e??1/0)>=v,l),d(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},u),d(()=>this._bindParameters.clouds.data?.state,()=>i(),u),d(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,i()},_),d(()=>"sun"===e.view.environment.lighting?.type,e=>{this._bindParameters.enableFillLights=e,this._requestRender()},l)])}destroy(){this._gpuTimerHandle=s(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowAccumulator.destroy(),this._shadowAccumulator=null,this._loadEdgeViewTask=i(this._loadEdgeViewTask),this._edgeView=a(this._edgeView),this.renderPassManager.dispose(),this.weatherFader=a(this.weatherFader),this._releaseFBOs(),this._disposeOffscreenBuffers(),this._fboCache.destroy(),this._fboCache=null,this._renderContext.destroy(),this._plugins.destroy(),this._pluginInput=null,this._oitBlendOrNil=null,this._nodes=null,this._framebuffer=null,this._performanceInfo=null,Q.prune(),ne.prune(),A()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _oitBlend(){return this._oitBlendOrNil??=new k(this._techniques),this._oitBlendOrNil}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e){this._renderStateFeatures.value=te(e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,r){this._renderStateFeatures.mutate(s=>s.set(t,e,r)),this._requestRender()}get _highQualityTransparency(){return this.isFeatureEnabled(1)}get hasReflections(){return this._bindParameters.screenSpaceReflections.enabled=this._pluginsHas.water&&this.isFeatureEnabled(5),this._bindParameters.screenSpaceReflections.enabled}get _hasHighlights(){return this._plugins.produces(10,2,4,19,13,14,15)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(10,13,14,15)}get hasSSAO(){return this.isFeatureEnabled(4)&&!this._inGlobeView}get hasSMAA(){return this.isFeatureEnabled(0)}get _hasEmission(){return this._plugins.hasEmitters&&(this._hasEmissive8Bit||this.hasFloatBlend)}get hasFloatBlend(){return this._rctx.driverTest.floatBufferBlend.result&&this.isFeatureEnabled(10)}get oitEnabled(){return this.hasFloatBlend||this._hasOit8Bit}get highResolutionAtmosphere(){return this.isFeatureEnabled(3)}get fboCache(){return this._fboCache}_releaseFBOs(){this._bindParameters.terrainDepth=n(this._bindParameters.terrainDepth),this._bindParameters.geometryDepth=n(this._bindParameters.geometryDepth),this._bindParameters.hudOcclusion=n(this._bindParameters.hudOcclusion),this._bindParameters.depth=null}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._bindParameters.shadowMap.disposeOutputs()}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._shadowAccumulator.readyToRun||this._plugins.updating||this.weatherFader?.readyToRun||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=r(async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");o(e);const r=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:xe(this.stage.view.resourceController)});return this.addHandles(d(()=>r.updating,()=>this._requestRender(),u)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(r)),this._edgeViewCallbacks.length=0,r})),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&f(this._bindParameters.reprojection.matrix,P)}set _reprojectionMatrix(e){t(this._bindParameters.reprojection.matrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._bindParameters.shadowMap.enabled}setParameters(e){void 0!==e.shadowMap&&this._bindParameters.shadowMap.enabled!==e.shadowMap&&(this._bindParameters.shadowMap.enabled=e.shadowMap,this._requestRender()),e.shadowCast&&this._shadowAccumulator.setParameters(e.shadowCast)}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}rendererAdded(e){this._plugins.add(e)}rendererRemoved(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this.occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(8&this.plugins.renderOccludedFlags)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,10)}updateHasFlags(){const has=this._pluginsHas;has.occludedHudElements=this._plugins.produces(0,14),has.hudElements=has.occludedHudElements||this._plugins.produces(0,...Ee),has.water=this._plugins.produces(4,20),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new z(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const r=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==r&&(this._gpuTimerHandle=r?s(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,r,s=!1){try{return this._isRendering=!0,this._render(e,t,r,s)}catch(i){console.error(`Exception during rendering: ${i}:\n${i.stack}`)}finally{this._isRendering=!1}return new he(this._pluginInput.get(D.FINAL),null)}_render(e,t,r,s){const i=0===r;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=i,this._disposeBindBuffers();const{camera:a,contentCamera:o,mode:d,alignPixelEnabled:l}=e;this._state.value=d,this._renderContext.time=t,this._bindParameters.output=0,this._bindParameters.hasEmission=this._hasEmission,this._bindParameters.alignPixelEnabled=l,this._bindParameters.decorations=!s,this._bindParameters.mainDepth=null,this._bindParameters.useFloatBlend.value=this.hasFloatBlend;const _=!s||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=_?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(R.VIEWSHED),this._bindParameters.cutFillComputationEnabled=this._nodes.produces(R.CUTFILL_COMPUTATION),this._bindParameters.cutFillVisualizationEnabled=this._nodes.produces(R.CUTFILL_COLOR),this._renderOverlay(),a.setGLViewport(this._rctx);const u=this._framebuffer,p=u.initialize(a.fullWidth,a.fullHeight,this._backgroundColor);this.hasReflections?(p?.setName("last frame color"),this._bindParameters.reprojection.lastFrameColor=p):p?.release(),this._ensureBindParametersCamera(a,o),this._ensureBindParametersWeatherFader(this._renderContext.time),this._plugins.sortTestsTransparentOrderedSlots(Ce),this._plugins.prepareRender(),this._bindParameters.hasShadowHighlights=this._needsShadowHighlight&&!s,this._hasTransparentGeometry=this._plugins.produces(0,...fe),this._precompilePrepasses(),this.performanceInfo.advance(de.PREPARE);const m=this._computeShadowDepthRange(a);this._renderShadowMap(a,this._bindParameters.lighting.mainLight.direction,m),this._pluginInput.set("normals",this._renderNormals()),this._renderAmbientIlluminationAndDepth(),this._renderShadowAccumulation(m,!i),this._oitCallouts=this._hasTransparentGeometry&&this.oitEnabled,this._ensureBindParametersSSR(t),u.bind(),this._bindParameters.mainDepth=u.depth.attachment,this._precompileShaders(),this._bindParameters.output=0,this._renderOpaque(),this._renderTransparent(),this._bindParameters.reprojection.lastFrameColor=n(this._bindParameters.reprojection.lastFrameColor),this.hasReflections&&(this._bindParameters.depth=h(this._bindParameters.depth)),this._bindParameters.shadowMap.disposeOutput(5),this._renderCutFillComputation(),this._pluginInput.set(R.FOCUSAREA,this._renderFocusAreaGeometry()),u.update(e=>this._renderNodes(R.TRANSPARENT_ENVIRONMENT,e)),u.update(e=>this._renderNodes(R.VIEWSHED,e)),u.update(e=>this._renderNodes(R.LASERLINES,e)),this._nodes.requireGeometryDepth&&(this._bindParameters.depth=h(this._bindParameters.depth)),u.update(e=>this._renderNodes(R.FOCUSAREA_COLOR,e)),u.update(e=>this._renderNodes(R.CUTFILL_COLOR,e)),this._pluginInput.release(R.FOCUSAREA),this._pluginInput.release(R.GROUND_DEPTH),u.update(e=>this._renderNodes(R.OCCLUDED,e)),this._pluginInput.set("highlights",this._renderHighlightPrepass());const c=2===r?this._renderObjectAndLayerIdColor():null;u.update(e=>this._renderNodes(D.COMPOSITE,e)),this._bindParameters.shadowMap.disposeOutputs(),u.update(e=>this._renderNodes(R.ANTIALIASING,e));const f=this._hasPhotoshopTerrain||!this._hasTransparentGeometry?1:2;let g;return this._bindParameters.hasEmission=!1,this._hasHUDHighlights&&u.update(e=>this._renderHUD(f,e)),u.update(e=>this._renderNodes(R.HIGHLIGHT_COLOR,e)),this._hasHUDHighlights||u.update(e=>this._renderHUD(f,e)),this._bindParameters.hasEmission=this._hasEmission,u.update(e=>this._renderNodes(R.MAGNIFIER,e)),u.update(e=>this._renderNodes(D.FINAL,e)),i&&this._blit.toFramebuffer(this._rctx,u.color,this._bindParameters),this._testsNeedsDepth&&(this._bindParameters.depth=h(this._bindParameters.depth)),this._releaseFBOs(),u.releaseDepth(),this._bindParameters.reprojection.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),i||(g=u.color,g.retain(),this._releaseFBOs(),this._disposeOffscreenBuffers()),this.performanceInfo.finishFrame(),new he(g,c)}_precompileShaders(){++this._plugins.context.techniques.precompiling,this._bindParameters.output=0;const e=this._bindParameters.hasEmission;this._precompileOpaqueGeometry(),this._nodes.precompile(e,R.OPAQUE_ENVIRONMENT,R.PRE_TRANSPARENT);const t=this._bindParameters;if(t.terrainDepthTest=t.cullAboveTerrain=this._needsTerrainDepth,this._bindParameters.output=3,this._plugins.precompile(...ge),this._bindParameters.output=0,this._plugins.precompile(...ge),this._hasTransparentGeometry){const e=this._pluginsHas.occludedHudElements;this._oitBlend.precompile(this._bindParameters,e,0),this._pluginsHas.hudElements&&this._oitBlend.precompile(this._bindParameters,!1,1)}this._hasTransparentGeometry&&(this._precompileTransparentGeometry(),this._hasPhotoshopTerrain&&(t.cullAboveTerrain=!1,this._precompileTransparentGeometry(),t.cullAboveTerrain=this._needsTerrainDepth)),this._nodes.precompile(e,R.FOCUSAREA);const r=this._hasPhotoshopTerrain&&!this._needsTerrainDepth;this._compositor.precompile(this._usesPremultipliedAlphaBlit,!!this._needsEdges,r,e),this._oitCallouts||this._plugins.precompile(16),t.terrainDepthTest=t.cullAboveTerrain=!1,this._nodes.precompile(e,R.TRANSPARENT_ENVIRONMENT,R.VIEWSHED,R.CUTFILL_COMPUTATION,R.CUTFILL_COLOR,R.LASERLINES,R.FOCUSAREA_COLOR,R.OCCLUDED,R.ANTIALIASING),t.highlightMixTexture=t.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(0),t.hasEmission=!1,this._precompileHUD(0),this._precompileHUD(1),t.hasEmission=this._hasEmission,this._hasHighlights&&(t.highlights.forEach((e,r)=>{t.highlightLevel=r,this._precompileAllGeometry(10),this._hasHUDHighlights&&this._plugins.precompile(14,13)}),t.highlightLevel=null,this._nodes.precompile(e,R.HIGHLIGHT_COLOR)),t.highlightMixTexture=null,this._nodes.precompile(e,D.COMPOSITE,R.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(9),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(R.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(de.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces("olid"))return null;const e=this._bindParameters.output;++this._techniques.precompiling;const{width:t,height:r}=this._framebuffer.size;let s=this.fboCache.acquire(t,r,"olid");return s.acquireDepth(13),s=this._nodes.render(s,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(de.OBJECT_AND_LAYER_ID_COLOR),this._bindParameters.output=e,s}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=0===e;if(r||t){const e=r?this.performanceInfo.elapsedTime:0;let s=0;t?s=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const i=Math.max(e,s);this._animationTimestep.frame(i,r)}}readMainDepth(e,t){const{mainDepth:r,camera:s}=this._bindParameters;if(!r)return;const i=this.fboCache.acquire(this._framebuffer.size.width,this._framebuffer.size.height,"linear depth");this._rctx.bindFramebuffer(i.fbo),s.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(C),this._compositor.blitDepthToLinearDepth(this._bindParameters,r),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),i.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,le.UNSIGNED_BYTE,t),i.release()}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}get _needsEdges(){return this._edgeView?.shouldRender()?this._edgeView:null}_renderEdges(e){const t=this._needsEdges;if(!t)return;const{width:r,height:s}=this._framebuffer.size,i=this.fboCache.acquire(r,s,"edges"),a=this._bindParameters.geometryDepth,n=()=>t.render(this._bindParameters,e);this._renderToTargets(n,i,a??this._framebuffer.depth,C),this._framebuffer.bind(),this._compositor.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(1===e?de.OPAQUE_EDGES:de.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(this._renderContext.time),this._bindParameters.overlay&&this.performanceInfo.advance(de.OVERLAY)}_renderShadowMap(e,t,r){if(!this.shadowsEnabled)return;const s=this._bindParameters.shadowMap;s.start(e,t,r,this.isFeatureEnabled(6),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(7,s),s.clear(),this._renderShadowCascades(6,s)):this._renderShadowCascades(5),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this.performanceInfo.advance(de.SHADOW_MAP)}_renderCutFillComputation(){this._nodes.produce(R.CUTFILL_COMPUTATION,this._pluginInput)?.release()}_precompileShadowCascades(e){0!==this._bindParameters.shadowMap.cascades.length&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._bindParameters.shadowMap){const r=this._bindParameters.output;t.bindFramebuffer();for(const s of t.cascades)s.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(s.camera,s.camera),this.renderAllGeometry(e);t.finish(e),this._bindParameters.output=r}get _needsDepth(){return+this._nodes.requireGeometryDepth+ +this.hasReflections+ +this._shadowAccumulator.accumulating+ +this._testsNeedsDepth}get _usesPremultipliedAlphaBlit(){return this._pluginsHas.hudElements&&this.oitEnabled||this._hasPhotoshopTerrain}_renderAmbientIlluminationAndDepth(){this._bindParameters.depth=n(this._bindParameters.depth);const e=this._pluginInput.get("normals");if(e){this._pluginInput.set(R.AMBIENT_ILLUMINATION,this._renderSSAO());const t=this._needsDepth;t?(this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(3),this._bindParameters.depth=e.obtainDepthTexture(),this._bindParameters.depth?.retain(t-1),this.performanceInfo.advance(de.DEPTH)):e.detachDepth(),this.hasSSAO&&this._pluginInput.release("normals")}else this._renderAllGeometryDepth()}_renderAllGeometryDepth(){const e=this._needsDepth;if(0===e)return;const{width:t,height:r}=this._framebuffer.size,s=this.fboCache.acquire(t,r,"geometry",13);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(1280),this.renderAllGeometry(3),this._bindParameters.depth=s.obtainDepthTexture(),this._bindParameters.depth?.retain(e-1),s.release(),this.performanceInfo.advance(de.DEPTH)}_renderTerrainDepth(){if(this._bindParameters.terrainDepth=n(this._bindParameters.terrainDepth),this._bindParameters.terrainDepthTest=this._bindParameters.cullAboveTerrain=this._needsTerrainDepth,!this._needsTerrainDepth)return;const e=this._bindParameters.output;this._bindParameters.output=3;const{width:t,height:r}=this._framebuffer.size,s=this.fboCache.acquire(t,r,"terrain",13);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(1280),this._renderTransparentGround(),this._bindParameters.terrainDepth=s.obtainDepthTexture(),s.release(),this._bindParameters.output=e}_renderGeometryDepth(){if(this._bindParameters.geometryDepth=n(this._bindParameters.geometryDepth),!this._needsTerrainDepth)return;const e=this._bindParameters.output,{width:t,height:r}=this._framebuffer.size,s=this.fboCache.acquire(t,r,"geometry",13);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(1280),this._renderOpaqueAndTransparentGeometry(3),this._bindParameters.output=e,this._bindParameters.geometryDepth=s.obtainDepthTexture(),s.release()}get _needsShadowDepthRange(){return this._bindParameters.shadowMap.enabled||this._shadowAccumulator.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return $.Zero;const t=J(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal)return void(this.sceneDepthRange.value=$.Infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<U)return void(this.sceneDepthRange.value=$.Infinite);const t=e.clone();t.near=O,t.far=1e10;const r=J(t,this._plugins.plugins,this.stage.layers,1);r.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(r)||(this.sceneDepthRange.value=r)}get _normalsRequired(){const e=this._nodes.require("normals",...S,R.VIEWSHED,R.LASERLINES);return(this.hasSSAO?1:0)+e}_precompilePrepasses(){this._normalsRequired?(this._precompilePlugins(4,be),this._needsDepth&&this._precompilePlugins(3,Pe)):this._needsDepth&&this._precompileAllGeometry(3),this.shadowsEnabled&&(this._needsShadowHighlight?(this._precompileShadowCascades(6),this._precompileShadowCascades(7)):this._precompileShadowCascades(5)),this._shadowAccumulator.active&&this._precompileAllGeometry(5),this.hasSSAO&&this._normalsRequired&&this._nodes.precompile(this._bindParameters.hasEmission,R.AMBIENT_ILLUMINATION)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const{width:t,height:r}=this._framebuffer.size,s=this.fboCache.acquire(t,r,"normals",5);s.acquireDepth(13),this._rctx.bindFramebuffer(s.fbo),this._rctx.clearFramebuffer(C,!0,!0),this._bindParameters.output=4,this._plugins.render(...be);const i=this._nodes.optional("normals",...S,R.VIEWSHED);return s.retain(e+i-1),this.performanceInfo.advance(de.NORMALS),s}_renderSSAO(){const e=this._pluginInput.get("normals");if(this.hasSSAO&&e)return this._bindParameters.ssao=this._nodes.produce(R.AMBIENT_ILLUMINATION,this._pluginInput),this._bindParameters.ssao&&this.performanceInfo.advance(de.AMBIENT_ILLUMINATION),this._bindParameters.ssao}_precompileAllGeometry(e){const t=this._bindParameters.output;this._bindParameters.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(...ge),this._bindParameters.output=t}renderAllGeometry(e){this._bindParameters.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentGround()}precompileSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const r of t)this._renderContext.renderOccludedMask=r,this.precompileSlots(e,...Te);this._renderContext.renderOccludedMask=X}renderSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.forAll(e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)})}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>1&&this._plugins.render(10),this.renderSlots(e,...Te),this._renderContext.renderOccludedMask=X}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Ae[e])}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(17),this.renderHUD(e),this._bindParameters.hudRenderStyle=e,this._plugins.render(15)}precompileViewshedShadowMap(){this._precompileAllGeometry(8)}precompileCutFillOrthographicReferenceDepth(){this._precompilePlugins(9,De)}_precompilePlugins(e,t){const r=this._bindParameters.output;this._bindParameters.output=e,this._plugins.precompile(...t),this._bindParameters.output=r}renderViewshedShadowMap(e){const{camera:t,contentCamera:r}=this._bindParameters,s=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(8),this._ensureBindParametersCamera(t,r),this._bindParameters.camera.setGLViewport(this._rctx),this._bindParameters.output=s}renderCutFillOrthographicReferenceDepth(e){const{camera:t,contentCamera:r}=this._bindParameters,s=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._bindParameters.output=9,this._plugins.render(...De),this._ensureBindParametersCamera(t,r),t.setGLViewport(this._rctx),this._bindParameters.output=s}get _needsGroundDepth(){return this._bindParameters.cutFillVisualizationEnabled}_blitGroundDepth(){if(!this._needsGroundDepth)return null;const{width:e,height:t}=this._framebuffer.size,r=this.fboCache.acquire(e,t,R.GROUND_DEPTH,13);return this._rctx.blitFramebuffer(this._framebuffer.color.fbo,r.fbo,256),this._framebuffer.bind(),r}_renderOpaqueAndTransparentGeometry(e){this._bindParameters.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithoutNormals(e){this._bindParameters.output=e,this._plugins.render(...Pe)}_precompileOpaqueGeometry(){this._needsOpaquePass&&(this._plugins.precompile(...ce),this._nodes.precompile(this._bindParameters.hasEmission,"opaque-color"))}_renderOpaqueGeometry(){this._plugins.render(...ce)}_renderTransparentGeometry(){this._plugins.render(...fe),this._oitCallouts&&this._plugins.render(16)}get _hasPhotoshopTerrain(){return this._plugins.produces(0,6)}get _needsTerrainDepth(){return this._highQualityTransparency&&this._hasPhotoshopTerrain}_renderPhotoshopTerrain(){if(!this._hasPhotoshopTerrain)return null;const{width:e,height:t}=this._framebuffer.size,r=this.fboCache.acquire(e,t,"transparent terrain"),s=()=>this._plugins.render(6);return this._renderToTargets(s,r,this._framebuffer.depth,C),this.performanceInfo.advance(de.TRANSPARENT_TERRAIN),r}_renderTransparentGround(){this._plugins.render(...ge)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,0===e){const e=()=>this._plugins.render(16),{width:t,height:r}=this._framebuffer.size,s=this.fboCache.acquireDepth(this._hudDepthFormat,t,r,"line callouts");this._renderToTargets(e,this._framebuffer.color,s,void 0,!0,!0),s.release()}else this._plugins.render(16)}_precompileHUD(e){if(!this._pluginsHas.hudElements)return;const t=this._bindParameters.output,r=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this.oitEnabled?(this._bindParameters.output=1,this._plugins.precompile(...Ee),this._bindParameters.output=2,this._plugins.precompile(...Ee),this._bindParameters.output=0,this._oitBlend.precompile(this._bindParameters,!1,1)):(this._bindParameters.output=0,this._plugins.precompile(...Ee)),this._hasHighlights&&(this._bindParameters.output=10,this._plugins.precompile(...Ee)),this._bindParameters.output=t,this._bindParameters.hudRenderStyle=r}_renderHUD(e,t){if(!this._pluginsHas.hudElements)return t;if(this.oitEnabled){const r=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo);const s=!!t.getTexture(_e);this._compositor.compositePreMultipliedAlpha(this._bindParameters,r.getTexture(),s),r.release()}else if(this._bindParameters.output=0,0===e){const t=()=>this._renderHUDElements(e),{width:r,height:s}=this._framebuffer.size,i=this.fboCache.acquireDepth(this._hudDepthFormat,r,s,"hud");this._renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(this._hudDepthFormat),this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(256),this._renderHUDElements(e),t.detachDepth();return this.performanceInfo.advance(0===e?de.HUD_OCCLUDED:de.HUD),t}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(6,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:r}=this,{width:s,height:i}=this._framebuffer.size,{highlights:a}=r,n=a.length>B?3:1,h=e.acquire(s,i,"highlights",n);h.acquireDepth(13);const o=this._plugins.produces(10,0);return o&&this._framebuffer.color.fbo&&h.fbo&&t.blitFramebuffer(this._framebuffer.color.fbo,h.fbo,1024),t.bindFramebuffer(h.fbo),t.gl.clearBufferuiv(6144,0,[0,0,0,0]),o||t.clear(1024),this._bindParameters.output=10,t.bindFramebuffer(h.fbo),V(t,e,s,i,r,()=>this._renderHighlightGeometries()),h.detachDepth(),this.performanceInfo.advance(de.HIGHLIGHTS),h.retain(this._nodes.require("highlights",...I)+this._nodes.optional("highlights",...I)-1),h}_renderHighlightGeometries(){this._plugins.render(...we),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e,t){this._shadowAccumulator.updateDepthRange(e),this._bindParameters.output=0,this._shadowAccumulator.accumulating&&this._bindParameters.depth&&(this._shadowAccumulator.renderAccumulation(this._bindParameters,t)&&this.performanceInfo.advance(de.ACCUMULATED_SHADOWS),this._bindParameters.depth=h(this._bindParameters.depth))}_precompileTransparentGeometry(){this.oitEnabled&&N(this._bindParameters.output)?(this._bindParameters.output=1,this._plugins.precompile(...fe),this._oitCallouts&&this._plugins.precompile(16),this._bindParameters.output=2,this._plugins.precompile(...fe),this._oitCallouts&&this._plugins.precompile(16),this._bindParameters.output=0):this._plugins.precompile(...fe)}_renderOIT(e,t=2){const r=1===e,{width:s,height:i}=this._framebuffer.size,a=r?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=h.useFloatBlend.value?8:5,d=h.output;h.output=1;const l=r?"oit hud":"oit",_=this.fboCache.acquire(s,i,l,o),u=h.hasEmission&&(0===e||1!==t);u&&_.acquireColor(_e,o,"oit emissive");const p=u?ue:_e;_.acquireColor(p,this.hasFloatBlend?7:0,"oit alpha"),r||_.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(_.fbo),this._rctx.clearFramebuffer([0,0,0,1]),u&&this._rctx.clearBuffer(1,C),a(),_.detachDepth(),h.output=2;const m=this.fboCache.acquire(s,i,r?"oit hud front":"oit front");u&&m.acquireColor(_e,o,"oit emissive front"),r?m.acquireDepth(this._hudDepthFormat):m.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(m.fbo),this._rctx.clearFramebuffer(C,r),a(),m.detachDepth();const c=this._pluginsHas.occludedHudElements&&!r;let f;return h.hudOcclusion=n(this._bindParameters.hudOcclusion),h.output=0,r?(f=this.fboCache.acquire(s,i,"oit hud composite"),this._rctx.bindFramebuffer(f.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):(c&&(this._framebuffer.color.acquireColor(p,0,"hud occlusion"),this._rctx.clearBuffer(p-pe,C)),this._framebuffer.bind()),this._oitBlend.blend(this._rctx,_,m,h,u,c,e),f?.detachDepth(),r||(this._rctx.bindFramebuffer(m.fbo),this._framebuffer.bind(),c&&(h.hudOcclusion=this._framebuffer.color.obtainAttachment(p))),m.release(),_.release(),h.output=d,f}get _hudDepthFormat(){return this.isFeatureEnabled(8)?13:12}get _needsOpaquePass(){return this.plugins.produces(0,...ce)||this.plugins.produces(5,...ce)||this.plugins.produces(3,3)}_renderOpaque(){const e=this._needsOpaquePass;e&&(this._plugins.render(0,1),this._pluginInput.set(R.GROUND_DEPTH,this._blitGroundDepth()),this._plugins.render(2,3));const t=this._framebuffer;this._renderTerrainDepth(),t.update(t=>this._renderNodes(D.OPAQUE,t,e)),this.fboCache.debugCallback?.(D.OPAQUE,t.color.fbo),t.update(e=>this._renderNodes(R.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(R.OPAQUE_ENVIRONMENT,t.color.fbo),this._renderEdges(1)}_renderTransparent(){const e=this._framebuffer;e.bind(),e.update(e=>this._renderNodes(R.PRE_TRANSPARENT,e)),this.fboCache.debugCallback?.(R.PRE_TRANSPARENT,e.color.fbo),this._renderHiddenTransparentEdges(),this._hasTransparentGeometry&&(this.oitEnabled?this._renderOIT(0):this._renderTransparentGeometry()),e.update(e=>this._renderNodes(D.TRANSPARENT,e,this._hasTransparentGeometry)),this.fboCache.debugCallback?.(D.TRANSPARENT,e.color.fbo),this._renderGeometryDepth(),this._needsTerrainDepth||this._oitCallouts||this._plugins.render(16),this._renderEdges(0);const t=this._renderPhotoshopTerrain(),r=t?.getTexture();r&&this._renderHUD(0,e.color),this._bindParameters.cullAboveTerrain=!1,r&&(e.bind(),this._compositor.compositePreMultipliedAlpha(this._bindParameters,r),t?.release(),this._needsTerrainDepth&&(this._renderEdges(1),this._hasTransparentGeometry&&(this.oitEnabled?this._renderOIT(0):this._renderTransparentGeometry(),this.performanceInfo.advance(de.TRANSPARENT)),this._renderEdges(0))),this._bindParameters.ssao=n(this._bindParameters.ssao),this._needsTerrainDepth&&this._renderLineCallouts(1),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(de.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(9),this.performanceInfo.advance(de.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderNodes(e,t,r=!1){const s=t.name;if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return r&&this.performanceInfo.advance(e),t;this._fboCache.debugCallback?.(s,t.fbo);const i=this._nodes.render(t,this._pluginInput,this._releaseNodeInputs);return this.performanceInfo.advance(e),i}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersWeatherFader(e){1===this.stage.viewingMode&&(this._bindParameters.clouds.data&&(this._bindParameters.clouds.fade(this._bindParameters.camera,e,this.stage.view.qualitySettings.fadeDuration),this.weatherFader?.cleanupCubemap()),this._bindParameters.snowCover=this.weatherFader?.snowCover??0)}_ensureBindParametersSSR(e){const{screenSpaceReflections:t,reprojection:r,camera:s}=this._bindParameters;if(this.hasReflections){null==this._ssrEnableTime&&(this._ssrEnableTime=e),r.lastFrameCamera.equals(s)?this._reprojectionMatrix=P:(g(Ie,s.viewMatrix),g(Se,s.projectionMatrix),b(Oe,Ie,Se),b(Oe,r.lastFrameCamera.viewMatrix,Oe),b(Oe,r.lastFrameCamera.projectionMatrix,Oe),this._reprojectionMatrix=Oe);const i=this.stage.view.qualitySettings.fadeDuration;t.fadeFactor=i>0?Math.min(i,e-this._ssrEnableTime)/i:1,t.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=P,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,r,s){this._bindParameters.updateLighting(e,t,r,s),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0,clouds:this.weatherFader?.usedMemory??0}}_renderToTargets(e,t,r,s,i=!1,a=!1){t.attachDepth(r),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(s,i,a),e(),t.detachDepth()}get test(){}};e([m({readOnly:!0})],me.prototype,"highResolutionAtmosphere",null),e([m()],me.prototype,"_edgeView",void 0),e([m()],me.prototype,"updating",null),me=e([c("esri.views.3d.webgl-engine.lib.Renderer")],me);const ce=[0,1,2,3],fe=[8,7,4,5],ge=[6,8,7],be=[0,1,2,4,...ge],Pe=[3,5],Te=[2,4,9],Ee=[17,13,15,14],we=[4,5,2,3,0,1,...ge],Ce=[4,9,5,12],Ae={0:[14],1:[13],2:[14,13],3:[14,13]},De=[0,1,...ge],Re=["normals","highlights"],Se=T(),Ie=T(),Oe=T();function xe(e){return t=>e.immediate.schedule(t)}export{me as Renderer};
2
+ import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import"../../../../core/has.js";import{removeMaybe as s,abortMaybe as i,destroyMaybe as a,releaseMaybe as n,releaseReferencedMaybe as h}from"../../../../core/maybe.js";import{throwIfAborted as o}from"../../../../core/promiseUtils.js";import{watch as d,syncAndInitial as _,initial as l,sync as u}from"../../../../core/reactiveUtils.js";import{signal as p}from"../../../../core/signal.js";import{property as m,subclass as c}from"../../../../core/accessorSupport/decorators.js";import{equals as f,invert as g,multiply as b}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as P,create as T}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as E}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as w,ZEROS as C}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as A}from"../../../../geometry/support/Indices.js";import{RenderNodeOutput as D,InternalRenderCategory as S,AllRenderNodeOutputs as R,AllInternalRenderNodeOutputs as I}from"../../webgl.js";import{minNearDistanceInMeters as O}from"../../state/NearFarHeuristic.js";import{debugFlags as x}from"../../support/debugFlags.js";import"../../webgl/ManagedDepthAttachment.js";import{FBOCache as F}from"../core/FBOCache.js";import{RenderPassManager as H}from"../core/renderPasses/RenderPassManager.js";import{isColor as y}from"../core/shaderLibrary/ShaderOutput.js";import{distanceFadeEnd as N}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{hasOit8Bit as v,hasEmissive8Bit as G}from"../effects/fboFormatUtils.js";import{RenderNodes as M}from"../effects/RenderNodes.js";import{RenderPluginManager as q}from"../effects/RenderPluginManager.js";import{WeatherFader as L}from"../effects/WeatherFader.js";import{innerAtmosphereFadeStart as U}from"../effects/atmosphere/atmosphereUtils.js";import{Blit as j}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as B,renderHighlightBuffer as V}from"../effects/highlight/Highlight.js";import{OITBlend as k}from"../effects/transparency/OITBlend.js";import{AnimationTimer as W}from"./AnimationTimer.js";import{AnimationTimeStep as z}from"./AnimationTimeStep.js";import{BoundingInfo as Q}from"./BoundingInfo.js";import{Compositor as Y}from"./Compositor.js";import{DepthRange as $}from"./DepthRange.js";import{depthRangeFromScene as J}from"./depthRangeUtils.js";import{MainFramebuffer as K}from"./MainFramebuffer.js";import{RenderContext as Z,defaultRenderOccludedMask as X}from"./RenderContext.js";import{RendererBase as ee}from"./RendererBase.js";import{setupFeatureDefaults as te}from"./RenderFeature.js";import{RenderPluginInput as re}from"./RenderPluginInput.js";import{ShadowAccumulator as se}from"./ShadowAccumulator.js";import{ShadowMap as ie}from"./ShadowMap.js";import ae from"./SliceHelper.js";import{MergedRenderer as ne}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as he}from"../parts/renderUtils.js";import{RendererPerformanceInfo as oe,PerformanceCategory as de}from"../statistics/RendererPerformanceInfo.js";import{PixelType as _e,ColorAttachment1 as le,ColorAttachment2 as ue,ColorAttachment0 as pe}from"../../../webgl/enums.js";let me=class extends ee{constructor(e,t,r,s,i){super({stage:e}),this._techniques=r,this._rctx=s,this._requestRender=i,this._pluginsHas={occludedHudElements:!1,hudElements:!1,water:!1},this.renderPassManager=new H,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=w(0,0,0,1),this._sliceHelper=new ae,this.sceneDepthRange=p($.Infinite),this._state=p(2),this._hasOit8Bit=v(),this._hasEmissive8Bit=G(),this._hasAnimations=!1,this._animationTimestep=new z,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=p(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new re,this._hasTransparentGeometry=!1,this._oitCallouts=!1,this._releaseNodeInputs=e=>{for(const t of Se)e.some(({name:e})=>e===t)&&this._pluginInput.release(t)},this._testsNeedsDepth=!1,this._fboCache=new F(s),this._compositor=new Y(s,r),this._renderStateFeatures=p(te(e.view.qualityProfile));const a=new ie(this._fboCache,e.viewingMode);this._renderContext=new Z(this._rctx,a,r),this._framebuffer=new K(this._fboCache,this._bindParameters),this._performanceInfo=new oe(this._rctx),this._blit=new j(r),this._shadowAccumulator=new se(this.fboCache,r,e,e=>{const t=this.shadowsEnabled;a.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),a.enabled=t},(t,r,s)=>{const i=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,r,s,!0,i),this._renderShadowCascades(5,t.shadowMap),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)},i),this._nodes=new M(this._renderContext),this._plugins=new q({renderContext:this._renderContext,techniques:r,materials:t,requestRender:i,controller:e}),this._plugins.add(this.renderPassManager),this.weatherFader=new L({view:e.view,context:this._renderContext}),this.addHandles([d(()=>e.view.state.camera,()=>i(),_),d(()=>x.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},i()},l),d(()=>e.view.environment.background?.color,e=>{const t=e?e.toUnitRGBA():C;E(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),i()},_),d(()=>e.view.state.camera.relativeElevation,e=>this._inGlobeView=(e??1/0)>=N,_),d(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},u),d(()=>this._bindParameters.clouds.data?.state,()=>i(),u),d(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,i()},l),d(()=>"sun"===e.view.environment.lighting?.type,e=>{this._bindParameters.enableFillLights=e,this._requestRender()},_)])}destroy(){this._gpuTimerHandle=s(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowAccumulator.destroy(),this._shadowAccumulator=null,this._loadEdgeViewTask=i(this._loadEdgeViewTask),this._edgeView=a(this._edgeView),this.renderPassManager.dispose(),this.weatherFader=a(this.weatherFader),this._releaseFBOs(),this._disposeOffscreenBuffers(),this._fboCache.destroy(),this._fboCache=null,this._renderContext.destroy(),this._plugins.destroy(),this._pluginInput=null,this._oitBlendOrNil=null,this._nodes=null,this._framebuffer=null,this._performanceInfo=null,Q.prune(),ne.prune(),A()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _oitBlend(){return this._oitBlendOrNil??=new k(this._techniques),this._oitBlendOrNil}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e){this._renderStateFeatures.value=te(e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,r){this._renderStateFeatures.mutate(s=>s.set(t,e,r)),this._requestRender()}get _highQualityTransparency(){return this.isFeatureEnabled(1)}get hasReflections(){return this._bindParameters.screenSpaceReflections.enabled=this._pluginsHas.water&&this.isFeatureEnabled(5),this._bindParameters.screenSpaceReflections.enabled}get _hasHighlights(){return this._plugins.produces(10,2,4,19,13,14,15)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(10,13,14,15)}get hasSSAO(){return this.isFeatureEnabled(4)&&!this._inGlobeView}get hasSMAA(){return this.isFeatureEnabled(0)}get _hasEmission(){return this._plugins.hasEmitters&&(this._hasEmissive8Bit||this.hasFloatBlend)}get hasFloatBlend(){return this._rctx.driverTest.floatBufferBlend.result&&this.isFeatureEnabled(10)}get oitEnabled(){return this.hasFloatBlend||this._hasOit8Bit}get highResolutionAtmosphere(){return this.isFeatureEnabled(3)}get fboCache(){return this._fboCache}_releaseFBOs(){this._bindParameters.terrainDepth=n(this._bindParameters.terrainDepth),this._bindParameters.geometryDepth=n(this._bindParameters.geometryDepth),this._bindParameters.hudOcclusion=n(this._bindParameters.hudOcclusion),this._bindParameters.depth=null,this._bindParameters.screenSpaceShadowHighlightFbo=n(this._bindParameters.screenSpaceShadowHighlightFbo)}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._bindParameters.shadowMap.disposeOutputs()}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._shadowAccumulator.readyToRun||this._plugins.updating||this.weatherFader?.readyToRun||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=r(async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");o(e);const r=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:xe(this.stage.view.resourceController)});return this.addHandles(d(()=>r.updating,()=>this._requestRender(),u)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(r)),this._edgeViewCallbacks.length=0,r})),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&f(this._bindParameters.reprojection.matrix,P)}set _reprojectionMatrix(e){t(this._bindParameters.reprojection.matrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._bindParameters.shadowMap.enabled}setParameters(e){void 0!==e.shadowMap&&this._bindParameters.shadowMap.enabled!==e.shadowMap&&(this._bindParameters.shadowMap.enabled=e.shadowMap,this._requestRender()),e.shadowCast&&this._shadowAccumulator.setParameters(e.shadowCast)}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}rendererAdded(e){this._plugins.add(e)}rendererRemoved(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this.occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(8&this.plugins.renderOccludedFlags)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,10)}updateHasFlags(){const has=this._pluginsHas;has.occludedHudElements=this._plugins.produces(0,14),has.hudElements=has.occludedHudElements||this._plugins.produces(0,...Ee),has.water=this._plugins.produces(4,20),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new W(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const r=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==r&&(this._gpuTimerHandle=r?s(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,r,s=!1){try{return this._isRendering=!0,this._render(e,t,r,s)}catch(i){console.error(`Exception during rendering: ${i}:\n${i.stack}`)}finally{this._isRendering=!1}return new he(this._pluginInput.get(D.FINAL),null)}_render(e,t,r,s){const i=0===r;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=i,this._disposeBindBuffers();const{camera:a,contentCamera:o,mode:d,alignPixelEnabled:_}=e;this._state.value=d,this._renderContext.time=t,this._bindParameters.output=0,this._bindParameters.hasEmission=this._hasEmission,this._bindParameters.alignPixelEnabled=_,this._bindParameters.decorations=!s,this._bindParameters.mainDepth=null,this._bindParameters.useFloatBlend.value=this.hasFloatBlend;const l=!s||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=l?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(S.VIEWSHED),this._bindParameters.cutFillComputationEnabled=this._nodes.produces(S.CUTFILL_COMPUTATION),this._bindParameters.cutFillVisualizationEnabled=this._nodes.produces(S.CUTFILL_COLOR),this._renderOverlay(),a.setGLViewport(this._rctx);const u=this._framebuffer,p=u.initialize(a.fullWidth,a.fullHeight,this._backgroundColor);this.hasReflections?(p?.setName("last frame color"),this._bindParameters.reprojection.lastFrameColor=p):p?.release(),this._ensureBindParametersCamera(a,o),this._ensureBindParametersWeatherFader(this._renderContext.time),this._plugins.sortTestsTransparentOrderedSlots(Ce),this._bindParameters.hasShadowHighlights=this._needsShadowHighlight&&!s,this._plugins.prepareRender(),this._hasTransparentGeometry=this._plugins.produces(0,...fe),this._precompilePrepasses(),this.performanceInfo.advance(de.PREPARE);const m=this._computeShadowDepthRange(a);this._pluginInput.set("normals",this._renderNormals()),this._renderAmbientIlluminationAndDepth(),this._renderShadowMap(a,o,this._bindParameters.lighting.mainLight.direction,m),this._renderShadowAccumulation(m,!i),this._oitCallouts=this._hasTransparentGeometry&&this.oitEnabled,this._ensureBindParametersSSR(t),u.bind(),this._bindParameters.mainDepth=u.depth.attachment,this._precompileShaders(),this._bindParameters.output=0,this._renderOpaque(),this._renderTransparent(),this._bindParameters.reprojection.lastFrameColor=n(this._bindParameters.reprojection.lastFrameColor),this.hasReflections&&(this._bindParameters.depth=h(this._bindParameters.depth)),this._bindParameters.shadowMap.disposeOutput(5),this._renderCutFillComputation(),this._pluginInput.set(S.FOCUSAREA,this._renderFocusAreaGeometry()),u.update(e=>this._renderNodes(S.TRANSPARENT_ENVIRONMENT,e)),u.update(e=>this._renderNodes(S.VIEWSHED,e)),u.update(e=>this._renderNodes(S.LASERLINES,e)),this._nodes.requireGeometryDepth&&(this._bindParameters.depth=h(this._bindParameters.depth)),u.update(e=>this._renderNodes(S.FOCUSAREA_COLOR,e)),u.update(e=>this._renderNodes(S.CUTFILL_COLOR,e)),this._pluginInput.release(S.FOCUSAREA),this._pluginInput.release(S.GROUND_DEPTH),u.update(e=>this._renderNodes(S.OCCLUDED,e)),this._pluginInput.set("highlights",this._renderHighlightPrepass());const c=2===r?this._renderObjectAndLayerIdColor():null;u.update(e=>this._renderNodes(D.COMPOSITE,e)),this._bindParameters.shadowMap.disposeOutputs(),this._bindParameters.screenSpaceShadowHighlightFbo=n(this._bindParameters.screenSpaceShadowHighlightFbo),u.update(e=>this._renderNodes(S.ANTIALIASING,e));const f=this._hasPhotoshopTerrain||!this._hasTransparentGeometry?1:2;let g;return this._bindParameters.hasEmission=!1,this._hasHUDHighlights&&u.update(e=>this._renderHUD(f,e)),u.update(e=>this._renderNodes(S.HIGHLIGHT_COLOR,e)),this._hasHUDHighlights||u.update(e=>this._renderHUD(f,e)),this._bindParameters.hasEmission=this._hasEmission,u.update(e=>this._renderNodes(S.MAGNIFIER,e)),u.update(e=>this._renderNodes(D.FINAL,e)),i&&this._blit.toFramebuffer(this._rctx,u.color,this._bindParameters),this._testsNeedsDepth&&(this._bindParameters.depth=h(this._bindParameters.depth)),this._releaseFBOs(),u.releaseDepth(),this._bindParameters.reprojection.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),i||(g=u.color,g.retain(),this._releaseFBOs(),this._disposeOffscreenBuffers()),this.performanceInfo.finishFrame(),new he(g,c)}_precompileShaders(){++this._plugins.context.techniques.precompiling,this._bindParameters.output=0;const e=this._bindParameters.hasEmission;this._precompileOpaqueGeometry(),this._nodes.precompile(e,S.OPAQUE_ENVIRONMENT,S.PRE_TRANSPARENT);const t=this._bindParameters;if(t.terrainDepthTest=t.cullAboveTerrain=this._needsTerrainDepth,this._bindParameters.output=3,this._plugins.precompile(...ge),this._bindParameters.output=0,this._plugins.precompile(...ge),this._hasTransparentGeometry){const e=this._pluginsHas.occludedHudElements;this._oitBlend.precompile(this._bindParameters,e,0),this._pluginsHas.hudElements&&this._oitBlend.precompile(this._bindParameters,!1,1)}this._hasTransparentGeometry&&(this._precompileTransparentGeometry(),this._hasPhotoshopTerrain&&(t.cullAboveTerrain=!1,this._precompileTransparentGeometry(),t.cullAboveTerrain=this._needsTerrainDepth)),this._nodes.precompile(e,S.FOCUSAREA);const r=this._hasPhotoshopTerrain&&!this._needsTerrainDepth;this._compositor.precompile(this._usesPremultipliedAlphaBlit,!!this._needsEdges,r,e),this._oitCallouts||this._plugins.precompile(16),t.terrainDepthTest=t.cullAboveTerrain=!1,this._nodes.precompile(e,S.TRANSPARENT_ENVIRONMENT,S.VIEWSHED,S.CUTFILL_COMPUTATION,S.CUTFILL_COLOR,S.LASERLINES,S.FOCUSAREA_COLOR,S.OCCLUDED,S.ANTIALIASING),t.highlightMixTexture=t.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(0),t.hasEmission=!1,this._precompileHUD(0),this._precompileHUD(1),t.hasEmission=this._hasEmission,this._hasHighlights&&(t.highlights.forEach((e,r)=>{t.highlightLevel=r,this._precompileAllGeometry(10),this._hasHUDHighlights&&this._plugins.precompile(14,13)}),t.highlightLevel=null,this._nodes.precompile(e,S.HIGHLIGHT_COLOR)),t.highlightMixTexture=null,this._nodes.precompile(e,D.COMPOSITE,S.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(9),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(S.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(de.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces("olid"))return null;const e=this._bindParameters.output;++this._techniques.precompiling;const{width:t,height:r}=this._framebuffer.size;let s=this.fboCache.acquire(t,r,"olid");return s.acquireDepth(13),s=this._nodes.render(s,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(de.OBJECT_AND_LAYER_ID_COLOR),this._bindParameters.output=e,s}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=0===e;if(r||t){const e=r?this.performanceInfo.elapsedTime:0;let s=0;t?s=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const i=Math.max(e,s);this._animationTimestep.frame(i,r)}}readMainDepth(e,t){const{mainDepth:r,camera:s}=this._bindParameters;if(!r)return;const i=this.fboCache.acquire(this._framebuffer.size.width,this._framebuffer.size.height,"linear depth");this._rctx.bindFramebuffer(i.fbo),s.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(C),this._compositor.blitDepthToLinearDepth(this._bindParameters,r),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),i.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,_e.UNSIGNED_BYTE,t),i.release()}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}get _needsEdges(){return this._edgeView?.shouldRender()?this._edgeView:null}_renderEdges(e){const t=this._needsEdges;if(!t)return;const{width:r,height:s}=this._framebuffer.size,i=this.fboCache.acquire(r,s,"edges"),a=this._bindParameters.geometryDepth,n=()=>t.render(this._bindParameters,e);this._renderToTargets(n,i,a??this._framebuffer.depth,C),this._framebuffer.bind(),this._compositor.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(1===e?de.OPAQUE_EDGES:de.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(this._renderContext.time),this._bindParameters.overlay&&this.performanceInfo.advance(de.OVERLAY)}_renderShadowMap(e,t,r,s){if(!this.shadowsEnabled)return;const i=this._bindParameters.shadowMap;if(i.start(e,r,s,this.isFeatureEnabled(6),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight){this._renderShadowCascades(6,i),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t);const r=this._bindParameters.output;this._bindParameters.output=0,this._bindParameters.screenSpaceShadowHighlightFbo=this._nodes.produce(S.SCREEN_SPACE_SHADOW_HIGHLIGHT,this._pluginInput),this._bindParameters.output=r,i.disposeOutput(6),i.clear(),this._renderShadowCascades(7,i)}else this._renderShadowCascades(5);e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this._needsShadowHighlight&&(this._bindParameters.depth=h(this._bindParameters.depth)),this.performanceInfo.advance(de.SHADOW_MAP)}_renderCutFillComputation(){this._nodes.produce(S.CUTFILL_COMPUTATION,this._pluginInput)?.release()}_precompileShadowCascades(e){0!==this._bindParameters.shadowMap.cascades.length&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._bindParameters.shadowMap){const r=this._bindParameters.output;t.bindFramebuffer();for(const s of t.cascades)s.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(s.camera,s.camera),this.renderAllGeometry(e);t.finish(e),this._bindParameters.output=r}get _needsDepth(){return+this._nodes.requireGeometryDepth+ +this.hasReflections+ +this._shadowAccumulator.accumulating+ +this._testsNeedsDepth}get _usesPremultipliedAlphaBlit(){return this._pluginsHas.hudElements&&this.oitEnabled||this._hasPhotoshopTerrain}_renderAmbientIlluminationAndDepth(){this._bindParameters.depth=n(this._bindParameters.depth);const e=this._pluginInput.get("normals");if(e){this._pluginInput.set(S.AMBIENT_ILLUMINATION,this._renderSSAO());const t=this._needsDepth;t?(this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(3),this._bindParameters.depth=e.obtainDepthTexture(),this._bindParameters.depth?.retain(t-1),this.performanceInfo.advance(de.DEPTH)):e.detachDepth(),this.hasSSAO&&this._pluginInput.release("normals")}else this._renderAllGeometryDepth()}_renderAllGeometryDepth(){const e=this._needsDepth;if(0===e)return;const{width:t,height:r}=this._framebuffer.size,s=this.fboCache.acquire(t,r,"geometry",13);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(1280),this.renderAllGeometry(3),this._bindParameters.depth=s.obtainDepthTexture(),this._bindParameters.depth?.retain(e-1),s.release(),this.performanceInfo.advance(de.DEPTH)}_renderTerrainDepth(){if(this._bindParameters.terrainDepth=n(this._bindParameters.terrainDepth),this._bindParameters.terrainDepthTest=this._bindParameters.cullAboveTerrain=this._needsTerrainDepth,!this._needsTerrainDepth)return;const e=this._bindParameters.output;this._bindParameters.output=3;const{width:t,height:r}=this._framebuffer.size,s=this.fboCache.acquire(t,r,"terrain",13);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(1280),this._renderTransparentGround(),this._bindParameters.terrainDepth=s.obtainDepthTexture(),s.release(),this._bindParameters.output=e}_renderGeometryDepth(){if(this._bindParameters.geometryDepth=n(this._bindParameters.geometryDepth),!this._needsTerrainDepth)return;const e=this._bindParameters.output,{width:t,height:r}=this._framebuffer.size,s=this.fboCache.acquire(t,r,"geometry",13);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(1280),this._renderOpaqueAndTransparentGeometry(3),this._bindParameters.output=e,this._bindParameters.geometryDepth=s.obtainDepthTexture(),s.release()}get _needsShadowDepthRange(){return this._bindParameters.shadowMap.enabled||this._shadowAccumulator.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return $.Zero;const t=J(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal)return void(this.sceneDepthRange.value=$.Infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<U)return void(this.sceneDepthRange.value=$.Infinite);const t=e.clone();t.near=O,t.far=1e10;const r=J(t,this._plugins.plugins,this.stage.layers,1);r.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(r)||(this.sceneDepthRange.value=r)}get _normalsRequired(){const e=this._nodes.require("normals",...R,S.VIEWSHED,S.LASERLINES);return(this.hasSSAO?1:0)+e}_precompilePrepasses(){this._normalsRequired?(this._precompilePlugins(4,be),this._needsDepth&&this._precompilePlugins(3,Pe)):this._needsDepth&&this._precompileAllGeometry(3),this.shadowsEnabled&&(this._needsShadowHighlight?(this._nodes.precompile(this._bindParameters.hasEmission,S.SCREEN_SPACE_SHADOW_HIGHLIGHT),this._precompileShadowCascades(6),this._precompileShadowCascades(7)):this._precompileShadowCascades(5)),this._shadowAccumulator.active&&this._precompileAllGeometry(5),this.hasSSAO&&this._normalsRequired&&this._nodes.precompile(this._bindParameters.hasEmission,S.AMBIENT_ILLUMINATION)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const{width:t,height:r}=this._framebuffer.size,s=this.fboCache.acquire(t,r,"normals",5);s.acquireDepth(13),this._rctx.bindFramebuffer(s.fbo),this._rctx.clearFramebuffer(C,!0,!0),this._bindParameters.output=4,this._plugins.render(...be);const i=this._nodes.optional("normals",...R,S.VIEWSHED);return s.retain(e+i-1),this.performanceInfo.advance(de.NORMALS),s}_renderSSAO(){const e=this._pluginInput.get("normals");if(this.hasSSAO&&e)return this._bindParameters.ssao=this._nodes.produce(S.AMBIENT_ILLUMINATION,this._pluginInput),this._bindParameters.ssao&&this.performanceInfo.advance(de.AMBIENT_ILLUMINATION),this._bindParameters.ssao}_precompileAllGeometry(e){const t=this._bindParameters.output;this._bindParameters.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(...ge),this._bindParameters.output=t}renderAllGeometry(e){this._bindParameters.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentGround()}precompileSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const r of t)this._renderContext.renderOccludedMask=r,this.precompileSlots(e,...Te);this._renderContext.renderOccludedMask=X}renderSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.forAll(e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)})}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>1&&this._plugins.render(10),this.renderSlots(e,...Te),this._renderContext.renderOccludedMask=X}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Ae[e])}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(17),this.renderHUD(e),this._bindParameters.hudRenderStyle=e,this._plugins.render(15)}precompileViewshedShadowMap(){this._precompileAllGeometry(8)}precompileCutFillOrthographicReferenceDepth(){this._precompilePlugins(9,De)}_precompilePlugins(e,t){const r=this._bindParameters.output;this._bindParameters.output=e,this._plugins.precompile(...t),this._bindParameters.output=r}renderViewshedShadowMap(e){const{camera:t,contentCamera:r}=this._bindParameters,s=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(8),this._ensureBindParametersCamera(t,r),this._bindParameters.camera.setGLViewport(this._rctx),this._bindParameters.output=s}renderCutFillOrthographicReferenceDepth(e){const{camera:t,contentCamera:r}=this._bindParameters,s=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._bindParameters.output=9,this._plugins.render(...De),this._ensureBindParametersCamera(t,r),t.setGLViewport(this._rctx),this._bindParameters.output=s}get _needsGroundDepth(){return this._bindParameters.cutFillVisualizationEnabled}_blitGroundDepth(){if(!this._needsGroundDepth)return null;const{width:e,height:t}=this._framebuffer.size,r=this.fboCache.acquire(e,t,S.GROUND_DEPTH,13);return this._rctx.blitFramebuffer(this._framebuffer.color.fbo,r.fbo,256),this._framebuffer.bind(),r}_renderOpaqueAndTransparentGeometry(e){this._bindParameters.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithoutNormals(e){this._bindParameters.output=e,this._plugins.render(...Pe)}_precompileOpaqueGeometry(){this._needsOpaquePass&&(this._plugins.precompile(...ce),this._nodes.precompile(this._bindParameters.hasEmission,"opaque-color"))}_renderOpaqueGeometry(){this._plugins.render(...ce)}_renderTransparentGeometry(){this._plugins.render(...fe),this._oitCallouts&&this._plugins.render(16)}get _hasPhotoshopTerrain(){return this._plugins.produces(0,6)}get _needsTerrainDepth(){return this._highQualityTransparency&&this._hasPhotoshopTerrain}_renderPhotoshopTerrain(){if(!this._hasPhotoshopTerrain)return null;const{width:e,height:t}=this._framebuffer.size,r=this.fboCache.acquire(e,t,"transparent terrain"),s=()=>this._plugins.render(6);return this._renderToTargets(s,r,this._framebuffer.depth,C),this.performanceInfo.advance(de.TRANSPARENT_TERRAIN),r}_renderTransparentGround(){this._plugins.render(...ge)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,0===e){const e=()=>this._plugins.render(16),{width:t,height:r}=this._framebuffer.size,s=this.fboCache.acquireDepth(this._hudDepthFormat,t,r,"line callouts");this._renderToTargets(e,this._framebuffer.color,s,void 0,!0,!0),s.release()}else this._plugins.render(16)}_precompileHUD(e){if(!this._pluginsHas.hudElements)return;const t=this._bindParameters.output,r=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this.oitEnabled?(this._bindParameters.output=1,this._plugins.precompile(...Ee),this._bindParameters.output=2,this._plugins.precompile(...Ee),this._bindParameters.output=0,this._oitBlend.precompile(this._bindParameters,!1,1)):(this._bindParameters.output=0,this._plugins.precompile(...Ee)),this._hasHighlights&&(this._bindParameters.output=10,this._plugins.precompile(...Ee)),this._bindParameters.output=t,this._bindParameters.hudRenderStyle=r}_renderHUD(e,t){if(!this._pluginsHas.hudElements)return t;if(this.oitEnabled){const r=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo);const s=!!t.getTexture(le);this._compositor.compositePreMultipliedAlpha(this._bindParameters,r.getTexture(),s),r.release()}else if(this._bindParameters.output=0,0===e){const t=()=>this._renderHUDElements(e),{width:r,height:s}=this._framebuffer.size,i=this.fboCache.acquireDepth(this._hudDepthFormat,r,s,"hud");this._renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(this._hudDepthFormat),this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(256),this._renderHUDElements(e),t.detachDepth();return this.performanceInfo.advance(0===e?de.HUD_OCCLUDED:de.HUD),t}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(6,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:r}=this,{width:s,height:i}=this._framebuffer.size,{highlights:a}=r,n=a.length>B?3:1,h=e.acquire(s,i,"highlights",n);h.acquireDepth(13);const o=this._plugins.produces(10,0);return o&&this._framebuffer.color.fbo&&h.fbo&&t.blitFramebuffer(this._framebuffer.color.fbo,h.fbo,1024),t.bindFramebuffer(h.fbo),t.gl.clearBufferuiv(6144,0,[0,0,0,0]),o||t.clear(1024),this._bindParameters.output=10,t.bindFramebuffer(h.fbo),V(t,e,s,i,r,()=>this._renderHighlightGeometries()),h.detachDepth(),this.performanceInfo.advance(de.HIGHLIGHTS),h.retain(this._nodes.require("highlights",...I)+this._nodes.optional("highlights",...I)-1),h}_renderHighlightGeometries(){this._plugins.render(...we),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e,t){this._shadowAccumulator.updateDepthRange(e),this._bindParameters.output=0,this._shadowAccumulator.accumulating&&this._bindParameters.depth&&(this._shadowAccumulator.renderAccumulation(this._bindParameters,t)&&this.performanceInfo.advance(de.ACCUMULATED_SHADOWS),this._bindParameters.depth=h(this._bindParameters.depth))}_precompileTransparentGeometry(){this.oitEnabled&&y(this._bindParameters.output)?(this._bindParameters.output=1,this._plugins.precompile(...fe),this._oitCallouts&&this._plugins.precompile(16),this._bindParameters.output=2,this._plugins.precompile(...fe),this._oitCallouts&&this._plugins.precompile(16),this._bindParameters.output=0):this._plugins.precompile(...fe)}_renderOIT(e,t=2){const r=1===e,{width:s,height:i}=this._framebuffer.size,a=r?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=h.useFloatBlend.value?8:5,d=h.output;h.output=1;const _=r?"oit hud":"oit",l=this.fboCache.acquire(s,i,_,o),u=h.hasEmission&&(0===e||1!==t);u&&l.acquireColor(le,o,"oit emissive");const p=u?ue:le;l.acquireColor(p,this.hasFloatBlend?7:0,"oit alpha"),r||l.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(l.fbo),this._rctx.clearFramebuffer([0,0,0,1]),u&&this._rctx.clearBuffer(1,C),a(),l.detachDepth(),h.output=2;const m=this.fboCache.acquire(s,i,r?"oit hud front":"oit front");u&&m.acquireColor(le,o,"oit emissive front"),r?m.acquireDepth(this._hudDepthFormat):m.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(m.fbo),this._rctx.clearFramebuffer(C,r),a(),m.detachDepth();const c=this._pluginsHas.occludedHudElements&&!r;let f;return h.hudOcclusion=n(this._bindParameters.hudOcclusion),h.output=0,r?(f=this.fboCache.acquire(s,i,"oit hud composite"),this._rctx.bindFramebuffer(f.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):(c&&(this._framebuffer.color.acquireColor(p,0,"hud occlusion"),this._rctx.clearBuffer(p-pe,C)),this._framebuffer.bind()),this._oitBlend.blend(this._rctx,l,m,h,u,c,e),f?.detachDepth(),r||(this._rctx.bindFramebuffer(m.fbo),this._framebuffer.bind(),c&&(h.hudOcclusion=this._framebuffer.color.obtainAttachment(p))),m.release(),l.release(),h.output=d,f}get _hudDepthFormat(){return this.isFeatureEnabled(8)?13:12}get _needsOpaquePass(){return this.plugins.produces(0,...ce)||this.plugins.produces(5,...ce)||this.plugins.produces(3,3)}_renderOpaque(){const e=this._needsOpaquePass;e&&(this._plugins.render(0,1),this._pluginInput.set(S.GROUND_DEPTH,this._blitGroundDepth()),this._plugins.render(2,3));const t=this._framebuffer;this._renderTerrainDepth(),t.update(t=>this._renderNodes(D.OPAQUE,t,e)),this.fboCache.debugCallback?.(D.OPAQUE,t.color.fbo),t.update(e=>this._renderNodes(S.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(S.OPAQUE_ENVIRONMENT,t.color.fbo),this._renderEdges(1)}_renderTransparent(){const e=this._framebuffer;e.bind(),e.update(e=>this._renderNodes(S.PRE_TRANSPARENT,e)),this.fboCache.debugCallback?.(S.PRE_TRANSPARENT,e.color.fbo),this._renderHiddenTransparentEdges(),this._hasTransparentGeometry&&(this.oitEnabled?this._renderOIT(0):this._renderTransparentGeometry()),e.update(e=>this._renderNodes(D.TRANSPARENT,e,this._hasTransparentGeometry)),this.fboCache.debugCallback?.(D.TRANSPARENT,e.color.fbo),this._renderGeometryDepth(),this._needsTerrainDepth||this._oitCallouts||this._plugins.render(16),this._renderEdges(0);const t=this._renderPhotoshopTerrain(),r=t?.getTexture();r&&this._renderHUD(0,e.color),this._bindParameters.cullAboveTerrain=!1,r&&(e.bind(),this._compositor.compositePreMultipliedAlpha(this._bindParameters,r),t?.release(),this._needsTerrainDepth&&(this._renderEdges(1),this._hasTransparentGeometry&&(this.oitEnabled?this._renderOIT(0):this._renderTransparentGeometry(),this.performanceInfo.advance(de.TRANSPARENT)),this._renderEdges(0))),this._bindParameters.ssao=n(this._bindParameters.ssao),this._needsTerrainDepth&&this._renderLineCallouts(1),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(de.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(9),this.performanceInfo.advance(de.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderNodes(e,t,r=!1){const s=t.name;if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return r&&this.performanceInfo.advance(e),t;this._fboCache.debugCallback?.(s,t.fbo);const i=this._nodes.render(t,this._pluginInput,this._releaseNodeInputs);return this.performanceInfo.advance(e),i}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersWeatherFader(e){1===this.stage.viewingMode&&(this._bindParameters.clouds.data&&(this._bindParameters.clouds.fade(this._bindParameters.camera,e,this.stage.view.qualitySettings.fadeDuration),this.weatherFader?.cleanupCubemap()),this._bindParameters.snowCover=this.weatherFader?.snowCover??0)}_ensureBindParametersSSR(e){const{screenSpaceReflections:t,reprojection:r,camera:s}=this._bindParameters;if(this.hasReflections){null==this._ssrEnableTime&&(this._ssrEnableTime=e),r.lastFrameCamera.equals(s)?this._reprojectionMatrix=P:(g(Ie,s.viewMatrix),g(Re,s.projectionMatrix),b(Oe,Ie,Re),b(Oe,r.lastFrameCamera.viewMatrix,Oe),b(Oe,r.lastFrameCamera.projectionMatrix,Oe),this._reprojectionMatrix=Oe);const i=this.stage.view.qualitySettings.fadeDuration;t.fadeFactor=i>0?Math.min(i,e-this._ssrEnableTime)/i:1,t.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=P,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,r,s){this._bindParameters.updateLighting(e,t,r,s),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0,clouds:this.weatherFader?.usedMemory??0}}_renderToTargets(e,t,r,s,i=!1,a=!1){t.attachDepth(r),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(s,i,a),e(),t.detachDepth()}get test(){}};e([m({readOnly:!0})],me.prototype,"highResolutionAtmosphere",null),e([m()],me.prototype,"_edgeView",void 0),e([m()],me.prototype,"updating",null),me=e([c("esri.views.3d.webgl-engine.lib.Renderer")],me);const ce=[0,1,2,3],fe=[8,7,4,5],ge=[6,8,7],be=[0,1,2,4,...ge],Pe=[3,5],Te=[2,4,9],Ee=[17,13,15,14],we=[4,5,2,3,0,1,...ge],Ce=[4,9,5,12],Ae={0:[14],1:[13],2:[14,13],3:[14,13]},De=[0,1,...ge],Se=["normals","highlights"],Re=T(),Ie=T(),Oe=T();function xe(e){return t=>e.immediate.schedule(t)}export{me as Renderer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{exactEquals as e,set as t,copy as r,normalize as s,subtract as i,length as a,scale as o,dot as n,transformMat3 as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as u,create as c,fromValues as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{is3DGeometryOrShadowLike as m,isColor as p}from"../core/shaderLibrary/ShaderOutput.js";import{GLTextureMaterial as d}from"../lib/GLTextureMaterial.js";import{Material as f}from"../lib/Material.js";import{intersectTriangleGeometry as T}from"../lib/RayIntersections.js";import{getVerticalOffsetObject3D as x}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as g}from"./DefaultBufferWriter.js";import{intersectWithPolygonOffset as v}from"./PolygonOffset.js";import{verticalOffsetAtDistance as S}from"./internal/MaterialUtil.js";import{getLayout as b,DefaultMaterialPassParameters as M,DefaultMaterialTechnique as O}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as C}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as w}from"../shaders/RealisticTreeTechnique.js";import{alphaCutoff as y}from"../../../../webscene/support/AlphaCutoff.js";class R extends f{constructor(e,t){super(e,P),this.materialType="default",this.supportsEdges=!0,this.intersectDraped=void 0,this.produces=new Map([[2,e=>m(e)&&!this.transparent],[4,e=>m(e)&&this.transparent&&this.parameters.writeDepth],[9,e=>m(e)&&this.transparent&&!this.parameters.writeDepth]]),this._layout=b(this.parameters),this._configuration=new C(t.spherical)}isVisibleForOutput(e){return 5!==e&&7!==e&&6!==e||this.parameters.castShadows}get visible(){const{layerOpacity:e,colorMixMode:t,opacity:r,externalColor:s}=this.parameters;return e*("replace"===t?1:r)*("ignore"===t||isNaN(s[3])?1:s[3])>=y}get _hasEmissiveBase(){return!!this.parameters.emissiveTextureId||!e(this.parameters.emissiveBaseColor,u)}get hasEmissions(){return this.parameters.emissiveStrength>0&&(0===this.parameters.emissiveSource&&this._hasEmissiveBase||1===this.parameters.emissiveSource)}updateConfiguration(e){super.updateConfiguration(e);const{parameters:t,_configuration:r}=this;r.hasNormalTexture=t.hasNormalTexture,r.hasColorTexture=t.hasColorTexture,r.hasMetallicRoughnessTexture=t.hasMetallicRoughnessTexture,r.hasOcclusionTexture=t.hasOcclusionTexture;const{treeRendering:s,doubleSided:i,doubleSidedType:a}=t;r.hasVertexTangents=!s&&t.hasVertexTangents,r.instanced=t.instanced,r.instancedDoublePrecision=t.instancedDoublePrecision,r.hasVVColor=!!t.vvColor,r.hasVVSize=!!t.vvSize,r.hasVerticalOffset=null!=t.verticalOffset,r.hasScreenSizePerspective=null!=t.screenSizePerspective,r.hasSlicePlane=t.hasSlicePlane,r.alphaDiscardMode=t.textureAlphaMode,r.normalType=s?0:t.normalType,r.transparent=this.transparent,r.enableOITOffset=e.enableOITOffset,r.writeDepth=t.writeDepth,r.customDepthTest=t.customDepthTest??0,r.hasOccludees=e.hasOccludees,r.cullFace=t.hasSlicePlane?0:t.cullFace,r.cullAboveTerrain=e.cullAboveTerrain,r.hasModelTransformation=!s&&null!=t.modelTransformation,r.hasVertexColors=t.hasVertexColors,r.hasSymbolColors=t.hasSymbolColors,r.doubleSidedMode=s?2:i&&"normal"===a?1:i&&"winding-order"===a?2:0,r.instancedFeatureAttribute=t.instancedFeatureAttribute,r.instancedColor=t.instancedColor,p(e.output)?(r.terrainDepthTest=e.terrainDepthTest,r.receiveShadows=t.receiveShadows,r.receiveAmbientOcclusion=t.receiveAmbientOcclusion&&null!=e.ssao):(r.terrainDepthTest=!1,r.receiveShadows=r.receiveAmbientOcclusion=!1),r.textureAlphaPremultiplied=!!t.textureAlphaPremultiplied,r.pbrMode=t.usePBR?t.isSchematic?2:1:0,r.emissionSource=t.emissionSource,r.offsetBackfaces=!(!this.transparent||!t.offsetTransparentBackfaces),r.snowCover=e.snowCover>0,r.hasColorTextureTransform=!!t.colorTextureTransformMatrix,r.hasNormalTextureTransform=!!t.normalTextureTransformMatrix,r.hasEmissionTextureTransform=!!t.emissiveTextureTransformMatrix,r.hasOcclusionTextureTransform=!!t.occlusionTextureTransformMatrix,r.hasMetallicRoughnessTextureTransform=!!t.metallicRoughnessTextureTransformMatrix}intersect(e,u,c,h,m,p){if(null!=this.parameters.verticalOffset){const e=c.camera;t(N,u[12],u[13],u[14]);let p=null;switch(c.viewingMode){case 1:p=s(_,N);break;case 2:p=r(_,V)}const d=i(z,N,e.eye),f=a(d),T=o(d,d,1/f);let x=null;this.parameters.screenSizePerspective&&(x=n(p,T));const g=S(e,f,this.parameters.verticalOffset,x??0,this.parameters.screenSizePerspective,null);o(p,p,g),l(B,p,c.transform.inverseRotation),h=i(I,h,B),m=i(A,m,B)}p=v(p,this._configuration,h,m),T(e,c,h,m,x(c.verticalOffset),p)}createGLMaterial(e){return new D(e)}createBufferWriter(){return new g(this._layout)}get transparent(){return j(this.parameters)}}class D extends d{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){this._material.setParameters({receiveShadows:e.shadowMap.enabled});const r=this._material.parameters;this.updateTexture(r.textureId);const s=e.camera.viewInverseTransposeMatrix;return t(r.origin,s[3],s[7],s[11]),this._material.setParameters(this.textureBindParameters),this.getTechnique(r.treeRendering?w:O,e)}}class P extends M{constructor(){super(...arguments),this.treeRendering=!1,this.useIndexing=!1,this.hasVertexTangents=!1}get hasNormalTexture(){return!this.treeRendering&&!!this.normalTextureId}get hasColorTexture(){return!!this.textureId}get hasMetallicRoughnessTexture(){return!this.treeRendering&&!!this.metallicRoughnessTextureId}get hasOcclusionTexture(){return!this.treeRendering&&!!this.occlusionTextureId}get emissiveStrength(){return this.emissiveStrengthFromSymbol*this.emissiveStrengthKHR}get emissionSource(){return this.treeRendering?0:null!=this.emissiveTextureId&&0===this.emissiveSource?3:0===this.emissiveSource?2:1}get hasTextures(){return this.hasColorTexture||this.hasNormalTexture||this.hasMetallicRoughnessTexture||3===this.emissionSource||this.hasOcclusionTexture}}function j(e){const{drivenOpacity:t,opacity:r,externalColor:s,layerOpacity:i,texture:a,textureId:o,textureAlphaMode:n,colorMixMode:l}=e,u=s[3];return t||r<1&&"replace"!==l||u<1&&"ignore"!==l||i<1||(null!=a||null!=o)&&1!==n&&2!==n&&"replace"!==l}const I=c(),A=c(),V=h(0,0,1),_=c(),B=c(),N=c(),z=c();export{D as DefaultGLMaterial,R as DefaultMaterial,P as DefaultMaterialParameters,j as isTransparent};
2
+ import{exactEquals as e,set as t,copy as r,normalize as s,subtract as i,length as a,scale as o,dot as n,transformMat3 as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as u,create as h,fromValues as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{is3DGeometryOrShadowLike as m,isColor as p}from"../core/shaderLibrary/ShaderOutput.js";import{GLTextureMaterial as d}from"../lib/GLTextureMaterial.js";import{Material as f}from"../lib/Material.js";import{intersectTriangleGeometry as T}from"../lib/RayIntersections.js";import{getVerticalOffsetObject3D as x}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as g}from"./DefaultBufferWriter.js";import{intersectWithPolygonOffset as v}from"./PolygonOffset.js";import{verticalOffsetAtDistance as S}from"./internal/MaterialUtil.js";import{getLayout as b,DefaultMaterialPassParameters as M,DefaultMaterialTechnique as O}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as w}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as C}from"../shaders/RealisticTreeTechnique.js";import{hasShadowHighlights as y}from"../shaders/ReceiveShadowsConfiguration.js";import{alphaCutoff as R}from"../../../../webscene/support/AlphaCutoff.js";class D extends f{constructor(e,t){super(e,j),this.materialType="default",this.supportsEdges=!0,this.intersectDraped=void 0,this.produces=new Map([[2,e=>m(e)&&!this.transparent],[4,e=>m(e)&&this.transparent&&this.parameters.writeDepth],[9,e=>m(e)&&this.transparent&&!this.parameters.writeDepth]]),this._layout=b(this.parameters),this._configuration=new w(t.spherical)}isVisibleForOutput(e){return 5!==e&&7!==e&&6!==e||this.parameters.castShadows}get visible(){const{layerOpacity:e,colorMixMode:t,opacity:r,externalColor:s}=this.parameters;return e*("replace"===t?1:r)*("ignore"===t||isNaN(s[3])?1:s[3])>=R}get _hasEmissiveBase(){return!!this.parameters.emissiveTextureId||!e(this.parameters.emissiveBaseColor,u)}get hasEmissions(){return this.parameters.emissiveStrength>0&&(0===this.parameters.emissiveSource&&this._hasEmissiveBase||1===this.parameters.emissiveSource)}updateConfiguration(e){super.updateConfiguration(e);const{parameters:t,_configuration:r}=this;r.hasNormalTexture=t.hasNormalTexture,r.hasColorTexture=t.hasColorTexture,r.hasMetallicRoughnessTexture=t.hasMetallicRoughnessTexture,r.hasOcclusionTexture=t.hasOcclusionTexture;const{treeRendering:s,doubleSided:i,doubleSidedType:a}=t;r.hasVertexTangents=!s&&t.hasVertexTangents,r.instanced=t.instanced,r.instancedDoublePrecision=t.instancedDoublePrecision,r.hasVVColor=!!t.vvColor,r.hasVVSize=!!t.vvSize,r.hasVerticalOffset=null!=t.verticalOffset,r.hasScreenSizePerspective=null!=t.screenSizePerspective,r.hasSlicePlane=t.hasSlicePlane,r.alphaDiscardMode=t.textureAlphaMode,r.normalType=s?0:t.normalType,r.transparent=this.transparent,r.enableOITOffset=e.enableOITOffset,r.writeDepth=t.writeDepth,r.customDepthTest=t.customDepthTest??0,r.hasOccludees=e.hasOccludees,r.cullFace=t.hasSlicePlane?0:t.cullFace,r.cullAboveTerrain=e.cullAboveTerrain,r.hasModelTransformation=!s&&null!=t.modelTransformation,r.hasVertexColors=t.hasVertexColors,r.hasSymbolColors=t.hasSymbolColors,r.doubleSidedMode=s?2:i&&"normal"===a?1:i&&"winding-order"===a?2:0,r.instancedFeatureAttribute=t.instancedFeatureAttribute,r.instancedColor=t.instancedColor,p(e.output)?(r.terrainDepthTest=e.terrainDepthTest,r.receiveShadows=t.receiveShadows,r.hasShadowHighlights=y(r,e),r.receiveAmbientOcclusion=t.receiveAmbientOcclusion&&null!=e.ssao):(r.terrainDepthTest=!1,r.receiveShadows=r.hasShadowHighlights=r.receiveAmbientOcclusion=!1),r.textureAlphaPremultiplied=!!t.textureAlphaPremultiplied,r.pbrMode=t.usePBR?t.isSchematic?2:1:0,r.emissionSource=t.emissionSource,r.offsetBackfaces=!(!this.transparent||!t.offsetTransparentBackfaces),r.snowCover=e.snowCover>0,r.hasColorTextureTransform=!!t.colorTextureTransformMatrix,r.hasNormalTextureTransform=!!t.normalTextureTransformMatrix,r.hasEmissionTextureTransform=!!t.emissiveTextureTransformMatrix,r.hasOcclusionTextureTransform=!!t.occlusionTextureTransformMatrix,r.hasMetallicRoughnessTextureTransform=!!t.metallicRoughnessTextureTransformMatrix}intersect(e,u,h,c,m,p){if(null!=this.parameters.verticalOffset){const e=h.camera;t(z,u[12],u[13],u[14]);let p=null;switch(h.viewingMode){case 1:p=s(B,z);break;case 2:p=r(B,_)}const d=i(F,z,e.eye),f=a(d),T=o(d,d,1/f);let x=null;this.parameters.screenSizePerspective&&(x=n(p,T));const g=S(e,f,this.parameters.verticalOffset,x??0,this.parameters.screenSizePerspective,null);o(p,p,g),l(N,p,h.transform.inverseRotation),c=i(A,c,N),m=i(V,m,N)}p=v(p,this._configuration,c,m),T(e,h,c,m,x(h.verticalOffset),p)}createGLMaterial(e){return new P(e)}createBufferWriter(){return new g(this._layout)}get transparent(){return I(this.parameters)}}class P extends d{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){this._material.setParameters({receiveShadows:e.shadowMap.enabled});const r=this._material.parameters;this.updateTexture(r.textureId);const s=e.camera.viewInverseTransposeMatrix;return t(r.origin,s[3],s[7],s[11]),this._material.setParameters(this.textureBindParameters),this.getTechnique(r.treeRendering?C:O,e)}}class j extends M{constructor(){super(...arguments),this.treeRendering=!1,this.useIndexing=!1,this.hasVertexTangents=!1}get hasNormalTexture(){return!this.treeRendering&&!!this.normalTextureId}get hasColorTexture(){return!!this.textureId}get hasMetallicRoughnessTexture(){return!this.treeRendering&&!!this.metallicRoughnessTextureId}get hasOcclusionTexture(){return!this.treeRendering&&!!this.occlusionTextureId}get emissiveStrength(){return this.emissiveStrengthFromSymbol*this.emissiveStrengthKHR}get emissionSource(){return this.treeRendering?0:null!=this.emissiveTextureId&&0===this.emissiveSource?3:0===this.emissiveSource?2:1}get hasTextures(){return this.hasColorTexture||this.hasNormalTexture||this.hasMetallicRoughnessTexture||3===this.emissionSource||this.hasOcclusionTexture}}function I(e){const{drivenOpacity:t,opacity:r,externalColor:s,layerOpacity:i,texture:a,textureId:o,textureAlphaMode:n,colorMixMode:l}=e,u=s[3];return t||r<1&&"replace"!==l||u<1&&"ignore"!==l||i<1||(null!=a||null!=o)&&1!==n&&2!==n&&"replace"!==l}const A=h(),V=h(),_=c(0,0,1),B=h(),N=h(),z=h(),F=h();export{P as DefaultGLMaterial,D as DefaultMaterial,j as DefaultMaterialParameters,I as isTransparent};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{clamp as t}from"../../../../core/mathUtils.js";import{clone as e}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as r}from"../../../../geometry/support/aaBoundingBox.js";import{isShadowLike as s,is3DGeometry as a,isColor as o}from"../core/shaderLibrary/ShaderOutput.js";import n from"../lib/GLMaterial.js";import{isPathGeometry as h}from"../lib/PathGeometry.js";import{MeshIntersectionOptions as p,intersectAabbInvDir as c}from"../lib/RayIntersections.js";import{DefaultBufferWriter as u}from"./DefaultBufferWriter.js";import{getLayout as m,PathPassParameters as l,PathTechnique as d}from"./PathTechnique.js";import{PathTechniqueConfiguration as f}from"./PathTechniqueConfiguration.js";import{TriangleMaterial as b}from"./TriangleMaterial.js";import{alphaCutoff as g}from"../../../../webscene/support/AlphaCutoff.js";class _ extends b{constructor(t,e){super(t,w),this.supportsEdges=!0,this._pp0=i(0,0,1),this._pp1=i(0,0,0),this.produces=new Map([[2,t=>(this.parameters.castShadows&&s(t)||a(t))&&!this.transparent],[4,t=>(this.parameters.castShadows&&s(t)||a(t))&&this.transparent]]),this._configuration=new f(e.spherical)}get hasEmissions(){return this.parameters.emissiveStrength>0}updateConfiguration(t){super.updateConfiguration(t),this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.transparent,this._configuration.hasOccludees=t.hasOccludees,o(t.output)?(this._configuration.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?1:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?2:0,this._configuration.receiveShadows=t.shadowMap.enabled,this._configuration.receiveAmbientOcclusion=null!=t.ssao):this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._configuration.pbrMode=this.parameters.usePBR?2:0,this._configuration.emissionSource=this.parameters.usePBR?1:0,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.snowCover=t.snowCover>0}isVisibleForOutput(t){return 5!==t&&7!==t&&6!==t||this.parameters.castShadows}get visible(){return this.parameters.opacity>=g}intersect(t,e,i,r,s,a){this._intersect(t,i,r,s,a)}intersectDraped(t,e,i,r){return this._pp0[0]=this._pp1[0]=i[0],this._pp0[1]=this._pp1[1]=i[1],this._intersect(t,e,this._pp0,this._pp1,r)}_intersect(i,s,a,o,n){const u=i;if(!h(u))return;const m=u.path,l=e(this.parameters.size);if(this.parameters.vvSize){const{offset:e,factor:i,minSize:r,maxSize:s,fallback:a}=this.parameters.vvSize,o=m.sizeAttributeValue;Number.isNaN(o)?(l[0]*=a[0],l[1]*=a[2]):(l[0]*=t(e[0]+o*i[0],r[0],s[0]),l[1]*=t(e[2]+o*i[2],r[2],s[2]))}const d=new p(s.tolerance,!1,s.options.normalRequired),f=Math.max(l[0],l[1]),b=i.boundingInfo;if(null==b)return void v(m,l,a,o,d,n);const g=r(b.bbMin[0]-f,b.bbMin[1]-f,b.bbMin[2]-f,b.bbMax[0]+f,b.bbMax[1]+f,b.bbMax[2]+f),_=[o[0]-a[0],o[1]-a[1],o[2]-a[2]],S=Math.sqrt(_[0]*_[0]+_[1]*_[1]+_[2]*_[2]),w=[S/_[0],S/_[1],S/_[2]];c(g,a,w,s.tolerance)&&v(m,l,a,o,d,n)}createBufferWriter(){return new u(m(this.parameters))}createGLMaterial(t){return new S(t)}get transparent(){const{parameters:t}=this;return t.drivenOpacity||t.opacity<1}}class S extends n{beginSlot(t){return this.getTechnique(d,t)}}function v(t,e,i,r,s,a){t.baked.size&&t.baked.size[0]===e[0]&&t.baked.size[1]===e[1]||t.baked.bake(e),t.baked.intersect(i,r,s,a)}class w extends l{constructor(){super(...arguments),this.doubleSided=!1,this.doubleSidedType="normal",this.polygonOffset=0,this.castShadows=!0,this.hasSlicePlane=!1,this.drivenOpacity=!1,this.usePBR=!1}}export{w as Parameters,_ as PathMaterial};
2
+ import{clamp as t}from"../../../../core/mathUtils.js";import{clone as e}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as s}from"../../../../geometry/support/aaBoundingBox.js";import{isShadowLike as r,is3DGeometry as a,isColor as o}from"../core/shaderLibrary/ShaderOutput.js";import n from"../lib/GLMaterial.js";import{isPathGeometry as h}from"../lib/PathGeometry.js";import{MeshIntersectionOptions as p,intersectAabbInvDir as c}from"../lib/RayIntersections.js";import{DefaultBufferWriter as u}from"./DefaultBufferWriter.js";import{getLayout as m,PathPassParameters as f,PathTechnique as l}from"./PathTechnique.js";import{PathTechniqueConfiguration as d}from"./PathTechniqueConfiguration.js";import{TriangleMaterial as b}from"./TriangleMaterial.js";import{hasShadowHighlights as g}from"../shaders/ReceiveShadowsConfiguration.js";import{alphaCutoff as _}from"../../../../webscene/support/AlphaCutoff.js";class S extends b{constructor(t,e){super(t,M),this.supportsEdges=!0,this._pp0=i(0,0,1),this._pp1=i(0,0,0),this.produces=new Map([[2,t=>(this.parameters.castShadows&&r(t)||a(t))&&!this.transparent],[4,t=>(this.parameters.castShadows&&r(t)||a(t))&&this.transparent]]),this._configuration=new d(e.spherical)}get hasEmissions(){return this.parameters.emissiveStrength>0}updateConfiguration(t){super.updateConfiguration(t),this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.transparent,this._configuration.hasOccludees=t.hasOccludees,o(t.output)?(this._configuration.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?1:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?2:0,this._configuration.receiveShadows=t.shadowMap.enabled,this._configuration.hasShadowHighlights=g(this._configuration,t),this._configuration.receiveAmbientOcclusion=null!=t.ssao):this._configuration.receiveShadows=this._configuration.hasShadowHighlights=this._configuration.receiveAmbientOcclusion=!1,this._configuration.pbrMode=this.parameters.usePBR?2:0,this._configuration.emissionSource=this.parameters.usePBR?1:0,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.snowCover=t.snowCover>0}isVisibleForOutput(t){return 5!==t&&7!==t&&6!==t||this.parameters.castShadows}get visible(){return this.parameters.opacity>=_}intersect(t,e,i,s,r,a){this._intersect(t,i,s,r,a)}intersectDraped(t,e,i,s){return this._pp0[0]=this._pp1[0]=i[0],this._pp0[1]=this._pp1[1]=i[1],this._intersect(t,e,this._pp0,this._pp1,s)}_intersect(i,r,a,o,n){const u=i;if(!h(u))return;const m=u.path,f=e(this.parameters.size);if(this.parameters.vvSize){const{offset:e,factor:i,minSize:s,maxSize:r,fallback:a}=this.parameters.vvSize,o=m.sizeAttributeValue;Number.isNaN(o)?(f[0]*=a[0],f[1]*=a[2]):(f[0]*=t(e[0]+o*i[0],s[0],r[0]),f[1]*=t(e[2]+o*i[2],s[2],r[2]))}const l=new p(r.tolerance,!1,r.options.normalRequired),d=Math.max(f[0],f[1]),b=i.boundingInfo;if(null==b)return void w(m,f,a,o,l,n);const g=s(b.bbMin[0]-d,b.bbMin[1]-d,b.bbMin[2]-d,b.bbMax[0]+d,b.bbMax[1]+d,b.bbMax[2]+d),_=[o[0]-a[0],o[1]-a[1],o[2]-a[2]],S=Math.sqrt(_[0]*_[0]+_[1]*_[1]+_[2]*_[2]),v=[S/_[0],S/_[1],S/_[2]];c(g,a,v,r.tolerance)&&w(m,f,a,o,l,n)}createBufferWriter(){return new u(m(this.parameters))}createGLMaterial(t){return new v(t)}get transparent(){const{parameters:t}=this;return t.drivenOpacity||t.opacity<1}}class v extends n{beginSlot(t){return this.getTechnique(l,t)}}function w(t,e,i,s,r,a){t.baked.size&&t.baked.size[0]===e[0]&&t.baked.size[1]===e[1]||t.baked.bake(e),t.baked.intersect(i,s,r,a)}class M extends f{constructor(){super(...arguments),this.doubleSided=!1,this.doubleSidedType="normal",this.polygonOffset=0,this.castShadows=!0,this.hasSlicePlane=!1,this.drivenOpacity=!1,this.usePBR=!1}}export{M as Parameters,S as PathMaterial};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{parameter as t}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{TriangleTechniqueConfiguration as o}from"./TriangleTechniqueConfiguration.js";class i extends o{constructor(e){super(),this.spherical=e,this.pbrMode=0,this.doubleSidedMode=0,this.emissionSource=0,this.receiveShadows=!1,this.receiveAmbientOcclusion=!1,this.hasVVSize=!1,this.hasVVColor=!1,this.hasVVOpacity=!1,this.hasOccludees=!1,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.snowCover=!1,this.textureCoordinateType=0,this.hasVVInstancing=!1,this.useCustomDTRExponentForWater=!1,this.useFillLights=!1,this.hasColorTexture=!1,this.hasMetallicRoughnessTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.draped=!1,this.overlayEnabled=!1}get discardInvisibleFragments(){return this.transparent}}e([t({count:7})],i.prototype,"pbrMode",void 0),e([t({count:3})],i.prototype,"doubleSidedMode",void 0),e([t({count:8})],i.prototype,"emissionSource",void 0),e([t()],i.prototype,"receiveShadows",void 0),e([t()],i.prototype,"receiveAmbientOcclusion",void 0),e([t()],i.prototype,"hasVVSize",void 0),e([t()],i.prototype,"hasVVColor",void 0),e([t()],i.prototype,"hasVVOpacity",void 0),e([t()],i.prototype,"hasOccludees",void 0),e([t()],i.prototype,"terrainDepthTest",void 0),e([t()],i.prototype,"cullAboveTerrain",void 0),e([t()],i.prototype,"snowCover",void 0);export{i as PathTechniqueConfiguration};
2
+ import{__decorate as e}from"tslib";import{parameter as t}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{TriangleTechniqueConfiguration as o}from"./TriangleTechniqueConfiguration.js";class i extends o{constructor(e){super(),this.spherical=e,this.pbrMode=0,this.doubleSidedMode=0,this.emissionSource=0,this.receiveShadows=!1,this.hasShadowHighlights=!1,this.receiveAmbientOcclusion=!1,this.hasVVSize=!1,this.hasVVColor=!1,this.hasVVOpacity=!1,this.hasOccludees=!1,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.snowCover=!1,this.textureCoordinateType=0,this.hasVVInstancing=!1,this.useCustomDTRExponentForWater=!1,this.useFillLights=!1,this.hasColorTexture=!1,this.hasMetallicRoughnessTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.draped=!1,this.overlayEnabled=!1}get discardInvisibleFragments(){return this.transparent}}e([t({count:7})],i.prototype,"pbrMode",void 0),e([t({count:3})],i.prototype,"doubleSidedMode",void 0),e([t({count:8})],i.prototype,"emissionSource",void 0),e([t()],i.prototype,"receiveShadows",void 0),e([t()],i.prototype,"hasShadowHighlights",void 0),e([t()],i.prototype,"receiveAmbientOcclusion",void 0),e([t()],i.prototype,"hasVVSize",void 0),e([t()],i.prototype,"hasVVColor",void 0),e([t()],i.prototype,"hasVVOpacity",void 0),e([t()],i.prototype,"hasOccludees",void 0),e([t()],i.prototype,"terrainDepthTest",void 0),e([t()],i.prototype,"cullAboveTerrain",void 0),e([t()],i.prototype,"snowCover",void 0);export{i as PathTechniqueConfiguration};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import"../../../../core/has.js";import{secondsFromMilliseconds as t}from"../../../../core/time.js";import{fromValues as e}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as i}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{is3DGeometry as a,isColor as s}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as o}from"../effects/geometry/olidUtils.js";import{DefaultBufferWriter as n}from"./DefaultBufferWriter.js";import{PositionUvf32OlidLayout as c,PositionUvf32Layout as h}from"./DefaultLayouts.js";import{TriangleMaterialParameters as p,TriangleMaterial as l}from"./TriangleMaterial.js";import{WaterGLMaterial as m}from"./WaterGLMaterial.js";import{WaterTechniqueConfiguration as u}from"./WaterTechniqueConfiguration.js";class f extends l{constructor(t,e){super(t,d),this.visible=!0,this.produces=new Map([[2,t=>a(t)&&!this.transparent],[4,t=>a(t)&&this.transparent],[19,t=>this.parameters.draped&&a(t)],[20,t=>4===t]]),this._configuration=new u(e.spherical)}updateConfiguration(t){super.updateConfiguration(t),this._configuration.writeDepth=!0,this._configuration.receiveShadows=s(t.output)&&t.shadowMap.enabled,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.screenSpaceReflections=t.hasScreenSpaceReflections,this._configuration.cloudReflections=null!=t.clouds.data,this._configuration.draped=this.parameters.draped,this._configuration.terrainDepthTest=t.terrainDepthTest&&s(t.output),this._configuration.cullAboveTerrain=t.cullAboveTerrain}update(e){return this.setParameters({timeElapsed:t(e.time)*this.parameters.animationSpeed},!1),this._animationEnabled(e.camera)&&e.dt>0}_animationEnabled(t){const e=Math.min(t.relativeElevation,t.distance);return Math.sqrt(this.parameters.waveTextureRepeat/this.parameters.waveStrength)*e<g}get transparent(){return this.parameters.transparent}createGLMaterial(t){return new m(t)}createBufferWriter(){return new n(o()?c:h)}get test(){}}class d extends p{constructor(){super(...arguments),this.waveStrength=.06,this.waveTextureRepeat=32,this.waveDirection=e(1,0),this.waveVelocity=.05,this.flowStrength=.015,this.flowOffset=-.5,this.animationSpeed=.35,this.timeElapsed=0,this.color=i(0,0,0,0),this.transparent=!0,this.hasSlicePlane=!1,this.draped=!1,this.origin=r(),this.modelTransformation=null}}const g=35e3;export{d as Parameters,f as WaterMaterial};
2
+ import"../../../../core/has.js";import{secondsFromMilliseconds as t}from"../../../../core/time.js";import{fromValues as e}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as i}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{is3DGeometry as a,isColor as s}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as o}from"../effects/geometry/olidUtils.js";import{DefaultBufferWriter as n}from"./DefaultBufferWriter.js";import{PositionUvf32OlidLayout as h,PositionUvf32Layout as c}from"./DefaultLayouts.js";import{TriangleMaterialParameters as p,TriangleMaterial as l}from"./TriangleMaterial.js";import{WaterGLMaterial as f}from"./WaterGLMaterial.js";import{WaterTechniqueConfiguration as m}from"./WaterTechniqueConfiguration.js";import{hasShadowHighlights as u}from"../shaders/ReceiveShadowsConfiguration.js";class d extends l{constructor(t,e){super(t,g),this.visible=!0,this.produces=new Map([[2,t=>a(t)&&!this.transparent],[4,t=>a(t)&&this.transparent],[19,t=>this.parameters.draped&&a(t)],[20,t=>4===t]]),this._configuration=new m(e.spherical)}updateConfiguration(t){super.updateConfiguration(t),this._configuration.writeDepth=!0,this._configuration.receiveShadows=s(t.output)&&t.shadowMap.enabled,this._configuration.hasShadowHighlights=u(this._configuration,t),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.screenSpaceReflections=t.hasScreenSpaceReflections,this._configuration.cloudReflections=null!=t.clouds.data,this._configuration.draped=this.parameters.draped,this._configuration.terrainDepthTest=t.terrainDepthTest&&s(t.output),this._configuration.cullAboveTerrain=t.cullAboveTerrain}update(e){return this.setParameters({timeElapsed:t(e.time)*this.parameters.animationSpeed},!1),this._animationEnabled(e.camera)&&e.dt>0}_animationEnabled(t){const e=Math.min(t.relativeElevation,t.distance);return Math.sqrt(this.parameters.waveTextureRepeat/this.parameters.waveStrength)*e<w}get transparent(){return this.parameters.transparent}createGLMaterial(t){return new f(t)}createBufferWriter(){return new n(o()?h:c)}get test(){}}class g extends p{constructor(){super(...arguments),this.waveStrength=.06,this.waveTextureRepeat=32,this.waveDirection=e(1,0),this.waveVelocity=.05,this.flowStrength=.015,this.flowOffset=-.5,this.animationSpeed=.35,this.timeElapsed=0,this.color=i(0,0,0,0),this.transparent=!0,this.hasSlicePlane=!1,this.draped=!1,this.origin=r(),this.modelTransformation=null}}const w=35e3;export{g as Parameters,d as WaterMaterial};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{parameter as t}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{TriangleTechniqueConfiguration as i}from"./TriangleTechniqueConfiguration.js";class o extends i{constructor(e){super(),this.spherical=e,this.receiveShadows=!1,this.writeDepth=!1,this.screenSpaceReflections=!1,this.cloudReflections=!1,this.draped=!1,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.textureCoordinateType=0,this.emissionSource=0,this.pbrMode=3,this.occlusionPass=!1,this.useCustomDTRExponentForWater=!0,this.highStepCount=!0,this.useFillLights=!1,this.overlayEnabled=!1,this.snowCover=!1}get discardInvisibleFragments(){return this.transparent&&this.writeDepth}}e([t()],o.prototype,"receiveShadows",void 0),e([t()],o.prototype,"writeDepth",void 0),e([t()],o.prototype,"screenSpaceReflections",void 0),e([t()],o.prototype,"cloudReflections",void 0),e([t()],o.prototype,"draped",void 0),e([t()],o.prototype,"terrainDepthTest",void 0),e([t()],o.prototype,"cullAboveTerrain",void 0);export{o as WaterTechniqueConfiguration};
2
+ import{__decorate as e}from"tslib";import{parameter as t}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{TriangleTechniqueConfiguration as i}from"./TriangleTechniqueConfiguration.js";class o extends i{constructor(e){super(),this.spherical=e,this.receiveShadows=!1,this.hasShadowHighlights=!1,this.writeDepth=!1,this.screenSpaceReflections=!1,this.cloudReflections=!1,this.draped=!1,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.textureCoordinateType=0,this.emissionSource=0,this.pbrMode=3,this.occlusionPass=!1,this.useCustomDTRExponentForWater=!0,this.highStepCount=!0,this.useFillLights=!1,this.overlayEnabled=!1,this.snowCover=!1}get discardInvisibleFragments(){return this.transparent&&this.writeDepth}}e([t()],o.prototype,"receiveShadows",void 0),e([t()],o.prototype,"hasShadowHighlights",void 0),e([t()],o.prototype,"writeDepth",void 0),e([t()],o.prototype,"screenSpaceReflections",void 0),e([t()],o.prototype,"cloudReflections",void 0),e([t()],o.prototype,"draped",void 0),e([t()],o.prototype,"terrainDepthTest",void 0),e([t()],o.prototype,"cullAboveTerrain",void 0);export{o as WaterTechniqueConfiguration};