@arcgis/core 4.33.0-next.20250425 → 4.33.0-next.20250427
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/WebLinkChart.js +1 -1
- package/WebScene.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{d696abbb1b13ac1a689b.js → 345993291540433d3d92.js} +1 -1
- package/assets/esri/core/workers/chunks/{db5913824d5e5a2a8365.js → 360c8cff7c3b25d2b2d2.js} +1 -1
- package/assets/esri/core/workers/chunks/73f9c3a74a815baa239c.js +1 -0
- package/assets/esri/core/workers/chunks/76575d2c1c56e37c1315.js +319 -0
- package/assets/esri/core/workers/chunks/{f2cef954b58c6604642c.js → 87dcfbbcf290e0fa5c0f.js} +160 -167
- package/assets/esri/core/workers/chunks/91acd69dcf7dac109017.js +1 -0
- package/assets/esri/core/workers/chunks/{265f69d153b7b6f07e42.js → 92836e3a2c5226296fec.js} +1 -1
- package/assets/esri/core/workers/chunks/{75a04b073231da70c18d.js → d44e99b4bb1cec6a922b.js} +1 -1
- package/assets/esri/themes/base/_core.scss +2 -0
- package/assets/esri/themes/base/widgets/_Legend.scss +64 -0
- package/assets/esri/themes/base/widgets/_OrientedImageryViewerNavigationUI.scss +77 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_en.json +1 -1
- package/chunks/boundedPlane.js +1 -1
- package/geometry/support/boundedPlane.js +1 -1
- package/interfaces.d.ts +328 -65
- package/layers/KnowledgeGraphLayer.js +1 -1
- package/layers/LinkChartLayer.js +1 -1
- package/layers/ogc/wfsUtils.js +1 -1
- package/layers/orientedImagery/transformations/utils.js +1 -1
- package/package.json +1 -1
- package/smartMapping/renderers/size.js +1 -1
- package/smartMapping/renderers/support/spikeUtils.js +1 -1
- package/support/revision.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
- package/views/3d/analysis/Slice/SliceController.js +1 -1
- package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
- package/views/3d/layers/VoxelLayerView3D.js +1 -1
- package/views/3d/layers/graphics/GraphicsDeconflictor.js +1 -1
- package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +1 -1
- package/views/3d/layers/graphics/pipeline/FeatureProcessingContext.js +5 -0
- package/views/3d/layers/graphics/pipeline/PipelineCommand.js +1 -1
- package/views/3d/layers/graphics/pipeline/symbolization/Factory.js +1 -1
- package/views/3d/layers/graphics/pipeline/symbolization/SimpleFeatureRenderer.js +1 -1
- package/views/3d/layers/graphics/pipeline/symbolization/TestObjectSymbol.js +1 -1
- package/views/3d/layers/graphics/pipeline/symbolization/TestSymbol.js +1 -1
- package/views/3d/layers/graphics/pipeline/symbolization/UniqueValueFeatureRenderer.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/support/ViewSlice.js +5 -0
- package/views/3d/webgl-engine/core/shaderLibrary/shading/AnalyticalSkyModel.glsl.js +3 -6
- package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +15 -15
- package/views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRendering.glsl.js +0 -9
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/SliceHelper.js +1 -1
- package/views/3d/webgl-engine/shaders/BlackLevelLightSoftCompression.glsl.js +10 -0
- package/views/SceneView.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/tileUtils.js +1 -1
- package/webscene/types.d.ts +5 -0
- package/webscene/types.js +5 -0
- package/widgets/ElevationProfile/ElevationProfileController.js +1 -1
- package/widgets/Legend/styles/card/SizeRamp.js +1 -1
- package/widgets/Legend/styles/classic/SizeRamp.js +1 -1
- package/widgets/Legend/styles/support/sizeRampUtils.js +5 -0
- package/widgets/Legend/styles/support/univariateUtils.js +1 -1
- package/widgets/Legend/styles/support/utils.js +1 -1
- package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
- package/widgets/Legend/support/sizeRampUtils.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerVisibleElements.js +1 -1
- package/widgets/OrientedImageryViewer/components/NavigationNode.js +5 -0
- package/widgets/OrientedImageryViewer/components/NavigationUI.js +5 -0
- package/widgets/OrientedImageryViewer/components/NavigationUIViewModel.js +5 -0
- package/widgets/OrientedImageryViewer/components/imageNavigationUtils.js +5 -0
- package/widgets/OrientedImageryViewer/css.js +1 -1
- package/widgets/OrientedImageryViewer/utils.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/ShadowCast/DiscreteOptions.d.ts +4 -0
- package/widgets/ShadowCast/DiscreteOptions.js +1 -1
- package/widgets/ShadowCast/DurationOptions.d.ts +4 -0
- package/widgets/ShadowCast/DurationOptions.js +1 -1
- package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
- package/widgets/ShadowCast/ThresholdOptions.d.ts +4 -0
- package/widgets/ShadowCast/ThresholdOptions.js +1 -1
- package/widgets/TimeZoneLabel.js +1 -1
- package/assets/esri/core/workers/chunks/7c7ff11246479382974c.js +0 -1
- package/assets/esri/core/workers/chunks/b53300b46646cfad2526.js +0 -319
- package/assets/esri/core/workers/chunks/bd0dbad694ce5531deab.js +0 -1
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{colorGamma as i}from"../../../../../../colorUtils.js";import
|
|
6
|
-
const float GAMMA_SRGB = ${
|
|
5
|
+
import{colorGamma as i}from"../../../../../../colorUtils.js";import"../../../../../../core/has.js";import{EvaluateAmbientLighting as n}from"./EvaluateAmbientLighting.glsl.js";import{EvaluateAmbientOcclusion as e}from"./EvaluateAmbientOcclusion.glsl.js";import{addMainLightDirection as o,addMainLightIntensity as t,applyShading as a}from"./MainLighting.glsl.js";import{PhysicallyBasedRendering as r}from"./PhysicallyBasedRendering.glsl.js";import{PBRMode as l}from"./PhysicallyBasedRenderingParameters.glsl.js";import{PiUtils as c}from"./PiUtils.glsl.js";import{BooleanBindUniform as d}from"../../shaderModules/BooleanBindUniform.js";import{FloatBindUniform as s}from"../../shaderModules/FloatBindUniform.js";import{glsl as m,If as g}from"../../shaderModules/glsl.js";import{ambientBoost as h}from"../../../lighting/SceneLighting.js";import{BlackLevelLightSoftCompression as u}from"../../../shaders/BlackLevelLightSoftCompression.glsl.js";function p(i){i.constants.add("ambientBoostFactor","float",h)}function v(i){i.uniforms.add(new s("lightingGlobalFactor",(i=>i.lighting.globalFactor)))}function f(h,f){const L=h.fragment,{pbrMode:b,spherical:C,hasColorTexture:R}=f;h.include(e,f),b!==l.Disabled&&h.include(r,f),h.include(n,f),h.include(c);const G=!(b===l.Schematic&&!R);switch(G&&L.include(u),L.code.add(m`
|
|
6
|
+
const float GAMMA_SRGB = ${m.float(i)};
|
|
7
7
|
const float INV_GAMMA_SRGB = 0.4761904;
|
|
8
|
-
${
|
|
9
|
-
`),
|
|
8
|
+
${g(b!==l.Disabled,"const float GROUND_REFLECTANCE = 0.2;")}
|
|
9
|
+
`),p(L),v(L),o(L),L.code.add(m`
|
|
10
10
|
float additionalDirectedAmbientLight(vec3 vPosWorld) {
|
|
11
|
-
float vndl = dot(${
|
|
11
|
+
float vndl = dot(${C?m`normalize(vPosWorld)`:m`vec3(0.0, 0.0, 1.0)`}, mainLightDirection);
|
|
12
12
|
return smoothstep(0.0, 1.0, clamp(vndl * 2.5, 0.0, 1.0));
|
|
13
13
|
}
|
|
14
|
-
`),
|
|
14
|
+
`),t(L),L.code.add(m`vec3 evaluateAdditionalLighting(float ambientOcclusion, vec3 vPosWorld) {
|
|
15
15
|
float additionalAmbientScale = additionalDirectedAmbientLight(vPosWorld);
|
|
16
16
|
return (1.0 - ambientOcclusion) * additionalAmbientScale * ambientBoostFactor * lightingGlobalFactor * mainLightIntensity;
|
|
17
|
-
}`),
|
|
17
|
+
}`),b){case l.Disabled:case l.WaterOnIntegratedMesh:case l.Water:h.include(a),L.code.add(m`vec3 evaluateSceneLighting(vec3 normalWorld, vec3 albedo, float shadow, float ssao, vec3 additionalLight) {
|
|
18
18
|
vec3 mainLighting = applyShading(normalWorld, shadow);
|
|
19
19
|
vec3 ambientLighting = calculateAmbientIrradiance(normalWorld, ssao);
|
|
20
20
|
vec3 albedoLinear = pow(albedo, vec3(GAMMA_SRGB));
|
|
@@ -22,7 +22,7 @@ vec3 totalLight = mainLighting + ambientLighting + additionalLight;
|
|
|
22
22
|
totalLight = min(totalLight, vec3(PI));
|
|
23
23
|
vec3 outColor = vec3((albedoLinear / PI) * totalLight);
|
|
24
24
|
return pow(outColor, vec3(INV_GAMMA_SRGB));
|
|
25
|
-
}`);break;case
|
|
25
|
+
}`);break;case l.Normal:case l.Schematic:L.code.add(m`const float fillLightIntensity = 0.25;
|
|
26
26
|
const float horizonLightDiffusion = 0.4;
|
|
27
27
|
const float additionalAmbientIrradianceFactor = 0.02;
|
|
28
28
|
vec3 evaluateSceneLightingPBR(vec3 normal, vec3 albedo, float shadow, float ssao, vec3 additionalLight, vec3 viewDir, vec3 normalGround, vec3 mrr, vec4 _emission, float additionalAmbientIrradiance)
|
|
@@ -37,9 +37,9 @@ inputs.RdotNG = clamp(dot(reflectedView, normalGround), -1.0, 1.0);
|
|
|
37
37
|
inputs.albedoLinear = pow(albedo, vec3(GAMMA_SRGB));
|
|
38
38
|
inputs.ssao = ssao;
|
|
39
39
|
inputs.metalness = mrr[0];
|
|
40
|
-
inputs.roughness = clamp(mrr[1] * mrr[1], 0.001, 0.99);`),
|
|
40
|
+
inputs.roughness = clamp(mrr[1] * mrr[1], 0.001, 0.99);`),L.code.add(m`inputs.f0 = (0.16 * mrr[2] * mrr[2]) * (1.0 - inputs.metalness) + inputs.albedoLinear * inputs.metalness;
|
|
41
41
|
inputs.f90 = vec3(clamp(dot(inputs.f0, vec3(50.0 * 0.33)), 0.0, 1.0));
|
|
42
|
-
inputs.diffuseColor = inputs.albedoLinear * (vec3(1.0) - inputs.f0) * (1.0 - inputs.metalness);`),
|
|
42
|
+
inputs.diffuseColor = inputs.albedoLinear * (vec3(1.0) - inputs.f0) * (1.0 - inputs.metalness);`),f.useFillLights?L.uniforms.add(new d("hasFillLights",(i=>i.enableFillLights))):L.constants.add("hasFillLights","bool",!1),L.code.add(m`vec3 ambientDir = vec3(5.0 * normalGround[1] - normalGround[0] * normalGround[2], - 5.0 * normalGround[0] - normalGround[2] * normalGround[1], normalGround[1] * normalGround[1] + normalGround[0] * normalGround[0]);
|
|
43
43
|
ambientDir = ambientDir != vec3(0.0) ? normalize(ambientDir) : normalize(vec3(5.0, -1.0, 0.0));
|
|
44
44
|
inputs.NdotAmbDir = hasFillLights ? abs(dot(normal, ambientDir)) : 1.0;
|
|
45
45
|
float NdotL = clamp(dot(normal, mainLightDirection), 0.001, 1.0);
|
|
@@ -47,7 +47,7 @@ vec3 mainLightIrradianceComponent = NdotL * (1.0 - shadow) * mainLightIntensity;
|
|
|
47
47
|
vec3 fillLightsIrradianceComponent = inputs.NdotAmbDir * mainLightIntensity * fillLightIntensity;
|
|
48
48
|
vec3 ambientLightIrradianceComponent = calculateAmbientIrradiance(normal, ssao) + additionalLight;
|
|
49
49
|
inputs.skyIrradianceToSurface = ambientLightIrradianceComponent + mainLightIrradianceComponent + fillLightsIrradianceComponent ;
|
|
50
|
-
inputs.groundIrradianceToSurface = GROUND_REFLECTANCE * ambientLightIrradianceComponent + mainLightIrradianceComponent + fillLightsIrradianceComponent ;`),
|
|
50
|
+
inputs.groundIrradianceToSurface = GROUND_REFLECTANCE * ambientLightIrradianceComponent + mainLightIrradianceComponent + fillLightsIrradianceComponent ;`),L.uniforms.add(new s("lightingSpecularStrength",(i=>i.lighting.mainLight.specularStrength)),new s("lightingEnvironmentStrength",(i=>i.lighting.mainLight.environmentStrength))).code.add(m`vec3 horizonRingDir = inputs.RdotNG * normalGround - reflectedView;
|
|
51
51
|
vec3 horizonRingH = normalize(viewDirection + horizonRingDir);
|
|
52
52
|
inputs.NdotH_Horizon = dot(normal, horizonRingH);
|
|
53
53
|
float NdotH = clamp(dot(normal, h), 0.0, 1.0);
|
|
@@ -57,15 +57,15 @@ vec3 ambientLightRadianceComponent = lightingEnvironmentStrength * calculateAmbi
|
|
|
57
57
|
float normalDirectionModifier = mix(1., min(mix(0.1, 2.0, (inputs.NdotNG + 1.) * 0.5), 1.0), clamp(inputs.roughness * 5.0, 0.0 , 1.0));
|
|
58
58
|
inputs.skyRadianceToSurface = (ambientLightRadianceComponent + horizonLightRadianceComponent) * normalDirectionModifier + mainLightRadianceComponent;
|
|
59
59
|
inputs.groundRadianceToSurface = 0.5 * GROUND_REFLECTANCE * (ambientLightRadianceComponent + horizonLightRadianceComponent) * normalDirectionModifier + mainLightRadianceComponent;
|
|
60
|
-
inputs.averageAmbientRadiance = ambientLightIrradianceComponent[1] * (1.0 + GROUND_REFLECTANCE
|
|
60
|
+
inputs.averageAmbientRadiance = ambientLightIrradianceComponent[1] * (1.0 + GROUND_REFLECTANCE);`),L.code.add(m`
|
|
61
61
|
vec3 reflectedColorComponent = evaluateEnvironmentIllumination(inputs);
|
|
62
62
|
vec3 additionalMaterialReflectanceComponent = inputs.albedoLinear * additionalAmbientIrradiance;
|
|
63
63
|
vec3 emissionComponent = _emission.rgb == vec3(0.0) ? _emission.rgb : pow(_emission.rgb, vec3(GAMMA_SRGB));
|
|
64
64
|
vec3 outColorLinear = reflectedColorComponent + additionalMaterialReflectanceComponent + emissionComponent;
|
|
65
|
-
${
|
|
65
|
+
${G?m`vec3 outColor = pow(blackLevelSoftCompression(outColorLinear, inputs.averageAmbientRadiance), vec3(INV_GAMMA_SRGB));`:m`vec3 outColor = pow(max(vec3(0.0), outColorLinear - 0.005 * inputs.averageAmbientRadiance), vec3(INV_GAMMA_SRGB));`}
|
|
66
66
|
return outColor;
|
|
67
67
|
}
|
|
68
|
-
`);break;case
|
|
68
|
+
`);break;case l.Simplified:case l.TerrainWithWater:o(L),t(L),L.code.add(m`const float roughnessTerrain = 0.5;
|
|
69
69
|
const float specularityTerrain = 0.5;
|
|
70
70
|
const vec3 fresnelReflectionTerrain = vec3(0.04);
|
|
71
71
|
vec3 evaluatePBRSimplifiedLighting(vec3 n, vec3 c, float shadow, float ssao, vec3 al, vec3 vd, vec3 nup) {
|
|
@@ -91,4 +91,4 @@ vec3 specularComponent = specularityTerrain * specularColor * mainLightRadianceC
|
|
|
91
91
|
vec3 outColorLinear = outDiffColor + specularComponent;
|
|
92
92
|
vec3 outColor = pow(outColorLinear, vec3(INV_GAMMA_SRGB));
|
|
93
93
|
return outColor;
|
|
94
|
-
}`);
|
|
94
|
+
}`);default:case l.COUNT:}}export{f as EvaluateSceneLighting,p as addAmbientBoostFactor,v as addLightingGlobalFactor};
|
|
@@ -42,15 +42,6 @@ vec2 dfg = prefilteredDFGAnalytical(inputs.roughness, inputs.NdotV);
|
|
|
42
42
|
vec3 specularColor = inputs.f0 * dfg.x + inputs.f90 * dfg.y;
|
|
43
43
|
vec3 specularComponent = specularColor * indirectSpecular;
|
|
44
44
|
return (diffuseComponent + specularComponent);
|
|
45
|
-
}`),l.add(a`float gamutMapChanel(float x, vec2 p){
|
|
46
|
-
return (x < p.x) ? mix(0.0, p.y, x/p.x) : mix(p.y, 1.0, (x - p.x) / (1.0 - p.x) );
|
|
47
|
-
}`),l.add(a`vec3 blackLevelSoftCompression(vec3 inColor, PBRShadingInfo inputs){
|
|
48
|
-
vec3 outColor;
|
|
49
|
-
vec2 p = vec2(0.02 * (inputs.averageAmbientRadiance), 0.0075 * (inputs.averageAmbientRadiance));
|
|
50
|
-
outColor.x = gamutMapChanel(inColor.x, p) ;
|
|
51
|
-
outColor.y = gamutMapChanel(inColor.y, p) ;
|
|
52
|
-
outColor.z = gamutMapChanel(inColor.z, p) ;
|
|
53
|
-
return outColor;
|
|
54
45
|
}`))}function r(e,o){const n=e.fragment.code;e.include(t),n.add(a`
|
|
55
46
|
struct PBRShadingWater
|
|
56
47
|
{
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import{unitRGBAFromColor as i}from"../../../../core/colorUtils.js";import has from"../../../../core/has.js";import{clamp as s,lerp as a}from"../../../../core/mathUtils.js";import{removeMaybe as n,abortMaybe as h,destroyMaybe as o,releaseMaybe as d}from"../../../../core/maybe.js";import{throwIfAborted as l}from"../../../../core/promiseUtils.js";import{watch as _,syncAndInitial as p,initial as u,sync as m}from"../../../../core/reactiveUtils.js";import{signal as c}from"../../../../core/signal.js";import{Milliseconds as g}from"../../../../core/time.js";import{property as f}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as b}from"../../../../core/accessorSupport/decorators/subclass.js";import{equals as A,invert as T,multiply as E}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as P,create as R}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as S}from"../../../../chunks/vec42.js";import{ZEROS as I}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{fromValues as C,ZEROS as w}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as D}from"../../../../geometry/support/Indices.js";import{RenderCategory as N,InternalRenderCategory as O}from"../../webgl.js";import{innerAtmosphereFadeStart as y}from"../../environment/atmosphereUtils.js";import{minNearDistanceInMeters as x}from"../../state/NearFarHeuristic.js";import{debugFlags as H}from"../../support/debugFlags.js";import{FBOCache as L,defaultWebGLFBO as M}from"../core/FBOCache.js";import{DepthTextureFormat as v,ColorFormat as F,DepthRenderbufferFormat as U}from"../core/FBOCacheFormats.js";import{RenderPassManager as G}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as q,isColorOrColorEmission as V}from"../core/shaderLibrary/ShaderOutput.js";import{HUDRenderStyle as j}from"../core/shaderLibrary/hud/HUDRenderStyle.js";import{distanceFadeEnd as B}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as Q}from"../effects/RenderNodes.js";import{RenderPluginManager as W}from"../effects/RenderPluginManager.js";import{Blit as k}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as z,renderHighlightBuffer as Y}from"../effects/highlight/Highlight.js";import{OITBlend as X}from"../effects/transparency/OITBlend.js";import{AnimationTimer as K}from"./AnimationTimer.js";import{AnimationTimeStep as J}from"./AnimationTimeStep.js";import{RenderRequestType as Z}from"./basicInterfaces.js";import{BoundingInfo as $}from"./BoundingInfo.js";import{DepthRange as ee}from"./DepthRange.js";import{depthRangeFromScene as te,DepthRangeMode as re}from"./depthRangeUtils.js";import{hudFragmentOpacityParameters as ie}from"./hudFragmentOpacityParameters.js";import{MainFramebuffer as se}from"./MainFramebuffer.js";import{RenderOccludedFlag as ae}from"./Material.js";import{OITPass as ne}from"./OITPass.js";import{RenderContext as he,defaultRenderOccludedMask as oe}from"./RenderContext.js";import{RendererBase as de}from"./RendererBase.js";import{RendererTarget as le}from"./rendererUtils.js";import{setupFeatureDefaults as _e,RenderFeature as pe}from"./RenderFeature.js";import{RenderPluginInput as ue}from"./RenderPluginInput.js";import{RenderSlot as me}from"./RenderSlot.js";import{ShadowAccumulator as ce}from"./ShadowAccumulator.js";import{ShadowMap as ge,SnapshotSlot as fe}from"./ShadowMap.js";import be from"./SliceHelper.js";import{Transparency as Ae}from"./edgeRendering/interfaces.js";import{MergedRenderer as Te}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as Ee}from"../parts/renderUtils.js";import{RendererPerformanceInfo as Pe,PerformanceCategory as Re}from"../statistics/RendererPerformanceInfo.js";import{RenderState as Se}from"../../../support/RenderState.js";import{PixelFormat as Ie,PixelType as Ce,DepthStencilAttachment as we,FramebufferBit as De,ColorAttachment1 as Ne,ColorAttachment2 as Oe}from"../../../webgl/enums.js";let ye=class extends de{constructor(e,t,r,s,a,n){super({stage:e}),this._techniques=r,this._rctx=s,this._compositingHelper=a,this._requestRender=n,this._pluginsHas={hudElements:!1,water:!1},this.renderPassManager=new G,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=C(0,0,0,1),this._sliceHelper=new be,this._blit=null,this._oitblend=null,this.sceneDepthRange=c(ee.infinite),this._state=c(Se.IDLE),this._highQualityTransparencyEnabled=!0,this._ssrEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new J,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=c(0),this._lastFrameTime=g(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new ue,this._releaseNormals=e=>{e.some((({name:e})=>"normals"===e))&&this._pluginInput.release("normals")},this._debugNeedsDepth=!1,this.fboCache=new L(s),this._renderStateFeatures=c(_e(!has("disable-feature:high-quality-idle"),e.view.qualityProfile)),this._framebuffer=new se(this.fboCache),this.performanceInfo=new Pe(this._rctx),this._shadowMap=new ge(this.fboCache,e.viewingMode),this._shadowAccumulator=new ce(this.fboCache,r,e,(e=>{const t=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),this._shadowMap.enabled=t}),((t,r,i)=>{const s=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,r,i,!0,s),this._renderShadowCascades(q.Shadow,t.shadowMap),t.shadowMap.finish(),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)}),n),this._renderContext=new he(this._rctx,this._shadowMap,r),this._nodes=new Q(this._renderContext),this._plugins=new W({renderContext:this._renderContext,techniques:r,materials:t,requestRender:n,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this._plugins.add(this.renderPassManager),this.addHandles([_((()=>e.view.state.camera),(()=>n()),p),_((()=>H.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(Ae.TRANSPARENT):()=>{},n()}),u),_((()=>e.view.environment.background?.color),(e=>{const t=e?i(e):w;S(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),n()}),p),_((()=>e.view.state.camera.relativeElevation),(e=>this._inGlobeView=(e??1/0)>=B),p),_((()=>this._bindParameters.clouds.fadeFactor),(()=>this._bindParameters.fadeLighting()),m),_((()=>this._bindParameters.clouds.data?.state),(()=>n()),m),_((()=>e.view.state.highlights),(e=>{this._bindParameters.highlights=e,n()}),u)])}destroy(){this._gpuTimerHandle=n(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.dispose(),this._loadEdgeViewTask=h(this._loadEdgeViewTask),this._edgeView=o(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.fboCache.destroy(),this._plugins.destroy(),this._blit=null,this._oitblend=null,$.prune(),Te.prune(),D()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _framebufferSize(){return this._framebuffer.size}updateRenderFeatures(e=null,t=!has("disable-feature:high-quality-idle")){this._renderStateFeatures.value=_e(t,e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,r){this._renderStateFeatures.mutate((i=>i.set(t,e,r))),this._requestRender()}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(pe.HighQualityTransparency)}get hasReflections(){return this._pluginsHas.water&&(this._ssrEnabled||this.isFeatureEnabled(pe.WaterReflection))}get _hasHighlights(){return this._plugins.produces(q.Highlight,me.OPAQUE_MATERIAL,me.TRANSPARENT_MATERIAL,me.DRAPED_MATERIAL,me.HUD_MATERIAL,me.LABEL_MATERIAL)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(q.Highlight,me.HUD_MATERIAL,me.LABEL_MATERIAL)}get hasSSAO(){return(this.stage.view.qualitySettings.ambientOcclusion||this.isFeatureEnabled(pe.SSAO))&&!this._inGlobeView}get hasSMAA(){return this.stage.view.qualitySettings.antialiasingEnabled||this.isFeatureEnabled(pe.Antialiasing)}get fullResolutionAtmosphere(){return this.stage.view.qualitySettings.highResolutionAtmosphere||this.isFeatureEnabled(pe.HighResolutionAtmosphere)}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=d(this._bindParameters.ssr.lastFrameColor),this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth),this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth)}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._bindParameters.depth=d(this._bindParameters.depth),this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility)}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._shadowAccumulator.running||this._plugins.updating||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=r((async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");l(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:Be(this.stage.view.resourceController)});return this.addHandles(_((()=>r.updating),(()=>this._requestRender()),m)),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&&A(this._bindParameters.ssr.reprojectionMatrix,P)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:t,_bindParameters:r}=this;if(void 0!==e.qualitySettings?.reflections&&this._ssrEnabled!==e.qualitySettings.reflections&&(this._ssrEnabled=e.qualitySettings.reflections,this._requestRender()),void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&t.maxCascades!==e.shadowMapMaxCascades&&(t.maxCascades=e.shadowMapMaxCascades,this._requestRender()),null!=e.environment){null!=e.environment.weather&&(this._bindParameters.weather=e.environment.weather,this._bindParameters.weatherVisible=!!e.weatherVisible);const t="virtual"!==e.environment.lighting.type;r.enableFillLights!==t&&(r.enableFillLights=t,this._requestRender())}void 0!==e.highQualityTransparency&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),void 0!==e.shadowCast&&this._shadowAccumulator.setOptions(e.shadowCast)}set slicePlane(e){this._sliceHelper.plane!==e&&(this._sliceHelper.plane=e,this._requestRender())}get plugins(){return this._plugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}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)}updateHasFlags(){const has=this._pluginsHas;has.hudElements=this._plugins.produces(q.Color,...Ue),has.water=this._plugins.produces(q.Normal,me.DRAPED_WATER),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new K(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?n(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=le.Default,i=!1){try{return this._isRendering=!0,this._render(e,t,r,i)}catch(s){console.error(`Exception during rendering: ${s}`)}finally{this._isRendering=!1}return new Ee(this._pluginInput.get(N.FINAL),null)}_updateHUDOccludedFragmentOpacity(e,t){const{idleOpacity:r,navigatingOpacity:i,maxDelta:n,tiltFadeStart:h,tiltFadeEnd:o,altitudeStart:d,altitudeEnd:l}=ie,_=this.stage.view,p=_.stateManager.camera,u=_.qualitySettings.fadeDuration,m=e===Se.IDLE?r:i,c=s((p.tilt-h)/(o-h),0,1),g=s(((p.position.z??0)-d)/(l-d),0,1),f=a(a(1,m,c),1,g),b=this._bindParameters.hudOccludedFragmentOpacity;if(u<=0||b===f||0===this._lastFrameTime||this._lastFrameTime>t)return this._bindParameters.hudOccludedFragmentOpacity=f,void(this._lastFrameTime=t);const A=t-this._lastFrameTime;this._lastFrameTime=t;const T=Math.max(1-r,Math.abs(r-i)),E=Math.min(T*A/u,n);E>=Math.abs(f-b)?this._bindParameters.hudOccludedFragmentOpacity=f:(this._bindParameters.hudOccludedFragmentOpacity=b+Math.sign(f-b)*E,this._requestRender())}_render(e,t,r=le.Default,i){this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=r===le.Default,this._disposeBindBuffers();const{camera:s,contentCamera:a,mode:n,alignPixelEnabled:h}=e;this._state.value=n;const o=this._nodes.produces("magnifier-color"),l=this._nodes.produces(N.FINAL),_=this._nodes.require("emissive",O.TRANSPARENT_ENVIRONMENT,N.COMPOSITE,N.FINAL)>0&&this._plugins.hasEmissions,p=_?q.ColorEmission:q.Color;this._renderContext.time=t,this._renderContext.output=p,this._bindParameters.oitPass=ne.NONE,this._bindParameters.alignPixelEnabled=h,this._bindParameters.decorations=!i,this._bindParameters.mainDepth=null,this._bindParameters.slicePlane=this._sliceHelper.plane,this._bindParameters.viewshedEnabled=this._nodes.produces(O.VIEWSHED),this._renderOverlay(t),s.setGLViewport(this._rctx);const u=this._framebuffer,m=u.initialize(s.fullWidth,s.fullHeight,this._backgroundColor,_);this.hasReflections?(m?.setName("last frame color"),this._bindParameters.ssr.lastFrameColor=m):m?.release(),this._ensureBindParametersCamera(s,a),this._updateHUDOccludedFragmentOpacity(n,t),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&!i;const c=this._highQualityTransparency&&this._hasTransparentTerrain,g=this._plugins.produces(q.Color,...ve);this._precompilePrepasses(),this.performanceInfo.advance(Re.PREPARE);const f=this._computeShadowDepthRange(s);this._renderShadowMap(s,this._bindParameters.lighting.mainLight.direction,f),this._ensureBindParametersCamera(s,a),this._pluginInput.set("normals",this._renderNormals()),this._renderRemainingGeometryDepth(),this._renderShadowAccumulation(f,s,a),this._ensureBindParametersSSR(t),this._precompileShaders(c,g,p),this._renderContext.output=p,u.bind(),this._bindParameters.mainDepth=u.depth.attachment;const b=this.plugins.produces(q.Color,...Me);b&&this._renderOpaqueGeometry(),u.update((e=>this._renderNodes(N.OPAQUE,e,b))),this.fboCache.debugCallback?.(N.OPAQUE,u.color.fbo),u.update((e=>this._renderNodes(O.OPAQUE_ENVIRONMENT,e))),this.fboCache.debugCallback?.(O.OPAQUE_ENVIRONMENT,u.color.fbo),this._renderTerrainDepth(c),this._renderEdges(Ae.OPAQUE),u.bind(),this._renderPlugins(me.VOXEL,Re.VOXEL),this._renderHiddenTransparentEdges(),g&&(this._oitEnabled?this._renderOIT(xe.Geometry,p):this._renderTransparentGeometry()),u.update((e=>this._renderNodes(N.TRANSPARENT,e,g))),this.fboCache.debugCallback?.(N.TRANSPARENT,u.color.fbo),this._renderGeometryDepth(c),this._renderHUDVisibility(),c||this._plugins.render(this._pluginInput,me.LINE_CALLOUTS),this._renderEdges(Ae.TRANSPARENT);const A=this._hasTransparentTerrain?this._renderTransparentTerrain():null;A&&(this.performanceInfo.advance(Re.TRANSPARENT_TERRAIN),this._bindParameters.hudVisibility&&(c?this._renderLineCallouts(j.Occluded):(this._rctx.bindFramebuffer(this._bindParameters.hudVisibility?.fbo),this._compositingHelper.compositeHUD(this._bindParameters,A.getTexture())),this._renderHUD(j.Occluded,u.color,p))),this._bindParameters.cullAboveTerrain=!1,A&&(u.bind(),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,A.getTexture()),A.release(),c&&(this._renderEdges(Ae.OPAQUE),g&&(this._oitEnabled?this._renderOIT(xe.Geometry,p):this._renderTransparentGeometry(),this.performanceInfo.advance(Re.TRANSPARENT)),this._renderEdges(Ae.TRANSPARENT))),this._bindParameters.ssao=d(this._bindParameters.ssao),c&&this._renderLineCallouts(j.NotOccluded),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment(),this._pluginInput.set(O.FOCUSAREA,this._renderFocusAreaGeometry()),u.update((e=>this._renderNodes(O.TRANSPARENT_ENVIRONMENT,e))),u.update((e=>this._renderNodes(O.VIEWSHED,e))),u.update((e=>this._renderNodes(O.LASERLINES,e))),u.update((e=>this._renderNodes(O.FOCUSAREA_COLOR,e))),u.update((e=>this._renderNodes(O.OCCLUDED,e))),this._pluginInput.set("highlights",this._renderHighlightPrepass());const T=r===le.ObjectAndLayerID?this._renderObjectAndLayerIdColor():null;u.update((e=>this._renderNodes(N.COMPOSITE,e))),this._pluginInput.release(O.FOCUSAREA);const E=!(r!==le.Default||l||o&&!i),P=this._pluginInput.get(N.COMPOSITE),R=E?M:this.fboCache.acquire(P.fbo.width,P.fbo.height,O.ANTIALIASING),S=this._nodes.produces(O.ANTIALIASING)?this._renderNodes(O.ANTIALIASING,R):this._blitFBO(P,R,!1);let I;this._pluginInput.set(O.ANTIALIASING,S),this._hasHUDHighlights?(this._renderHUD(j.NotOccluded,S,p),I=this._renderNodes(O.HIGHLIGHTS,S)):(I=this._renderNodes(O.HIGHLIGHTS,S),this._renderHUD(j.NotOccluded,I,p));const C=this._renderNodes(O.MAGNIFIER,I);return o&&!i&&r===le.Default&&!l&&this._blitFBO(C),l?(C.attachDepth(u.depth),this._blitFBO(this._renderNodes(N.FINAL,C)),C.detachDepth()):this._pluginInput.set(N.FINAL,C),this._pluginInput.release("highlights"),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),u.releaseDepth(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),this.performanceInfo.finishFrame(),r!==le.Default&&(this._releaseFBOs(),this._disposeOffscreenBuffers()),new Ee(this._pluginInput.get(N.FINAL),T)}_precompileShaders(e,t,r){++this._plugins.context.techniques.precompiling,this._renderContext.output=r,this._precompileOpaqueGeometry(),this._nodes.precompile(O.OPAQUE_ENVIRONMENT),this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,this._renderContext.output=q.Depth,this._plugins.precompile(me.TRANSPARENT_TERRAIN),e&&(this._precompileOpaqueGeometry(),this._precompileTransparentGeometry()),this._renderContext.output=r,this._plugins.precompile(me.TRANSPARENT_TERRAIN),t&&(this._precompileTransparentGeometry(),this._hasTransparentTerrain&&(this._bindParameters.cullAboveTerrain=!1,this._precompileTransparentGeometry(),this._bindParameters.cullAboveTerrain=e)),this._nodes.precompile(O.FOCUSAREA),this._needsHUDVisibility&&this._plugins.precompile(me.OCCLUSION_PIXELS),this._plugins.precompile(me.LINE_CALLOUTS),this._precompileHUD(j.Occluded),this._bindParameters.terrainDepthTest=!1,this._bindParameters.cullAboveTerrain=!1,this._nodes.precompile(O.VIEWSHED,O.LASERLINES,O.FOCUSAREA_COLOR,O.OCCLUDED,O.ANTIALIASING,O.HIGHLIGHTS);const i=this._bindParameters;i.highlightMixTexture=i.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(j.NotOccluded),this._hasHighlights&&(i.highlights.forEach(((e,t)=>{i.highlightLevel=t,this._precompileAllGeometry(q.Highlight)})),i.highlightLevel=null),i.highlightMixTexture=null,this._nodes.precompile(N.COMPOSITE,O.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(me.TRANSPARENT_MATERIAL_WITHOUT_DEPTH),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){if(!this._nodes.produces(O.FOCUSAREA))return null;const{width:e,height:t}=this._framebufferSize;let r=this.fboCache.acquire(e,t,O.FOCUSAREA);return r=this._nodes.render(r,this._pluginInput),this.performanceInfo.advance(Re.FOCUS_AREA_MASK),r}_renderObjectAndLayerIdColor(){if(!this._nodes.produces("olid"))return null;const e=this._renderContext.output;++this._techniques.precompiling;const t=this._framebufferSize;let r=this.fboCache.acquire(t.width,t.height,"olid");return r.acquireDepth(v.DEPTH24_STENCIL8),r=this._nodes.render(r,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(Re.OBJECT_AND_LAYER_ID_COLOR),this._renderContext.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=e===Z.BACKGROUND;if(r||t){const e=r?this.performanceInfo.elapsedTime:0;let i=0;t?i=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const s=Math.max(e,i);this._animationTimestep.frame(s,r)}}readMainDepth(e,t){const{mainDepth:r,camera:i}=this._bindParameters;if(!r)return;const s=this.fboCache.acquire(this._framebufferSize.width,this._framebufferSize.height,"linear-depth");this._rctx.bindFramebuffer(s.fbo),i.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(w),this._compositingHelper.blitDepthToLinearDepth(this._bindParameters,r),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),s.fbo?.readPixels(e[0],e[1],e[2],e[3],Ie.RGBA,Ce.UNSIGNED_BYTE,t),s.release()}readHUDVisibility(e,t,r,i,s){this._bindParameters.hudVisibility?.fbo?.readPixels(e,t,r,i,Ie.RGBA,Ce.UNSIGNED_BYTE,s)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_renderEdges(e){const t=this._edgeView;if(!t?.shouldRender())return;const r=this._framebufferSize,i=this.fboCache.acquire(r.width,r.height,"edges"),s=()=>t.render(this._bindParameters,e),a=this._bindParameters.geometryDepth;this.renderToTargets(s,i,a??this._framebuffer.depth,w),this._framebuffer.bind(),this._compositingHelper.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(e===Ae.OPAQUE?Re.OPAQUE_EDGES:Re.TRANSPARENT_EDGES)}_renderOverlay(e){this._bindParameters.overlay=this.overlay?.render(e),this._bindParameters.overlay&&this.performanceInfo.advance(Re.OVERLAY)}_renderShadowMap(e,t,r){if(!this.shadowsEnabled)return;const i=this._shadowMap;i.start(e,t,r,this.isFeatureEnabled(pe.HighResolutionShadows),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(q.ShadowHighlight,this._shadowMap),i.moveSnapshot(fe.Highlight),this._renderShadowCascades(q.ShadowExcludeHighlight,this._shadowMap),i.copySnapshot(fe.ExcludeHighlight),this._renderShadowCascades(q.ShadowHighlight,this._shadowMap)):this._renderShadowCascades(q.Shadow),i.finish(),e.setGLViewport(this._rctx),this.performanceInfo.advance(Re.SHADOW_MAP)}_precompileShadowCascades(e){for(const t of this._shadowMap.cascades)t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.camera),this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._shadowMap){for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this.renderAllGeometry(e)}get _needsDepth(){return this._plugins.consumes(q.Depth)||this._nodes.requireGeometryDepth()||this.hasReflections||this._needsShadowHighlight||this._needsShadowAccumulation||this._debugNeedsDepth}_renderRemainingGeometryDepth(){const e=this._pluginInput.get("normals");if(e){const t=this._needsDepth?e.getAttachment(we):null;t?.retain(),this._pluginInput.set(O.SSAO,this._renderSSAO()),this._renderGeometryWithoutNormalsDepth(t)}else this._renderAllGeometryDepth()}_renderGeometryWithoutNormalsDepth(e){if(!this._needsDepth||!e)return void(this._bindParameters.depth=d(this._bindParameters.depth));const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"depth");r.attachDepth(e),e.release(),this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(De.STENCIL),this._renderGeometryWithoutNormals(q.Depth),d(this._bindParameters.depth),this._bindParameters.depth=r.obtainDepthTexture(),r.release(),this.performanceInfo.advance(Re.DEPTH)}_renderAllGeometryDepth(){if(!this._needsDepth)return void(this._bindParameters.depth=d(this._bindParameters.depth));const e=this._framebufferSize,t=this.fboCache.acquire(e.width,e.height,"depth",v.DEPTH24_STENCIL8);this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(De.DEPTH|De.STENCIL),this.renderAllGeometry(q.Depth),d(this._bindParameters.depth),this._bindParameters.depth=t.obtainDepthTexture(),t.release(),this.performanceInfo.advance(Re.DEPTH)}_renderTerrainDepth(e){if(this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,!e)return void(this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth));const t=this._renderContext.output;this._renderContext.output=q.Depth;const r=this._framebufferSize,i=this.fboCache.acquire(r.width,r.height,"terrain depth",v.DEPTH24_STENCIL8);this._rctx.bindFramebuffer(i.fbo),this._rctx.clear(De.DEPTH|De.STENCIL),this._renderTransparentTerrain(),d(this._bindParameters.terrainDepth),this._bindParameters.terrainDepth=i.obtainDepthTexture(),this._renderContext.output=t,i.release()}_renderGeometryDepth(e){if(!e)return void(this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth));const t=this._renderContext.output,{width:r,height:i}=this._framebufferSize,s=this.fboCache.acquire(r,i,"geometry depth",v.DEPTH24_STENCIL8);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(De.DEPTH|De.STENCIL),this._renderOpaqueAndTransparentGeometry(q.Depth),this._renderContext.output=t,d(this._bindParameters.geometryDepth),this._bindParameters.geometryDepth=s.obtainDepthTexture(),s.release()}get _needsShadowDepthRange(){return this._shadowMap.enabled||this._needsShadowAccumulation}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return ee.zero;const t=te(e,this._plugins.plugins,this.stage.layers,re.SHADOW_CASTERS);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=ee.infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<y)return void(this.sceneDepthRange.value=ee.infinite);const t=e.clone();t.near=x,t.far=1e10;const r=te(t,this._plugins.plugins,this.stage.layers,re.FULL_SCENE);r.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.far===r.far&&this.sceneDepthRange.value.near===r.near||(this.sceneDepthRange.value=r)}get _normalsRequired(){const e=this._nodes.require("normals",N.FINAL,N.COMPOSITE,N.OPAQUE,N.TRANSPARENT,O.VIEWSHED,O.LASERLINES);return(this.hasSSAO?1:0)+e}_precompilePrepasses(){this._normalsRequired&&this._precompileAllGeometry(q.Normal),this._needsDepth&&this._precompileAllGeometry(q.Depth),this.shadowsEnabled&&(this._needsShadowHighlight?(this._precompileShadowCascades(q.ShadowHighlight),this._precompileShadowCascades(q.ShadowExcludeHighlight),this._precompileShadowCascades(q.ShadowHighlight)):this._precompileShadowCascades(q.Shadow)),this._needsShadowAccumulation&&this._precompileAllGeometry(q.Shadow)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"normals",F.RGBA8UNORM);r.acquireDepth(v.DEPTH24_STENCIL8),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(w,!0,!0),this._renderGeometryWithNormals(q.Normal);const i=this._nodes.optional("normals",N.FINAL,N.COMPOSITE,N.OPAQUE,N.TRANSPARENT,O.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(Re.NORMALS),r}_renderSSAO(){const e=this._pluginInput.get("normals");if(!this.hasSSAO||!e)return void e?.detachDepth();M.setName(O.SSAO);const t=this._nodes.render(M,this._pluginInput);return this._bindParameters.ssao=t,e.detachDepth(),this._pluginInput.release("normals"),this.performanceInfo.advance(Re.SSAO),t}_precompileAllGeometry(e){const t=this._renderContext.output;this._renderContext.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(me.TRANSPARENT_TERRAIN),this._renderContext.output=t}renderAllGeometry(e){this._renderContext.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentTerrain()}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,...Fe);this._renderContext.renderOccludedMask=oe}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,this._pluginInput)}))}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>ae.Occlude&&this._plugins.render(this._pluginInput,me.OCCLUDED_TERRAIN),this.renderSlots(e,...Fe),this._renderContext.renderOccludedMask=oe}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(this._pluginInput,me.HUD_MATERIAL)}precompileViewshedShadowMap(){this._precompileAllGeometry(q.ViewshedShadow)}renderViewshedShadowMap(e){const{camera:t,contentCamera:r}=this._bindParameters,i=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(q.ViewshedShadow),this._ensureBindParametersCamera(t,r),this._bindParameters.camera.setGLViewport(this._rctx),this._renderContext.output=i}_renderOpaqueAndTransparentGeometry(e){this._renderContext.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithNormals(e){this._renderContext.output=e,this._plugins.render(this._pluginInput,...He),this._renderTransparentTerrain()}_renderGeometryWithoutNormals(e){this._renderContext.output=e,this._plugins.render(this._pluginInput,...Le)}_precompileOpaqueGeometry(){this._plugins.precompile(...Me)}_renderOpaqueGeometry(){this._plugins.render(this._pluginInput,...Me)}_renderTransparentGeometry(){this._plugins.render(this._pluginInput,...ve)}get _hasTransparentTerrain(){return this._plugins.produces(q.Color,me.TRANSPARENT_TERRAIN)}_renderTransparentTerrain(){const e=()=>this._plugins.render(this._pluginInput,me.TRANSPARENT_TERRAIN);if(!V(this._renderContext.output))return void e();const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"transparent terrain");return this.renderToTargets(e,r,this._framebuffer.depth,w),r}get _needsHUDVisibility(){return this._plugins.produces(this._renderContext.output,me.OCCLUSION_PIXELS)}_renderHUDVisibility(){if(!this._needsHUDVisibility)return void(this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility));const{width:e,height:t}=this._framebufferSize;let r=this._bindParameters.hudVisibility;r?.fbo?.width===e&&r?.fbo?.height===t||(r?.release(),r=this.fboCache.acquire(e,t,"hud visibility",F.RGBA4UNORM),this._bindParameters.hudVisibility=r);const i=this._bindParameters.geometryDepth;r.attachDepth(i||this._framebuffer.depth),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer([0,1,0,1]),this._plugins.render(this._pluginInput,me.OCCLUSION_PIXELS),r.detachDepth(),this._framebuffer.bind(),this.performanceInfo.advance(Re.HUD_VISIBILITY)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,e===j.Occluded){const e=()=>this._plugins.render(this._pluginInput,me.LINE_CALLOUTS),t=this._framebufferSize,r=this.fboCache.acquireDepth(U.DEPTH16,t.width,t.height,"line callouts");this.renderToTargets(e,this._framebuffer.color,r,void 0,!0,!0),r.release()}else this._plugins.render(this._pluginInput,me.LINE_CALLOUTS)}_precompileHUD(e){if(this._precompileHUDOutput(e),this._hasHighlights){const t=this._renderContext.output;this._renderContext.output=q.Highlight,this._precompileHUDOutput(e),this._renderContext.output=t}}_precompileHUDOutput(e){const t=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this._oitEnabled&&V(this._renderContext.output)?(this._bindParameters.oitPass=ne.ColorAlpha,this._plugins.precompile(...Ue),this._bindParameters.oitPass=ne.FrontFace,this._plugins.precompile(...Ue),this._bindParameters.oitPass=ne.NONE):this._plugins.precompile(...Ue),this._bindParameters.hudRenderStyle=t}_renderHUD(e,t,r){if(this._pluginsHas.hudElements){if(this._oitEnabled){const i=this._renderOIT(xe.HUD,r,e);this._rctx.bindFramebuffer(t.fbo),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,i.getTexture()),i.release()}else if(this._renderContext.output=r,e===j.Occluded){const t=()=>this._renderHUDElements(e),r=this._framebufferSize,i=this.fboCache.acquireDepth(U.DEPTH16,r.width,r.height,"hud");this.renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(U.DEPTH16),this._rctx.bindFramebuffer(t.fbo),this._renderHUDElements(e),t.detachDepth();this.performanceInfo.advance(e===j.Occluded?Re.HUD_OCCLUDED:Re.HUD)}}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(this._pluginInput,...Ue)}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(q.ShadowHighlight,me.OPAQUE_MATERIAL)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:r}=this,i=this._framebufferSize,{highlights:s}=r,a=e.acquire(i.width,i.height,"highlights",s.length>z?F.RG8UINT:F.R8UINT);a.acquireDepth(v.DEPTH24_STENCIL8),t.bindFramebuffer(a.fbo);const{gl:n}=t;return n.clearBufferuiv(n.COLOR,0,[0,0,0,0]),this._renderContext.output=q.Highlight,t.bindFramebuffer(a.fbo),Y(t,e,i,r,(()=>this._renderHighlightGeometries())),this.performanceInfo.advance(Re.HIGHLIGHTS),a}_renderHighlightGeometries(){this._plugins.render(this._pluginInput,...Ge),this._rctx.clear(De.DEPTH),this._renderHUDElements(j.Both)}get _needsShadowAccumulation(){return this._shadowAccumulator.accumulating}_renderShadowAccumulation(e,t,r){this._needsShadowAccumulation&&this._bindParameters.depth&&this._shadowAccumulator.renderAccumulation(this._bindParameters.depth,e,t,r)&&this.performanceInfo.advance(Re.ACCUMULATED_SHADOWS)}_precompileTransparentGeometry(){this._oitEnabled&&V(this._renderContext.output)?(this._bindParameters.oitPass=ne.ColorAlpha,this._plugins.precompile(...ve),this._bindParameters.oitPass=ne.FrontFace,this._plugins.precompile(...ve),this._bindParameters.oitPass=ne.NONE):this._plugins.precompile(...ve)}_renderOIT(e,t,r=j.Both){const i=e===xe.HUD,s=this._framebufferSize,a=i?this.fboCache.acquire(s.width,s.height,"oit hud composite"):null,n=i?()=>this._renderHUDElements(r):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=this._renderContext.output;this._renderContext.output=t,h.oitPass=ne.ColorAlpha;const d=a?"oit hud color+alpha":"oit color+alpha",l=this.fboCache.acquire(s.width,s.height,d,F.RGBA16FLOAT),_=t===q.ColorEmission;_&&l.acquireColor(Ne,F.RGBA16FLOAT,"emissive"),l.acquireColor(_?Oe:Ne,F.R16FLOAT),a||l.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(l.fbo),this._rctx.clearFramebuffer([0,0,0,1]),_&&this._rctx.clearBuffer(1,I),n(),l.detachDepth(),h.oitPass=ne.FrontFace;const p=this.fboCache.acquire(s.width,s.height,a?"oit hud front":"oit front");return _&&p.acquireColor(Ne,F.RGBA16FLOAT,"emissive"),a?p.acquireDepth(U.DEPTH16):p.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(p.fbo),this._rctx.clearFramebuffer(w,!!a),n(),p.detachDepth(),h.oitPass=ne.NONE,a?(this._rctx.bindFramebuffer(a.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(De.COLOR)):this._framebuffer.bind(),this._oitblend??=new X(this._techniques),this._oitblend.blend(this._rctx,l,p,h,_),a?.detachDepth(),p.release(),l.release(),this._renderContext.output=o,a}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(Re.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(this._pluginInput,me.TRANSPARENT_MATERIAL_WITHOUT_DEPTH),this.performanceInfo.advance(Re.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderPlugins(e,t){this._plugins.produces(this._renderContext.output,e)&&(this._plugins.render(this._pluginInput,e),this.performanceInfo.advance(t))}_renderNodes(e,t,r=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return r&&this.performanceInfo.advance(e),t;const i=this._nodes.render(t,this._pluginInput,this._releaseNormals);return this.performanceInfo.advance(e),i}_blitFBO(e,t=M,r=!0){return this._blit??=new k(this._techniques),this._blit.blit(this._rctx,e,t,this._bindParameters),this._pluginInput.set(e.name,t),r&&e.release(),t}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=P:(T(Ve,this._bindParameters.camera.viewMatrix),T(qe,this._bindParameters.camera.projectionMatrix),E(je,Ve,qe),E(je,this._renderContext.lastFrameCamera.viewMatrix,je),E(je,this._renderContext.lastFrameCamera.projectionMatrix,je),this._reprojectionMatrix=je);const t=this.stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=t>0?Math.min(t,e-this._ssrEnableTime)/t:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=P,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,r,i){this._bindParameters.updateLighting(e,t,r,i),this._requestRender(Z.UPDATE)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0}}renderToTargets(e,t,r,i,s=!1,a=!1){t.attachDepth(r),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(i,s,a),e(),t.detachDepth()}get test(){}};var xe;e([f({readOnly:!0})],ye.prototype,"fullResolutionAtmosphere",null),e([f()],ye.prototype,"_edgeView",void 0),e([f()],ye.prototype,"updating",null),ye=e([b("esri.views.3d.webgl-engine.lib.Renderer")],ye),function(e){e[e.Geometry=0]="Geometry",e[e.HUD=1]="HUD"}(xe||(xe={}));const He=[me.INTEGRATED_MESH,me.OPAQUE_TERRAIN,me.OPAQUE_MATERIAL,me.TRANSPARENT_MATERIAL],Le=[me.OPAQUE_MATERIAL_WITHOUT_NORMALS,me.TRANSPARENT_MATERIAL_WITHOUT_NORMALS],Me=[me.INTEGRATED_MESH,me.OPAQUE_TERRAIN,me.OPAQUE_MATERIAL,me.OPAQUE_MATERIAL_WITHOUT_NORMALS],ve=[me.TRANSPARENT_MATERIAL,me.TRANSPARENT_MATERIAL_WITHOUT_NORMALS],Fe=[me.OPAQUE_MATERIAL,me.TRANSPARENT_MATERIAL,me.TRANSPARENT_MATERIAL_WITHOUT_DEPTH],Ue=[me.LINE_CALLOUTS_HUD_DEPTH,me.HUD_MATERIAL,me.LABEL_MATERIAL],Ge=[me.TRANSPARENT_MATERIAL,me.TRANSPARENT_MATERIAL_WITHOUT_NORMALS,me.OPAQUE_MATERIAL,me.OPAQUE_MATERIAL_WITHOUT_NORMALS,me.TRANSPARENT_TERRAIN,me.INTEGRATED_MESH,me.OPAQUE_TERRAIN],qe=R(),Ve=R(),je=R();function Be(e){return t=>e.immediate.schedule(t)}export{ye as Renderer};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import{unitRGBAFromColor as i}from"../../../../core/colorUtils.js";import has from"../../../../core/has.js";import{clamp as s,lerp as a}from"../../../../core/mathUtils.js";import{removeMaybe as n,abortMaybe as h,destroyMaybe as o,releaseMaybe as d}from"../../../../core/maybe.js";import{throwIfAborted as l}from"../../../../core/promiseUtils.js";import{watch as _,syncAndInitial as u,initial as p,sync as m}from"../../../../core/reactiveUtils.js";import{signal as c}from"../../../../core/signal.js";import{Milliseconds as g}from"../../../../core/time.js";import{property as f}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as b}from"../../../../core/accessorSupport/decorators/subclass.js";import{equals as A,invert as T,multiply as E}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as P,create as R}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as S}from"../../../../chunks/vec42.js";import{ZEROS as I}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{fromValues as C,ZEROS as w}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as D}from"../../../../geometry/support/Indices.js";import{RenderCategory as N,InternalRenderCategory as O}from"../../webgl.js";import{innerAtmosphereFadeStart as y}from"../../environment/atmosphereUtils.js";import{minNearDistanceInMeters as x}from"../../state/NearFarHeuristic.js";import{debugFlags as H}from"../../support/debugFlags.js";import{FBOCache as L,defaultWebGLFBO as M}from"../core/FBOCache.js";import{DepthTextureFormat as v,ColorFormat as F,DepthRenderbufferFormat as U}from"../core/FBOCacheFormats.js";import{RenderPassManager as G}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as q,isColorOrColorEmission as V}from"../core/shaderLibrary/ShaderOutput.js";import{HUDRenderStyle as j}from"../core/shaderLibrary/hud/HUDRenderStyle.js";import{distanceFadeEnd as B}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as Q}from"../effects/RenderNodes.js";import{RenderPluginManager as W}from"../effects/RenderPluginManager.js";import{Blit as k}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as z,renderHighlightBuffer as Y}from"../effects/highlight/Highlight.js";import{OITBlend as X}from"../effects/transparency/OITBlend.js";import{AnimationTimer as K}from"./AnimationTimer.js";import{AnimationTimeStep as J}from"./AnimationTimeStep.js";import{RenderRequestType as Z}from"./basicInterfaces.js";import{BoundingInfo as $}from"./BoundingInfo.js";import{DepthRange as ee}from"./DepthRange.js";import{depthRangeFromScene as te,DepthRangeMode as re}from"./depthRangeUtils.js";import{hudFragmentOpacityParameters as ie}from"./hudFragmentOpacityParameters.js";import{MainFramebuffer as se}from"./MainFramebuffer.js";import{RenderOccludedFlag as ae}from"./Material.js";import{OITPass as ne}from"./OITPass.js";import{RenderContext as he,defaultRenderOccludedMask as oe}from"./RenderContext.js";import{RendererBase as de}from"./RendererBase.js";import{RendererTarget as le}from"./rendererUtils.js";import{setupFeatureDefaults as _e,RenderFeature as ue}from"./RenderFeature.js";import{RenderPluginInput as pe}from"./RenderPluginInput.js";import{RenderSlot as me}from"./RenderSlot.js";import{ShadowAccumulator as ce}from"./ShadowAccumulator.js";import{ShadowMap as ge,SnapshotSlot as fe}from"./ShadowMap.js";import be from"./SliceHelper.js";import{Transparency as Ae}from"./edgeRendering/interfaces.js";import{MergedRenderer as Te}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as Ee}from"../parts/renderUtils.js";import{RendererPerformanceInfo as Pe,PerformanceCategory as Re}from"../statistics/RendererPerformanceInfo.js";import{RenderState as Se}from"../../../support/RenderState.js";import{PixelFormat as Ie,PixelType as Ce,DepthStencilAttachment as we,FramebufferBit as De,ColorAttachment1 as Ne,ColorAttachment2 as Oe}from"../../../webgl/enums.js";let ye=class extends de{constructor(e,t,r,s,a,n){super({stage:e}),this._techniques=r,this._rctx=s,this._compositingHelper=a,this._requestRender=n,this._pluginsHas={hudElements:!1,water:!1},this.renderPassManager=new G,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=C(0,0,0,1),this._sliceHelper=new be,this._blit=null,this._oitblend=null,this.sceneDepthRange=c(ee.infinite),this._state=c(Se.IDLE),this._highQualityTransparencyEnabled=!0,this._ssrEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new J,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=c(0),this._lastFrameTime=g(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new pe,this._releaseNormals=e=>{e.some((({name:e})=>"normals"===e))&&this._pluginInput.release("normals")},this._debugNeedsDepth=!1,this.fboCache=new L(s),this._renderStateFeatures=c(_e(!has("disable-feature:high-quality-idle"),e.view.qualityProfile)),this._framebuffer=new se(this.fboCache),this.performanceInfo=new Pe(this._rctx),this._shadowMap=new ge(this.fboCache,e.viewingMode),this._shadowAccumulator=new ce(this.fboCache,r,e,(e=>{const t=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),this._shadowMap.enabled=t}),((t,r,i)=>{const s=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,r,i,!0,s),this._renderShadowCascades(q.Shadow,t.shadowMap),t.shadowMap.finish(),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)}),n),this._renderContext=new he(this._rctx,this._shadowMap,r),this._nodes=new Q(this._renderContext),this._plugins=new W({renderContext:this._renderContext,techniques:r,materials:t,requestRender:n,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this._plugins.add(this.renderPassManager),this.addHandles([_((()=>e.view.state.camera),(()=>n()),u),_((()=>H.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(Ae.TRANSPARENT):()=>{},n()}),p),_((()=>e.view.environment.background?.color),(e=>{const t=e?i(e):w;S(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),n()}),u),_((()=>e.view.state.camera.relativeElevation),(e=>this._inGlobeView=(e??1/0)>=B),u),_((()=>this._bindParameters.clouds.fadeFactor),(()=>this._bindParameters.fadeLighting()),m),_((()=>this._bindParameters.clouds.data?.state),(()=>n()),m),_((()=>e.view.state.highlights),(e=>{this._bindParameters.highlights=e,n()}),p)])}destroy(){this._gpuTimerHandle=n(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.dispose(),this._loadEdgeViewTask=h(this._loadEdgeViewTask),this._edgeView=o(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.fboCache.destroy(),this._plugins.destroy(),this._blit=null,this._oitblend=null,$.prune(),Te.prune(),D()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _framebufferSize(){return this._framebuffer.size}updateRenderFeatures(e=null,t=!has("disable-feature:high-quality-idle")){this._renderStateFeatures.value=_e(t,e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,r){this._renderStateFeatures.mutate((i=>i.set(t,e,r))),this._requestRender()}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(ue.HighQualityTransparency)}get hasReflections(){return this._pluginsHas.water&&(this._ssrEnabled||this.isFeatureEnabled(ue.WaterReflection))}get _hasHighlights(){return this._plugins.produces(q.Highlight,me.OPAQUE_MATERIAL,me.TRANSPARENT_MATERIAL,me.DRAPED_MATERIAL,me.HUD_MATERIAL,me.LABEL_MATERIAL)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(q.Highlight,me.HUD_MATERIAL,me.LABEL_MATERIAL)}get hasSSAO(){return(this.stage.view.qualitySettings.ambientOcclusion||this.isFeatureEnabled(ue.SSAO))&&!this._inGlobeView}get hasSMAA(){return this.stage.view.qualitySettings.antialiasingEnabled||this.isFeatureEnabled(ue.Antialiasing)}get fullResolutionAtmosphere(){return this.stage.view.qualitySettings.highResolutionAtmosphere||this.isFeatureEnabled(ue.HighResolutionAtmosphere)}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=d(this._bindParameters.ssr.lastFrameColor),this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth),this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth)}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._bindParameters.depth=d(this._bindParameters.depth),this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility)}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._shadowAccumulator.running||this._plugins.updating||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=r((async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");l(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:Be(this.stage.view.resourceController)});return this.addHandles(_((()=>r.updating),(()=>this._requestRender()),m)),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&&A(this._bindParameters.ssr.reprojectionMatrix,P)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:t,_bindParameters:r}=this;if(void 0!==e.qualitySettings?.reflections&&this._ssrEnabled!==e.qualitySettings.reflections&&(this._ssrEnabled=e.qualitySettings.reflections,this._requestRender()),void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&t.maxCascades!==e.shadowMapMaxCascades&&(t.maxCascades=e.shadowMapMaxCascades,this._requestRender()),null!=e.environment){null!=e.environment.weather&&(this._bindParameters.weather=e.environment.weather,this._bindParameters.weatherVisible=!!e.weatherVisible);const t="virtual"!==e.environment.lighting.type;r.enableFillLights!==t&&(r.enableFillLights=t,this._requestRender())}void 0!==e.highQualityTransparency&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),void 0!==e.shadowCast&&this._shadowAccumulator.setOptions(e.shadowCast)}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}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)}updateHasFlags(){const has=this._pluginsHas;has.hudElements=this._plugins.produces(q.Color,...Ue),has.water=this._plugins.produces(q.Normal,me.DRAPED_WATER),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new K(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?n(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=le.Default,i=!1){try{return this._isRendering=!0,this._render(e,t,r,i)}catch(s){console.error(`Exception during rendering: ${s}`)}finally{this._isRendering=!1}return new Ee(this._pluginInput.get(N.FINAL),null)}_updateHUDOccludedFragmentOpacity(e,t){const{idleOpacity:r,navigatingOpacity:i,maxDelta:n,tiltFadeStart:h,tiltFadeEnd:o,altitudeStart:d,altitudeEnd:l}=ie,_=this.stage.view,u=_.stateManager.camera,p=_.qualitySettings.fadeDuration,m=e===Se.IDLE?r:i,c=s((u.tilt-h)/(o-h),0,1),g=s(((u.position.z??0)-d)/(l-d),0,1),f=a(a(1,m,c),1,g),b=this._bindParameters.hudOccludedFragmentOpacity;if(p<=0||b===f||0===this._lastFrameTime||this._lastFrameTime>t)return this._bindParameters.hudOccludedFragmentOpacity=f,void(this._lastFrameTime=t);const A=t-this._lastFrameTime;this._lastFrameTime=t;const T=Math.max(1-r,Math.abs(r-i)),E=Math.min(T*A/p,n);E>=Math.abs(f-b)?this._bindParameters.hudOccludedFragmentOpacity=f:(this._bindParameters.hudOccludedFragmentOpacity=b+Math.sign(f-b)*E,this._requestRender())}_render(e,t,r=le.Default,i){this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=r===le.Default,this._disposeBindBuffers();const{camera:s,contentCamera:a,mode:n,alignPixelEnabled:h}=e;this._state.value=n;const o=this._nodes.produces("magnifier-color"),l=this._nodes.produces(N.FINAL),_=this._nodes.require("emissive",O.TRANSPARENT_ENVIRONMENT,N.COMPOSITE,N.FINAL)>0&&this._plugins.hasEmissions,u=_?q.ColorEmission:q.Color;this._renderContext.time=t,this._renderContext.output=u,this._bindParameters.oitPass=ne.NONE,this._bindParameters.alignPixelEnabled=h,this._bindParameters.decorations=!i,this._bindParameters.mainDepth=null;const p=!i||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=p?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(O.VIEWSHED),this._renderOverlay(t),s.setGLViewport(this._rctx);const m=this._framebuffer,c=m.initialize(s.fullWidth,s.fullHeight,this._backgroundColor,_);this.hasReflections?(c?.setName("last frame color"),this._bindParameters.ssr.lastFrameColor=c):c?.release(),this._ensureBindParametersCamera(s,a),this._updateHUDOccludedFragmentOpacity(n,t),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&!i;const g=this._highQualityTransparency&&this._hasTransparentTerrain,f=this._plugins.produces(q.Color,...ve);this._precompilePrepasses(),this.performanceInfo.advance(Re.PREPARE);const b=this._computeShadowDepthRange(s);this._renderShadowMap(s,this._bindParameters.lighting.mainLight.direction,b),this._ensureBindParametersCamera(s,a),this._pluginInput.set("normals",this._renderNormals()),this._renderRemainingGeometryDepth(),this._renderShadowAccumulation(b,s,a),this._ensureBindParametersSSR(t),this._precompileShaders(g,f,u),this._renderContext.output=u,m.bind(),this._bindParameters.mainDepth=m.depth.attachment;const A=this.plugins.produces(q.Color,...Me);A&&this._renderOpaqueGeometry(),m.update((e=>this._renderNodes(N.OPAQUE,e,A))),this.fboCache.debugCallback?.(N.OPAQUE,m.color.fbo),m.update((e=>this._renderNodes(O.OPAQUE_ENVIRONMENT,e))),this.fboCache.debugCallback?.(O.OPAQUE_ENVIRONMENT,m.color.fbo),this._renderTerrainDepth(g),this._renderEdges(Ae.OPAQUE),m.bind(),this._renderPlugins(me.VOXEL,Re.VOXEL),this._renderHiddenTransparentEdges(),f&&(this._oitEnabled?this._renderOIT(xe.Geometry,u):this._renderTransparentGeometry()),m.update((e=>this._renderNodes(N.TRANSPARENT,e,f))),this.fboCache.debugCallback?.(N.TRANSPARENT,m.color.fbo),this._renderGeometryDepth(g),this._renderHUDVisibility(),g||this._plugins.render(this._pluginInput,me.LINE_CALLOUTS),this._renderEdges(Ae.TRANSPARENT);const T=this._hasTransparentTerrain?this._renderTransparentTerrain():null;T&&(this.performanceInfo.advance(Re.TRANSPARENT_TERRAIN),this._bindParameters.hudVisibility&&(g?this._renderLineCallouts(j.Occluded):(this._rctx.bindFramebuffer(this._bindParameters.hudVisibility?.fbo),this._compositingHelper.compositeHUD(this._bindParameters,T.getTexture())),this._renderHUD(j.Occluded,m.color,u))),this._bindParameters.cullAboveTerrain=!1,T&&(m.bind(),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,T.getTexture()),T.release(),g&&(this._renderEdges(Ae.OPAQUE),f&&(this._oitEnabled?this._renderOIT(xe.Geometry,u):this._renderTransparentGeometry(),this.performanceInfo.advance(Re.TRANSPARENT)),this._renderEdges(Ae.TRANSPARENT))),this._bindParameters.ssao=d(this._bindParameters.ssao),g&&this._renderLineCallouts(j.NotOccluded),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment(),this._pluginInput.set(O.FOCUSAREA,this._renderFocusAreaGeometry()),m.update((e=>this._renderNodes(O.TRANSPARENT_ENVIRONMENT,e))),m.update((e=>this._renderNodes(O.VIEWSHED,e))),m.update((e=>this._renderNodes(O.LASERLINES,e))),m.update((e=>this._renderNodes(O.FOCUSAREA_COLOR,e))),m.update((e=>this._renderNodes(O.OCCLUDED,e))),this._pluginInput.set("highlights",this._renderHighlightPrepass());const E=r===le.ObjectAndLayerID?this._renderObjectAndLayerIdColor():null;m.update((e=>this._renderNodes(N.COMPOSITE,e))),this._pluginInput.release(O.FOCUSAREA);const P=!(r!==le.Default||l||o&&!i),R=this._pluginInput.get(N.COMPOSITE),S=P?M:this.fboCache.acquire(R.fbo.width,R.fbo.height,O.ANTIALIASING),I=this._nodes.produces(O.ANTIALIASING)?this._renderNodes(O.ANTIALIASING,S):this._blitFBO(R,S,!1);let C;this._pluginInput.set(O.ANTIALIASING,I),this._hasHUDHighlights?(this._renderHUD(j.NotOccluded,I,u),C=this._renderNodes(O.HIGHLIGHTS,I)):(C=this._renderNodes(O.HIGHLIGHTS,I),this._renderHUD(j.NotOccluded,C,u));const w=this._renderNodes(O.MAGNIFIER,C);return o&&!i&&r===le.Default&&!l&&this._blitFBO(w),l?(w.attachDepth(m.depth),this._blitFBO(this._renderNodes(N.FINAL,w)),w.detachDepth()):this._pluginInput.set(N.FINAL,w),this._pluginInput.release("highlights"),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),m.releaseDepth(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),this.performanceInfo.finishFrame(),r!==le.Default&&(this._releaseFBOs(),this._disposeOffscreenBuffers()),new Ee(this._pluginInput.get(N.FINAL),E)}_precompileShaders(e,t,r){++this._plugins.context.techniques.precompiling,this._renderContext.output=r,this._precompileOpaqueGeometry(),this._nodes.precompile(O.OPAQUE_ENVIRONMENT),this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,this._renderContext.output=q.Depth,this._plugins.precompile(me.TRANSPARENT_TERRAIN),e&&(this._precompileOpaqueGeometry(),this._precompileTransparentGeometry()),this._renderContext.output=r,this._plugins.precompile(me.TRANSPARENT_TERRAIN),t&&(this._precompileTransparentGeometry(),this._hasTransparentTerrain&&(this._bindParameters.cullAboveTerrain=!1,this._precompileTransparentGeometry(),this._bindParameters.cullAboveTerrain=e)),this._nodes.precompile(O.FOCUSAREA),this._needsHUDVisibility&&this._plugins.precompile(me.OCCLUSION_PIXELS),this._plugins.precompile(me.LINE_CALLOUTS),this._precompileHUD(j.Occluded),this._bindParameters.terrainDepthTest=!1,this._bindParameters.cullAboveTerrain=!1,this._nodes.precompile(O.VIEWSHED,O.LASERLINES,O.FOCUSAREA_COLOR,O.OCCLUDED,O.ANTIALIASING,O.HIGHLIGHTS);const i=this._bindParameters;i.highlightMixTexture=i.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(j.NotOccluded),this._hasHighlights&&(i.highlights.forEach(((e,t)=>{i.highlightLevel=t,this._precompileAllGeometry(q.Highlight)})),i.highlightLevel=null),i.highlightMixTexture=null,this._nodes.precompile(N.COMPOSITE,O.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(me.TRANSPARENT_MATERIAL_WITHOUT_DEPTH),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){if(!this._nodes.produces(O.FOCUSAREA))return null;const{width:e,height:t}=this._framebufferSize;let r=this.fboCache.acquire(e,t,O.FOCUSAREA);return r=this._nodes.render(r,this._pluginInput),this.performanceInfo.advance(Re.FOCUS_AREA_MASK),r}_renderObjectAndLayerIdColor(){if(!this._nodes.produces("olid"))return null;const e=this._renderContext.output;++this._techniques.precompiling;const t=this._framebufferSize;let r=this.fboCache.acquire(t.width,t.height,"olid");return r.acquireDepth(v.DEPTH24_STENCIL8),r=this._nodes.render(r,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(Re.OBJECT_AND_LAYER_ID_COLOR),this._renderContext.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=e===Z.BACKGROUND;if(r||t){const e=r?this.performanceInfo.elapsedTime:0;let i=0;t?i=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const s=Math.max(e,i);this._animationTimestep.frame(s,r)}}readMainDepth(e,t){const{mainDepth:r,camera:i}=this._bindParameters;if(!r)return;const s=this.fboCache.acquire(this._framebufferSize.width,this._framebufferSize.height,"linear-depth");this._rctx.bindFramebuffer(s.fbo),i.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(w),this._compositingHelper.blitDepthToLinearDepth(this._bindParameters,r),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),s.fbo?.readPixels(e[0],e[1],e[2],e[3],Ie.RGBA,Ce.UNSIGNED_BYTE,t),s.release()}readHUDVisibility(e,t,r,i,s){this._bindParameters.hudVisibility?.fbo?.readPixels(e,t,r,i,Ie.RGBA,Ce.UNSIGNED_BYTE,s)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_renderEdges(e){const t=this._edgeView;if(!t?.shouldRender())return;const r=this._framebufferSize,i=this.fboCache.acquire(r.width,r.height,"edges"),s=()=>t.render(this._bindParameters,e),a=this._bindParameters.geometryDepth;this.renderToTargets(s,i,a??this._framebuffer.depth,w),this._framebuffer.bind(),this._compositingHelper.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(e===Ae.OPAQUE?Re.OPAQUE_EDGES:Re.TRANSPARENT_EDGES)}_renderOverlay(e){this._bindParameters.overlay=this.overlay?.render(e),this._bindParameters.overlay&&this.performanceInfo.advance(Re.OVERLAY)}_renderShadowMap(e,t,r){if(!this.shadowsEnabled)return;const i=this._shadowMap;i.start(e,t,r,this.isFeatureEnabled(ue.HighResolutionShadows),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(q.ShadowHighlight,this._shadowMap),i.moveSnapshot(fe.Highlight),this._renderShadowCascades(q.ShadowExcludeHighlight,this._shadowMap),i.copySnapshot(fe.ExcludeHighlight),this._renderShadowCascades(q.ShadowHighlight,this._shadowMap)):this._renderShadowCascades(q.Shadow),i.finish(),e.setGLViewport(this._rctx),this.performanceInfo.advance(Re.SHADOW_MAP)}_precompileShadowCascades(e){for(const t of this._shadowMap.cascades)t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.camera),this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._shadowMap){for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this.renderAllGeometry(e)}get _needsDepth(){return this._plugins.consumes(q.Depth)||this._nodes.requireGeometryDepth()||this.hasReflections||this._needsShadowHighlight||this._needsShadowAccumulation||this._debugNeedsDepth}_renderRemainingGeometryDepth(){const e=this._pluginInput.get("normals");if(e){const t=this._needsDepth?e.getAttachment(we):null;t?.retain(),this._pluginInput.set(O.SSAO,this._renderSSAO()),this._renderGeometryWithoutNormalsDepth(t)}else this._renderAllGeometryDepth()}_renderGeometryWithoutNormalsDepth(e){if(!this._needsDepth||!e)return void(this._bindParameters.depth=d(this._bindParameters.depth));const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"depth");r.attachDepth(e),e.release(),this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(De.STENCIL),this._renderGeometryWithoutNormals(q.Depth),d(this._bindParameters.depth),this._bindParameters.depth=r.obtainDepthTexture(),r.release(),this.performanceInfo.advance(Re.DEPTH)}_renderAllGeometryDepth(){if(!this._needsDepth)return void(this._bindParameters.depth=d(this._bindParameters.depth));const e=this._framebufferSize,t=this.fboCache.acquire(e.width,e.height,"depth",v.DEPTH24_STENCIL8);this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(De.DEPTH|De.STENCIL),this.renderAllGeometry(q.Depth),d(this._bindParameters.depth),this._bindParameters.depth=t.obtainDepthTexture(),t.release(),this.performanceInfo.advance(Re.DEPTH)}_renderTerrainDepth(e){if(this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,!e)return void(this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth));const t=this._renderContext.output;this._renderContext.output=q.Depth;const r=this._framebufferSize,i=this.fboCache.acquire(r.width,r.height,"terrain depth",v.DEPTH24_STENCIL8);this._rctx.bindFramebuffer(i.fbo),this._rctx.clear(De.DEPTH|De.STENCIL),this._renderTransparentTerrain(),d(this._bindParameters.terrainDepth),this._bindParameters.terrainDepth=i.obtainDepthTexture(),this._renderContext.output=t,i.release()}_renderGeometryDepth(e){if(!e)return void(this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth));const t=this._renderContext.output,{width:r,height:i}=this._framebufferSize,s=this.fboCache.acquire(r,i,"geometry depth",v.DEPTH24_STENCIL8);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(De.DEPTH|De.STENCIL),this._renderOpaqueAndTransparentGeometry(q.Depth),this._renderContext.output=t,d(this._bindParameters.geometryDepth),this._bindParameters.geometryDepth=s.obtainDepthTexture(),s.release()}get _needsShadowDepthRange(){return this._shadowMap.enabled||this._needsShadowAccumulation}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return ee.zero;const t=te(e,this._plugins.plugins,this.stage.layers,re.SHADOW_CASTERS);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=ee.infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<y)return void(this.sceneDepthRange.value=ee.infinite);const t=e.clone();t.near=x,t.far=1e10;const r=te(t,this._plugins.plugins,this.stage.layers,re.FULL_SCENE);r.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.far===r.far&&this.sceneDepthRange.value.near===r.near||(this.sceneDepthRange.value=r)}get _normalsRequired(){const e=this._nodes.require("normals",N.FINAL,N.COMPOSITE,N.OPAQUE,N.TRANSPARENT,O.VIEWSHED,O.LASERLINES);return(this.hasSSAO?1:0)+e}_precompilePrepasses(){this._normalsRequired&&this._precompileAllGeometry(q.Normal),this._needsDepth&&this._precompileAllGeometry(q.Depth),this.shadowsEnabled&&(this._needsShadowHighlight?(this._precompileShadowCascades(q.ShadowHighlight),this._precompileShadowCascades(q.ShadowExcludeHighlight),this._precompileShadowCascades(q.ShadowHighlight)):this._precompileShadowCascades(q.Shadow)),this._needsShadowAccumulation&&this._precompileAllGeometry(q.Shadow)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"normals",F.RGBA8UNORM);r.acquireDepth(v.DEPTH24_STENCIL8),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(w,!0,!0),this._renderGeometryWithNormals(q.Normal);const i=this._nodes.optional("normals",N.FINAL,N.COMPOSITE,N.OPAQUE,N.TRANSPARENT,O.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(Re.NORMALS),r}_renderSSAO(){const e=this._pluginInput.get("normals");if(!this.hasSSAO||!e)return void e?.detachDepth();M.setName(O.SSAO);const t=this._nodes.render(M,this._pluginInput);return this._bindParameters.ssao=t,e.detachDepth(),this._pluginInput.release("normals"),this.performanceInfo.advance(Re.SSAO),t}_precompileAllGeometry(e){const t=this._renderContext.output;this._renderContext.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(me.TRANSPARENT_TERRAIN),this._renderContext.output=t}renderAllGeometry(e){this._renderContext.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentTerrain()}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,...Fe);this._renderContext.renderOccludedMask=oe}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,this._pluginInput)}))}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>ae.Occlude&&this._plugins.render(this._pluginInput,me.OCCLUDED_TERRAIN),this.renderSlots(e,...Fe),this._renderContext.renderOccludedMask=oe}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(this._pluginInput,me.HUD_MATERIAL)}precompileViewshedShadowMap(){this._precompileAllGeometry(q.ViewshedShadow)}renderViewshedShadowMap(e){const{camera:t,contentCamera:r}=this._bindParameters,i=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(q.ViewshedShadow),this._ensureBindParametersCamera(t,r),this._bindParameters.camera.setGLViewport(this._rctx),this._renderContext.output=i}_renderOpaqueAndTransparentGeometry(e){this._renderContext.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithNormals(e){this._renderContext.output=e,this._plugins.render(this._pluginInput,...He),this._renderTransparentTerrain()}_renderGeometryWithoutNormals(e){this._renderContext.output=e,this._plugins.render(this._pluginInput,...Le)}_precompileOpaqueGeometry(){this._plugins.precompile(...Me)}_renderOpaqueGeometry(){this._plugins.render(this._pluginInput,...Me)}_renderTransparentGeometry(){this._plugins.render(this._pluginInput,...ve)}get _hasTransparentTerrain(){return this._plugins.produces(q.Color,me.TRANSPARENT_TERRAIN)}_renderTransparentTerrain(){const e=()=>this._plugins.render(this._pluginInput,me.TRANSPARENT_TERRAIN);if(!V(this._renderContext.output))return void e();const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"transparent terrain");return this.renderToTargets(e,r,this._framebuffer.depth,w),r}get _needsHUDVisibility(){return this._plugins.produces(this._renderContext.output,me.OCCLUSION_PIXELS)}_renderHUDVisibility(){if(!this._needsHUDVisibility)return void(this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility));const{width:e,height:t}=this._framebufferSize;let r=this._bindParameters.hudVisibility;r?.fbo?.width===e&&r?.fbo?.height===t||(r?.release(),r=this.fboCache.acquire(e,t,"hud visibility",F.RGBA4UNORM),this._bindParameters.hudVisibility=r);const i=this._bindParameters.geometryDepth;r.attachDepth(i||this._framebuffer.depth),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer([0,1,0,1]),this._plugins.render(this._pluginInput,me.OCCLUSION_PIXELS),r.detachDepth(),this._framebuffer.bind(),this.performanceInfo.advance(Re.HUD_VISIBILITY)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,e===j.Occluded){const e=()=>this._plugins.render(this._pluginInput,me.LINE_CALLOUTS),t=this._framebufferSize,r=this.fboCache.acquireDepth(U.DEPTH16,t.width,t.height,"line callouts");this.renderToTargets(e,this._framebuffer.color,r,void 0,!0,!0),r.release()}else this._plugins.render(this._pluginInput,me.LINE_CALLOUTS)}_precompileHUD(e){if(this._precompileHUDOutput(e),this._hasHighlights){const t=this._renderContext.output;this._renderContext.output=q.Highlight,this._precompileHUDOutput(e),this._renderContext.output=t}}_precompileHUDOutput(e){const t=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this._oitEnabled&&V(this._renderContext.output)?(this._bindParameters.oitPass=ne.ColorAlpha,this._plugins.precompile(...Ue),this._bindParameters.oitPass=ne.FrontFace,this._plugins.precompile(...Ue),this._bindParameters.oitPass=ne.NONE):this._plugins.precompile(...Ue),this._bindParameters.hudRenderStyle=t}_renderHUD(e,t,r){if(this._pluginsHas.hudElements){if(this._oitEnabled){const i=this._renderOIT(xe.HUD,r,e);this._rctx.bindFramebuffer(t.fbo),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,i.getTexture()),i.release()}else if(this._renderContext.output=r,e===j.Occluded){const t=()=>this._renderHUDElements(e),r=this._framebufferSize,i=this.fboCache.acquireDepth(U.DEPTH16,r.width,r.height,"hud");this.renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(U.DEPTH16),this._rctx.bindFramebuffer(t.fbo),this._renderHUDElements(e),t.detachDepth();this.performanceInfo.advance(e===j.Occluded?Re.HUD_OCCLUDED:Re.HUD)}}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(this._pluginInput,...Ue)}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(q.ShadowHighlight,me.OPAQUE_MATERIAL)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:r}=this,i=this._framebufferSize,{highlights:s}=r,a=e.acquire(i.width,i.height,"highlights",s.length>z?F.RG8UINT:F.R8UINT);a.acquireDepth(v.DEPTH24_STENCIL8),t.bindFramebuffer(a.fbo);const{gl:n}=t;return n.clearBufferuiv(n.COLOR,0,[0,0,0,0]),this._renderContext.output=q.Highlight,t.bindFramebuffer(a.fbo),Y(t,e,i,r,(()=>this._renderHighlightGeometries())),this.performanceInfo.advance(Re.HIGHLIGHTS),a}_renderHighlightGeometries(){this._plugins.render(this._pluginInput,...Ge),this._rctx.clear(De.DEPTH),this._renderHUDElements(j.Both)}get _needsShadowAccumulation(){return this._shadowAccumulator.accumulating}_renderShadowAccumulation(e,t,r){this._needsShadowAccumulation&&this._bindParameters.depth&&this._shadowAccumulator.renderAccumulation(this._bindParameters.depth,e,t,r)&&this.performanceInfo.advance(Re.ACCUMULATED_SHADOWS)}_precompileTransparentGeometry(){this._oitEnabled&&V(this._renderContext.output)?(this._bindParameters.oitPass=ne.ColorAlpha,this._plugins.precompile(...ve),this._bindParameters.oitPass=ne.FrontFace,this._plugins.precompile(...ve),this._bindParameters.oitPass=ne.NONE):this._plugins.precompile(...ve)}_renderOIT(e,t,r=j.Both){const i=e===xe.HUD,s=this._framebufferSize,a=i?this.fboCache.acquire(s.width,s.height,"oit hud composite"):null,n=i?()=>this._renderHUDElements(r):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=this._renderContext.output;this._renderContext.output=t,h.oitPass=ne.ColorAlpha;const d=a?"oit hud color+alpha":"oit color+alpha",l=this.fboCache.acquire(s.width,s.height,d,F.RGBA16FLOAT),_=t===q.ColorEmission;_&&l.acquireColor(Ne,F.RGBA16FLOAT,"emissive"),l.acquireColor(_?Oe:Ne,F.R16FLOAT),a||l.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(l.fbo),this._rctx.clearFramebuffer([0,0,0,1]),_&&this._rctx.clearBuffer(1,I),n(),l.detachDepth(),h.oitPass=ne.FrontFace;const u=this.fboCache.acquire(s.width,s.height,a?"oit hud front":"oit front");return _&&u.acquireColor(Ne,F.RGBA16FLOAT,"emissive"),a?u.acquireDepth(U.DEPTH16):u.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(u.fbo),this._rctx.clearFramebuffer(w,!!a),n(),u.detachDepth(),h.oitPass=ne.NONE,a?(this._rctx.bindFramebuffer(a.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(De.COLOR)):this._framebuffer.bind(),this._oitblend??=new X(this._techniques),this._oitblend.blend(this._rctx,l,u,h,_),a?.detachDepth(),u.release(),l.release(),this._renderContext.output=o,a}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(Re.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(this._pluginInput,me.TRANSPARENT_MATERIAL_WITHOUT_DEPTH),this.performanceInfo.advance(Re.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderPlugins(e,t){this._plugins.produces(this._renderContext.output,e)&&(this._plugins.render(this._pluginInput,e),this.performanceInfo.advance(t))}_renderNodes(e,t,r=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return r&&this.performanceInfo.advance(e),t;const i=this._nodes.render(t,this._pluginInput,this._releaseNormals);return this.performanceInfo.advance(e),i}_blitFBO(e,t=M,r=!0){return this._blit??=new k(this._techniques),this._blit.blit(this._rctx,e,t,this._bindParameters),this._pluginInput.set(e.name,t),r&&e.release(),t}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=P:(T(Ve,this._bindParameters.camera.viewMatrix),T(qe,this._bindParameters.camera.projectionMatrix),E(je,Ve,qe),E(je,this._renderContext.lastFrameCamera.viewMatrix,je),E(je,this._renderContext.lastFrameCamera.projectionMatrix,je),this._reprojectionMatrix=je);const t=this.stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=t>0?Math.min(t,e-this._ssrEnableTime)/t:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=P,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,r,i){this._bindParameters.updateLighting(e,t,r,i),this._requestRender(Z.UPDATE)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0}}renderToTargets(e,t,r,i,s=!1,a=!1){t.attachDepth(r),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(i,s,a),e(),t.detachDepth()}get test(){}};var xe;e([f({readOnly:!0})],ye.prototype,"fullResolutionAtmosphere",null),e([f()],ye.prototype,"_edgeView",void 0),e([f()],ye.prototype,"updating",null),ye=e([b("esri.views.3d.webgl-engine.lib.Renderer")],ye),function(e){e[e.Geometry=0]="Geometry",e[e.HUD=1]="HUD"}(xe||(xe={}));const He=[me.INTEGRATED_MESH,me.OPAQUE_TERRAIN,me.OPAQUE_MATERIAL,me.TRANSPARENT_MATERIAL],Le=[me.OPAQUE_MATERIAL_WITHOUT_NORMALS,me.TRANSPARENT_MATERIAL_WITHOUT_NORMALS],Me=[me.INTEGRATED_MESH,me.OPAQUE_TERRAIN,me.OPAQUE_MATERIAL,me.OPAQUE_MATERIAL_WITHOUT_NORMALS],ve=[me.TRANSPARENT_MATERIAL,me.TRANSPARENT_MATERIAL_WITHOUT_NORMALS],Fe=[me.OPAQUE_MATERIAL,me.TRANSPARENT_MATERIAL,me.TRANSPARENT_MATERIAL_WITHOUT_DEPTH],Ue=[me.LINE_CALLOUTS_HUD_DEPTH,me.HUD_MATERIAL,me.LABEL_MATERIAL],Ge=[me.TRANSPARENT_MATERIAL,me.TRANSPARENT_MATERIAL_WITHOUT_NORMALS,me.OPAQUE_MATERIAL,me.OPAQUE_MATERIAL_WITHOUT_NORMALS,me.TRANSPARENT_TERRAIN,me.INTEGRATED_MESH,me.OPAQUE_TERRAIN],qe=R(),Ve=R(),je=R();function Be(e){return t=>e.immediate.schedule(t)}export{ye as Renderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{d as s,a}from"../../../../chunks/boundedPlane.js";const
|
|
5
|
+
import{d as t,g as s,a as e}from"../../../../chunks/boundedPlane.js";const a=t();class i{constructor(){this._plane=t(),this._isDecoration=!0}get plane(){return this._plane}get isDecoration(){return this._isDecoration}update({plane:t,isDecoration:i}){let n=!1;return this._isDecoration!==i&&(this._isDecoration=i,n=!0),t??=a,s(t,this._plane)?n:(e(t,this._plane),!0)}}export{i as default};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{glsl as e}from"../core/shaderModules/glsl.js";function a(a){a.code.add(e`float mapChannel(float x, vec2 p) {
|
|
6
|
+
return (x < p.x) ? mix(0.0, p.y, x/p.x) : mix(p.y, 1.0, (x - p.x) / (1.0 - p.x) );
|
|
7
|
+
}`),a.code.add(e`vec3 blackLevelSoftCompression(vec3 color, float averageAmbientRadiance) {
|
|
8
|
+
vec2 p = vec2(0.02, 0.0075) * averageAmbientRadiance;
|
|
9
|
+
return vec3(mapChannel(color.x, p), mapChannel(color.y, p), mapChannel(color.z, p));
|
|
10
|
+
}`)}export{a as BlackLevelLightSoftCompression};
|
package/views/SceneView.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../Camera.js";import i from"../Viewpoint.js";import r from"../core/Collection.js";import{byId as s}from"../core/domUtils.js";import n from"../core/Error.js";import{on as a}from"../core/events.js";import{makeHandle as o}from"../core/handleUtils.js";import has from"../core/has.js";import l from"../core/Logger.js";import{destroyMaybe as p,maybeProperty as h}from"../core/maybe.js";import{ObservableChangesType as d}from"../core/ObservableChangesType.js";import{throwIfAborted as c}from"../core/promiseUtils.js";import{on as u,watch as g,initial as m,whenOnce as y,syncAndInitial as f,sync as w}from"../core/reactiveUtils.js";import{setFrameDuration as v}from"../core/scheduling.js";import{createScreenPoint as _,createScreenPointArray as b}from"../core/screenUtils.js";import{getMetersPerUnitForSR as M}from"../core/unitUtils.js";import{initialize as S}from"../core/workers/workers.js";import{property as V}from"../core/accessorSupport/decorators/property.js";import{cast as j}from"../core/accessorSupport/decorators/cast.js";import"../core/RandomLCG.js";import{subclass as R}from"../core/accessorSupport/decorators/subclass.js";import{ensureType as C,ensureClass as T}from"../core/accessorSupport/ensureType.js";import{overrideDefaultsFrom as O}from"../core/accessorSupport/overrideDefaultsFrom.js";import{create as x}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{owningCollectionProperty as E}from"../core/support/OwningCollection.js";import L from"../geometry/Extent.js";import P from"../geometry/HeightModelInfo.js";import A from"../geometry/Point.js";import{canProjectWithoutEngine as I,project as H}from"../geometry/projection.js";import G from"../geometry/SpatialReference.js";import{projectBoundingRect as D}from"../geometry/projection/projectBoundingRect.js";import{projectPointToVector as F}from"../geometry/projection/projectPointToVector.js";import{create as U,toExtent as W}from"../geometry/support/aaBoundingRect.js";import{B as q,a as k}from"../chunks/boundedPlane.js";import{renderSRFromViewSR as z}from"../geometry/support/coordinateSystem.js";import{getResolutionForScale as B}from"../geometry/support/scaleUtils.js";import{isImageryTileLayer as N,isTiledLayer as Q,isVoxelLayer as Y,isIntegratedMeshLayer as Z}from"../layers/support/layerUtils.js";import{AnalysesCollection as $}from"../support/AnalysesCollection.js";import{BreakpointsOwner as J}from"./BreakpointsOwner.js";import{DOMContainer as K}from"./DOMContainer.js";import{FocusAreas as X}from"./FocusAreas.js";import ee from"./GroundView.js";import{PopupView as te}from"./PopupView.js";import ie from"./View.js";import re from"./ViewAnimation.js";import{ViewingMode as se,stringFromViewingMode as ne,viewingModeFromString as ae}from"./ViewingMode.js";import{layerView3DImporter as oe}from"./3d/layerViewModuleImportUtils.js";import le from"./3d/analysis/AnalysisViewManager3D.js";import{Constraints as pe}from"./3d/constraints/Constraints.js";import{EnvironmentManager as he}from"./3d/environment/EnvironmentManager.js";import de from"./3d/environment/SceneViewEnvironment.js";import ce from"./3d/input/SceneInputManager.js";import{GraphicsDeconflictor as ue}from"./3d/layers/graphics/GraphicsDeconflictor.js";import{Labeler as ge}from"./3d/layers/graphics/Labeler.js";import{FeatureTileTree3D as me}from"./3d/layers/support/FeatureTileTree3D.js";import ye from"./3d/state/ViewState.js";import{ViewStateManager as fe}from"./3d/state/ViewStateManager.js";import{SceneIntersectionHelper as we}from"./3d/state/helpers/SceneIntersectionHelper.js";import{CombinedElevationProvider as ve}from"./3d/support/CombinedElevationProvider.js";import{debugFlags as _e}from"./3d/support/debugFlags.js";import be from"./3d/support/DisplayQualityProfile.js";import{getElevationAtPoint as Me}from"./3d/support/ElevationProvider.js";import{toMap as Se,hitTest as Ve}from"./3d/support/hitTest.js";import{popupHitTest as je}from"./3d/support/popupHitTest.js";import Re from"./3d/support/QualitySettings.js";import{RenderCoordsHelper as Ce}from"./3d/support/RenderCoordsHelper.js";import{newResourceController as Te}from"./3d/support/ResourceController.js";import Oe from"./3d/support/SceneViewPerformanceInfo.js";import{SharedSymbolResources as xe}from"./3d/support/SharedSymbolResources.js";import{PointsOfInterest as Ee}from"./3d/support/pointsOfInterest/PointsOfInterest.js";import Le from"./3d/terrain/TerrainSurface.js";import{isSurfaceLayerView as Pe,getTiledLayerInfo as Ae,checkIfTileInfoSupportedForView as Ie}from"./3d/terrain/terrainUtils.js";import{Stage as He}from"./3d/webgl-engine/Stage.js";import{olidEnabled as Ge}from"./3d/webgl-engine/effects/geometry/olidUtils.js";import{defaultTolerance as De}from"./3d/webgl-engine/lib/Intersector.js";import{terrainId as Fe}from"./3d/webgl-engine/lib/verticalOffsetUtils.js";import{defaultHighlightName as Ue}from"./support/HighlightDefaults.js";import We from"./support/HighlightOptions.js";import{occludeesSupported as qe}from"./support/layerViewUtils.js";import{PropertiesPool as ke}from"./support/PropertiesPool.js";import{isSupportedScreenPointEvent as ze,createScreenPointFromSupportedEvent as Be}from"./support/screenUtils.js";import{isSpatialReferenceSupported as Ne}from"./support/spatialReferenceSupport.js";import{initializeTextureCompressionWorker as Qe,destroyTextureCompressionWorker as Ye}from"./support/TextureCompressionHelper.js";import{check as Ze}from"./support/WebGLRequirements.js";import $e from"./ui/DefaultUI.js";import Je from"./ui/3d/DefaultUI3D.js";import Ke from"../webscene/Environment.js";let Xe=class extends(J(te(K(ie)))){constructor(e){super(e),this._userClippingArea=null,this._clippingArea=null,this._initialDefaultSpatialReference=null,this._overrideDefaultEnvironmentOnly=!0,this._createGraphicsViewController=null,this._resolveWhenReady=[],this._propertiesPool=new ke({slicePlane:q},this),this._resourceController=Te(this),this.deconflictor=new ue({view:this}),this.labeler=new ge({view:this,deconflictor:this.deconflictor.labels}),this.sharedSymbolResources=null,this.analyses=new $,this.basemapTerrain=null,this.elevationProvider=null,this.canvas=null,this.constraints=new pe,this.environment=new de,this.environmentManager=new he,this.floors=new r,this.fullOpacity=1,this.graphicsView=null,this.analysisViewManager=new le({view:this}),this.groundView=null,this.map=null,this.screenSizePerspectiveEnabled=!0,this.state=new ye({view:this}),this.spatialReference=null,this.alphaCompositingEnabled=!1,this.preserveDrawingBufferEnabled=!1,this.supersampleScreenshotsEnabled=!0,this.type="3d",this.ui=new Je,this._numUpdating=0,this._lastUpdateTime=0,this.updatingProgress=.5,this.focusAreas=new X({view:this}),S();const t=(e=null)=>{null!=e&&e.type===d.MOVE||(this._updatingChanged(),this.map&&this.map.allLayers.forEach((async e=>{try{await e.when()}catch{}this._updatingChanged()})))};this.addHandles([u((()=>this.map?.allLayers),"after-changes",(e=>t(e)),{onListenerAdd:()=>t(),onListenerRemove:()=>t(),sync:!0}),this.allLayerViews.on("after-changes",(e=>this._updateUpdatingMonitors(e))),g((()=>this.map),(e=>{e&&"load"in e&&e.load&&e.load().catch((()=>{}))}))]),this.inputManager=new ce({view:this}),this.stateManager=new fe({view:this})}initialize(){if(has("enable-feature:esri-compress-textures")&&has("wasm-simd")){const e=Qe(this,this.resourceController);this.addResolvingPromise(e.promise)}this.groundView=new ee({view:this}),this._updateUpdatingMonitors(),this.updatingHandles.add((()=>this.qualitySettings.memoryLimit),(e=>{this.resourceController&&(this.resourceController.memoryController.maxMemory=e)}),m),this.updatingHandles.add((()=>this.qualitySettings.additionalCacheMemory),(e=>{this.resourceController&&(this.resourceController.memoryController.additionalCacheMemory=e)}),m),this.updatingHandles.add((()=>this.qualitySettings.frameRate??0),(e=>v(e>0?1e3/Math.ceil(e):0)),m),this.addHandles(g((()=>this.spatialReference),(()=>this.notifyChange("clippingArea")),w))}destroy(){this.destroyed||(Ye(this),this.updatingHandles.removeAll(),this.invalidate(),this.activeTool=null,this.layerViewManager.clear(),this._set("analysisViewManager",p(this.analysisViewManager)),this._exitSurface(),this._disposeGraphicsView(),this.sharedSymbolResources=p(this.sharedSymbolResources),this._set("labeler",p(this.labeler)),this._set("deconflictor",p(this.deconflictor)),this._resourceController=p(this._resourceController),this._set("stateManager",p(this.stateManager)),this._set("inputManager",p(this.inputManager)),this.state.destroy(),this.highlights.destroy(),this._propertiesPool.destroy(),this.removeHandles("updatingMonitors"),this._set("environmentManager",p(this.environmentManager)),this._set("environment",p(this.environment)),this.groundView=p(this.groundView),this._exitBasemapTerrain(),this.stage?.destroy())}get stage(){return this._stage}get renderSpatialReference(){return this.renderCoordsHelper?.spatialReference}get basemapSpatialReference(){return this.basemapTerrain?.spatialReference}get animation(){return this.state?.animation}get camera(){return this.stateManager?.camera}set camera(e){this.stateManager&&(this.stateManager.camera=e)}get contentCamera(){return this.stateManager?.contentCamera}set contentCamera(e){this.stateManager&&(this.stateManager.contentCamera=e)}installContentCameraReset(e={sticky:!1}){return this.stateManager.installContentCameraReset(e)}get center(){return this.stateManager?.center}set center(e){this.stateManager&&(this.stateManager.center=e)}get clippingArea(){if("global"===this.viewingMode)return null;const e=this.map;let t=this._userClippingArea||h(e,"clippingArea");return!this._userClippingArea&&!h(e,"clippingEnabled")||null==t?(this._clippingArea=null,null):t instanceof L?this.spatialReference&&(t=et(t,this.spatialReference),null==t)?(l.getLogger(this).error("#clippingArea","setting clippingArea with incompatible SpatialReference"),this._clippingArea):(t=t.clone(),null==t.intersection(this._groundAndLayersExtent)&&(t.xmin=t.xmax,t.ymin=t.ymax),t.zmin=void 0,t.zmax=void 0,t.equals(this._clippingArea)||(this._clippingArea=t),this._clippingArea):(l.getLogger(this).error("#clippingArea","only clippingArea geometries of type Extent are supported"),this._clippingArea)}set clippingArea(e){this.ready&&"global"===this.viewingMode&&null!=e?l.getLogger(this).error("#clippingArea=","Clipping area is only supported in local viewingMode"):this._userClippingArea=e}get renderDataExtent(){if(this.state.viewingMode===se.Global)return null;const e=this.renderSpatialReference,t=this.dataExtent;return null==t||null==e||t.spatialReference.equals(e)?t:et(t,e)}get tileInfo(){return this.basemapTerrain?.tilingScheme?.toTileInfo()}get dataExtent(){let e=this._groundAndLayersExtent;const t=this.spatialReference||G.WGS84,i=et(this.clippingArea,t);null!=i&&(e=null!=e?e.intersection(i):i);const r=this._get("dataExtent");return null!=e&&e.equals(r)?r:e}get _groundAndLayersExtent(){const e=this.spatialReference||G.WGS84;let t;const i=i=>{const r=et(i,e);null!=r&&(null!=t?t.union(r):t=r.clone())},r=this.basemapTerrain;if(r?.spatialReference){const e=r.groundExtent;i(new L({xmin:e[0],ymin:e[1],zmin:0,xmax:e[2],ymax:e[3],zmax:0,spatialReference:r.spatialReference}))}if(this.map){const e=e=>{null==e.fullExtent||"graphics"===e.type&&e.internal||i(e.fullExtent)};this.map.allLayers.forEach((t=>e(t)))}if(null==t)return null;t.hasZ?(t.zmin=Math.min(0,t.zmin??0),t.zmax=Math.max(0,t.zmax??0)):(t.zmin=0,t.zmax=0);const s=this._get("_groundAndLayersExtent");return t.equals(s)?s:t}castEnvironment(e){return e?e instanceof de?e:e instanceof Ke?this.environment?.cloneWithWebsceneEnvironment(e)??de.fromWebsceneEnvironment(e):C(de,e):new de}get extent(){return this.stateManager?.extent}set extent(e){this.stateManager&&(this.stateManager.extent=e)}get screenCenter(){return this.stateManager?.screenCenter}get frustum(){return this.stateManager?.frustum}get initialExtentRequired(){return this.stateManager&&!this.stateManager.hasInitialView}get defaultsFromMapSettings(){return{required:{tileInfo:!1,heightModelInfo:!0,extent:!1}}}get interacting(){return this.navigating||(this.toolViewManager?.interacting??!1)}get stationary(){return!this.animation&&!this.resizing&&(this.state?.stationary??!0)}get navigating(){return this.state?.navigating??!1}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}set qualityProfile(e){be.isValidProfile(e)&&(be.apply(e,this.qualitySettings),this.stage?.renderView.updateQualitySettings(this.qualitySettings),this._set("qualityProfile",e))}get qualityProfile(){return this._get("qualityProfile")||be.getDefaultProfile()}set slicePlane(e){if(null!=this.stage&&(this.stage.renderer.slicePlane=e),null==e)return void this._set("slicePlane",null);const t=this._propertiesPool.get("slicePlane");k(e,t),this._set("slicePlane",t)}get typeSpecificPreconditionsReady(){return!!this.viewingMode&&!!this.stateManager?.preinit(this.spatialReference)}get resolution(){return null!=this.spatialReference?B(this.scale,this.spatialReference):0}get scale(){return this.stateManager?.scale}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get heightModelInfo(){const e=this.getDefaultHeightModelInfo();return null!=e?P.deriveUnitFromSR(e,this.spatialReference):null}get updating(){if(this.destroyed)return!1;let e=0,t=this.layerViewManager.updating,i=t?this.layerViewManager.updatingRemaining:0;this.allLayerViews.forEach((r=>{if(r.isFulfilled()){if(r.updating){if(t=!0,r.suspended||Pe(r))return;++i,e+=r.updatingProgress}}else++i}));for(const s of this._updatingObjects)if(null!=s&&s.updating){const t=.1;i+=t,e+=.5*t}for(const s of this._updatingObjectsWithProgress)null!=s&&s.updating&&(++i,e+=s.updatingProgress);const r=!this.stateManager.test.updatingIgnoreRenderState&&this.state.updating;if(t=!!(t||i>0||this.updatingHandles.updating||!this.ready||!this.stationary||r||this._createGraphicsViewController||this.inputManager?.updating||this.map?.allLayers?.some((e=>!e.isFulfilled()))),t?(this._numUpdating=Math.max(i,this._numUpdating),e+=this._numUpdating-i):this._numUpdating=0,this._numUpdating>0?e/=this._numUpdating:e=t?0:1,this._get("updatingProgress")!==e){const i=performance.now();if(e<1){const t=Math.min((i-this._lastUpdateTime)/2e3,1);e=this.updatingProgress*(1-t)+e*t}this._set("updatingProgress",e),this._lastUpdateTime=t&&e<1?i:0}return t}get _updatingObjects(){return[this.graphicsView,this.basemapView,this._resourceController,this.stage,this.featureTiles,this.pointsOfInterest,this.environmentManager,this.overlay,this._featureTreeDebugger,this.toolViewManager,this.analysisViewManager]}get _updatingObjectsWithProgress(){return[this.deconflictor,this.labeler,this.basemapTerrain]}get viewingMode(){const e=this._predeterminedViewingMode;if(null!=e)return ne(e);const t=this.spatialReference;return t?null!=this.defaultsFromMap?.viewingMode&&t.equals(this.defaultsFromMap.spatialReference)?ne(this.defaultsFromMap.viewingMode):Ne(t,se.Global)?"global":"local":"global"}set viewingMode(e){this.ready?l.getLogger(this).error("#viewingMode","viewingMode cannot be set once view is ready"):this._overrideIfSome("viewingMode",e)}get viewpoint(){return this.stateManager?.viewpoint}set viewpoint(e){this.stateManager&&(this.stateManager.viewpoint=e)}get visibleArea(){return this.stateManager?.visibleArea}get zoom(){return this.stateManager.zoom}set zoom(e){this.stateManager&&(this.stateManager.zoom=e)}get highlightOptions(){return this.highlights.find((({name:e})=>e===Ue))??new We}set highlightOptions(e){for(let t=0;t<this.highlights.length;++t){if(this.highlights.at(t).name===Ue)return void this.highlights.items[t].assignFrom(e)}}get resourceController(){return this._resourceController}get quality(){return this._resourceController?.memoryController?.memoryFactor??1}get resolutionScale(){return Math.sqrt(Math.min(1,this.quality/.75))}get performanceInfo(){return new Oe(this)}on(e,t,i,r){const s=this.viewEvents.on(e,t,i,r);return s||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}toMap(e,t){if(!this.ready)return l.getLogger(this).error("#toMap()","Scene view cannot be used before it is ready"),null;const i=ze(e)?Be(this,e):e;return Se(this,i,t,this._defaultToMapOptions)}toScreen(e){if(!this.ready)return l.getLogger(this).error("#toScreen()","Scene view cannot be used before it is ready"),null;const t=(null==e.z?Me(this.elevationProvider,e):null)??0;return F(e,tt,this.renderSpatialReference,t),this.state.camera.projectToScreen(tt,it),_(it[0],it[1])}pixelSizeAt(e,t){if(!this.ready)return l.getLogger(this).error("#pixelSizeAt()","Scene view cannot be used before it is ready"),null;if(!e)return 0;const i=this.renderSpatialReference;F(e,tt,i);const r=this.state.camera.computeScreenPixelSizeAt(tt);return t&&i!==t?r*M(i)/M(t):r}overlayPixelSizeInMapUnits(e){const t=this.basemapTerrain.overlayManager;return t?t.overlayPixelSizeInMapUnits(e,(()=>this.pixelSizeAt(e))):1}hitTest(e,t){if(!this.ready)return l.getLogger(this).error("#hitTest()","Scene view cannot be used before it is ready"),null;const i=ze(e)?Be(this,e):e;return Ve(this,i,t,this._defaultHitTestOptions)}async popupHitTest(e){return je(this,e)}goTo(e,t){return this.updatingHandles.addPromise(this.stateManager.goTo(e,t))}async whenAnalysisView(e){if(null==e.parent)throw new n("view:no-analysisview-for-analysis","The analysis has not been added to view.analyses",{analysis:e});switch(e.parent.type){case"line-of-sight":case"dimension":case"viewshed":return(await this.whenLayerView(e.parent)).whenAnalysisView();default:return this.analysisViewManager.whenAnalysisView(e)}}whenLayerView(e){return super.whenLayerView(e)}async takeScreenshot(e){const t=await this._completeSettings(e);await this.whenReady();const i=await this.stage.renderView.takeScreenshot(t);return(await import("./support/screenshotUtils.js")).encode(i,t,this._pixelFormat())}async _takeScreenshot(e){const t=await this._completeSettings(e);await this.whenReady();const i=await this.stage.renderView.takeScreenshot(t);return(await import("./support/screenshotUtils.js")).encodeData(i,this._pixelFormat())}async _takeScreenshotWithObjectAndLayerId(e){const t=await this._completeSettings(e);await this.whenReady();const i=await this.stage.renderView.takeScreenshotWithOID(t),{encodeData:r}=await import("./support/screenshotUtils.js");return[r(i[0],this._pixelFormat()),r(i[1],this._pixelFormat())]}async _completeSettings(e){const{toRenderSettings:t,screenshotSuperSampleSettings:i}=await import("./support/screenshotUtils.js"),r=t(e,this);return r.pixelRatio/=this.state.pixelRatio,i(r,this.supersampleScreenshotsEnabled,this.padding)}_pixelFormat(){return{flipY:!0,premultipliedAlpha:this.stage?.renderView.getAlpha()??!1}}get test(){}async takeScreenshotWithObjectAndLayerId(e){if(!Ge())throw new n("360vr:objectAndLayerId-rendering-disabled","has enable-feature:objectAndLayerId-rendering must be true");const{encode:t}=await import("./support/screenshotUtils.js"),i=await this._completeSettings(e);await this.whenReady();const r=await this.stage.renderView.takeScreenshotWithOID(i),s=t(r[0],i,this._pixelFormat()),a=await this._completeSettings(e);a.format="png";return[s,t(r[1],a,this._pixelFormat())]}getColorToObjectAndLayerIdMapping(){const e=this.stage.renderView.olidRenderHelper;if(e)return e.getColorToObjectAndLayerIdMapping();throw new n("360vr:objectAndLayerId-rendering-disabled","has enable-feature:objectAndLayerId-rendering must be true")}addUpdatingPromise(e){return this.updatingHandles.addPromise(e)}importLayerView(e){return oe.importLayerView(e)}hasLayerViewModule(e){return oe.hasLayerViewModule(e)}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties?.spatialReference||this.defaultsFromMap?.spatialReference||this.defaultsFromMap?.ready&&this._initialDefaultSpatialReference||null}async validate(){let e=Ze(this.type);const t=has("safari");if(t&&t<9&&(e=new n("sceneview:browser-not-supported","This browser is not supported by SceneView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:t})),null!=e)throw l.getLogger(this).warn("#validate()",e.message),e}get _predeterminedViewingMode(){const e=this._isOverridden("viewingMode")?this._get("viewingMode"):(this.map&&"initialViewProperties"in this.map?this.map.initialViewProperties?.viewingMode:null)??null;return null!=e?ae(e):null}getSpatialReferenceSupport(e,t){const i=this._predeterminedViewingMode;if(null!=i)return this._validateSpatialReferenceForViewingMode(e,t,i)?{constraints:this._makeSpatialReferenceConstraints(e,t,i)}:null;const r=this._validateSpatialReferenceForViewingMode(e,t,se.Local),s=this._validateSpatialReferenceForViewingMode(e,t,se.Global);return r||s?r&&s?{constraints:this._makeSpatialReferenceConstraints(e,t,null)}:r?{constraints:this._makeSpatialReferenceConstraints(e,t,se.Local)}:{constraints:this._makeSpatialReferenceConstraints(e,t,se.Global)}:null}_validateSpatialReferenceForViewingMode(e,t,i){return!!Ne(e,i)&&(null==t||(!!N(t)||(!Q(t)||null!=Ae(t,e,i))&&(!Y(t)||i!==se.Global)))}_makeSpatialReferenceConstraints(e,t,i){if(null==t)return[{spatialReference:e,viewingMode:i}];const{isWebMercator:r,isWGS84:s}=e;if(N(t)&&(r||s)){return!s||i===se.Local||null===Ie(t.tileInfo,t.fullExtent,e,se.Global)?[{spatialReference:e,viewingMode:i},{spatialReference:G.WebMercator,viewingMode:i}]:[{spatialReference:r?G.WGS84:G.WebMercator,viewingMode:i}]}return Q(t)||Y(t)||!r&&!s?Q(t)&&r&&i!==se.Global?[{spatialReference:e,viewingMode:i},{spatialReference:G.WGS84,viewingMode:se.Local}]:[{spatialReference:e,viewingMode:i}]:[{spatialReference:e,viewingMode:i},{spatialReference:r?G.WGS84:G.WebMercator,viewingMode:i}]}_validateSpatialReference(e){const t=null!=this.getSpatialReferenceSupport(e),i=this._predeterminedViewingMode;return t||(null!=i?l.getLogger(this).warnOnce(`Spatial reference defined on view not supported in ${ne(i)} viewing mode.`):e.isGeographic&&l.getLogger(this).warnOnce("Spatial reference is geographic but not supported.")),t}whenReady(){return new Promise((e=>{this.ready?e(this):this._resolveWhenReady.push(e)}))}trackGraphicState(e){if(!e.graphic)return l.getLogger(this).error("trackGraphicState","GraphicState.graphic must not be null or undefined to start tracking"),null;const t=this.getViewForGraphic(e.graphic);let i=null,r=!1;const s=t=>{!r&&null!=t&&"processor"in t&&"graphics-3d"===t.processor?.type&&t.processor.graphicsCore&&(i=t.processor.graphicsCore.trackGraphicState(e))};return null!=t?s(t):this.whenViewForGraphic(e.graphic,{waitForLayer:!0}).then((e=>s(e)),(()=>{})).catch((()=>{})),o((()=>{r=!0,null!=i&&(i.remove(),i=null)}))}maskOccludee(e){if(!e)return l.getLogger(this).error("maskOccludee","GraphicState.graphic must not be null or undefined to mask an occludee"),null;const t=this.getViewForGraphic(e);let i=null,r=!1;const s=t=>{!r&&null!=t&&qe(t)&&(i=t.maskOccludee(e))};return null!=t?s(t):this.whenViewForGraphic(e,{waitForLayer:!0}).then((e=>s(e)),(()=>{})).catch((()=>{})),o((()=>{r=!0,null!=i&&(i.remove(),i=null)}))}getViewForGraphic(e){return e.layer===this?this.graphicsView:e.layer?this.allLayerViews.filter((e=>"media-3d"!==e.type)).find((t=>t.layer===e.layer)):null}graphicChanged(e){null!=this.graphicsView&&this.graphicsView.graphicChanged(e)}async whenViewForGraphic(e,t){return e.layer===this?(await y((()=>this.graphicsView)),this.graphicsView):e.layer&&this.map?t&&t.waitForLayer&&!this.map.allLayers.includes(e.layer)?new Promise(((t,i)=>{const r=this.map.allLayers.on("change",(s=>{s.added.includes(e.layer)&&(r.remove(),this.whenLayerView(e.layer).then(t,i))}))})):this.whenLayerView(e.layer):null}_initBasemapTerrain(){this._set("basemapTerrain",new Le({view:this})),this._set("elevationProvider",new ve({view:this})),this.elevationProvider.register("ground",this.basemapTerrain)}_exitBasemapTerrain(){this.basemapTerrain&&(this.elevationProvider.unregister(this.basemapTerrain),this.elevationProvider.destroy(),this._set("elevationProvider",null),this.basemapTerrain.destroy(),this._set("basemapTerrain",null))}_initGlobe(){this._initCoordinateSystem(),this.state.createInitialCamera(),this._initBasemapTerrain(),this._set("pointsOfInterest",new Ee({view:this})),this._set("featureTiles",new me({renderCoordsHelper:this.renderCoordsHelper,cameraOnSurface:this.pointsOfInterest.cameraOnSurface,focus:this.pointsOfInterest.focus,tilingSchemeOwner:this.basemapTerrain,viewState:this.state,scheduler:this._resourceController.scheduler,terrain:this.basemapTerrain}));const e=()=>{const e=this.basemapTerrain?.extent;if(this.clippingArea||e)if(e&&this.basemapTerrain.spatialReference){const e=null!=this.basemapTerrain.extent&&null!=this.basemapTerrain.spatialReference?H(W(this.basemapTerrain.extent,this.basemapTerrain.spatialReference),this.spatialReference):null;this.clippingArea?this.featureTiles.filterExtent=this.clippingArea.intersection(e):this.featureTiles.filterExtent=e}else this.featureTiles.filterExtent=this.clippingArea;else this.featureTiles.filterExtent=null};this.addHandles([this.updatingHandles.add((()=>_e.FEATURE_TILE_TREE_SHOW_TILES),(e=>{e&&this.featureTiles&&!this._featureTreeDebugger?this.updatingHandles.addPromise(import("./3d/layers/support/FeatureTileTree3DDebugger.js")).then((({FeatureTileTree3DDebugger:e})=>{!this._featureTreeDebugger&&_e.FEATURE_TILE_TREE_SHOW_TILES&&(this._featureTreeDebugger=new e({view:this}))})):e||!this._featureTreeDebugger||_e.FEATURE_TILE_TREE_SHOW_TILES||(this._featureTreeDebugger.destroy(),this._featureTreeDebugger=null)}),f),this.updatingHandles.add((()=>this.clippingArea),e,f),this.updatingHandles.add((()=>this.basemapTerrain.extent),e,f)],"feature-tiles"),this.stateManager.init()}_exitGlobe(){this.featureTiles&&(this.stateManager.exit(),this.removeHandles("render-coords-helper"),this.removeHandles("feature-tiles"),this._set("featureTiles",p(this.featureTiles)),this._set("pointsOfInterest",p(this.pointsOfInterest)),this._exitBasemapTerrain(),this.state.reset(),this._exitCoordinateSystem())}_initCoordinateSystem(){if(this.spatialReference){const e=this.spatialReference,t=this.state.isGlobal,i=z(t,e);i!==this.renderSpatialReference&&(this._set("renderCoordsHelper",Ce.create(this.state.viewingMode,i)),t||this.addHandles(g((()=>this.basemapTerrain?.extent),(e=>{const t=this.renderCoordsHelper.spatialReference;null==e||0===e[0]&&0===e[1]&&0===e[2]&&0===e[3]||!D(e,this.basemapTerrain.spatialReference,rt,t)||(this.renderCoordsHelper.extent=rt)}),w),"render-coords-helper"),this.sceneIntersectionHelper&&this.sceneIntersectionHelper.setTolerance(De/this.renderCoordsHelper.unitInMeters))}else this._set("renderCoordsHelper",null)}_exitCoordinateSystem(){this.removeHandles("render-coords-helper"),this._set("renderCoordsHelper",null)}_updatingChanged(){this.notifyChange("updating")}_updateUpdatingMonitors(e=null){null!=e&&e.type===d.MOVE||(this.removeHandles("updatingMonitors"),this.allLayerViews.forEach((e=>{e.destroyed||(this.addHandles(g((()=>[e.updating,e.updatingProgress]),(()=>this._updatingChanged()),w),"updatingMonitors"),e.when((()=>this._updatingChanged()),(()=>this._updatingChanged())))})),this._updatingChanged())}async _prepareScreenshotOverlay(){this.overlay&&await this.overlay.prepare()}_renderScreenshotOverlay(e,t,i){if(!this.overlay||!this.overlay.hasVisibleItems)return i;const r=e.getContext("2d",{willReadFrequently:!0});return r.putImageData(i,0,0),this.overlay.renderCanvas(e,{disableDecorations:t}),r.getImageData(0,0,i.width,i.height)}_initStage(){const e={deactivatedWebGLExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions,alpha:this.alphaCompositingEnabled,preserveDrawingBuffer:this.preserveDrawingBufferEnabled,canvas:this.renderCanvas,screenshot:{prepareOverlay:()=>this._prepareScreenshotOverlay(),renderOverlay:(e,t,i)=>this._renderScreenshotOverlay(e,t,i)}},t=new we(this.state.viewingMode,(e=>this.stage.layers.forAll(e)),this);this._set("sceneIntersectionHelper",t);const i=s(this.surface);this._stage=new He({view:this,options:e,container:i}),this._stage.renderer.slicePlane=this.slicePlane,this.addHandles([this.updatingHandles.add((()=>this.qualitySettings.highQualityTransparency),(e=>this.stage.renderer.setParameters({highQualityTransparency:e})),m),this.on("pointer-move",(()=>this.stage?.renderer.resetAnimation())),a(this.stage.renderView.canvas,"webglcontextlost",(e=>{this.fatalError=new n("webgl-context-lost",e.statusMessage)}))],"stage"),this.renderCoordsHelper&&this.sceneIntersectionHelper.setTolerance(De/this.renderCoordsHelper.unitInMeters),this._set("canvas",this.stage.renderView.canvas)}_exitStage(){this._set("sceneIntersectionHelper",null),this._stage=p(this.stage),this.removeHandles("stage"),this._set("canvas",null)}_initSurface(e){this._exitSurface(),this._initStage(),this._initGlobe(),this.sharedSymbolResources=new xe({view:this,viewingMode:e,resourceController:this._resourceController,pointsOfInterest:this.pointsOfInterest,viewState:this.state})}_exitSurface(){this.sharedSymbolResources&&(this.sharedSymbolResources.objectResourceCache.destroy(),this.sharedSymbolResources.destroy(),this.sharedSymbolResources=null,this._exitGlobe(),this._exitStage())}_createGraphicsViewIfNeeded(){if(this.graphicsView||this._createGraphicsViewController)return;if(0===this.graphics.length)return;this.removeHandles("graphics-view"),this._createGraphicsViewController=new AbortController;const e=()=>{this._createGraphicsViewController=null,this._updatingChanged()};this._createGraphicsViewAsync(this._createGraphicsViewController.signal).then(e,e),this._updatingChanged()}async _createGraphicsViewAsync(e){const t=(await import("./3d/layers/GraphicsView3D.js")).default;c(e),await y((()=>this.basemapTerrain?.ready),e),this._set("graphicsView",new t({view:this,getGraphics:()=>this.graphics}))}_disposeGraphicsView(){this._createGraphicsViewController&&(this._createGraphicsViewController.abort(),this._createGraphicsViewController=null),this.removeHandles("graphics-view"),null!=this.graphicsView&&(this.removeHandles(this.graphicsView.processor.layer.id),this.graphicsView.destroy(),this._set("graphicsView",null))}_startup(){const e=ae(this.viewingMode);e===se.Global&&(this._clippingArea=null),this._initSurface(e),this._set("ready",!0),this.addHandles(u((()=>this.graphics),"after-changes",(()=>this._createGraphicsViewIfNeeded())),"graphics-view"),this._createGraphicsViewIfNeeded();const t=this.map&&"initialViewProperties"in this.map?this.map.initialViewProperties:null,i=t?.environment;i&&(this._overrideDefaultEnvironmentOnly?O(this.environment,i):this.environment=this.environment.cloneWithWebsceneEnvironment(i)),this.timeExtent=t?.timeExtent,t?.analyses.applyTo(this),this.labeler.setup(),this.environmentManager.connectView(this),this.inputManager.connect();const r=this._resolveWhenReady;this._resolveWhenReady=[],r.forEach((e=>e(this)))}_teardown(){this._initialDefaultSpatialReference=null,this.inputManager.disconnect(),this.environmentManager.disconnectView(),this._overrideDefaultEnvironmentOnly=!1,this.labeler.dispose(),this._disposeGraphicsView(),this.removeHandles("graphics-view"),this._exitSurface(),this._set("ready",!1)}get _defaultToMapOptions(){const e={include:new Set};if(!this.map)return e;this.map.ground&&e.include.add(Fe);for(const t of this.allLayerViews)Z(t.layer.type)&&e.include.add(t.uid);return e}get _defaultHitTestOptions(){const e={exclude:new Set};if(!this.map)return e;this.map.ground&&this.map.ground.opacity<1&&e.exclude.add(Fe);for(const t of this.allLayerViews)Z(t.layer.type)&&t.layer.opacity<1&&e.exclude.add(t.uid);return e}static{this.type="3d"}};function et(e,t){return null!=e&&I(e.spatialReference,t)?H(e,t):null}e([V()],Xe.prototype,"_userClippingArea",void 0),e([V()],Xe.prototype,"_resourceController",void 0),e([V()],Xe.prototype,"_stage",void 0),e([V({readOnly:!0})],Xe.prototype,"deconflictor",void 0),e([V({readOnly:!0})],Xe.prototype,"labeler",void 0),e([V(E($,"analyses"))],Xe.prototype,"analyses",void 0),e([V({type:re,readOnly:!0})],Xe.prototype,"animation",null),e([V({readOnly:!0})],Xe.prototype,"basemapTerrain",void 0),e([V({readOnly:!0})],Xe.prototype,"elevationProvider",void 0),e([V()],Xe.prototype,"camera",null),e([V({type:t})],Xe.prototype,"contentCamera",null),e([V({readOnly:!0})],Xe.prototype,"canvas",void 0),e([V({type:A})],Xe.prototype,"center",null),e([V({type:L})],Xe.prototype,"clippingArea",null),e([V({type:pe})],Xe.prototype,"constraints",void 0),e([V({type:L,readOnly:!0})],Xe.prototype,"renderDataExtent",null),e([V({readOnly:!0})],Xe.prototype,"tileInfo",null),e([V({type:L,readOnly:!0})],Xe.prototype,"dataExtent",null),e([V({type:L,readOnly:!0})],Xe.prototype,"_groundAndLayersExtent",null),e([V({type:de})],Xe.prototype,"environment",void 0),e([j("environment")],Xe.prototype,"castEnvironment",null),e([V({readOnly:!0})],Xe.prototype,"environmentManager",void 0),e([V({type:L})],Xe.prototype,"extent",null),e([V({type:r})],Xe.prototype,"floors",void 0),e([V()],Xe.prototype,"screenCenter",null),e([V()],Xe.prototype,"frustum",null),e([V({type:Number,readOnly:!0})],Xe.prototype,"fullOpacity",void 0),e([V({readOnly:!0})],Xe.prototype,"graphicsView",void 0),e([V({readOnly:!0})],Xe.prototype,"analysisViewManager",void 0),e([V()],Xe.prototype,"groundView",void 0),e([V({type:Boolean})],Xe.prototype,"initialExtentRequired",null),e([V()],Xe.prototype,"defaultsFromMapSettings",null),e([V()],Xe.prototype,"interacting",null),e([V()],Xe.prototype,"stationary",null),e([V()],Xe.prototype,"navigating",null),e([V()],Xe.prototype,"map",void 0),e([V()],Xe.prototype,"padding",null),e([V({type:Ee,readOnly:!0})],Xe.prototype,"pointsOfInterest",void 0),e([V({type:me,readOnly:!0})],Xe.prototype,"featureTiles",void 0),e([V()],Xe.prototype,"_featureTreeDebugger",void 0),e([V({type:Boolean})],Xe.prototype,"screenSizePerspectiveEnabled",void 0),e([V({constructOnly:!0})],Xe.prototype,"deactivatedWebGLExtensions",void 0),e([V({constructOnly:!0})],Xe.prototype,"debugWebGLExtensions",void 0),e([V({constructOnly:!0})],Xe.prototype,"renderCanvas",void 0),e([V({constructOnly:!0})],Xe.prototype,"state",void 0),e([V({readOnly:!0})],Xe.prototype,"inputManager",void 0),e([V({readOnly:!0})],Xe.prototype,"stateManager",void 0),e([V({type:["low","medium","high"]})],Xe.prototype,"qualityProfile",null),e([V({type:Re,get(){let e=this._get("qualitySettings");return e||(e=new Re,be.apply(this.qualityProfile,e)),e}})],Xe.prototype,"qualitySettings",void 0),e([V()],Xe.prototype,"slicePlane",null),e([V({readOnly:!0})],Xe.prototype,"typeSpecificPreconditionsReady",null),e([V({readOnly:!0})],Xe.prototype,"renderCoordsHelper",void 0),e([V({readOnly:!0})],Xe.prototype,"sceneIntersectionHelper",void 0),e([V({type:Number,dependsOn:["scale","spatialReference"],readOnly:!0})],Xe.prototype,"resolution",null),e([V({type:Number})],Xe.prototype,"scale",null),e([V()],Xe.prototype,"heightModelInfo",null),e([V()],Xe.prototype,"spatialReference",void 0),e([V({type:Boolean,constructOnly:!0})],Xe.prototype,"alphaCompositingEnabled",void 0),e([V({constructOnly:!0})],Xe.prototype,"preserveDrawingBufferEnabled",void 0),e([V({type:Boolean})],Xe.prototype,"supersampleScreenshotsEnabled",void 0),e([V({readOnly:!0})],Xe.prototype,"type",void 0),e([V(),j((e=>e instanceof $e?e:T(Je,e)))],Xe.prototype,"ui",void 0),e([V({type:Boolean,readOnly:!0,dependsOn:["graphicsView.updating","basemapView.updating","basemapTerrain.updating","layerViewManager.updating","layerViewManager.updatingRemaining","_resourceController.updating","stage.updating","featureTiles.updating","pointsOfInterest.updating","environmentManager.updating","overlay.updating","updatingHandles.updating","featureTreeDebugger.updating","labeler.updating","deconflictor.updating","ready","stationary","inputManager.updating","toolViewManager.updating","analysisViewManager.updating","state.updating","textures.updating"]})],Xe.prototype,"updating",null),e([V()],Xe.prototype,"_updatingObjects",null),e([V()],Xe.prototype,"_updatingObjectsWithProgress",null),e([V({type:Number,readOnly:!0,dependsOn:["updating"]})],Xe.prototype,"updatingProgress",void 0),e([V({type:["global","local"]})],Xe.prototype,"viewingMode",null),e([V({type:i})],Xe.prototype,"viewpoint",null),e([V({readOnly:!0})],Xe.prototype,"visibleArea",null),e([V({type:Number})],Xe.prototype,"zoom",null),e([V({type:We})],Xe.prototype,"highlightOptions",null),e([V({readOnly:!0})],Xe.prototype,"quality",null),e([V({readOnly:!0})],Xe.prototype,"resolutionScale",null),e([V()],Xe.prototype,"_defaultToMapOptions",null),e([V()],Xe.prototype,"_defaultHitTestOptions",null),Xe=e([R("esri.views.SceneView")],Xe);const tt=x(),it=b(),rt=U(),st=Xe;export{st as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../Camera.js";import i from"../Viewpoint.js";import r from"../core/Collection.js";import{byId as s}from"../core/domUtils.js";import n from"../core/Error.js";import{on as a}from"../core/events.js";import{makeHandle as o}from"../core/handleUtils.js";import has from"../core/has.js";import l from"../core/Logger.js";import{destroyMaybe as p,maybeProperty as h}from"../core/maybe.js";import{ObservableChangesType as d}from"../core/ObservableChangesType.js";import{throwIfAborted as c}from"../core/promiseUtils.js";import{on as u,watch as g,initial as m,whenOnce as y,syncAndInitial as f,sync as w}from"../core/reactiveUtils.js";import{setFrameDuration as v}from"../core/scheduling.js";import{createScreenPoint as _,createScreenPointArray as b}from"../core/screenUtils.js";import{getMetersPerUnitForSR as M}from"../core/unitUtils.js";import{initialize as S}from"../core/workers/workers.js";import{property as V}from"../core/accessorSupport/decorators/property.js";import{cast as R}from"../core/accessorSupport/decorators/cast.js";import"../core/RandomLCG.js";import{subclass as j}from"../core/accessorSupport/decorators/subclass.js";import{ensureType as C,ensureClass as T}from"../core/accessorSupport/ensureType.js";import{overrideDefaultsFrom as O}from"../core/accessorSupport/overrideDefaultsFrom.js";import{create as x}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{owningCollectionProperty as E}from"../core/support/OwningCollection.js";import L from"../geometry/Extent.js";import A from"../geometry/HeightModelInfo.js";import I from"../geometry/Point.js";import{canProjectWithoutEngine as H,project as G}from"../geometry/projection.js";import P from"../geometry/SpatialReference.js";import{projectBoundingRect as D}from"../geometry/projection/projectBoundingRect.js";import{projectPointToVector as F}from"../geometry/projection/projectPointToVector.js";import{create as U,toExtent as W}from"../geometry/support/aaBoundingRect.js";import{renderSRFromViewSR as q}from"../geometry/support/coordinateSystem.js";import{getResolutionForScale as k}from"../geometry/support/scaleUtils.js";import{isImageryTileLayer as z,isTiledLayer as B,isVoxelLayer as N,isIntegratedMeshLayer as Q}from"../layers/support/layerUtils.js";import{AnalysesCollection as Y}from"../support/AnalysesCollection.js";import{BreakpointsOwner as Z}from"./BreakpointsOwner.js";import{DOMContainer as $}from"./DOMContainer.js";import{FocusAreas as J}from"./FocusAreas.js";import K from"./GroundView.js";import{PopupView as X}from"./PopupView.js";import ee from"./View.js";import te from"./ViewAnimation.js";import{ViewingMode as ie,stringFromViewingMode as re,viewingModeFromString as se}from"./ViewingMode.js";import{layerView3DImporter as ne}from"./3d/layerViewModuleImportUtils.js";import ae from"./3d/analysis/AnalysisViewManager3D.js";import{Constraints as oe}from"./3d/constraints/Constraints.js";import{EnvironmentManager as le}from"./3d/environment/EnvironmentManager.js";import pe from"./3d/environment/SceneViewEnvironment.js";import he from"./3d/input/SceneInputManager.js";import{GraphicsDeconflictor as de}from"./3d/layers/graphics/GraphicsDeconflictor.js";import{Labeler as ce}from"./3d/layers/graphics/Labeler.js";import{FeatureTileTree3D as ue}from"./3d/layers/support/FeatureTileTree3D.js";import ge from"./3d/state/ViewState.js";import{ViewStateManager as me}from"./3d/state/ViewStateManager.js";import{SceneIntersectionHelper as ye}from"./3d/state/helpers/SceneIntersectionHelper.js";import{CombinedElevationProvider as fe}from"./3d/support/CombinedElevationProvider.js";import{debugFlags as we}from"./3d/support/debugFlags.js";import ve from"./3d/support/DisplayQualityProfile.js";import{getElevationAtPoint as _e}from"./3d/support/ElevationProvider.js";import{toMap as be,hitTest as Me}from"./3d/support/hitTest.js";import{popupHitTest as Se}from"./3d/support/popupHitTest.js";import Ve from"./3d/support/QualitySettings.js";import{RenderCoordsHelper as Re}from"./3d/support/RenderCoordsHelper.js";import{newResourceController as je}from"./3d/support/ResourceController.js";import Ce from"./3d/support/SceneViewPerformanceInfo.js";import{SharedSymbolResources as Te}from"./3d/support/SharedSymbolResources.js";import{ViewSlice as Oe}from"./3d/support/ViewSlice.js";import{PointsOfInterest as xe}from"./3d/support/pointsOfInterest/PointsOfInterest.js";import Ee from"./3d/terrain/TerrainSurface.js";import{isSurfaceLayerView as Le,getTiledLayerInfo as Ae,checkIfTileInfoSupportedForView as Ie}from"./3d/terrain/terrainUtils.js";import{Stage as He}from"./3d/webgl-engine/Stage.js";import{olidEnabled as Ge}from"./3d/webgl-engine/effects/geometry/olidUtils.js";import{defaultTolerance as Pe}from"./3d/webgl-engine/lib/Intersector.js";import{terrainId as De}from"./3d/webgl-engine/lib/verticalOffsetUtils.js";import{defaultHighlightName as Fe}from"./support/HighlightDefaults.js";import Ue from"./support/HighlightOptions.js";import{occludeesSupported as We}from"./support/layerViewUtils.js";import{isSupportedScreenPointEvent as qe,createScreenPointFromSupportedEvent as ke}from"./support/screenUtils.js";import{isSpatialReferenceSupported as ze}from"./support/spatialReferenceSupport.js";import{initializeTextureCompressionWorker as Be,destroyTextureCompressionWorker as Ne}from"./support/TextureCompressionHelper.js";import{check as Qe}from"./support/WebGLRequirements.js";import Ye from"./ui/DefaultUI.js";import Ze from"./ui/3d/DefaultUI3D.js";import $e from"../webscene/Environment.js";let Je=class extends(Z(X($(ee)))){constructor(e){super(e),this._userClippingArea=null,this._clippingArea=null,this._initialDefaultSpatialReference=null,this._overrideDefaultEnvironmentOnly=!0,this._createGraphicsViewController=null,this._resolveWhenReady=[],this._resourceController=je(this),this.deconflictor=new de({view:this}),this.labeler=new ce({view:this,deconflictor:this.deconflictor.labels}),this.sharedSymbolResources=null,this.analyses=new Y,this.basemapTerrain=null,this.elevationProvider=null,this.canvas=null,this.constraints=new oe,this.environment=new pe,this.environmentManager=new le,this.floors=new r,this.fullOpacity=1,this.graphicsView=null,this.analysisViewManager=new ae({view:this}),this.groundView=null,this.map=null,this.screenSizePerspectiveEnabled=!0,this.state=new ge({view:this}),this.slice=new Oe,this.spatialReference=null,this.alphaCompositingEnabled=!1,this.preserveDrawingBufferEnabled=!1,this.supersampleScreenshotsEnabled=!0,this.type="3d",this.ui=new Ze,this._numUpdating=0,this._lastUpdateTime=0,this.updatingProgress=.5,this.focusAreas=new J({view:this}),S();const t=(e=null)=>{null!=e&&e.type===d.MOVE||(this._updatingChanged(),this.map&&this.map.allLayers.forEach((async e=>{try{await e.when()}catch{}this._updatingChanged()})))};this.addHandles([u((()=>this.map?.allLayers),"after-changes",(e=>t(e)),{onListenerAdd:()=>t(),onListenerRemove:()=>t(),sync:!0}),this.allLayerViews.on("after-changes",(e=>this._updateUpdatingMonitors(e))),g((()=>this.map),(e=>{e&&"load"in e&&e.load&&e.load().catch((()=>{}))}))]),this.inputManager=new he({view:this}),this.stateManager=new me({view:this})}initialize(){if(has("enable-feature:esri-compress-textures")&&has("wasm-simd")){const e=Be(this,this.resourceController);this.addResolvingPromise(e.promise)}this.groundView=new K({view:this}),this._updateUpdatingMonitors(),this.updatingHandles.add((()=>this.qualitySettings.memoryLimit),(e=>{this.resourceController&&(this.resourceController.memoryController.maxMemory=e)}),m),this.updatingHandles.add((()=>this.qualitySettings.additionalCacheMemory),(e=>{this.resourceController&&(this.resourceController.memoryController.additionalCacheMemory=e)}),m),this.updatingHandles.add((()=>this.qualitySettings.frameRate??0),(e=>v(e>0?1e3/Math.ceil(e):0)),m),this.addHandles([g((()=>this.spatialReference),(()=>this.notifyChange("clippingArea")),w),g((()=>({plane:this.slice.plane,isDecoration:this.slice.isDecoration})),(()=>this._updateSlice()),w)])}destroy(){this.destroyed||(Ne(this),this.updatingHandles.removeAll(),this.invalidate(),this.activeTool=null,this.layerViewManager.clear(),this._set("analysisViewManager",p(this.analysisViewManager)),this._exitSurface(),this._disposeGraphicsView(),this.sharedSymbolResources=p(this.sharedSymbolResources),this._set("labeler",p(this.labeler)),this._set("deconflictor",p(this.deconflictor)),this._resourceController=p(this._resourceController),this._set("stateManager",p(this.stateManager)),this._set("inputManager",p(this.inputManager)),this.state.destroy(),this.highlights.destroy(),this.removeHandles("updatingMonitors"),this._set("environmentManager",p(this.environmentManager)),this._set("environment",p(this.environment)),this.groundView=p(this.groundView),this._exitBasemapTerrain(),this.stage?.destroy(),this.slice.destroy())}get stage(){return this._stage}get renderSpatialReference(){return this.renderCoordsHelper?.spatialReference}get basemapSpatialReference(){return this.basemapTerrain?.spatialReference}get animation(){return this.state?.animation}get camera(){return this.stateManager?.camera}set camera(e){this.stateManager&&(this.stateManager.camera=e)}get contentCamera(){return this.stateManager?.contentCamera}set contentCamera(e){this.stateManager&&(this.stateManager.contentCamera=e)}installContentCameraReset(e={sticky:!1}){return this.stateManager.installContentCameraReset(e)}get center(){return this.stateManager?.center}set center(e){this.stateManager&&(this.stateManager.center=e)}get clippingArea(){if("global"===this.viewingMode)return null;const e=this.map;let t=this._userClippingArea||h(e,"clippingArea");return!this._userClippingArea&&!h(e,"clippingEnabled")||null==t?(this._clippingArea=null,null):t instanceof L?this.spatialReference&&(t=Ke(t,this.spatialReference),null==t)?(l.getLogger(this).error("#clippingArea","setting clippingArea with incompatible SpatialReference"),this._clippingArea):(t=t.clone(),null==t.intersection(this._groundAndLayersExtent)&&(t.xmin=t.xmax,t.ymin=t.ymax),t.zmin=void 0,t.zmax=void 0,t.equals(this._clippingArea)||(this._clippingArea=t),this._clippingArea):(l.getLogger(this).error("#clippingArea","only clippingArea geometries of type Extent are supported"),this._clippingArea)}set clippingArea(e){this.ready&&"global"===this.viewingMode&&null!=e?l.getLogger(this).error("#clippingArea=","Clipping area is only supported in local viewingMode"):this._userClippingArea=e}get renderDataExtent(){if(this.state.viewingMode===ie.Global)return null;const e=this.renderSpatialReference,t=this.dataExtent;return null==t||null==e||t.spatialReference.equals(e)?t:Ke(t,e)}get tileInfo(){return this.basemapTerrain?.tilingScheme?.toTileInfo()}get dataExtent(){let e=this._groundAndLayersExtent;const t=this.spatialReference||P.WGS84,i=Ke(this.clippingArea,t);null!=i&&(e=null!=e?e.intersection(i):i);const r=this._get("dataExtent");return null!=e&&e.equals(r)?r:e}get _groundAndLayersExtent(){const e=this.spatialReference||P.WGS84;let t;const i=i=>{const r=Ke(i,e);null!=r&&(null!=t?t.union(r):t=r.clone())},r=this.basemapTerrain;if(r?.spatialReference){const e=r.groundExtent;i(new L({xmin:e[0],ymin:e[1],zmin:0,xmax:e[2],ymax:e[3],zmax:0,spatialReference:r.spatialReference}))}if(this.map){const e=e=>{null==e.fullExtent||"graphics"===e.type&&e.internal||i(e.fullExtent)};this.map.allLayers.forEach((t=>e(t)))}if(null==t)return null;t.hasZ?(t.zmin=Math.min(0,t.zmin??0),t.zmax=Math.max(0,t.zmax??0)):(t.zmin=0,t.zmax=0);const s=this._get("_groundAndLayersExtent");return t.equals(s)?s:t}castEnvironment(e){return e?e instanceof pe?e:e instanceof $e?this.environment?.cloneWithWebsceneEnvironment(e)??pe.fromWebsceneEnvironment(e):C(pe,e):new pe}get extent(){return this.stateManager?.extent}set extent(e){this.stateManager&&(this.stateManager.extent=e)}get screenCenter(){return this.stateManager?.screenCenter}get frustum(){return this.stateManager?.frustum}get initialExtentRequired(){return this.stateManager&&!this.stateManager.hasInitialView}get defaultsFromMapSettings(){return{required:{tileInfo:!1,heightModelInfo:!0,extent:!1}}}get interacting(){return this.navigating||(this.toolViewManager?.interacting??!1)}get stationary(){return!this.animation&&!this.resizing&&(this.state?.stationary??!0)}get navigating(){return this.state?.navigating??!1}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}set qualityProfile(e){ve.isValidProfile(e)&&(ve.apply(e,this.qualitySettings),this.stage?.renderView.updateQualitySettings(this.qualitySettings),this._set("qualityProfile",e))}get qualityProfile(){return this._get("qualityProfile")||ve.getDefaultProfile()}_updateSlice(){null!=this.stage&&(this.stage.renderer.slice=this.slice)}get typeSpecificPreconditionsReady(){return!!this.viewingMode&&!!this.stateManager?.preinit(this.spatialReference)}get resolution(){return null!=this.spatialReference?k(this.scale,this.spatialReference):0}get scale(){return this.stateManager?.scale}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get heightModelInfo(){const e=this.getDefaultHeightModelInfo();return null!=e?A.deriveUnitFromSR(e,this.spatialReference):null}get updating(){if(this.destroyed)return!1;let e=0,t=this.layerViewManager.updating,i=t?this.layerViewManager.updatingRemaining:0;this.allLayerViews.forEach((r=>{if(r.isFulfilled()){if(r.updating){if(t=!0,r.suspended||Le(r))return;++i,e+=r.updatingProgress}}else++i}));for(const s of this._updatingObjects)if(null!=s&&s.updating){const t=.1;i+=t,e+=.5*t}for(const s of this._updatingObjectsWithProgress)null!=s&&s.updating&&(++i,e+=s.updatingProgress);const r=!this.stateManager.test.updatingIgnoreRenderState&&this.state.updating;if(t=!!(t||i>0||this.updatingHandles.updating||!this.ready||!this.stationary||r||this._createGraphicsViewController||this.inputManager?.updating||this.map?.allLayers?.some((e=>!e.isFulfilled()))),t?(this._numUpdating=Math.max(i,this._numUpdating),e+=this._numUpdating-i):this._numUpdating=0,this._numUpdating>0?e/=this._numUpdating:e=t?0:1,this._get("updatingProgress")!==e){const i=performance.now();if(e<1){const t=Math.min((i-this._lastUpdateTime)/2e3,1);e=this.updatingProgress*(1-t)+e*t}this._set("updatingProgress",e),this._lastUpdateTime=t&&e<1?i:0}return t}get _updatingObjects(){return[this.graphicsView,this.basemapView,this._resourceController,this.stage,this.featureTiles,this.pointsOfInterest,this.environmentManager,this.overlay,this._featureTreeDebugger,this.toolViewManager,this.analysisViewManager]}get _updatingObjectsWithProgress(){return[this.deconflictor,this.labeler,this.basemapTerrain]}get viewingMode(){const e=this._predeterminedViewingMode;if(null!=e)return re(e);const t=this.spatialReference;return t?null!=this.defaultsFromMap?.viewingMode&&t.equals(this.defaultsFromMap.spatialReference)?re(this.defaultsFromMap.viewingMode):ze(t,ie.Global)?"global":"local":"global"}set viewingMode(e){this.ready?l.getLogger(this).error("#viewingMode","viewingMode cannot be set once view is ready"):this._overrideIfSome("viewingMode",e)}get viewpoint(){return this.stateManager?.viewpoint}set viewpoint(e){this.stateManager&&(this.stateManager.viewpoint=e)}get visibleArea(){return this.stateManager?.visibleArea}get zoom(){return this.stateManager.zoom}set zoom(e){this.stateManager&&(this.stateManager.zoom=e)}get highlightOptions(){return this.highlights.find((({name:e})=>e===Fe))??new Ue}set highlightOptions(e){for(let t=0;t<this.highlights.length;++t){if(this.highlights.at(t).name===Fe)return void this.highlights.items[t].assignFrom(e)}}get resourceController(){return this._resourceController}get quality(){return this._resourceController?.memoryController?.memoryFactor??1}get resolutionScale(){return Math.sqrt(Math.min(1,this.quality/.75))}get performanceInfo(){return new Ce(this)}on(e,t,i,r){const s=this.viewEvents.on(e,t,i,r);return s||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}toMap(e,t){if(!this.ready)return l.getLogger(this).error("#toMap()","Scene view cannot be used before it is ready"),null;const i=qe(e)?ke(this,e):e;return be(this,i,t,this._defaultToMapOptions)}toScreen(e){if(!this.ready)return l.getLogger(this).error("#toScreen()","Scene view cannot be used before it is ready"),null;const t=(null==e.z?_e(this.elevationProvider,e):null)??0;return F(e,Xe,this.renderSpatialReference,t),this.state.camera.projectToScreen(Xe,et),_(et[0],et[1])}pixelSizeAt(e,t){if(!this.ready)return l.getLogger(this).error("#pixelSizeAt()","Scene view cannot be used before it is ready"),null;if(!e)return 0;const i=this.renderSpatialReference;F(e,Xe,i);const r=this.state.camera.computeScreenPixelSizeAt(Xe);return t&&i!==t?r*M(i)/M(t):r}overlayPixelSizeInMapUnits(e){const t=this.basemapTerrain.overlayManager;return t?t.overlayPixelSizeInMapUnits(e,(()=>this.pixelSizeAt(e))):1}hitTest(e,t){if(!this.ready)return l.getLogger(this).error("#hitTest()","Scene view cannot be used before it is ready"),null;const i=qe(e)?ke(this,e):e;return Me(this,i,t,this._defaultHitTestOptions)}async popupHitTest(e){return Se(this,e)}goTo(e,t){return this.updatingHandles.addPromise(this.stateManager.goTo(e,t))}async whenAnalysisView(e){if(null==e.parent)throw new n("view:no-analysisview-for-analysis","The analysis has not been added to view.analyses",{analysis:e});switch(e.parent.type){case"line-of-sight":case"dimension":case"viewshed":return(await this.whenLayerView(e.parent)).whenAnalysisView();default:return this.analysisViewManager.whenAnalysisView(e)}}whenLayerView(e){return super.whenLayerView(e)}async takeScreenshot(e){const t=await this._completeSettings(e);await this.whenReady();const i=await this.stage.renderView.takeScreenshot(t);return(await import("./support/screenshotUtils.js")).encode(i,t,this._pixelFormat())}async _takeScreenshot(e){const t=await this._completeSettings(e);await this.whenReady();const i=await this.stage.renderView.takeScreenshot(t);return(await import("./support/screenshotUtils.js")).encodeData(i,this._pixelFormat())}async _takeScreenshotWithObjectAndLayerId(e){const t=await this._completeSettings(e);await this.whenReady();const i=await this.stage.renderView.takeScreenshotWithOID(t),{encodeData:r}=await import("./support/screenshotUtils.js");return[r(i[0],this._pixelFormat()),r(i[1],this._pixelFormat())]}async _completeSettings(e){const{toRenderSettings:t,screenshotSuperSampleSettings:i}=await import("./support/screenshotUtils.js"),r=t(e,this);return r.pixelRatio/=this.state.pixelRatio,i(r,this.supersampleScreenshotsEnabled,this.padding)}_pixelFormat(){return{flipY:!0,premultipliedAlpha:this.stage?.renderView.getAlpha()??!1}}get test(){}async takeScreenshotWithObjectAndLayerId(e){if(!Ge())throw new n("360vr:objectAndLayerId-rendering-disabled","has enable-feature:objectAndLayerId-rendering must be true");const{encode:t}=await import("./support/screenshotUtils.js"),i=await this._completeSettings(e);await this.whenReady();const r=await this.stage.renderView.takeScreenshotWithOID(i),s=t(r[0],i,this._pixelFormat()),a=await this._completeSettings(e);a.format="png";return[s,t(r[1],a,this._pixelFormat())]}getColorToObjectAndLayerIdMapping(){const e=this.stage.renderView.olidRenderHelper;if(e)return e.getColorToObjectAndLayerIdMapping();throw new n("360vr:objectAndLayerId-rendering-disabled","has enable-feature:objectAndLayerId-rendering must be true")}addUpdatingPromise(e){return this.updatingHandles.addPromise(e)}importLayerView(e){return ne.importLayerView(e)}hasLayerViewModule(e){return ne.hasLayerViewModule(e)}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties?.spatialReference||this.defaultsFromMap?.spatialReference||this.defaultsFromMap?.ready&&this._initialDefaultSpatialReference||null}async validate(){let e=Qe(this.type);const t=has("safari");if(t&&t<9&&(e=new n("sceneview:browser-not-supported","This browser is not supported by SceneView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:t})),null!=e)throw l.getLogger(this).warn("#validate()",e.message),e}get _predeterminedViewingMode(){const e=this._isOverridden("viewingMode")?this._get("viewingMode"):(this.map&&"initialViewProperties"in this.map?this.map.initialViewProperties?.viewingMode:null)??null;return null!=e?se(e):null}getSpatialReferenceSupport(e,t){const i=this._predeterminedViewingMode;if(null!=i)return this._validateSpatialReferenceForViewingMode(e,t,i)?{constraints:this._makeSpatialReferenceConstraints(e,t,i)}:null;const r=this._validateSpatialReferenceForViewingMode(e,t,ie.Local),s=this._validateSpatialReferenceForViewingMode(e,t,ie.Global);return r||s?r&&s?{constraints:this._makeSpatialReferenceConstraints(e,t,null)}:r?{constraints:this._makeSpatialReferenceConstraints(e,t,ie.Local)}:{constraints:this._makeSpatialReferenceConstraints(e,t,ie.Global)}:null}_validateSpatialReferenceForViewingMode(e,t,i){return!!ze(e,i)&&(null==t||(!!z(t)||(!B(t)||null!=Ae(t,e,i))&&(!N(t)||i!==ie.Global)))}_makeSpatialReferenceConstraints(e,t,i){if(null==t)return[{spatialReference:e,viewingMode:i}];const{isWebMercator:r,isWGS84:s}=e;if(z(t)&&(r||s)){return!s||i===ie.Local||null===Ie(t.tileInfo,t.fullExtent,e,ie.Global)?[{spatialReference:e,viewingMode:i},{spatialReference:P.WebMercator,viewingMode:i}]:[{spatialReference:r?P.WGS84:P.WebMercator,viewingMode:i}]}return B(t)||N(t)||!r&&!s?B(t)&&r&&i!==ie.Global?[{spatialReference:e,viewingMode:i},{spatialReference:P.WGS84,viewingMode:ie.Local}]:[{spatialReference:e,viewingMode:i}]:[{spatialReference:e,viewingMode:i},{spatialReference:r?P.WGS84:P.WebMercator,viewingMode:i}]}_validateSpatialReference(e){const t=null!=this.getSpatialReferenceSupport(e),i=this._predeterminedViewingMode;return t||(null!=i?l.getLogger(this).warnOnce(`Spatial reference defined on view not supported in ${re(i)} viewing mode.`):e.isGeographic&&l.getLogger(this).warnOnce("Spatial reference is geographic but not supported.")),t}whenReady(){return new Promise((e=>{this.ready?e(this):this._resolveWhenReady.push(e)}))}trackGraphicState(e){if(!e.graphic)return l.getLogger(this).error("trackGraphicState","GraphicState.graphic must not be null or undefined to start tracking"),null;const t=this.getViewForGraphic(e.graphic);let i=null,r=!1;const s=t=>{!r&&null!=t&&"processor"in t&&"graphics-3d"===t.processor?.type&&t.processor.graphicsCore&&(i=t.processor.graphicsCore.trackGraphicState(e))};return null!=t?s(t):this.whenViewForGraphic(e.graphic,{waitForLayer:!0}).then((e=>s(e)),(()=>{})).catch((()=>{})),o((()=>{r=!0,null!=i&&(i.remove(),i=null)}))}maskOccludee(e){if(!e)return l.getLogger(this).error("maskOccludee","GraphicState.graphic must not be null or undefined to mask an occludee"),null;const t=this.getViewForGraphic(e);let i=null,r=!1;const s=t=>{!r&&null!=t&&We(t)&&(i=t.maskOccludee(e))};return null!=t?s(t):this.whenViewForGraphic(e,{waitForLayer:!0}).then((e=>s(e)),(()=>{})).catch((()=>{})),o((()=>{r=!0,null!=i&&(i.remove(),i=null)}))}getViewForGraphic(e){return e.layer===this?this.graphicsView:e.layer?this.allLayerViews.filter((e=>"media-3d"!==e.type)).find((t=>t.layer===e.layer)):null}graphicChanged(e){null!=this.graphicsView&&this.graphicsView.graphicChanged(e)}async whenViewForGraphic(e,t){return e.layer===this?(await y((()=>this.graphicsView)),this.graphicsView):e.layer&&this.map?t&&t.waitForLayer&&!this.map.allLayers.includes(e.layer)?new Promise(((t,i)=>{const r=this.map.allLayers.on("change",(s=>{s.added.includes(e.layer)&&(r.remove(),this.whenLayerView(e.layer).then(t,i))}))})):this.whenLayerView(e.layer):null}_initBasemapTerrain(){this._set("basemapTerrain",new Ee({view:this})),this._set("elevationProvider",new fe({view:this})),this.elevationProvider.register("ground",this.basemapTerrain)}_exitBasemapTerrain(){this.basemapTerrain&&(this.elevationProvider.unregister(this.basemapTerrain),this.elevationProvider.destroy(),this._set("elevationProvider",null),this.basemapTerrain.destroy(),this._set("basemapTerrain",null))}_initGlobe(){this._initCoordinateSystem(),this.state.createInitialCamera(),this._initBasemapTerrain(),this._set("pointsOfInterest",new xe({view:this})),this._set("featureTiles",new ue({renderCoordsHelper:this.renderCoordsHelper,cameraOnSurface:this.pointsOfInterest.cameraOnSurface,focus:this.pointsOfInterest.focus,tilingSchemeOwner:this.basemapTerrain,viewState:this.state,scheduler:this._resourceController.scheduler,terrain:this.basemapTerrain}));const e=()=>{const e=this.basemapTerrain?.extent;if(this.clippingArea||e)if(e&&this.basemapTerrain.spatialReference){const e=null!=this.basemapTerrain.extent&&null!=this.basemapTerrain.spatialReference?G(W(this.basemapTerrain.extent,this.basemapTerrain.spatialReference),this.spatialReference):null;this.clippingArea?this.featureTiles.filterExtent=this.clippingArea.intersection(e):this.featureTiles.filterExtent=e}else this.featureTiles.filterExtent=this.clippingArea;else this.featureTiles.filterExtent=null};this.addHandles([this.updatingHandles.add((()=>we.FEATURE_TILE_TREE_SHOW_TILES),(e=>{e&&this.featureTiles&&!this._featureTreeDebugger?this.updatingHandles.addPromise(import("./3d/layers/support/FeatureTileTree3DDebugger.js")).then((({FeatureTileTree3DDebugger:e})=>{!this._featureTreeDebugger&&we.FEATURE_TILE_TREE_SHOW_TILES&&(this._featureTreeDebugger=new e({view:this}))})):e||!this._featureTreeDebugger||we.FEATURE_TILE_TREE_SHOW_TILES||(this._featureTreeDebugger.destroy(),this._featureTreeDebugger=null)}),f),this.updatingHandles.add((()=>this.clippingArea),e,f),this.updatingHandles.add((()=>this.basemapTerrain.extent),e,f)],"feature-tiles"),this.stateManager.init()}_exitGlobe(){this.featureTiles&&(this.stateManager.exit(),this.removeHandles("render-coords-helper"),this.removeHandles("feature-tiles"),this._set("featureTiles",p(this.featureTiles)),this._set("pointsOfInterest",p(this.pointsOfInterest)),this._exitBasemapTerrain(),this.state.reset(),this._exitCoordinateSystem())}_initCoordinateSystem(){if(this.spatialReference){const e=this.spatialReference,t=this.state.isGlobal,i=q(t,e);i!==this.renderSpatialReference&&(this._set("renderCoordsHelper",Re.create(this.state.viewingMode,i)),t||this.addHandles(g((()=>this.basemapTerrain?.extent),(e=>{const t=this.renderCoordsHelper.spatialReference;null==e||0===e[0]&&0===e[1]&&0===e[2]&&0===e[3]||!D(e,this.basemapTerrain.spatialReference,tt,t)||(this.renderCoordsHelper.extent=tt)}),w),"render-coords-helper"),this.sceneIntersectionHelper&&this.sceneIntersectionHelper.setTolerance(Pe/this.renderCoordsHelper.unitInMeters))}else this._set("renderCoordsHelper",null)}_exitCoordinateSystem(){this.removeHandles("render-coords-helper"),this._set("renderCoordsHelper",null)}_updatingChanged(){this.notifyChange("updating")}_updateUpdatingMonitors(e=null){null!=e&&e.type===d.MOVE||(this.removeHandles("updatingMonitors"),this.allLayerViews.forEach((e=>{e.destroyed||(this.addHandles(g((()=>[e.updating,e.updatingProgress]),(()=>this._updatingChanged()),w),"updatingMonitors"),e.when((()=>this._updatingChanged()),(()=>this._updatingChanged())))})),this._updatingChanged())}async _prepareScreenshotOverlay(){this.overlay&&await this.overlay.prepare()}_renderScreenshotOverlay(e,t,i){if(!this.overlay||!this.overlay.hasVisibleItems)return i;const r=e.getContext("2d",{willReadFrequently:!0});return r.putImageData(i,0,0),this.overlay.renderCanvas(e,{disableDecorations:t}),r.getImageData(0,0,i.width,i.height)}_initStage(){const e={deactivatedWebGLExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions,alpha:this.alphaCompositingEnabled,preserveDrawingBuffer:this.preserveDrawingBufferEnabled,canvas:this.renderCanvas,screenshot:{prepareOverlay:()=>this._prepareScreenshotOverlay(),renderOverlay:(e,t,i)=>this._renderScreenshotOverlay(e,t,i)}},t=new ye(this.state.viewingMode,(e=>this.stage.layers.forAll(e)),this);this._set("sceneIntersectionHelper",t);const i=s(this.surface);this._stage=new He({view:this,options:e,container:i}),this._updateSlice(),this.addHandles([this.updatingHandles.add((()=>this.qualitySettings.highQualityTransparency),(e=>this.stage.renderer.setParameters({highQualityTransparency:e})),m),this.on("pointer-move",(()=>this.stage?.renderer.resetAnimation())),a(this.stage.renderView.canvas,"webglcontextlost",(e=>{this.fatalError=new n("webgl-context-lost",e.statusMessage)}))],"stage"),this.renderCoordsHelper&&this.sceneIntersectionHelper.setTolerance(Pe/this.renderCoordsHelper.unitInMeters),this._set("canvas",this.stage.renderView.canvas)}_exitStage(){this._set("sceneIntersectionHelper",null),this._stage=p(this.stage),this.removeHandles("stage"),this._set("canvas",null)}_initSurface(e){this._exitSurface(),this._initStage(),this._initGlobe(),this.sharedSymbolResources=new Te({view:this,viewingMode:e,resourceController:this._resourceController,pointsOfInterest:this.pointsOfInterest,viewState:this.state})}_exitSurface(){this.sharedSymbolResources&&(this.sharedSymbolResources.objectResourceCache.destroy(),this.sharedSymbolResources.destroy(),this.sharedSymbolResources=null,this._exitGlobe(),this._exitStage())}_createGraphicsViewIfNeeded(){if(this.graphicsView||this._createGraphicsViewController)return;if(0===this.graphics.length)return;this.removeHandles("graphics-view"),this._createGraphicsViewController=new AbortController;const e=()=>{this._createGraphicsViewController=null,this._updatingChanged()};this._createGraphicsViewAsync(this._createGraphicsViewController.signal).then(e,e),this._updatingChanged()}async _createGraphicsViewAsync(e){const t=(await import("./3d/layers/GraphicsView3D.js")).default;c(e),await y((()=>this.basemapTerrain?.ready),e),this._set("graphicsView",new t({view:this,getGraphics:()=>this.graphics}))}_disposeGraphicsView(){this._createGraphicsViewController&&(this._createGraphicsViewController.abort(),this._createGraphicsViewController=null),this.removeHandles("graphics-view"),null!=this.graphicsView&&(this.removeHandles(this.graphicsView.processor.layer.id),this.graphicsView.destroy(),this._set("graphicsView",null))}_startup(){const e=se(this.viewingMode);e===ie.Global&&(this._clippingArea=null),this._initSurface(e),this._set("ready",!0),this.addHandles(u((()=>this.graphics),"after-changes",(()=>this._createGraphicsViewIfNeeded())),"graphics-view"),this._createGraphicsViewIfNeeded();const t=this.map&&"initialViewProperties"in this.map?this.map.initialViewProperties:null,i=t?.environment;i&&(this._overrideDefaultEnvironmentOnly?O(this.environment,i):this.environment=this.environment.cloneWithWebsceneEnvironment(i)),this.timeExtent=t?.timeExtent,t?.analyses.applyTo(this),this.labeler.setup(),this.environmentManager.connectView(this),this.inputManager.connect();const r=this._resolveWhenReady;this._resolveWhenReady=[],r.forEach((e=>e(this)))}_teardown(){this._initialDefaultSpatialReference=null,this.inputManager.disconnect(),this.environmentManager.disconnectView(),this._overrideDefaultEnvironmentOnly=!1,this.labeler.dispose(),this._disposeGraphicsView(),this.removeHandles("graphics-view"),this._exitSurface(),this._set("ready",!1)}get _defaultToMapOptions(){const e={include:new Set};if(!this.map)return e;this.map.ground&&e.include.add(De);for(const t of this.allLayerViews)Q(t.layer.type)&&e.include.add(t.uid);return e}get _defaultHitTestOptions(){const e={exclude:new Set};if(!this.map)return e;this.map.ground&&this.map.ground.opacity<1&&e.exclude.add(De);for(const t of this.allLayerViews)Q(t.layer.type)&&t.layer.opacity<1&&e.exclude.add(t.uid);return e}static{this.type="3d"}};function Ke(e,t){return null!=e&&H(e.spatialReference,t)?G(e,t):null}e([V()],Je.prototype,"_userClippingArea",void 0),e([V()],Je.prototype,"_resourceController",void 0),e([V()],Je.prototype,"_stage",void 0),e([V({readOnly:!0})],Je.prototype,"deconflictor",void 0),e([V({readOnly:!0})],Je.prototype,"labeler",void 0),e([V(E(Y,"analyses"))],Je.prototype,"analyses",void 0),e([V({type:te,readOnly:!0})],Je.prototype,"animation",null),e([V({readOnly:!0})],Je.prototype,"basemapTerrain",void 0),e([V({readOnly:!0})],Je.prototype,"elevationProvider",void 0),e([V()],Je.prototype,"camera",null),e([V({type:t})],Je.prototype,"contentCamera",null),e([V({readOnly:!0})],Je.prototype,"canvas",void 0),e([V({type:I})],Je.prototype,"center",null),e([V({type:L})],Je.prototype,"clippingArea",null),e([V({type:oe})],Je.prototype,"constraints",void 0),e([V({type:L,readOnly:!0})],Je.prototype,"renderDataExtent",null),e([V({readOnly:!0})],Je.prototype,"tileInfo",null),e([V({type:L,readOnly:!0})],Je.prototype,"dataExtent",null),e([V({type:L,readOnly:!0})],Je.prototype,"_groundAndLayersExtent",null),e([V({type:pe})],Je.prototype,"environment",void 0),e([R("environment")],Je.prototype,"castEnvironment",null),e([V({readOnly:!0})],Je.prototype,"environmentManager",void 0),e([V({type:L})],Je.prototype,"extent",null),e([V({type:r})],Je.prototype,"floors",void 0),e([V()],Je.prototype,"screenCenter",null),e([V()],Je.prototype,"frustum",null),e([V({type:Number,readOnly:!0})],Je.prototype,"fullOpacity",void 0),e([V({readOnly:!0})],Je.prototype,"graphicsView",void 0),e([V({readOnly:!0})],Je.prototype,"analysisViewManager",void 0),e([V()],Je.prototype,"groundView",void 0),e([V({type:Boolean})],Je.prototype,"initialExtentRequired",null),e([V()],Je.prototype,"defaultsFromMapSettings",null),e([V()],Je.prototype,"interacting",null),e([V()],Je.prototype,"stationary",null),e([V()],Je.prototype,"navigating",null),e([V()],Je.prototype,"map",void 0),e([V()],Je.prototype,"padding",null),e([V({type:xe,readOnly:!0})],Je.prototype,"pointsOfInterest",void 0),e([V({type:ue,readOnly:!0})],Je.prototype,"featureTiles",void 0),e([V()],Je.prototype,"_featureTreeDebugger",void 0),e([V({type:Boolean})],Je.prototype,"screenSizePerspectiveEnabled",void 0),e([V({constructOnly:!0})],Je.prototype,"deactivatedWebGLExtensions",void 0),e([V({constructOnly:!0})],Je.prototype,"debugWebGLExtensions",void 0),e([V({constructOnly:!0})],Je.prototype,"renderCanvas",void 0),e([V({constructOnly:!0})],Je.prototype,"state",void 0),e([V({readOnly:!0})],Je.prototype,"inputManager",void 0),e([V({readOnly:!0})],Je.prototype,"stateManager",void 0),e([V({type:["low","medium","high"]})],Je.prototype,"qualityProfile",null),e([V({type:Ve,get(){let e=this._get("qualitySettings");return e||(e=new Ve,ve.apply(this.qualityProfile,e)),e}})],Je.prototype,"qualitySettings",void 0),e([V()],Je.prototype,"slice",void 0),e([V({readOnly:!0})],Je.prototype,"typeSpecificPreconditionsReady",null),e([V({readOnly:!0})],Je.prototype,"renderCoordsHelper",void 0),e([V({readOnly:!0})],Je.prototype,"sceneIntersectionHelper",void 0),e([V({type:Number,dependsOn:["scale","spatialReference"],readOnly:!0})],Je.prototype,"resolution",null),e([V({type:Number})],Je.prototype,"scale",null),e([V()],Je.prototype,"heightModelInfo",null),e([V()],Je.prototype,"spatialReference",void 0),e([V({type:Boolean,constructOnly:!0})],Je.prototype,"alphaCompositingEnabled",void 0),e([V({constructOnly:!0})],Je.prototype,"preserveDrawingBufferEnabled",void 0),e([V({type:Boolean})],Je.prototype,"supersampleScreenshotsEnabled",void 0),e([V({readOnly:!0})],Je.prototype,"type",void 0),e([V(),R((e=>e instanceof Ye?e:T(Ze,e)))],Je.prototype,"ui",void 0),e([V({type:Boolean,readOnly:!0,dependsOn:["graphicsView.updating","basemapView.updating","basemapTerrain.updating","layerViewManager.updating","layerViewManager.updatingRemaining","_resourceController.updating","stage.updating","featureTiles.updating","pointsOfInterest.updating","environmentManager.updating","overlay.updating","updatingHandles.updating","featureTreeDebugger.updating","labeler.updating","deconflictor.updating","ready","stationary","inputManager.updating","toolViewManager.updating","analysisViewManager.updating","state.updating","textures.updating"]})],Je.prototype,"updating",null),e([V()],Je.prototype,"_updatingObjects",null),e([V()],Je.prototype,"_updatingObjectsWithProgress",null),e([V({type:Number,readOnly:!0,dependsOn:["updating"]})],Je.prototype,"updatingProgress",void 0),e([V({type:["global","local"]})],Je.prototype,"viewingMode",null),e([V({type:i})],Je.prototype,"viewpoint",null),e([V({readOnly:!0})],Je.prototype,"visibleArea",null),e([V({type:Number})],Je.prototype,"zoom",null),e([V({type:Ue})],Je.prototype,"highlightOptions",null),e([V({readOnly:!0})],Je.prototype,"quality",null),e([V({readOnly:!0})],Je.prototype,"resolutionScale",null),e([V()],Je.prototype,"_defaultToMapOptions",null),e([V()],Je.prototype,"_defaultHitTestOptions",null),Je=e([j("esri.views.SceneView")],Je);const Xe=x(),et=b(),tt=U(),it=Je;export{it as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{i as r}from"../../../../../chunks/vec32.js";import{create as s}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{d as e,
|
|
5
|
+
import{i as r}from"../../../../../chunks/vec32.js";import{create as s}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{d as e,h as o,j as t}from"../../../../../chunks/boundedPlane.js";function a(s,e){return o(e.extent,c),t(c,r(n,s.x,s.y,0))}const c=e(),n=s();export{a as distanceToTile};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import "../interfaces";
|
|
2
|
+
|
|
3
|
+
export type WebSceneUpdateFromOptions = __esri.websceneTypes.WebSceneUpdateFromOptions;
|
|
4
|
+
export type WebSceneUpdateThumbnailOptions = __esri.websceneTypes.WebSceneUpdateThumbnailOptions;
|
|
5
|
+
export type WebSceneThumbnailSize = __esri.websceneTypes.WebSceneThumbnailSize;
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import{createTask as o}from"../../core/asyncUtils.js";import{handlesGroup as i}from"../../core/handleUtils.js";import{abortMaybe as s}from"../../core/maybe.js";import{memoize as r}from"../../core/memoize.js";import{ignoreAbortErrors as l,throwIfAborted as a,throwIfAbortError as n}from"../../core/promiseUtils.js";import{watch as p,syncAndInitial as m}from"../../core/reactiveUtils.js";import{throttle as d}from"../../core/throttle.js";import{property as h}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as u}from"../../core/accessorSupport/decorators/subclass.js";import{hasGraphicFeatureExpressionInfo as f,getGraphicEffectiveElevationInfo as c}from"../../support/elevationInfoUtils.js";import{getConfig as _}from"./support/constants.js";import{isPolyline as P,isValidInputPath as v}from"./support/geometryUtils.js";import{generateProfiles as g}from"./support/profileUtils.js";const M=Symbol("line-change");let y=class extends t{constructor(e){super(e),this._updateTask=null,this._paramsPerProfile=new Map,this._getUpdateParametersMemoized=r(((e,t,o)=>({stationary:e,visibleProfiles:t,generationParameters:o}))),this._getGenerationParametersMemoized=r(((e,t,o,i,s,r,l)=>P(t)&&v(t)&&null!=i?{view:e,geometry:t,elevationInfo:o,options:r,queue:i,cache:s,slicePlane:l}:null)),this._getElevationInfoMemoized=r(((e,t)=>({mode:e,offset:t}))),this._getOptionsMemoized=r(((e,t)=>{const{densificationMaxSamples:o,maxTotalSamples:i}=_();return{samplingDistance:e,densificationMaxSamples:Math.round(o/t),maxTotalSamples:i}})),this._updateThrottled=d((e=>l(this._update(e))),_().updateThrottleMillis)}initialize(){const e=this.viewModel;this.addHandles([p((()=>({visible:e.visible,profiles:e.profiles.toArray()})),(({visible:e,profiles:t})=>{this._abortUpdate(),this._paramsPerProfile.clear(),this.removeHandles(M),e&&0!==t.length&&this.addHandles([...t.map((e=>i([e.attach(this.viewModel),e.on("change",(()=>{this._invalidateProfile(e)}))]))),p((()=>this._updateParameters),this._updateThrottled,m),this._updateThrottled],M)}),m)])}destroy(){this._paramsPerProfile.clear()}get _updateParameters(){const{viewModel:e}=this,t=e.view;return this._getUpdateParametersMemoized(null==t||t.stationary,this.viewModel.visibleProfiles,this._generationParameters)}get _generationParameters(){const{view:e,input:t,queue:o,tileCache:i}=this.viewModel;return null!=e&&e.ready?this._getGenerationParametersMemoized(e,t?.geometry,this._elevationInfo,o,i,this._options,"3d"===e.type?e.
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import{createTask as o}from"../../core/asyncUtils.js";import{handlesGroup as i}from"../../core/handleUtils.js";import{abortMaybe as s}from"../../core/maybe.js";import{memoize as r}from"../../core/memoize.js";import{ignoreAbortErrors as l,throwIfAborted as a,throwIfAbortError as n}from"../../core/promiseUtils.js";import{watch as p,syncAndInitial as m}from"../../core/reactiveUtils.js";import{throttle as d}from"../../core/throttle.js";import{property as h}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as u}from"../../core/accessorSupport/decorators/subclass.js";import{hasGraphicFeatureExpressionInfo as f,getGraphicEffectiveElevationInfo as c}from"../../support/elevationInfoUtils.js";import{getConfig as _}from"./support/constants.js";import{isPolyline as P,isValidInputPath as v}from"./support/geometryUtils.js";import{generateProfiles as g}from"./support/profileUtils.js";const M=Symbol("line-change");let y=class extends t{constructor(e){super(e),this._updateTask=null,this._paramsPerProfile=new Map,this._getUpdateParametersMemoized=r(((e,t,o)=>({stationary:e,visibleProfiles:t,generationParameters:o}))),this._getGenerationParametersMemoized=r(((e,t,o,i,s,r,l)=>P(t)&&v(t)&&null!=i?{view:e,geometry:t,elevationInfo:o,options:r,queue:i,cache:s,slicePlane:l}:null)),this._getElevationInfoMemoized=r(((e,t)=>({mode:e,offset:t}))),this._getOptionsMemoized=r(((e,t)=>{const{densificationMaxSamples:o,maxTotalSamples:i}=_();return{samplingDistance:e,densificationMaxSamples:Math.round(o/t),maxTotalSamples:i}})),this._updateThrottled=d((e=>l(this._update(e))),_().updateThrottleMillis)}initialize(){const e=this.viewModel;this.addHandles([p((()=>({visible:e.visible,profiles:e.profiles.toArray()})),(({visible:e,profiles:t})=>{this._abortUpdate(),this._paramsPerProfile.clear(),this.removeHandles(M),e&&0!==t.length&&this.addHandles([...t.map((e=>i([e.attach(this.viewModel),e.on("change",(()=>{this._invalidateProfile(e)}))]))),p((()=>this._updateParameters),this._updateThrottled,m),this._updateThrottled],M)}),m)])}destroy(){this._paramsPerProfile.clear()}get _updateParameters(){const{viewModel:e}=this,t=e.view;return this._getUpdateParametersMemoized(null==t||t.stationary,this.viewModel.visibleProfiles,this._generationParameters)}get _generationParameters(){const{view:e,input:t,queue:o,tileCache:i}=this.viewModel;return null!=e&&e.ready?this._getGenerationParametersMemoized(e,t?.geometry,this._elevationInfo,o,i,this._options,"3d"===e.type?e.slice.plane:null):null}get _elevationInfo(){const e=this.viewModel.input,t=e?f(e)?null:c(e):null;return null!=t?this._getElevationInfoMemoized(t.mode,t.offset):null}get _options(){const e=this.viewModel,t=e.visibleProfiles.length;let o=e.minDemResolution??_().defaultDemResolution;return o=parseFloat(o.toFixed(2)),this._getOptionsMemoized(o,t)}async _update({stationary:e,visibleProfiles:t,generationParameters:i}){this._abortUpdate(),e&&(null!=i?this._updateTask=o((async e=>{this.viewModel.error=null;const o=t.filter((e=>!this._isProfileValid(e,i))),s=g({...i,providers:o},{signal:e});try{for await(const t of s){a(e),this._clearInvalidResults(i);for(let e=0;e<o.length;e++)o[e].result=t[e]}for(const e of o)this._paramsPerProfile.set(e,i)}catch(r){n(r),this._abortUpdate(),this.viewModel.error=r,o.forEach((e=>{e.result=null}))}})):this._clearResults())}_abortUpdate(){this._updateTask=s(this._updateTask)}_isProfileValid(e,t){return this._paramsPerProfile.has(e)&&this._paramsPerProfile.get(e)===t}_invalidateProfile(e){this._paramsPerProfile.delete(e),this._updateThrottled(this._updateParameters)}_clearInvalidResults(e){for(const t of this.viewModel.profiles.items)this._isProfileValid(t,e)||(t.result=null,this._paramsPerProfile.delete(t))}_clearResults(){for(const e of this.viewModel.profiles.items)e.result=null,this._paramsPerProfile.delete(e)}};e([h({nonNullable:!0})],y.prototype,"viewModel",void 0),e([h()],y.prototype,"_updateParameters",null),e([h()],y.prototype,"_generationParameters",null),e([h()],y.prototype,"_elevationInfo",null),e([h()],y.prototype,"_options",null),y=e([u("esri.widgets.ElevationProfile.ElevationProfileController")],y);export{y as ElevationProfileController};
|