@arcgis/core 4.27.0-next.20230516 → 4.27.0-next.20230517
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/06d5f5e37fd44dc7de06.js +1 -0
- package/assets/esri/core/workers/chunks/12714d64a0154688072e.js +1 -0
- package/assets/esri/core/workers/chunks/{a507135977d83aea4421.js → 1827a3da6b5b9272ffe1.js} +1 -1
- package/assets/esri/core/workers/chunks/{395ef46b635f9e9a5643.js → 20e8e18e4bd2fd5da47c.js} +1 -1
- package/assets/esri/core/workers/chunks/23f73f81aea461c0c6e6.js +1 -0
- package/assets/esri/core/workers/chunks/{15dda462b979e90b58fe.js → 3cebdd77a8401495097f.js} +1 -1
- package/assets/esri/core/workers/chunks/48cb634255e39711a720.js +1 -0
- package/assets/esri/core/workers/chunks/4d5f71d84c85f45c97ea.js +1 -0
- package/assets/esri/core/workers/chunks/6312783626bacf52df7a.js +1 -0
- package/assets/esri/core/workers/chunks/6d80f81bf6ad97a7e69e.js +1 -0
- package/assets/esri/core/workers/chunks/{a3822a97701890c12d63.js → 7903beee895860c7e3af.js} +1 -1
- package/assets/esri/core/workers/chunks/887a630c5c980c5028e1.js +1 -0
- package/assets/esri/core/workers/chunks/{522660da4589739a70c3.js → c7fb48ea5d907883bcce.js} +1 -1
- package/assets/esri/core/workers/chunks/d0ff968e42116f592065.js +1 -0
- package/assets/esri/core/workers/chunks/{fdf64f23529a22c79fbd.js → d52c920acf08c95277c3.js} +19 -19
- package/assets/esri/core/workers/chunks/d64c271c173797d98286.js +1 -0
- package/assets/esri/core/workers/chunks/e1b2076d0040fcb7d864.js +1 -0
- package/assets/esri/core/workers/chunks/{b3013a5a39d038b2d748.js → e4f84c79fe3e7b54b76c.js} +1 -1
- package/assets/esri/core/workers/chunks/e6836c84470fb6bd25bf.js +1 -0
- package/assets/esri/core/workers/chunks/f3f6035a17f7dcd19675.js +1 -0
- package/assets/esri/core/workers/chunks/{bff317b08e91414f6edc.js → f720967ba8c5486a26a2.js} +1 -1
- package/assets/esri/themes/base/widgets/_ValuePicker.scss +27 -10
- 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/BasemapGallery/t9n/BasemapGallery_ar.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_bg.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_bs.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ca.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_cs.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_da.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_de.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_el.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_es.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_et.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_fi.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_fr.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_he.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_hr.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_hu.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_id.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_it.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ja.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ko.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_lt.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_lv.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_nb.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_nl.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_pl.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_pt-BR.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_pt-PT.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ro.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ru.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_sk.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_sl.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_sr.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_sv.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_th.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_tr.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_uk.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_vi.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_zh-CN.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_zh-HK.json +1 -1
- package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_zh-TW.json +1 -1
- package/chunks/DefaultMaterial.glsl.js +4 -4
- package/chunks/HUDMaterial.glsl.js +22 -22
- package/chunks/HeatmapDensity.glsl.js +5 -5
- package/chunks/LineMarker.glsl.js +35 -35
- package/chunks/RibbonLine.glsl.js +47 -47
- package/chunks/ShadowCastVisualize.glsl.js +2 -2
- package/core/Queue.js +1 -1
- package/interfaces.d.ts +290 -6
- package/intl/date.js +1 -1
- package/layers/ImageryTileLayer.js +1 -1
- package/layers/WMSLayer.js +1 -1
- package/layers/graphics/data/QueryEngine.js +1 -1
- package/layers/graphics/data/attributeSupport.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/support/rasterFunctions/rasterFunctionHelper.js +1 -1
- package/package.json +1 -1
- package/popup/FieldInfo.js +1 -1
- package/popup/support/FieldInfoFormat.js +1 -1
- package/portal/schemas/definitions.js +1 -1
- package/smartMapping/raster/support/adapters/ImageryLayerAdapter.js +1 -1
- package/smartMapping/raster/support/adapters/ImageryTileLayerAdapter.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/2d/layers/support/cimSymbolUtils.js +1 -1
- package/views/3d/support/DisplayQualityProfile.js +1 -1
- package/views/3d/support/QualitySettings.js +1 -1
- package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
- package/views/3d/terrain/Overlay.js +1 -1
- package/views/3d/terrain/OverlayManager.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js +13 -13
- package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +18 -18
- package/views/3d/webgl-engine/core/shaderLibrary/shading/MarkerSizing.glsl.js +8 -8
- package/views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js +1 -1
- package/views/3d/webgl-engine/lib/OffscreenRendering.js +1 -1
- package/views/3d/webgl-engine/lib/RenderFeature.js +1 -1
- package/views/3d/webgl-engine/lib/RenderTargetHelper.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodComponentData.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultBufferWriter.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/lineStippleUtils.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
- package/views/3d/webgl-engine/shaders/HUDMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/HUDMaterialTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/HeatmapDensity.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/LineCalloutTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/LineMarkerTechniqueConfiguration.js +1 -1
- package/views/PopupView.js +1 -1
- package/views/webgl/ValidatedTextureDescriptor.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
- package/widgets/ValuePicker/ValuePickerBaseComponent.js +1 -1
- package/widgets/ValuePicker/ValuePickerCollection.js +1 -1
- package/widgets/ValuePicker/ValuePickerCombobox.js +1 -1
- package/widgets/ValuePicker/ValuePickerLabel.js +1 -1
- package/widgets/ValuePicker/ValuePickerSlider.js +1 -1
- package/widgets/ValuePicker/ValuePickerViewModel.js +1 -1
- package/widgets/ValuePicker.js +1 -1
- package/assets/esri/core/workers/chunks/009026614cae60e9505c.js +0 -1
- package/assets/esri/core/workers/chunks/415c326d268b1a8fd03f.js +0 -1
- package/assets/esri/core/workers/chunks/504e929b686570ee858d.js +0 -1
- package/assets/esri/core/workers/chunks/5c811527898eb1c04e67.js +0 -1
- package/assets/esri/core/workers/chunks/6164a9c654c38f9cb64e.js +0 -1
- package/assets/esri/core/workers/chunks/6dd99db0adce09ac9794.js +0 -1
- package/assets/esri/core/workers/chunks/7cec069db0598431829e.js +0 -1
- package/assets/esri/core/workers/chunks/8bb3b10a777ae19f57f9.js +0 -1
- package/assets/esri/core/workers/chunks/91971a76a4ae0474a878.js +0 -1
- package/assets/esri/core/workers/chunks/9ed9e2ad50816a4f937a.js +0 -1
- package/assets/esri/core/workers/chunks/b81bb096ccfcea182cc1.js +0 -1
- package/assets/esri/core/workers/chunks/d05d9ddf244bb3dcbcaa.js +0 -1
- package/assets/esri/core/workers/chunks/d3a6504fbaf555707c58.js +0 -1
|
@@ -2,27 +2,27 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{RgbaFloatEncoding as e}from"../util/RgbaFloatEncoding.glsl.js";import{addCameraPosition as t}from"../util/View.glsl.js";import{Float4PassUniform as
|
|
5
|
+
import{RgbaFloatEncoding as e}from"../util/RgbaFloatEncoding.glsl.js";import{addCameraPosition as t,addPixelRatio as i}from"../util/View.glsl.js";import{Float4PassUniform as o}from"../../shaderModules/Float4PassUniform.js";import{FloatPassUniform as r}from"../../shaderModules/FloatPassUniform.js";import{glsl as l}from"../../shaderModules/interfaces.js";import{Texture2DPassUniform as a}from"../../shaderModules/Texture2DPassUniform.js";import{STIPPLE_TEXTURE_PADDING as p,computeLongestPattern as s,computeTextureSize as n}from"../../../materials/stippleTextureRepository.js";import{ensureColor4 as d}from"../../../shaders/ensureColor4.js";function c(e,t){e.constants.add("stippleAlphaColorDiscard","float",.001),e.constants.add("stippleAlphaHighlightDiscard","float",.5),t.stippleEnabled?f(e,t):u(e)}function f(s,n){const c=!(n.draped&&n.stipplePreferContinuous),{vertex:f,fragment:u}=s;u.include(e),n.draped||(t(f,n),f.uniforms.add(new r("worldToScreenPerDistanceRatio",((e,t)=>1/t.camera.perScreenPixelRatio))),f.code.add(l`float computeWorldToScreenRatio(vec3 segmentCenter) {
|
|
6
6
|
float segmentDistanceToCamera = length(segmentCenter - cameraPosition);
|
|
7
7
|
return worldToScreenPerDistanceRatio / segmentDistanceToCamera;
|
|
8
|
-
}`)),
|
|
8
|
+
}`)),s.varyings.add("vStippleDistance","float"),n.stippleRequiresClamp&&s.varyings.add("vStippleDistanceLimits","vec2"),n.stippleRequiresStretchMeasure&&s.varyings.add("vStipplePatternStretch","float"),f.code.add(l`
|
|
9
9
|
float discretizeWorldToScreenRatio(float worldToScreenRatio) {
|
|
10
|
-
float step = ${
|
|
10
|
+
float step = ${h};
|
|
11
11
|
|
|
12
12
|
float discreteWorldToScreenRatio = log(worldToScreenRatio);
|
|
13
13
|
discreteWorldToScreenRatio = ceil(discreteWorldToScreenRatio / step) * step;
|
|
14
14
|
discreteWorldToScreenRatio = exp(discreteWorldToScreenRatio);
|
|
15
15
|
return discreteWorldToScreenRatio;
|
|
16
16
|
}
|
|
17
|
-
`),
|
|
18
|
-
if (segmentLengthPseudoScreen >= ${
|
|
19
|
-
`),
|
|
17
|
+
`),f.code.add(l`vec2 computeStippleDistanceLimits(float startPseudoScreen, float segmentLengthPseudoScreen, float segmentLengthScreen, float patternLength) {`),f.code.add(l`
|
|
18
|
+
if (segmentLengthPseudoScreen >= ${c?"patternLength":"1e4"}) {
|
|
19
|
+
`),i(f,n),f.code.add(l`
|
|
20
20
|
// Round the screen length to get an integer number of pattern repetitions (minimum 1).
|
|
21
21
|
float repetitions = segmentLengthScreen / (patternLength * pixelRatio);
|
|
22
22
|
float flooredRepetitions = max(1.0, floor(repetitions + 0.5));
|
|
23
23
|
float segmentLengthScreenRounded = flooredRepetitions * patternLength;
|
|
24
24
|
|
|
25
|
-
${
|
|
25
|
+
${n.stippleRequiresStretchMeasure?l`
|
|
26
26
|
float stretch = repetitions / flooredRepetitions;
|
|
27
27
|
|
|
28
28
|
// We need to impose a lower bound on the stretch factor to prevent the dots from merging together when there is only 1 repetition.
|
|
@@ -33,27 +33,27 @@ return worldToScreenPerDistanceRatio / segmentDistanceToCamera;
|
|
|
33
33
|
}
|
|
34
34
|
return vec2(startPseudoScreen, startPseudoScreen + segmentLengthPseudoScreen);
|
|
35
35
|
}
|
|
36
|
-
`),
|
|
36
|
+
`),u.constants.add("stippleTexturePadding","float",p),u.uniforms.add(new a("stipplePatternTexture",(e=>e.stippleTexture)),new r("stipplePatternSDFNormalizer",(e=>S(e.stipplePattern))),new r("stipplePatternPixelSizeInv",(e=>1/m(e)))),u.code.add(l`float padStippleTexture(float u) {
|
|
37
37
|
float paddedTextureSize = float(textureSize(stipplePatternTexture, 0).x);
|
|
38
38
|
float unpaddedTextureSize = paddedTextureSize - stippleTexturePadding;
|
|
39
39
|
return (u * unpaddedTextureSize + stippleTexturePadding * 0.5) / paddedTextureSize;
|
|
40
|
-
}`),
|
|
40
|
+
}`),u.code.add(l`
|
|
41
41
|
float getStippleSDF(out bool isClamped) {
|
|
42
|
-
${
|
|
42
|
+
${n.stippleRequiresClamp?l`
|
|
43
43
|
float stippleDistanceClamped = clamp(vStippleDistance, vStippleDistanceLimits.x, vStippleDistanceLimits.y);
|
|
44
44
|
vec2 aaCorrectedLimits = vStippleDistanceLimits + vec2(1.0, -1.0) / gl_FragCoord.w;
|
|
45
|
-
isClamped = vStippleDistance < aaCorrectedLimits.x || vStippleDistance > aaCorrectedLimits.y;`:
|
|
45
|
+
isClamped = vStippleDistance < aaCorrectedLimits.x || vStippleDistance > aaCorrectedLimits.y;`:l`
|
|
46
46
|
float stippleDistanceClamped = vStippleDistance;
|
|
47
47
|
isClamped = false;`}
|
|
48
48
|
|
|
49
49
|
float u = stippleDistanceClamped * gl_FragCoord.w * stipplePatternPixelSizeInv;
|
|
50
|
-
${
|
|
50
|
+
${n.stippleScaleWithLineWidth?l`u *= vLineSizeInv;`:""}
|
|
51
51
|
u = padStippleTexture(fract(u));
|
|
52
52
|
|
|
53
53
|
float encodedSDF = rgba2float(texture(stipplePatternTexture, vec2(u, 0.5)));
|
|
54
54
|
float sdf = (encodedSDF * 2.0 - 1.0) * stipplePatternSDFNormalizer;
|
|
55
55
|
|
|
56
|
-
${
|
|
56
|
+
${n.stippleRequiresStretchMeasure?l`return (sdf - 0.5) * vStipplePatternStretch + 0.5;`:l`return sdf;`}
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
float getStippleSDF() {
|
|
@@ -65,12 +65,12 @@ return (u * unpaddedTextureSize + stippleTexturePadding * 0.5) / paddedTextureSi
|
|
|
65
65
|
bool isClamped;
|
|
66
66
|
float stippleSDF = getStippleSDF(isClamped);
|
|
67
67
|
|
|
68
|
-
float antiAliasedResult = ${
|
|
68
|
+
float antiAliasedResult = ${n.stippleScaleWithLineWidth?l`clamp(stippleSDF * vLineWidth + 0.5, 0.0, 1.0);`:l`clamp(stippleSDF + 0.5, 0.0, 1.0);`}
|
|
69
69
|
|
|
70
70
|
return isClamped ? floor(antiAliasedResult + 0.5) : antiAliasedResult;
|
|
71
71
|
}
|
|
72
|
-
`),
|
|
73
|
-
#define blendStipple(color, stippleAlpha) mix(color, stippleOffColor, stippleAlpha)`)):
|
|
74
|
-
#define blendStipple(color, stippleAlpha) vec4(color.rgb, color.a * stippleAlpha)`)}function
|
|
72
|
+
`),n.stippleOffColorEnabled?(u.uniforms.add(new o("stippleOffColor",(e=>d(e.stippleOffColor)))),u.code.add(l`#define discardByStippleAlpha(stippleAlpha, threshold) {}
|
|
73
|
+
#define blendStipple(color, stippleAlpha) mix(color, stippleOffColor, stippleAlpha)`)):u.code.add(l`#define discardByStippleAlpha(stippleAlpha, threshold) if (stippleAlpha < threshold) { discard; }
|
|
74
|
+
#define blendStipple(color, stippleAlpha) vec4(color.rgb, color.a * stippleAlpha)`)}function u(e){e.fragment.code.add(l`float getStippleAlpha() { return 1.0; }
|
|
75
75
|
#define discardByStippleAlpha(_stippleAlpha_, _threshold_) {}
|
|
76
|
-
#define blendStipple(color, _stippleAlpha_) color`)}function
|
|
76
|
+
#define blendStipple(color, _stippleAlpha_) color`)}function S(e){return e?(Math.floor(.5*(s(e)-1))+.5)/e.pixelRatio:1}function m(e){const t=e.stipplePattern;return t?n(e.stipplePattern)/t.pixelRatio:1}const h=l.float(.4);export{c as LineStipple,m as computePixelSize};
|
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{MARKER_SIZE_PER_LINE_WIDTH as e}from"../../../../support/engineContent/marker.js";import{
|
|
5
|
+
import{MARKER_SIZE_PER_LINE_WIDTH as e}from"../../../../support/engineContent/marker.js";import{addPixelRatio as r}from"../util/View.glsl.js";import{FloatPassUniform as o}from"../../shaderModules/FloatPassUniform.js";import{glsl as t}from"../../shaderModules/interfaces.js";import{LineMarkerSpace as a}from"../../../shaders/LineMarkerTechniqueConfiguration.js";function n(n,i){const{vertex:d,constants:s}=n;s.add("markerSizePerLineWidth","float",e),r(d,i),null==d.uniforms.get("markerScale")&&d.constants.add("markerScale","float",1),d.code.add(t`float getLineWidth() {
|
|
6
6
|
return max(getSize(), 1.0) * pixelRatio;
|
|
7
7
|
}
|
|
8
8
|
float getScreenMarkerSize() {
|
|
9
9
|
return markerSizePerLineWidth * markerScale * getLineWidth();
|
|
10
|
-
}`),
|
|
11
|
-
float distanceToCamera = length(pos.xyz);
|
|
12
|
-
float screenToWorldRatio = perRenderPixelRatio * distanceToCamera * 0.5;
|
|
13
|
-
return getScreenMarkerSize() * screenToWorldRatio;
|
|
14
|
-
}
|
|
15
|
-
bool areWorldMarkersHidden(vec4 pos, vec4 other) {
|
|
10
|
+
}`),i.space===a.World&&(d.constants.add("maxSegmentLengthFraction","float",.45),d.uniforms.add(new o("perRenderPixelRatio",((e,r)=>r.camera.perRenderPixelRatio))),d.code.add(t`bool areWorldMarkersHidden(vec4 pos, vec4 other) {
|
|
16
11
|
vec3 midPoint = mix(pos.xyz, other.xyz, 0.5);
|
|
17
12
|
float distanceToCamera = length(midPoint);
|
|
18
13
|
float screenToWorldRatio = perRenderPixelRatio * distanceToCamera * 0.5;
|
|
19
14
|
float worldMarkerSize = getScreenMarkerSize() * screenToWorldRatio;
|
|
20
15
|
float segmentLen = length(pos.xyz - other.xyz);
|
|
21
16
|
return worldMarkerSize > maxSegmentLengthFraction * segmentLen;
|
|
22
|
-
}
|
|
17
|
+
}
|
|
18
|
+
float getWorldMarkerSize(vec4 pos) {
|
|
19
|
+
float distanceToCamera = length(pos.xyz);
|
|
20
|
+
float screenToWorldRatio = perRenderPixelRatio * distanceToCamera * 0.5;
|
|
21
|
+
return getScreenMarkerSize() * screenToWorldRatio;
|
|
22
|
+
}`))}export{n as MarkerSizing};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{w as r}from"../../../../../../chunks/mat4.js";import{c as
|
|
5
|
+
import{w as r}from"../../../../../../chunks/mat4.js";import{c as a}from"../../../../../../chunks/mat4f64.js";import{s as e}from"../../../../../../chunks/vec3.js";import{Z as i,c as o}from"../../../../../../chunks/vec3f64.js";import{OverlayStretch as s}from"../../../../terrain/Overlay.js";import{Float3DrawUniform as n}from"../../shaderModules/Float3DrawUniform.js";import{Float3PassUniform as m}from"../../shaderModules/Float3PassUniform.js";import{FloatPassUniform as t}from"../../shaderModules/FloatPassUniform.js";import{Matrix4DrawUniform as c}from"../../shaderModules/Matrix4DrawUniform.js";import{Matrix4PassUniform as d}from"../../shaderModules/Matrix4PassUniform.js";function f(r,a){a.instancedDoublePrecision?r.constants.add("cameraPosition","vec3",i):r.uniforms.add(new n("cameraPosition",((r,a)=>e(w,a.camera.viewInverseTransposeMatrix[3]-r.origin[0],a.camera.viewInverseTransposeMatrix[7]-r.origin[1],a.camera.viewInverseTransposeMatrix[11]-r.origin[2]))))}function p(a,i){if(!i.instancedDoublePrecision)return void a.uniforms.add(new d("proj",((r,a)=>a.camera.projectionMatrix)),new c("view",((a,e)=>r(v,e.camera.viewMatrix,a.origin))),new n("localOrigin",(r=>r.origin)));const o=r=>e(w,r.camera.viewInverseTransposeMatrix[3],r.camera.viewInverseTransposeMatrix[7],r.camera.viewInverseTransposeMatrix[11]);a.uniforms.add(new d("proj",((r,a)=>a.camera.projectionMatrix)),new d("view",((a,e)=>r(v,e.camera.viewMatrix,o(e)))),new m("localOrigin",((r,a)=>o(a))))}const v=a(),w=o();function u(r){r.uniforms.add(new d("viewNormal",((r,a)=>a.camera.viewInverseTransposeMatrix)))}function l(r,a){r.uniforms.add(new t("pixelRatio",((r,e)=>e.camera.pixelRatio/(a.draped?s:1))))}export{f as addCameraPosition,l as addPixelRatio,p as addProjViewLocalOrigin,u as addViewNormal};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../core/has.js";import{RenderTargetHelper as e}from"./RenderTargetHelper.js";import{TransparencyPassType as t}from"./TransparencyPassType.js";import{AlphaMode as r}from"../shaders/CompositingTechniqueConfiguration.js";import{
|
|
5
|
+
import"../../../../core/has.js";import{RenderTargetHelper as e}from"./RenderTargetHelper.js";import{TransparencyPassType as t}from"./TransparencyPassType.js";import{AlphaMode as r}from"../shaders/CompositingTechniqueConfiguration.js";import{PixelType as i,SizedPixelFormat as o,TextureSamplingMode as s,ClearBufferBit as a}from"../../../webgl/enums.js";import{ensureAttachmentMaxSize as h}from"../../../webgl/FramebufferObject.js";class n{constructor(t,r){this._rctx=t,this._compositingHelper=r,this._mainColorTarget=0,this.width=4,this.height=4,this._background={type:"color",color:[0,0,0,1]},this._renderTargetHelper=new e(t);const a=this._renderTargetHelper;this._mainColorTargets=[a.registerColorTarget({name:"mainColorTarget0"}),a.registerColorTarget({name:"mainColorTarget1"})],this.frontFaceTarget=a.registerColorTarget({name:"frontFaceTarget"}),this.colorFloatTarget=a.registerColorTarget({name:"colorFloatTarget",dataType:i.HALF_FLOAT,internalFormat:o.RGBA16F,samplingMode:s.NEAREST}),this.alphaFloatTarget=a.registerColorTarget({name:"alphaFloatTarget",dataType:i.HALF_FLOAT,internalFormat:o.R16F,samplingMode:s.NEAREST}),this.mainDepth=a.registerDepthTarget({name:"mainDepth"}),this.linearDepth=a.registerColorTarget({name:"linearDepth",samplingMode:s.NEAREST}),this.terrainLinearDepth=a.registerColorTarget({name:"terrainLinearDepth"}),this.geometryLinearDepth=a.registerColorTarget({name:"geometryLinearDepth"}),this.normal=a.registerColorTarget({name:"normal"}),this.highlight=a.registerColorTarget({name:"highlight",internalFormat:o.RGBA4,dataType:i.UNSIGNED_SHORT_4_4_4_4}),this.hudVisibility=a.registerColorTarget({name:"hudVisibility",internalFormat:o.RGBA4,dataType:i.UNSIGNED_SHORT_4_4_4_4}),this.tmpColor=a.registerColorTarget({name:"tmpColor"}),this.tmpDepth=a.registerDepthTarget({name:"tmpDepth"}),this.hudColor=a.registerColorTarget({name:"hudColor"})}dispose(){this._renderTargetHelper.dispose()}set background(e){this._background=e}get background(){return this._background}get currentColorTarget(){return this._mainColorTargets[this._mainColorTarget]}get previousColorTarget(){return this._mainColorTargets[1-this._mainColorTarget]}get framebuffer(){return this.getFramebuffer(this.currentColorTarget,this.mainDepth)}getFramebuffer(e,t){return this._renderTargetHelper.getFramebuffer(this.width,this.height,e,t)}get colorTexture(){return this._renderTargetHelper.getAllocatedColorTexture(this.currentColorTarget)}get depthTexture(){return this._renderTargetHelper.getAllocatedDepthTexture(this.mainDepth)}get linearDepthTexture(){return this._renderTargetHelper.getAllocatedColorTexture(this.linearDepth)}get terrainLinearDepthTexture(){return this._renderTargetHelper.getAllocatedColorTexture(this.terrainLinearDepth)}get geometryLinearDepthTexture(){return this._renderTargetHelper.getAllocatedColorTexture(this.geometryLinearDepth)}get lastFrameColorTexture(){return this._renderTargetHelper.getAllocatedColorTexture(this.previousColorTarget)}get normalTexture(){return this._renderTargetHelper.getAllocatedColorTexture(this.normal)}get highlightTexture(){return this._renderTargetHelper.getAllocatedColorTexture(this.highlight)}get hudVisibilityTexture(){return this._getColorTexture(this.hudVisibility)}get tmpColorTexture(){return this._getColorTexture(this.tmpColor)}get hudColorTexture(){return this._getColorTexture(this.hudColor)}get mainColorTexture(){return this._getColorTexture(this.currentColorTarget)}setupRenderTarget(e){e?this._mainColorTarget=this._mainColorTarget?0:1:(this._mainColorTarget=0,this.disposeTarget(this._mainColorTargets[1]))}initializeFrame(e){const t=this._rctx;this.width=e.fullWidth,this.height=e.fullHeight,h(this,t.parameters.maxTextureSize),this.bindTarget(this.currentColorTarget,this.mainDepth),t.setClearStencil(0);const r=this._background.color;t.setClearColor(r[0]*r[3],r[1]*r[3],r[2]*r[3],r[3]),t.clearSafe(a.COLOR_BUFFER_BIT|a.DEPTH_BUFFER_BIT|a.STENCIL_BUFFER_BIT)}composite(e){null!=this.colorTexture&&this._compositingHelper.composite(e,this.colorTexture,r.None)}renderTmpAndCompositeToMain(e,t,r,i=!1){this.renderToTargets(e,this.tmpColor,i?this.tmpDepth:this.mainDepth,l),this._compositingHelper.composite(t,this._getColorTexture(this.tmpColor),r)}compositeAtmosphereToMain(e,t,r,i){this.bindTarget(this.currentColorTarget),this._compositingHelper.compositeAtmosphere(e,this._renderTargetHelper.getColorTexture(this.tmpColor,this.width,this.height),r,i,t),this.bindTarget(this.currentColorTarget,this.mainDepth)}renderHUDVisibility(e,t=!1){this.renderToTargets(e,this.hudVisibility,t?this.tmpDepth:this.mainDepth,g)}compositeTransparentTerrainOntoHUDVisibility(e){this.renderToTargets((()=>this._compositingHelper.compositeHUD(e,this._getColorTexture(this.tmpColor))),this.hudVisibility,this.tmpDepth)}renderOITPass(e,r,i){let o,s;switch(r){case t.Color:o=this.colorFloatTarget,s=[0,0,0,0];break;case t.Alpha:o=this.alphaFloatTarget,s=[1,1,1,1];break;case t.FrontFace:o=this.frontFaceTarget,s=[0,0,0,0];break;case t.NONE:case t.COUNT:return}i?this.renderToTargets(e,o,this.tmpDepth,s,!0,!0):this.renderToTargets(e,o,this.mainDepth,s,!1)}compositeTransparentTerrainOntoMain(e){this.bindFramebuffer(),this._compositingHelper.composite(e,this._getColorTexture(this.tmpColor),r.PremultipliedAlpha)}compositeOccludedOntoMain(e,t){this.bindFramebuffer(),this._compositingHelper.composite(e,this._getColorTexture(this.tmpColor),r.PremultipliedAlpha,t)}compositeTransparentOntoOpaque(e,t){t?(this.bindTarget(this.hudColor,this.tmpDepth),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clearSafe(a.COLOR_BUFFER_BIT)):this.bindFramebuffer(),this._compositingHelper.compositeOIT(e,this._getColorTexture(this.colorFloatTarget),this._getColorTexture(this.alphaFloatTarget),this._getColorTexture(this.frontFaceTarget))}bindFramebuffer(){this._rctx.bindFramebuffer(this.framebuffer)}renderDepthDetached(e){this.bindTarget(this.currentColorTarget),e(),this.bindTarget(this.currentColorTarget,this.mainDepth)}disposeTarget(e){this._renderTargetHelper.disposeTargetResource(e)}renderToFBO(e,t,r=!1,i=!1){const o=this._rctx;let s=0;if(t){const e=1e-13,r=Math.max(e,t[3]);o.setClearColor(t[0],t[1],t[2],r),s|=a.COLOR_BUFFER_BIT}r&&(s|=a.DEPTH_BUFFER_BIT),!1===i?i=0:(!0===i&&(i=255),s|=a.STENCIL_BUFFER_BIT),s&&o.clearSafe(s,i),e(),o.gl.flush(),this.bindTarget(this.currentColorTarget,this.mainDepth)}renderToTargets(e,t,r,i,o=!1,s=!1){const a=this.bindTarget(t,r);return this.renderToFBO(e,i,o,s),a}bindTarget(e,t){const r=this._renderTargetHelper.getFramebuffer(this.width,this.height,e,t);return this._rctx.bindFramebuffer(r),r}_getColorTexture(e){return this._renderTargetHelper.getColorTexture(e,this.width,this.height)}get gpuMemoryUsage(){let e=0;return this._renderTargetHelper&&(e+=this._renderTargetHelper.gpuMemoryUsage),e}}const l=[0,0,0,0],g=[0,1,0,1];export{n as OffscreenRendering};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import has from"../../../../core/has.js";import{NestedMap as i}from"../../../../core/NestedMap.js";import{RenderState as e}from"../../../support/RenderState.js";var t;function a(a=!has("disable-feature:high-quality-idle")){const s=new i;return a
|
|
5
|
+
import has from"../../../../core/has.js";import{NestedMap as i}from"../../../../core/NestedMap.js";import{RenderState as e}from"../../../support/RenderState.js";var t;function a(a=!has("disable-feature:high-quality-idle")){const s=new i;return a?(s.set(e.IDLE,t.Antialiasing,!0),s.set(e.IDLE,t.HighQualityTransparency,!0),s.set(e.IDLE,t.HighQualityAtmosphere,!0),s.set(e.IDLE,t.SSAO,!0),s.set(e.IDLE,t.WaterReflection,!0),s.set(e.IDLE,t.PhysicalPixelRendering,!has("esri-mobile"))):(s.set(e.ANIMATING,t.HighQualityShadows,!0),s.set(e.INTERACTING,t.HighQualityShadows,!0)),s.set(e.IDLE,t.HighQualityShadows,!0),s.set(e.IDLE,t.HighQualityVoxel,!0),s}!function(i){i[i.Antialiasing=0]="Antialiasing",i[i.HighQualityTransparency=1]="HighQualityTransparency",i[i.HighQualityVoxel=2]="HighQualityVoxel",i[i.HighQualityAtmosphere=3]="HighQualityAtmosphere",i[i.SSAO=4]="SSAO",i[i.WaterReflection=5]="WaterReflection",i[i.HighQualityShadows=6]="HighQualityShadows",i[i.PhysicalPixelRendering=7]="PhysicalPixelRendering"}(t||(t={}));export{t as RenderFeature,a as setupFeatureDefaults};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{nullifyNonNullableForDispose as e}from"../../../../core/maybe.js";import{generateUID as t}from"../../../../core/uid.js";import{PixelType as r,PixelFormat as s,TextureSamplingMode as i,TextureWrapMode as o
|
|
5
|
+
import{nullifyNonNullableForDispose as e}from"../../../../core/maybe.js";import{generateUID as t}from"../../../../core/uid.js";import{PixelType as r,PixelFormat as s,TextureSamplingMode as i,TextureWrapMode as o}from"../../../webgl/enums.js";import{FramebufferObject as h}from"../../../webgl/FramebufferObject.js";import{Texture as a}from"../../../webgl/Texture.js";import{TextureDescriptor as d}from"../../../webgl/TextureDescriptor.js";const c={dataType:r.UNSIGNED_BYTE,internalFormat:s.RGBA},p={};class u{constructor(e){this._rctx=e,this._activeTargets=new Set,this._colorTextures=new Map,this._depthTextures=new Map,this._fbos=new Map}dispose(){this._depthTextures.forEach((e=>e.dispose())),this._depthTextures.clear(),this._colorTextures.forEach((e=>e.dispose())),this._colorTextures.clear(),this._fbos.forEach((e=>e.dispose())),this._fbos.clear(),this._activeTargets.clear()}disposeTargetResource(e){const t=e.id;this._activeTargets.has(t)&&(this._activeTargets.delete(t),this._disposeWithFramebuffers(this._depthTextures,t),this._disposeWithFramebuffers(this._colorTextures,t))}_disposeWithFramebuffers(e,t){const r=e.get(t);r&&(this._fbos.forEach(((e,t)=>{e.colorTexture!==r&&e.depthStencilAttachment!==r||(e.detachColorTexture(),e.detachDepthStencilTexture(),e.dispose(),this._fbos.delete(t))})),r.dispose(),e.delete(t))}_getDepthTexture(e,t,h){let c=this._depthTextures.get(e.id);if(!c||c.descriptor.width===t&&c.descriptor.height===h||(c.dispose(),c=null),!c){const p=new d(t,h);p.pixelFormat=s.DEPTH_STENCIL,p.dataType=r.UNSIGNED_INT_24_8,p.samplingMode=i.NEAREST,p.wrapMode=o.CLAMP_TO_EDGE,c=new a(this._rctx,p),this._depthTextures.set(e.id,c),this._activeTargets.add(e.id)}return c}getAllocatedDepthTexture(e){return this._depthTextures.get(e.id)}getColorTexture(t,r,s){let h=this._colorTextures.get(t.id);if(h&&(h.descriptor.width===r&&h.descriptor.height===s||(h.dispose(),h=e())),!h){const e=new d(r,s);e.internalFormat=t.internalFormat,e.dataType=t.dataType,e.samplingMode=null!=t.samplingMode?t.samplingMode:i.LINEAR,e.wrapMode=o.CLAMP_TO_EDGE,h=new a(this._rctx,e),this._colorTextures.set(t.id,h),this._activeTargets.add(t.id)}return h}getAllocatedColorTexture(e){return this._colorTextures.get(e.id)}registerDepthTarget(e={}){return{id:t(),...p,...e}}registerColorTarget(e={}){return{id:t(),...c,...e}}getFramebuffer(e,t,r,s){const i=this._getKey(r,s);let o=this._fbos.get(i);const a=this.getColorTexture(r,e,t),d=s?this._getDepthTexture(s,e,t):void 0;if(!o)return o=new h(this._rctx,a,d),this._fbos.set(i,o),o;return(o.width!==e||o.height!==t||o.colorTexture!==a||o.depthStencilAttachment!==d)&&(o.detachColorTexture(),o.detachDepthStencilTexture(),o.resize(e,t),o.attachColorTexture(a),o.attachDepthStencil(d)),o}_getKey(e,t){return`${e.id}_${t?t.id:"X"}_${e.name}${t?"_"+t.name:""}`}get gpuMemoryUsage(){let e=0;const t=new Set,r=r=>{t.has(r)||(t.add(r),e+=r.gpuMemoryUsage)};return this._colorTextures.forEach(r),this._depthTextures.forEach(r),e}}export{u as RenderTargetHelper};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import r from"../../../../core/Accessor.js";import{update as t}from"../../../../core/arrayUtils.js";import s from"../../../../core/Handles.js";import has from"../../../../core/has.js";import{removeMaybe as i,disposeMaybe as a,destroyMaybe as n,applySome as h}from"../../../../core/maybe.js";import o from"../../../../core/PooledArray.js";import{watch as d,syncAndInitial as _,initial as l,sync as p}from"../../../../core/reactiveUtils.js";import{property as c}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as m}from"../../../../core/accessorSupport/decorators/subclass.js";import{h as u,a as f,m as T}from"../../../../chunks/mat4.js";import{I as g,c as A}from"../../../../chunks/mat4f64.js";import{a as E}from"../../../../chunks/boundedPlane.js";import R from"../../support/debugFlags.js";import{TransparencyMode as S}from"../../terrain/TerrainRenderer.js";import{RenderPassManager as P}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as b}from"../core/shaderLibrary/ShaderOutput.js";import{HUDTransparencyRenderStyle as y}from"../core/shaderLibrary/hud/HUDUniforms.js";import{AnimationTimeStep as I}from"./AnimationTimeStep.js";import{Decorations as O,RenderRequestType as C,StencilBits as D}from"./basicInterfaces.js";import{BoundingInfo as w}from"./BoundingInfo.js";import{ZERO as x,union as N}from"./depthRange.js";import{depthRangeFromScene as L}from"./depthRangeUtils.js";import{createEmptyDepthTexture as H}from"./glUtil3D.js";import{Highlight as M}from"./Highlight.js";import{RenderOccludedFlag as v}from"./Material.js";import{OffscreenRendering as U}from"./OffscreenRendering.js";import{RenderContext as F}from"./RenderContext.js";import{splitRenderGeometryChangeSetByMaterial as j}from"./rendererUtils.js";import{RenderFeature as G,setupFeatureDefaults as q}from"./RenderFeature.js";import{RenderPluginManager as V}from"./RenderPluginManager.js";import{RenderSlot as B}from"./RenderSlot.js";import{ShadowAccumulator as Q}from"./ShadowAccumulator.js";import{ShadowHighlight as k}from"./ShadowHighlight.js";import{ShadowMap as W,SnapshotSlot as Y}from"./ShadowMap.js";import X from"./SliceHelper.js";import{SmaaRenderPass as z}from"./SmaaRenderPass.js";import{SSAOHelper as J}from"./SSAOHelper.js";import{TransparencyPassType as K}from"./TransparencyPassType.js";import{EdgeView as Z}from"./edgeRendering/EdgeView.js";import{Transparency as $}from"./edgeRendering/interfaces.js";import{MergedRenderer as ee}from"../materials/renderers/MergedRenderer.js";import{AlphaMode as re}from"../shaders/CompositingTechniqueConfiguration.js";import{RendererPerformanceInfo as te,PerformanceCategory as se}from"../statistics/RendererPerformanceInfo.js";import{RenderState as ie}from"../../../support/RenderState.js";import{ClearBufferBit as ae,PixelFormat as ne,PixelType as he}from"../../../webgl/enums.js";let oe=class extends r{get _bindParameters(){return this._renderContext.bindParameters}isFeatureEnabled(e,r=this._state){return this._renderStateFeatures.get(r,e)??!1}setFeatureEnabled(e,r,t){this._renderStateFeatures.set(r,e,t),this.notifyChange("_renderStateFeatures"),this._requestRender()}get _antialiasing(){return this._antialiasingEnabled||this.isFeatureEnabled(G.Antialiasing)}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(G.HighQualityTransparency)}get hasReflections(){return this.hasWater&&(this._ssrEnabled||this.isFeatureEnabled(G.WaterReflection))}get hasWater(){return this._hasWater||this._hasOverlayWater}constructor(e,r,t,i,a,n,h,p){super({}),this._stage=e,this._materialRepository=r,this._techniqueRepository=i,this._rctx=a,this._compositingHelper=n,this._magnifierHelper=h,this._requestRender=p,this._materialRenderers=new o,this._needsTransparentPass=!1,this._hasHUDElements=!1,this._hasHighlights=!1,this._hasWater=!1,this._hasOverlayWater=!1,this._renderOverlay=e=>{},this._isRendering=!1,this._fallbackDepthStencilTexture=null,this._sliceHelper=new X,this._state=ie.IDLE,this._renderStateFeatures=q(),this._antialiasingEnabled=!0,this._highQualityTransparencyEnabled=!0,this._terrainRenderingEnabled=!0,this._terrainTransparency=S.Opaque,this._ssrEnabled=!1,this._ssaoEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new I,this._handles=new s,this._renderHiddenTransparentEdges=()=>{},this._oitUsed=!1,this._smaaPass=new z(this._rctx,i),p(),this._offscreen=new U(this._rctx,this._compositingHelper),this.performanceInfo=new te(this._rctx),this._shadowMap=new W(this._rctx,e.viewingMode),this._ssaoHelper=new J(e.view,i,this._rctx,p),this._highlight=new M(i,this._rctx),this._shadowHighlight=new k(this._rctx,e.viewingMode),this._shadowAccumulator=new Q(this._rctx,i,e,(e=>{const r=this.shadowsEnabled;this._shadowMap.enabled=!0,this._prepare(e.camera,e.contentCamera),this._renderPlugins.prepareRender(),this._shadowMap.enabled=r}),((e,r,t)=>{e.shadowMap.start(e.camera,r,t,!0),this._renderShadowCascades(b.Shadow,e.shadowMap),e.camera.setGLViewport(this._rctx),this._prepare(e.camera,e.contentCamera)}),p),this._renderContext=new F(this._rctx,this._offscreen,this._shadowMap,this._ssaoHelper,this._sliceHelper),this._renderPlugins=new V({renderContext:this._renderContext,techniqueRepository:i,textureRepository:t,materialRepository:this._materialRepository,requestRender:p,controller:e}),this.renderPassManager=new P(this._rctx,this._techniqueRepository),this._renderPlugins.add(this.renderPassManager.slots(),this.renderPassManager),this._handles.add([d((()=>this._stage.view.state.camera),(()=>p()),_),d((()=>R.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges($.TRANSPARENT):()=>{},p()}),l),d((()=>this._ssaoEnabled||this.isFeatureEnabled(G.SSAO)),(e=>this._ssaoHelper.enabled=e),_)])}normalizeCtorArgs(){return{}}destroy(){this._handles.destroy(),this._smaaPass.dispose(),this._gpuTimerHandle=i(this._gpuTimerHandle),this._materialRenderers.forAll((e=>e.dispose())),this._materialRenderers.clear(),this._offscreen.dispose(),this._fallbackDepthStencilTexture=a(this._fallbackDepthStencilTexture),this._shadowMap.dispose(),this._ssaoHelper.destroy(),this._highlight.dispose(),this._shadowHighlight.dispose(),this._shadowAccumulator.dispose(),this._edgeView=n(this._edgeView),this.renderPassManager.destroy(),w.prune()}disposeOffscreenBuffers(){this._offscreen.dispose(),this._shadowMap.disposeOffscreenBuffers(),this._smaaPass.disable(),this._ssaoHelper.disposeOffscreenBuffers()}get updating(){return this._antialiasing&&this._smaaPass.updating||null!=this._edgeView&&this._edgeView.updating||this._shadowAccumulator.running||this._renderPlugins.updating||!this.isCameraFinal}ensureEdgeView(){if(null==this._edgeView){const e=this._stage.view.resourceController;this._edgeView=new Z({rctx:this._rctx,renderSR:this._stage.view.renderSpatialReference,viewingMode:this._stage.viewingMode,techniqueRepository:this._techniqueRepository,setNeedsRender:()=>this._requestRender(),schedule:ue(e)}),this._handles.add(d((()=>h(this._edgeView,(e=>e.updating))),(()=>this._requestRender()),p)),this._requestRender()}return this._edgeView}get edgeView(){return this._edgeView}get isCameraFinal(){return u(this._bindParameters.ssr.reprojectionMatrix,g)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this.notifyChange("isCameraFinal")}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:r,_bindParameters:t}=this;if(void 0!==e.qualitySettings?.reflections&&this._ssrEnabled!==e.qualitySettings.reflections&&(this._ssrEnabled=e.qualitySettings.reflections,this._requestRender()),void 0!==e.qualitySettings?.ambientOcclusion&&this._ssaoEnabled!==e.qualitySettings.ambientOcclusion&&(this._ssaoEnabled=e.qualitySettings.ambientOcclusion,this._requestRender()),void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&r.maxCascades!==e.shadowMapMaxCascades&&(r.maxCascades=e.shadowMapMaxCascades,this._requestRender()),null!=e.environment){null!=e.environment.weather&&(this._bindParameters.weather=e.environment.weather,this._bindParameters.weatherVisible=!!e.weatherVisible);const r="virtual"!==e.environment.lighting.type;t.enableFillLights!==r&&(t.enableFillLights=r,this._requestRender())}e.background&&this._offscreen.background!==e.background&&(this._offscreen.background=e.background,this._requestRender()),void 0!==e.antialiasingEnabled&&this._antialiasingEnabled!==e.antialiasingEnabled&&(this._antialiasingEnabled=e.antialiasingEnabled,this._requestRender()),void 0!==e.highQualityTransparency&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),void 0!==e.defaultHighlightOptions&&(this._highlight.setDefaultOptions(e.defaultHighlightOptions),this._shadowHighlight.setDefaultOptions(e.defaultHighlightOptions),this._requestRender()),void 0!==e.overlays&&this._bindParameters.overlays!==e.overlays&&(this._bindParameters.overlays=e.overlays,this._requestRender()),void 0!==e.hasOverlayWater&&this._hasOverlayWater!==e.hasOverlayWater&&(this._hasOverlayWater=e.hasOverlayWater,this._requestRender()),void 0!==e.renderOverlay&&this._renderOverlay!==e.renderOverlay&&(this._renderOverlay=e.renderOverlay,this._requestRender()),void 0!==e.slicePlane&&this._sliceHelper.plane!==e.slicePlane&&(this._sliceHelper.plane=e.slicePlane,this._requestRender()),void 0!==e.terrainRenderingEnabled&&this._terrainRenderingEnabled!==e.terrainRenderingEnabled&&(this._terrainRenderingEnabled=e.terrainRenderingEnabled,this._requestRender()),void 0!==e.terrainTransparency&&this._terrainTransparency!==e.terrainTransparency&&(this._terrainTransparency=e.terrainTransparency,this._requestRender()),void 0!==e.shadowCastOptions&&this._shadowAccumulator.setOptions(e.shadowCastOptions)}get hasSlicePlane(){return!!this._sliceHelper.plane}get renderPlugins(){return this._renderPlugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}modify(e,r){this._isRendering&&console.warn("Renderer.modify called while rendering");const{adds:t,removes:s,updates:i}=e;if(0===t.length&&0===s.length&&0===i.length)return;const a=j(e);let n=!1;a.forEach(((t,s)=>{if(r.done)return;let i=this._materialRenderers.find((e=>e.material===s));null==i&&t.adds.length>0&&(i=new ee(this._rctx,this._materialRepository,s),this._materialRenderers.push(i)),i&&(i.modify(t),i.isEmpty&&(n=!0)),t.removes.forEach((r=>e.removes.removeUnordered(r))),t.adds.forEach((r=>e.adds.removeUnordered(r))),t.updates.forEach((r=>e.updates.removeUnordered(r))),r.madeProgress()})),n&&this._materialRenderers.filterInPlace((e=>!e.isEmpty||(e.dispose(),!1))),this._hasHighlights=this._materialRenderers.some((e=>e.hasHighlights)),this._bindParameters.hasOccludees=this._materialRenderers.some((e=>e.hasOccludees)),this._hasWater=this._materialRenderers.some((e=>e.hasWater)),this._hasHUDElements=this._materialRenderers.some((e=>e.requiresSlot(B.LINE_CALLOUTS_HUD_DEPTH,b.Color)||e.requiresSlot(B.HUD_MATERIAL,b.Color)||e.requiresSlot(B.LABEL_MATERIAL,b.Color))),this._requestRender()}updateAnimation(e){const r=this._hasAnimations;return this._hasAnimations=!1,this._materialRenderers.forAll((r=>this._hasAnimations=r.updateAnimation(e)||this._hasAnimations)),this._hasAnimations=this._renderPlugins.updateAnimation(e)||this._hasAnimations,this._hasAnimations!==r&&(this._gpuTimerHandle=r?i(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}render(e,r,t,s,i){this._isRendering=!0,this._oitUsed=!1,this.performanceInfo.startFrame();const{camera:a,contentCamera:n,mode:h,alignPixelEnabled:o}=t;this._state=h,this._renderOverlay(i),this.performanceInfo.advance(se.OVERLAY),this._renderContext.time=i,this._bindParameters.transparencyPassType=K.NONE,this._bindParameters.alignPixelEnabled=o;const d=this._offscreen;d.setupRenderTarget(this.hasReflections);const _=E(this._sliceHelper.plane);s===O.OFF&&(this._sliceHelper.plane=null),this._rctx.bindFramebuffer(e),a.setGLViewport(this._rctx),this._prepare(a,n),this._renderPlugins.prepareRender(),this.performanceInfo.advance(se.PREPARE);const l=this._computeDepthRange(a);this._renderShadowMap(e,a,this._bindParameters.lighting.mainLight.direction,l),this.performanceInfo.advance(se.SHADOW_MAP),d.initializeFrame(a),this._ensureBindParameters(a,n);const p=this._terrainRenderingEnabled&&(this._terrainTransparency===S.Semitransparent||this._terrainTransparency===S.TransparentWithDraped),c=this._highQualityTransparency&&p,m=this._needsTransparentPass||this._renderPlugins.needsTransparentPass;this._prepareShaders(c,m),this._renderLinearDepth(),this.performanceInfo.advance(se.LINEAR_DEPTH),this._accumulateShadows(l,a,n),this.performanceInfo.advance(se.ACCUMULATED_SHADOWS),this._renderNormal(),this.performanceInfo.advance(se.NORMALS),this._ensureBindParametersSSR(i),this._renderSSAO(i),this.performanceInfo.advance(se.SSAO),this._renderContext.output=b.Color,d.bindFramebuffer(),this._renderOpaqueGeometry(),this.performanceInfo.advance(se.OPAQUE),this._renderTerrainLinearDepth(c),this._setMultipassTerrain(c),this._renderEdges($.OPAQUE),this.performanceInfo.advance(se.OPAQUE_EDGES),this._offscreen.bindTarget(this._offscreen.currentColorTarget,this._offscreen.mainDepth),this._renderSlot(B.VOXEL),this.performanceInfo.advance(se.VOXEL),this._renderHiddenTransparentEdges(),m&&(this._oitEnabled?this._renderOITPass(de.Geometry):this._renderTransparentGeometry()),this.performanceInfo.advance(se.TRANSPARENT),this._renderGeometryLinearDepth(c);const u=this._renderHUDVisibility(c);c||this._renderInternalSlot(B.LINE_CALLOUTS),this.performanceInfo.advance(se.HUD_VISIBILITY),this._renderObjectAndLayerIdColor(r),this.performanceInfo.advance(se.OBJECT_AND_LAYER_ID_COLOR),this._renderEdges($.TRANSPARENT,c),this.performanceInfo.advance(se.TRANSPARENT_EDGES),this._renderTransparentTerrain(),p&&u&&(c?this._renderLineCallouts(y.Occluded):d.compositeTransparentTerrainOntoHUDVisibility(this._bindParameters),this._renderHUD(y.Occluded,d.framebuffer),this.performanceInfo.advance(se.HUD_OCCLUDED)),this.performanceInfo.advance(se.TRANSPARENT_TERRAIN),this._setTerrainCulling(!1),p&&(d.compositeTransparentTerrainOntoMain(this._bindParameters),c&&(this._renderEdges($.OPAQUE),this.performanceInfo.advance(se.OPAQUE_EDGES),m&&(this._oitEnabled?this._renderOITPass(de.Geometry):this._renderTransparentGeometry()),this.performanceInfo.advance(se.TRANSPARENT),this._renderEdges($.TRANSPARENT),this.performanceInfo.advance(se.TRANSPARENT_EDGES))),c&&this._renderLineCallouts(y.NotOccluded),this._setMultipassEnabled(!1),this._shadowAccumulator.render(this._bindParameters),d.renderToTargets((()=>{this._renderInternalSlot(B.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),this._renderSlot(B.POSTPROCESSING_ENVIRONMENT_TRANSPARENT),this._renderSlot(B.LASERLINES)}),d.currentColorTarget,d.mainDepth),this.performanceInfo.advance(se.ENVIRONMENT),this._renderPlugins.needsLaserlineWithContrastControl&&d.renderTmpAndCompositeToMain((()=>this._renderSlot(B.LASERLINES_CONTRAST_CONTROL)),this._bindParameters,re.PremultipliedAlpha),this.performanceInfo.advance(se.LASER_LINE),this._renderOccluded(),this.performanceInfo.advance(se.OCCLUDED);const f=s===O.ON&&this._magnifierHelper.enabled,T=f&&null==e?this._offscreen.getFramebuffer(this._offscreen.tmpColor,this._offscreen.tmpDepth):e;this._rctx.bindFramebuffer(T);const g=this._offscreen.colorTexture;this._renderAntiAliasing(g)||null==g||this._compositingHelper.composite(this._bindParameters,g,re.None),this.performanceInfo.advance(se.ANTIALIASING),this._renderHUD(y.NotOccluded,T),this.performanceInfo.advance(se.HUD),this._renderHighlights(T,this._bindParameters),this.performanceInfo.advance(se.HIGHLIGHTS),f&&this._magnifierHelper.render(this._rctx,this._bindParameters),T!==e&&(this._rctx.bindFramebuffer(e),this._compositingHelper.composite(this._bindParameters,this._offscreen.tmpColorTexture,re.None)),this._disposeOITBuffers(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this._sliceHelper.plane=_,this._isRendering=!1,this.onPostRender&&this.onPostRender(),this.performanceInfo.finishFrame()}_prepareShaders(e,r){this._renderContext.output=b.Color,this._prepareOpaqueGeometrySlots(),this._setMultipassTerrain(e),this._prepareSlots(B.TRANSPARENT_TERRAIN),this._setMultipassTerrain(!1),e||this._prepareInternalSlots(this._materialRenderers,B.LINE_CALLOUTS),r&&this._prepareTransparencySlots(),this._prepareInternalSlots(this._materialRenderers,B.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),this._prepareSlots(B.POSTPROCESSING_ENVIRONMENT_TRANSPARENT,B.LASERLINES),this._rctx.gl.flush()}_renderObjectAndLayerIdColor(e){if(null!=e&&has("enable-feature:objectAndLayerId-rendering")){const r=this._renderContext.output;this._rctx.bindFramebuffer(e),this._offscreen.renderToFBO((()=>this._renderGeometryAndTransparentTerrainPass(b.ObjectAndLayerIdColor)),[0,0,0,0],!0,!0),this._rctx.bindFramebuffer(e),this._offscreen.renderToFBO((()=>{this._bindParameters.renderTransparentlyOccludedHUD=y.NotOccluded,this._renderInternalSlot(B.HUD_MATERIAL)}),void 0,!0,!0),this._renderContext.output=r}}finish(e){this._hasAnimations||this._animationTimestep.clear();const r=this.performanceInfo.gpuSamplingEnabled,t=e===C.BACKGROUND;if(t||r){const e=t?this.performanceInfo.elapsedTime:0,s=r?this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.getError(),i=Math.max(e,s);this._animationTimestep.frame(i,t)}}readDepthPixels(e,r,t){const s=this._offscreen.bindTarget(this._offscreen.linearDepth,this._offscreen.tmpDepth);if(!this._needsLinearDepth){this._ensureBindParameters(e,e),this._bindParameters.camera.setGLViewport(this._rctx),this._rctx.setClearColor(0,0,0,0);const r=ae.COLOR_BUFFER_BIT|ae.DEPTH_BUFFER_BIT|ae.STENCIL_BUFFER_BIT;this._rctx.clearSafe(r),this._renderGeometryAndTransparentTerrainPass(b.Depth)}s.readPixels(r[0],r[1],r[2],r[3],ne.RGBA,he.UNSIGNED_BYTE,t)}readHUDVisibility(e,r,t,s,i){this._offscreen.bindTarget(this._offscreen.hudVisibility).readPixels(e,r,t,s,ne.RGBA,he.UNSIGNED_BYTE,i)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_setMultipassTerrain(e){this._setMultipassEnabled(e),this._setTerrainCulling(e)}_setMultipassEnabled(e){this._bindParameters.multipassTerrain.enabled=this._bindParameters.multipassGeometry.enabled=e}_setTerrainCulling(e){this._bindParameters.multipassTerrain.cullAboveGround=e}_prepareSlots(...e){this._renderPlugins.prepareSlots(e)}_renderSlot(e){this._bindParameters.slot=e,this._renderPlugins.render()}_renderEdges(e,r=!1){const t=this._edgeView;null!=t&&t.shouldRender()&&this._offscreen.renderTmpAndCompositeToMain((()=>t.render(this._bindParameters,e)),this._bindParameters,re.Alpha,r)}_renderShadowMap(e,r,t,s){const i=this._shadowMap;i.enabled&&(i.start(r,t,s,this._stage.view.qualitySettings.highQualityShadows||this.isFeatureEnabled(G.HighQualityShadows)),this._shadowHighlight.updateParameters(r,t),this._needsShadowHighlight?(this._renderShadowCascades(b.ShadowHighlight,this._shadowMap,(e=>i.takeCascadeSnapshotTo(e,Y.Highlight))),i.clear(),this._renderShadowCascades(b.ShadowExcludeHighlight,this._shadowMap,(e=>{i.takeCascadeSnapshotTo(e,Y.Default),this._renderGeometryAndTransparentTerrainPass(b.ShadowHighlight)}))):this._renderShadowCascades(b.Shadow),i.finish(e),r.setGLViewport(this._rctx))}_renderShadowCascades(e,r=this._shadowMap,t=(e=>{})){for(const s of r.cascades)s.camera.setGLViewport(this._rctx),this._prepare(s.camera,s.camera),this._renderGeometryAndTransparentTerrainPass(e),t(s)}get _needsLinearDepth(){return this._ssaoHelper.active||this._renderPlugins.needsLinearDepth||this.hasReflections||this._needsShadowHighlight||this._needsShadowCast}_renderLinearDepth(){this._needsLinearDepth?this._offscreen.renderToTargets((()=>this._renderGeometryAndTransparentTerrainPass(b.Depth)),this._offscreen.linearDepth,this._offscreen.tmpDepth,[0,0,0,0],!0,!0):this._offscreen.disposeTarget(this._offscreen.linearDepth),this._bindParameters.linearDepthTexture=this._offscreen.linearDepthTexture}_renderTerrainLinearDepth(e){if(e){const e=this._renderContext.output;this._renderContext.output=b.Depth,this._offscreen.renderToTargets((()=>this._renderTransparentTerrain()),this._offscreen.terrainLinearDepth,this._offscreen.tmpDepth,[-1e10,-1e10,-1e10,1],!0,!0),this._renderContext.output=e}else this._offscreen.disposeTarget(this._offscreen.terrainLinearDepth);this._bindParameters.multipassTerrain.linearDepthTexture=this._offscreen.terrainLinearDepthTexture}_renderGeometryLinearDepth(e){if(e){const e=this._renderContext.output;this._offscreen.renderToTargets((()=>this._renderGeometryPass(b.Depth)),this._offscreen.geometryLinearDepth,this._offscreen.tmpDepth,[1,1,1,1],!0,!0),this._renderContext.output=e}else this._offscreen.disposeTarget(this._offscreen.geometryLinearDepth);this._bindParameters.multipassGeometry.linearDepthTexture=this._offscreen.geometryLinearDepthTexture}get _needsNormal(){return this._ssaoHelper.active}_renderNormal(){this._needsNormal?this._offscreen.renderToTargets((()=>{this._renderGeometryAndTransparentTerrainPass(b.Normal)}),this._offscreen.normal,this._offscreen.tmpDepth,[0,0,0,0],!0,!0):this._offscreen.disposeTarget(this._offscreen.normal)}get _needsDepthRange(){return this._shadowMap.enabled||this._needsShadowCast}_computeDepthRange(e){if(!this._needsDepthRange)return x;const r=L(e,this._materialRenderers,this._stage.layers);return N(r,this.renderPlugins.queryDepthRange(e)),r.near=Math.max(e.near,r.near),r.far=Math.min(e.far,r.far),r}_renderGeometryAndTransparentTerrainPass(e){this._renderContext.output=e,this._prepareSlots(B.TRANSPARENT_TERRAIN),this._renderGeometryPass(e),this._renderTransparentTerrain()}_renderGeometryPass(e){this._renderContext.output=e,this._prepareSlots(B.TRANSPARENT_MATERIAL),this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderSSAO(e){this._ssaoHelper.render(this._bindParameters,e,this._offscreen.linearDepthTexture,this._offscreen.normalTexture)}_prepareOpaqueGeometrySlots(){this._prepareSlots(B.INTEGRATED_MESH,B.OPAQUE_TERRAIN,B.OPAQUE_MATERIAL,B.POSTPROCESSING_ENVIRONMENT_OPAQUE),this._prepareInternalSlots(this._materialRenderers,B.OPAQUE_MATERIAL)}_renderOpaqueGeometry(){this._renderSlot(B.INTEGRATED_MESH),this._renderSlot(B.OPAQUE_TERRAIN),this._renderInternalSlot(B.OPAQUE_MATERIAL),this._renderSlot(B.OPAQUE_MATERIAL),this._renderSlot(B.POSTPROCESSING_ENVIRONMENT_OPAQUE)}_renderTransparentGeometry(){this._renderInternalSlot(B.TRANSPARENT_MATERIAL),this._renderSlot(B.TRANSPARENT_MATERIAL)}_renderTransparentTerrain(){this._renderSlot(B.TRANSPARENT_TERRAIN)}_renderHUDVisibility(e){let r=!1;return this._renderContext.offscreenRenderingHelper&&this._renderContext.offscreenRenderingHelper.renderHUDVisibility((()=>{this._bindParameters.hudVisibilityTexture=this._renderContext.offscreenRenderingHelper.hudVisibilityTexture,r=this._renderInternalSlot(B.OCCLUSION_PIXELS)}),e),r}_renderLineCallouts(e){this._bindParameters.renderTransparentlyOccludedHUD=e,e===y.Occluded?this._offscreen.renderToTargets((()=>this._renderInternalSlot(B.LINE_CALLOUTS)),this._offscreen.currentColorTarget,this._offscreen.tmpDepth,void 0,!0,!0):this._renderInternalSlot(B.LINE_CALLOUTS)}_renderHUD(e,r){this._hasHUDElements&&(this._oitEnabled?(this._renderOITPass(de.HUD,e),this._rctx.bindFramebuffer(r),this._compositingHelper.composite(this._bindParameters,this._offscreen.hudColorTexture,re.PremultipliedAlpha)):e===y.Occluded?this._offscreen.renderToTargets((()=>this._renderHUDElements(y.Occluded)),this._offscreen.currentColorTarget,this._offscreen.tmpDepth,void 0,!0,!0):this._renderHUDElements(e))}_renderHUDElements(e){this._bindParameters.renderTransparentlyOccludedHUD=e,this._prepareInternalSlots(this._materialRenderers,B.LINE_CALLOUTS_HUD_DEPTH,B.HUD_MATERIAL,B.LABEL_MATERIAL),this._renderInternalSlot(B.LINE_CALLOUTS_HUD_DEPTH),this._renderInternalSlot(B.HUD_MATERIAL),this._renderInternalSlot(B.LABEL_MATERIAL)}get _needsHighlight(){return this._hasHighlights||this._renderPlugins.needsHighlight}get _needsShadowHighlight(){return this._shadowMap.enabled&&this._shadowHighlight.isVisible&&this._needsHighlight}_renderHighlights(e,r){if(!this._needsHighlight)return void this._offscreen.disposeTarget(this._offscreen.highlight);const t=this._highlight,s=this._offscreen.renderToTargets((()=>{this._renderGeometryAndTransparentTerrainPass(b.Highlight),this._rctx.clearSafe(ae.DEPTH_BUFFER_BIT),this._renderHUDElements(y.Both)}),this._offscreen.highlight,this._offscreen.tmpDepth,[0,0,0,0],!0,!0);this._bindParameters.highlightColorTexture=s.colorTexture,this._needsShadowHighlight&&this._shadowHighlight.render(r,e),t.render(this._bindParameters,s,e)}get _needsShadowCast(){return this._shadowAccumulator.isAccumulating}_accumulateShadows(e,r,t){this._needsShadowCast&&null!=this._offscreen.linearDepthTexture&&this._shadowAccumulator.renderAccumulation(this._offscreen.linearDepthTexture,e,r,t)}_prepareTransparencySlots(){this._renderContext.output=b.Alpha,this._bindParameters.transparencyPassType=K.Alpha,this._prepareInternalSlots(this._materialRenderers,B.TRANSPARENT_MATERIAL),this._prepareSlots(B.TRANSPARENT_MATERIAL),this._renderContext.output=b.Color,this._bindParameters.transparencyPassType=K.Color,this._prepareInternalSlots(this._materialRenderers,B.TRANSPARENT_MATERIAL),this._prepareSlots(B.TRANSPARENT_MATERIAL),this._bindParameters.transparencyPassType=K.FrontFace,this._prepareInternalSlots(this._materialRenderers,B.TRANSPARENT_MATERIAL),this._prepareSlots(B.TRANSPARENT_MATERIAL),this._bindParameters.transparencyPassType=K.NONE}_renderOITPass(e,r=y.Both){const t=e===de.HUD,s=t?()=>this._renderHUDElements(r):()=>this._renderTransparentGeometry(),i=e=>{this._bindParameters.transparencyPassType=e,this._offscreen.renderOITPass(s,e,t)},a=this._renderContext.output;this._renderContext.output=b.Alpha,i(K.Alpha),this._renderContext.output=b.Color,i(K.Color),i(K.FrontFace),this._offscreen.compositeTransparentOntoOpaque(this._bindParameters,t),this._bindParameters.transparencyPassType=K.NONE,this._renderContext.output=a,this._oitUsed=!0}_disposeOITBuffers(){this._oitUsed||(this._offscreen.disposeTarget(this._offscreen.alphaFloatTarget),this._offscreen.disposeTarget(this._offscreen.colorFloatTarget),this._offscreen.disposeTarget(this._offscreen.frontFaceTarget))}_renderOccluded(){let e=0;le.clear(),this._materialRenderers.forAll((r=>{r.material&&r.material.isVisible()&&r.material.renderOccluded===v.OccludeAndTransparentStencil&&(e|=r.material.renderOccluded,le.push(r))}));const r=this._offscreen,t=(t,s,i,a,n)=>{0!=(e&s)&&(r.renderToTargets(i,r.tmpColor,r.mainDepth,[0,0,0,0],a,n),r.compositeOccludedOntoMain(this._bindParameters,t))};0!==le.length&&(this._prepareInternalSlots(le,B.OCCLUDER_MATERIAL,B.TRANSPARENT_OCCLUDER_MATERIAL),this._renderInternalSlot(B.OCCLUDER_MATERIAL,le),t(.5,v.OccludeAndTransparentStencil,(()=>this._renderInternalSlot(B.TRANSPARENT_OCCLUDER_MATERIAL,le)),!1,!1)),le.clear(),this._materialRenderers.forAll((r=>{r.material&&r.material.isVisible()&&(r.material.renderOccluded===v.OccludeAndTransparent||r.material.renderOccluded===v.Transparent||r.material.renderOccluded===v.Opaque)&&(e|=r.material.renderOccluded,le.push(r))}));const s=this._renderPlugins.renderOccludedFlags;if(e|=s,!e)return;const i=e=>{this._renderContext.renderOccludedMask=e,this._prepareInternalSlots(le,B.OPAQUE_MATERIAL,B.TRANSPARENT_MATERIAL,B.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),s>v.Occlude&&this._renderSlot(B.OCCLUDED_TERRAIN),this._renderInternalSlot(B.OPAQUE_MATERIAL,le),this._renderInternalSlot(B.TRANSPARENT_MATERIAL,le),this._renderInternalSlot(B.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,le),this._renderContext.resetRenderOccludedMask()};this._renderContext.output=b.Color,t(.5,v.OccludeAndTransparent,(()=>i(v.OccludeAndTransparent)),!0,D.OutlineVisualElementMask),t(.5,v.Transparent,(()=>i(v.Transparent)),!0,D.OutlineVisualElementMask),t(1,v.Opaque,(()=>i(v.Opaque)),!0,D.OutlineVisualElementMask),le.clear()}_renderAntiAliasing(e){if(this._antialiasing){if(this._smaaPass.enable((()=>this._requestRender()))&&null!=e)return this._smaaPass.render(e),!0}else this._smaaPass.disable();return!1}_prepare(e,r){this._needsTransparentPass=this._materialRenderers.some((e=>e.requiresSlot(B.TRANSPARENT_MATERIAL,b.Color))),this._bindParameters.camera=e,this._bindParameters.contentCamera=r}_ensureBindParameters(e,r){this._bindParameters.camera=e,this._bindParameters.contentCamera=r;const t=this._renderContext.offscreenRenderingHelper;this._bindParameters.hudVisibilityTexture=t.hudVisibilityTexture,this._bindParameters.mainColorTexture=t.mainColorTexture,this._bindParameters.highlightDepthTexture=t.depthTexture??this._getFallbackDepthTexture()}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.enabled=this.hasReflections,this._bindParameters.ssr.enabled){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=g:(f(ce,this._bindParameters.camera.viewMatrix),f(pe,this._bindParameters.camera.projectionMatrix),T(me,ce,pe),T(me,this._renderContext.lastFrameCamera.viewMatrix,me),T(me,this._renderContext.lastFrameCamera.projectionMatrix,me),this._reprojectionMatrix=me),this._bindParameters.ssr.lastFrameColorTexture=this._offscreen.lastFrameColorTexture;const r=this._stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=r>0?Math.min(r,e-this._ssrEnableTime)/r:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=g,this._bindParameters.ssr.lastFrameColorTexture=null,this._ssrEnableTime=null}_prepareInternalSlots(e,...r){for(const t of r)this._bindParameters.slot=t,e.forAll((e=>{e.material.shouldRender(this._renderContext)&&e.prepareTechnique(this._renderContext)}))}_renderInternalSlot(e,r=this._materialRenderers){let t=!1;return this._bindParameters.slot=e,r.forAll((e=>{if(e.material.shouldRender(this._renderContext)){const r=e.prepareTechnique(this._renderContext);null!=r&&(e.render(this._renderContext,r),t=!0)}})),t}_getFallbackDepthTexture(){return this._fallbackDepthStencilTexture||(this._fallbackDepthStencilTexture=H(this._rctx)),this._fallbackDepthStencilTexture}get gpuMemoryUsage(){return{offscreen:this._offscreen?.gpuMemoryUsage??0,highlights:(this._highlight?.gpuMemoryUsage??0)+(this._shadowHighlight?.gpuMemoryUsage??0),shadows:this._shadowMap?.gpuMemoryUsage??0,ssao:this._ssaoHelper?.gpuMemoryUsage??0}}get test(){const e=this;return{offscreen:this._offscreen,shadowMap:this._shadowMap,ssao:this._ssaoHelper,highlight:this._highlight,lighting:this._bindParameters.lighting,materialRenderers:this._materialRenderers,shadowAccumulator:this._shadowAccumulator,weatherIsFading:this._bindParameters.cloudsFade.isFading,resetRenderStateFeatures:()=>{e._renderStateFeatures=q()},getFramebufferTexture:r=>{switch(r){case _e.Color:return e._offscreen.colorTexture;case _e.LinearDepth:return e._offscreen.linearDepthTexture;case _e.Normals:return e._offscreen.normalTexture;case _e.ShadowMap:return e._shadowMap.depthTexture;case _e.HudVisibility:return e._offscreen.hudVisibilityTexture;case _e.Highlight:return e._offscreen.highlightTexture}}}}};var de,_e;e([c()],oe.prototype,"_renderPlugins",void 0),e([c()],oe.prototype,"_shadowAccumulator",void 0),e([c()],oe.prototype,"_state",void 0),e([c()],oe.prototype,"_renderStateFeatures",void 0),e([c()],oe.prototype,"_antialiasingEnabled",void 0),e([c({readOnly:!0})],oe.prototype,"_antialiasing",null),e([c()],oe.prototype,"_ssaoEnabled",void 0),e([c()],oe.prototype,"_smaaPass",void 0),e([c({autoDestroy:!0})],oe.prototype,"_edgeView",void 0),e([c()],oe.prototype,"updating",null),e([c()],oe.prototype,"isCameraFinal",null),oe=e([m("esri.views.3d.webgl-engine.lib.Renderer")],oe),function(e){e[e.Geometry=0]="Geometry",e[e.HUD=1]="HUD"}(de||(de={})),function(e){e[e.Color=0]="Color",e[e.LinearDepth=1]="LinearDepth",e[e.Normals=2]="Normals",e[e.ShadowMap=3]="ShadowMap",e[e.HudVisibility=4]="HudVisibility",e[e.Highlight=5]="Highlight"}(_e||(_e={}));const le=new o,pe=A(),ce=A(),me=A();function ue(e){return r=>e.immediate.schedule(r)}export{_e as FramebufferId,oe as Renderer};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import r from"../../../../core/Accessor.js";import{update as t}from"../../../../core/arrayUtils.js";import s from"../../../../core/Handles.js";import has from"../../../../core/has.js";import{removeMaybe as i,disposeMaybe as a,destroyMaybe as n,applySome as h}from"../../../../core/maybe.js";import o from"../../../../core/PooledArray.js";import{watch as d,syncAndInitial as l,initial as _,sync as p}from"../../../../core/reactiveUtils.js";import{property as c}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as m}from"../../../../core/accessorSupport/decorators/subclass.js";import{h as u,a as f,m as T}from"../../../../chunks/mat4.js";import{I as g,c as R}from"../../../../chunks/mat4f64.js";import{a as A}from"../../../../chunks/boundedPlane.js";import E from"../../support/debugFlags.js";import{TransparencyMode as S}from"../../terrain/TerrainRenderer.js";import{RenderPassManager as P}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as b}from"../core/shaderLibrary/ShaderOutput.js";import{HUDTransparencyRenderStyle as y}from"../core/shaderLibrary/hud/HUDUniforms.js";import{AnimationTimeStep as I}from"./AnimationTimeStep.js";import{Decorations as O,RenderRequestType as C,StencilBits as D}from"./basicInterfaces.js";import{BoundingInfo as w}from"./BoundingInfo.js";import{ZERO as x,union as N}from"./depthRange.js";import{depthRangeFromScene as L}from"./depthRangeUtils.js";import{createEmptyDepthTexture as H}from"./glUtil3D.js";import{Highlight as M}from"./Highlight.js";import{RenderOccludedFlag as v}from"./Material.js";import{OffscreenRendering as U}from"./OffscreenRendering.js";import{RenderContext as F}from"./RenderContext.js";import{splitRenderGeometryChangeSetByMaterial as j}from"./rendererUtils.js";import{RenderFeature as q,setupFeatureDefaults as G}from"./RenderFeature.js";import{RenderPluginManager as V}from"./RenderPluginManager.js";import{RenderSlot as B}from"./RenderSlot.js";import{ShadowAccumulator as Q}from"./ShadowAccumulator.js";import{ShadowHighlight as k}from"./ShadowHighlight.js";import{ShadowMap as W,SnapshotSlot as Y}from"./ShadowMap.js";import X from"./SliceHelper.js";import{SmaaRenderPass as z}from"./SmaaRenderPass.js";import{SSAOHelper as J}from"./SSAOHelper.js";import{TransparencyPassType as K}from"./TransparencyPassType.js";import{EdgeView as Z}from"./edgeRendering/EdgeView.js";import{Transparency as $}from"./edgeRendering/interfaces.js";import{MergedRenderer as ee}from"../materials/renderers/MergedRenderer.js";import{AlphaMode as re}from"../shaders/CompositingTechniqueConfiguration.js";import{RendererPerformanceInfo as te,PerformanceCategory as se}from"../statistics/RendererPerformanceInfo.js";import{RenderState as ie}from"../../../support/RenderState.js";import{ClearBufferBit as ae,PixelFormat as ne,PixelType as he}from"../../../webgl/enums.js";let oe=class extends r{get _bindParameters(){return this._renderContext.bindParameters}isFeatureEnabled(e,r=this._state){return this._renderStateFeatures.get(r,e)??!1}setFeatureEnabled(e,r,t){this._renderStateFeatures.set(r,e,t),this.notifyChange("_renderStateFeatures"),this._requestRender()}get _antialiasing(){return this._antialiasingEnabled||this.isFeatureEnabled(q.Antialiasing)}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(q.HighQualityTransparency)}get hasReflections(){return this.hasWater&&(this._ssrEnabled||this.isFeatureEnabled(q.WaterReflection))}get hasWater(){return this._hasWater||this._hasOverlayWater}constructor(e,r,t,i,a,n,h,p){super({}),this._stage=e,this._materialRepository=r,this._techniqueRepository=i,this._rctx=a,this._compositingHelper=n,this._magnifierHelper=h,this._requestRender=p,this._materialRenderers=new o,this._needsTransparentPass=!1,this._hasHUDElements=!1,this._hasHighlights=!1,this._hasWater=!1,this._hasOverlayWater=!1,this._renderOverlay=e=>{},this._isRendering=!1,this._fallbackDepthStencilTexture=null,this._sliceHelper=new X,this._state=ie.IDLE,this._renderStateFeatures=G(),this._antialiasingEnabled=!0,this._highQualityTransparencyEnabled=!0,this._terrainRenderingEnabled=!0,this._terrainTransparency=S.Opaque,this._ssrEnabled=!1,this._ssaoEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new I,this._handles=new s,this._renderHiddenTransparentEdges=()=>{},this._oitUsed=!1,this._smaaPass=new z(this._rctx,i),p(),this._offscreen=new U(this._rctx,this._compositingHelper),this.performanceInfo=new te(this._rctx),this._shadowMap=new W(this._rctx,e.viewingMode),this._ssaoHelper=new J(e.view,i,this._rctx,p),this._highlight=new M(i,this._rctx),this._shadowHighlight=new k(this._rctx,e.viewingMode),this._shadowAccumulator=new Q(this._rctx,i,e,(e=>{const r=this.shadowsEnabled;this._shadowMap.enabled=!0,this._prepare(e.camera,e.contentCamera),this._renderPlugins.prepareRender(),this._shadowMap.enabled=r}),((e,r,t)=>{e.shadowMap.start(e.camera,r,t,!0,this._stage.view.qualitySettings.maximumPixelRatio),this._renderShadowCascades(b.Shadow,e.shadowMap),e.camera.setGLViewport(this._rctx),this._prepare(e.camera,e.contentCamera)}),p),this._renderContext=new F(this._rctx,this._offscreen,this._shadowMap,this._ssaoHelper,this._sliceHelper),this._renderPlugins=new V({renderContext:this._renderContext,techniqueRepository:i,textureRepository:t,materialRepository:this._materialRepository,requestRender:p,controller:e}),this.renderPassManager=new P(this._rctx,this._techniqueRepository),this._renderPlugins.add(this.renderPassManager.slots(),this.renderPassManager),this._handles.add([d((()=>this._stage.view.state.camera),(()=>p()),l),d((()=>E.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges($.TRANSPARENT):()=>{},p()}),_),d((()=>this._ssaoEnabled||this.isFeatureEnabled(q.SSAO)),(e=>this._ssaoHelper.enabled=e),l)])}normalizeCtorArgs(){return{}}destroy(){this._handles.destroy(),this._smaaPass.dispose(),this._gpuTimerHandle=i(this._gpuTimerHandle),this._materialRenderers.forAll((e=>e.dispose())),this._materialRenderers.clear(),this._offscreen.dispose(),this._fallbackDepthStencilTexture=a(this._fallbackDepthStencilTexture),this._shadowMap.dispose(),this._ssaoHelper.destroy(),this._highlight.dispose(),this._shadowHighlight.dispose(),this._shadowAccumulator.dispose(),this._edgeView=n(this._edgeView),this.renderPassManager.destroy(),w.prune()}disposeOffscreenBuffers(){this._offscreen.dispose(),this._shadowMap.disposeOffscreenBuffers(),this._smaaPass.disable(),this._ssaoHelper.disposeOffscreenBuffers()}get updating(){return this._antialiasing&&this._smaaPass.updating||null!=this._edgeView&&this._edgeView.updating||this._shadowAccumulator.running||this._renderPlugins.updating||!this.isCameraFinal}ensureEdgeView(){if(null==this._edgeView){const e=this._stage.view.resourceController;this._edgeView=new Z({rctx:this._rctx,renderSR:this._stage.view.renderSpatialReference,viewingMode:this._stage.viewingMode,techniqueRepository:this._techniqueRepository,setNeedsRender:()=>this._requestRender(),schedule:ue(e)}),this._handles.add(d((()=>h(this._edgeView,(e=>e.updating))),(()=>this._requestRender()),p)),this._requestRender()}return this._edgeView}get edgeView(){return this._edgeView}get isCameraFinal(){return u(this._bindParameters.ssr.reprojectionMatrix,g)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this.notifyChange("isCameraFinal")}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:r,_bindParameters:t}=this;if(void 0!==e.qualitySettings?.reflections&&this._ssrEnabled!==e.qualitySettings.reflections&&(this._ssrEnabled=e.qualitySettings.reflections,this._requestRender()),void 0!==e.qualitySettings?.ambientOcclusion&&this._ssaoEnabled!==e.qualitySettings.ambientOcclusion&&(this._ssaoEnabled=e.qualitySettings.ambientOcclusion,this._requestRender()),void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&r.maxCascades!==e.shadowMapMaxCascades&&(r.maxCascades=e.shadowMapMaxCascades,this._requestRender()),null!=e.environment){null!=e.environment.weather&&(this._bindParameters.weather=e.environment.weather,this._bindParameters.weatherVisible=!!e.weatherVisible);const r="virtual"!==e.environment.lighting.type;t.enableFillLights!==r&&(t.enableFillLights=r,this._requestRender())}e.background&&this._offscreen.background!==e.background&&(this._offscreen.background=e.background,this._requestRender()),void 0!==e.antialiasingEnabled&&this._antialiasingEnabled!==e.antialiasingEnabled&&(this._antialiasingEnabled=e.antialiasingEnabled,this._requestRender()),void 0!==e.highQualityTransparency&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),void 0!==e.defaultHighlightOptions&&(this._highlight.setDefaultOptions(e.defaultHighlightOptions),this._shadowHighlight.setDefaultOptions(e.defaultHighlightOptions),this._requestRender()),void 0!==e.overlays&&this._bindParameters.overlays!==e.overlays&&(this._bindParameters.overlays=e.overlays,this._requestRender()),void 0!==e.hasOverlayWater&&this._hasOverlayWater!==e.hasOverlayWater&&(this._hasOverlayWater=e.hasOverlayWater,this._requestRender()),void 0!==e.renderOverlay&&this._renderOverlay!==e.renderOverlay&&(this._renderOverlay=e.renderOverlay,this._requestRender()),void 0!==e.slicePlane&&this._sliceHelper.plane!==e.slicePlane&&(this._sliceHelper.plane=e.slicePlane,this._requestRender()),void 0!==e.terrainRenderingEnabled&&this._terrainRenderingEnabled!==e.terrainRenderingEnabled&&(this._terrainRenderingEnabled=e.terrainRenderingEnabled,this._requestRender()),void 0!==e.terrainTransparency&&this._terrainTransparency!==e.terrainTransparency&&(this._terrainTransparency=e.terrainTransparency,this._requestRender()),void 0!==e.shadowCastOptions&&this._shadowAccumulator.setOptions(e.shadowCastOptions)}get hasSlicePlane(){return!!this._sliceHelper.plane}get renderPlugins(){return this._renderPlugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}modify(e,r){this._isRendering&&console.warn("Renderer.modify called while rendering");const{adds:t,removes:s,updates:i}=e;if(0===t.length&&0===s.length&&0===i.length)return;const a=j(e);let n=!1;a.forEach(((t,s)=>{if(r.done)return;let i=this._materialRenderers.find((e=>e.material===s));null==i&&t.adds.length>0&&(i=new ee(this._rctx,this._materialRepository,s),this._materialRenderers.push(i)),i&&(i.modify(t),i.isEmpty&&(n=!0)),t.removes.forEach((r=>e.removes.removeUnordered(r))),t.adds.forEach((r=>e.adds.removeUnordered(r))),t.updates.forEach((r=>e.updates.removeUnordered(r))),r.madeProgress()})),n&&this._materialRenderers.filterInPlace((e=>!e.isEmpty||(e.dispose(),!1))),this._hasHighlights=this._materialRenderers.some((e=>e.hasHighlights)),this._bindParameters.hasOccludees=this._materialRenderers.some((e=>e.hasOccludees)),this._hasWater=this._materialRenderers.some((e=>e.hasWater)),this._hasHUDElements=this._materialRenderers.some((e=>e.requiresSlot(B.LINE_CALLOUTS_HUD_DEPTH,b.Color)||e.requiresSlot(B.HUD_MATERIAL,b.Color)||e.requiresSlot(B.LABEL_MATERIAL,b.Color))),this._requestRender()}updateAnimation(e){const r=this._hasAnimations;return this._hasAnimations=!1,this._materialRenderers.forAll((r=>this._hasAnimations=r.updateAnimation(e)||this._hasAnimations)),this._hasAnimations=this._renderPlugins.updateAnimation(e)||this._hasAnimations,this._hasAnimations!==r&&(this._gpuTimerHandle=r?i(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}render(e,r,t,s,i){this._isRendering=!0,this._oitUsed=!1,this.performanceInfo.startFrame();const{camera:a,contentCamera:n,mode:h,alignPixelEnabled:o}=t;this._state=h,this._renderOverlay(i),this.performanceInfo.advance(se.OVERLAY),this._renderContext.time=i,this._bindParameters.transparencyPassType=K.NONE,this._bindParameters.alignPixelEnabled=o;const d=this._offscreen;d.setupRenderTarget(this.hasReflections);const l=A(this._sliceHelper.plane);s===O.OFF&&(this._sliceHelper.plane=null),this._rctx.bindFramebuffer(e),a.setGLViewport(this._rctx),this._prepare(a,n),this._renderPlugins.prepareRender(),this.performanceInfo.advance(se.PREPARE);const _=this._computeDepthRange(a);this._renderShadowMap(e,a,this._bindParameters.lighting.mainLight.direction,_),this.performanceInfo.advance(se.SHADOW_MAP),d.initializeFrame(a),this._ensureBindParameters(a,n);const p=this._terrainRenderingEnabled&&(this._terrainTransparency===S.Semitransparent||this._terrainTransparency===S.TransparentWithDraped),c=this._highQualityTransparency&&p,m=this._needsTransparentPass||this._renderPlugins.needsTransparentPass;this._prepareShaders(c,m),this._renderLinearDepth(),this.performanceInfo.advance(se.LINEAR_DEPTH),this._accumulateShadows(_,a,n),this.performanceInfo.advance(se.ACCUMULATED_SHADOWS),this._renderNormal(),this.performanceInfo.advance(se.NORMALS),this._ensureBindParametersSSR(i),this._renderSSAO(i),this.performanceInfo.advance(se.SSAO),this._renderContext.output=b.Color,d.bindFramebuffer(),this._renderOpaqueGeometry(),this.performanceInfo.advance(se.OPAQUE),this._renderTerrainLinearDepth(c),this._setMultipassTerrain(c),this._renderEdges($.OPAQUE),this.performanceInfo.advance(se.OPAQUE_EDGES),this._offscreen.bindTarget(this._offscreen.currentColorTarget,this._offscreen.mainDepth),this._renderSlot(B.VOXEL),this.performanceInfo.advance(se.VOXEL),this._renderHiddenTransparentEdges(),m&&(this._oitEnabled?this._renderOITPass(de.Geometry):this._renderTransparentGeometry()),this.performanceInfo.advance(se.TRANSPARENT),this._renderGeometryLinearDepth(c);const u=this._renderHUDVisibility(c);c||this._renderInternalSlot(B.LINE_CALLOUTS),this.performanceInfo.advance(se.HUD_VISIBILITY),this._renderObjectAndLayerIdColor(r),this.performanceInfo.advance(se.OBJECT_AND_LAYER_ID_COLOR),this._renderEdges($.TRANSPARENT,c),this.performanceInfo.advance(se.TRANSPARENT_EDGES),this._renderTransparentTerrain(),p&&u&&(c?this._renderLineCallouts(y.Occluded):d.compositeTransparentTerrainOntoHUDVisibility(this._bindParameters),this._renderHUD(y.Occluded,d.framebuffer),this.performanceInfo.advance(se.HUD_OCCLUDED)),this.performanceInfo.advance(se.TRANSPARENT_TERRAIN),this._setTerrainCulling(!1),p&&(d.compositeTransparentTerrainOntoMain(this._bindParameters),c&&(this._renderEdges($.OPAQUE),this.performanceInfo.advance(se.OPAQUE_EDGES),m&&(this._oitEnabled?this._renderOITPass(de.Geometry):this._renderTransparentGeometry()),this.performanceInfo.advance(se.TRANSPARENT),this._renderEdges($.TRANSPARENT),this.performanceInfo.advance(se.TRANSPARENT_EDGES))),c&&this._renderLineCallouts(y.NotOccluded),this._setMultipassEnabled(!1),this._shadowAccumulator.render(this._bindParameters),d.renderToTargets((()=>{this._renderInternalSlot(B.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),this._renderSlot(B.POSTPROCESSING_ENVIRONMENT_TRANSPARENT),this._renderSlot(B.LASERLINES)}),d.currentColorTarget,d.mainDepth),this.performanceInfo.advance(se.ENVIRONMENT),this._renderPlugins.needsLaserlineWithContrastControl&&d.renderTmpAndCompositeToMain((()=>this._renderSlot(B.LASERLINES_CONTRAST_CONTROL)),this._bindParameters,re.PremultipliedAlpha),this.performanceInfo.advance(se.LASER_LINE),this._renderOccluded(),this.performanceInfo.advance(se.OCCLUDED);const f=s===O.ON&&this._magnifierHelper.enabled,T=f&&null==e?this._offscreen.getFramebuffer(this._offscreen.tmpColor,this._offscreen.tmpDepth):e;this._rctx.bindFramebuffer(T);const g=this._offscreen.colorTexture;this._renderAntiAliasing(g)||null==g||this._compositingHelper.composite(this._bindParameters,g,re.None),this.performanceInfo.advance(se.ANTIALIASING),this._renderHUD(y.NotOccluded,T),this.performanceInfo.advance(se.HUD),this._renderHighlights(T,this._bindParameters),this.performanceInfo.advance(se.HIGHLIGHTS),f&&this._magnifierHelper.render(this._rctx,this._bindParameters),T!==e&&(this._rctx.bindFramebuffer(e),this._compositingHelper.composite(this._bindParameters,this._offscreen.tmpColorTexture,re.None)),this._disposeOITBuffers(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this._sliceHelper.plane=l,this._isRendering=!1,this.onPostRender&&this.onPostRender(),this.performanceInfo.finishFrame()}_prepareShaders(e,r){this._renderContext.output=b.Color,this._prepareOpaqueGeometrySlots(),this._setMultipassTerrain(e),this._prepareSlots(B.TRANSPARENT_TERRAIN),this._setMultipassTerrain(!1),e||this._prepareInternalSlots(this._materialRenderers,B.LINE_CALLOUTS),r&&this._prepareTransparencySlots(),this._prepareInternalSlots(this._materialRenderers,B.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),this._prepareSlots(B.POSTPROCESSING_ENVIRONMENT_TRANSPARENT,B.LASERLINES),this._rctx.gl.flush()}_renderObjectAndLayerIdColor(e){if(null!=e&&has("enable-feature:objectAndLayerId-rendering")){const r=this._renderContext.output;this._rctx.bindFramebuffer(e),this._offscreen.renderToFBO((()=>this._renderGeometryAndTransparentTerrainPass(b.ObjectAndLayerIdColor)),[0,0,0,0],!0,!0),this._rctx.bindFramebuffer(e),this._offscreen.renderToFBO((()=>{this._bindParameters.renderTransparentlyOccludedHUD=y.NotOccluded,this._renderInternalSlot(B.HUD_MATERIAL)}),void 0,!0,!0),this._renderContext.output=r}}finish(e){this._hasAnimations||this._animationTimestep.clear();const r=this.performanceInfo.gpuSamplingEnabled,t=e===C.BACKGROUND;if(t||r){const e=t?this.performanceInfo.elapsedTime:0,s=r?this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.getError(),i=Math.max(e,s);this._animationTimestep.frame(i,t)}}readDepthPixels(e,r,t){const s=this._offscreen.bindTarget(this._offscreen.linearDepth,this._offscreen.tmpDepth);if(!this._needsLinearDepth){this._ensureBindParameters(e,e),this._bindParameters.camera.setGLViewport(this._rctx),this._rctx.setClearColor(0,0,0,0);const r=ae.COLOR_BUFFER_BIT|ae.DEPTH_BUFFER_BIT|ae.STENCIL_BUFFER_BIT;this._rctx.clearSafe(r),this._renderGeometryAndTransparentTerrainPass(b.Depth)}s.readPixels(r[0],r[1],r[2],r[3],ne.RGBA,he.UNSIGNED_BYTE,t)}readHUDVisibility(e,r,t,s,i){this._offscreen.bindTarget(this._offscreen.hudVisibility).readPixels(e,r,t,s,ne.RGBA,he.UNSIGNED_BYTE,i)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_setMultipassTerrain(e){this._setMultipassEnabled(e),this._setTerrainCulling(e)}_setMultipassEnabled(e){this._bindParameters.multipassTerrain.enabled=this._bindParameters.multipassGeometry.enabled=e}_setTerrainCulling(e){this._bindParameters.multipassTerrain.cullAboveGround=e}_prepareSlots(...e){this._renderPlugins.prepareSlots(e)}_renderSlot(e){this._bindParameters.slot=e,this._renderPlugins.render()}_renderEdges(e,r=!1){const t=this._edgeView;null!=t&&t.shouldRender()&&this._offscreen.renderTmpAndCompositeToMain((()=>t.render(this._bindParameters,e)),this._bindParameters,re.Alpha,r)}_renderShadowMap(e,r,t,s){const i=this._shadowMap;i.enabled&&(i.start(r,t,s,this.isFeatureEnabled(q.HighQualityShadows),this._stage.view.qualitySettings.maximumPixelRatio),this._shadowHighlight.updateParameters(r,t),this._needsShadowHighlight?(this._renderShadowCascades(b.ShadowHighlight,this._shadowMap,(e=>i.takeCascadeSnapshotTo(e,Y.Highlight))),i.clear(),this._renderShadowCascades(b.ShadowExcludeHighlight,this._shadowMap,(e=>{i.takeCascadeSnapshotTo(e,Y.Default),this._renderGeometryAndTransparentTerrainPass(b.ShadowHighlight)}))):this._renderShadowCascades(b.Shadow),i.finish(e),r.setGLViewport(this._rctx))}_renderShadowCascades(e,r=this._shadowMap,t=(e=>{})){for(const s of r.cascades)s.camera.setGLViewport(this._rctx),this._prepare(s.camera,s.camera),this._renderGeometryAndTransparentTerrainPass(e),t(s)}get _needsLinearDepth(){return this._ssaoHelper.active||this._renderPlugins.needsLinearDepth||this.hasReflections||this._needsShadowHighlight||this._needsShadowCast}_renderLinearDepth(){this._needsLinearDepth?this._offscreen.renderToTargets((()=>this._renderGeometryAndTransparentTerrainPass(b.Depth)),this._offscreen.linearDepth,this._offscreen.tmpDepth,[0,0,0,0],!0,!0):this._offscreen.disposeTarget(this._offscreen.linearDepth),this._bindParameters.linearDepthTexture=this._offscreen.linearDepthTexture}_renderTerrainLinearDepth(e){if(e){const e=this._renderContext.output;this._renderContext.output=b.Depth,this._offscreen.renderToTargets((()=>this._renderTransparentTerrain()),this._offscreen.terrainLinearDepth,this._offscreen.tmpDepth,[-1e10,-1e10,-1e10,1],!0,!0),this._renderContext.output=e}else this._offscreen.disposeTarget(this._offscreen.terrainLinearDepth);this._bindParameters.multipassTerrain.linearDepthTexture=this._offscreen.terrainLinearDepthTexture}_renderGeometryLinearDepth(e){if(e){const e=this._renderContext.output;this._offscreen.renderToTargets((()=>this._renderGeometryPass(b.Depth)),this._offscreen.geometryLinearDepth,this._offscreen.tmpDepth,[1,1,1,1],!0,!0),this._renderContext.output=e}else this._offscreen.disposeTarget(this._offscreen.geometryLinearDepth);this._bindParameters.multipassGeometry.linearDepthTexture=this._offscreen.geometryLinearDepthTexture}get _needsNormal(){return this._ssaoHelper.active}_renderNormal(){this._needsNormal?this._offscreen.renderToTargets((()=>{this._renderGeometryAndTransparentTerrainPass(b.Normal)}),this._offscreen.normal,this._offscreen.tmpDepth,[0,0,0,0],!0,!0):this._offscreen.disposeTarget(this._offscreen.normal)}get _needsDepthRange(){return this._shadowMap.enabled||this._needsShadowCast}_computeDepthRange(e){if(!this._needsDepthRange)return x;const r=L(e,this._materialRenderers,this._stage.layers);return N(r,this.renderPlugins.queryDepthRange(e)),r.near=Math.max(e.near,r.near),r.far=Math.min(e.far,r.far),r}_renderGeometryAndTransparentTerrainPass(e){this._renderContext.output=e,this._prepareSlots(B.TRANSPARENT_TERRAIN),this._renderGeometryPass(e),this._renderTransparentTerrain()}_renderGeometryPass(e){this._renderContext.output=e,this._prepareSlots(B.TRANSPARENT_MATERIAL),this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderSSAO(e){this._ssaoHelper.render(this._bindParameters,e,this._offscreen.linearDepthTexture,this._offscreen.normalTexture)}_prepareOpaqueGeometrySlots(){this._prepareSlots(B.INTEGRATED_MESH,B.OPAQUE_TERRAIN,B.OPAQUE_MATERIAL,B.POSTPROCESSING_ENVIRONMENT_OPAQUE),this._prepareInternalSlots(this._materialRenderers,B.OPAQUE_MATERIAL)}_renderOpaqueGeometry(){this._renderSlot(B.INTEGRATED_MESH),this._renderSlot(B.OPAQUE_TERRAIN),this._renderInternalSlot(B.OPAQUE_MATERIAL),this._renderSlot(B.OPAQUE_MATERIAL),this._renderSlot(B.POSTPROCESSING_ENVIRONMENT_OPAQUE)}_renderTransparentGeometry(){this._renderInternalSlot(B.TRANSPARENT_MATERIAL),this._renderSlot(B.TRANSPARENT_MATERIAL)}_renderTransparentTerrain(){this._renderSlot(B.TRANSPARENT_TERRAIN)}_renderHUDVisibility(e){let r=!1;return this._renderContext.offscreenRenderingHelper&&this._renderContext.offscreenRenderingHelper.renderHUDVisibility((()=>{this._bindParameters.hudVisibilityTexture=this._renderContext.offscreenRenderingHelper.hudVisibilityTexture,r=this._renderInternalSlot(B.OCCLUSION_PIXELS)}),e),r}_renderLineCallouts(e){this._bindParameters.renderTransparentlyOccludedHUD=e,e===y.Occluded?this._offscreen.renderToTargets((()=>this._renderInternalSlot(B.LINE_CALLOUTS)),this._offscreen.currentColorTarget,this._offscreen.tmpDepth,void 0,!0,!0):this._renderInternalSlot(B.LINE_CALLOUTS)}_renderHUD(e,r){this._hasHUDElements&&(this._oitEnabled?(this._renderOITPass(de.HUD,e),this._rctx.bindFramebuffer(r),this._compositingHelper.composite(this._bindParameters,this._offscreen.hudColorTexture,re.PremultipliedAlpha)):e===y.Occluded?this._offscreen.renderToTargets((()=>this._renderHUDElements(y.Occluded)),this._offscreen.currentColorTarget,this._offscreen.tmpDepth,void 0,!0,!0):this._renderHUDElements(e))}_renderHUDElements(e){this._bindParameters.renderTransparentlyOccludedHUD=e,this._prepareInternalSlots(this._materialRenderers,B.LINE_CALLOUTS_HUD_DEPTH,B.HUD_MATERIAL,B.LABEL_MATERIAL),this._renderInternalSlot(B.LINE_CALLOUTS_HUD_DEPTH),this._renderInternalSlot(B.HUD_MATERIAL),this._renderInternalSlot(B.LABEL_MATERIAL)}get _needsHighlight(){return this._hasHighlights||this._renderPlugins.needsHighlight}get _needsShadowHighlight(){return this._shadowMap.enabled&&this._shadowHighlight.isVisible&&this._needsHighlight}_renderHighlights(e,r){if(!this._needsHighlight)return void this._offscreen.disposeTarget(this._offscreen.highlight);const t=this._highlight,s=this._offscreen.renderToTargets((()=>{this._renderGeometryAndTransparentTerrainPass(b.Highlight),this._rctx.clearSafe(ae.DEPTH_BUFFER_BIT),this._renderHUDElements(y.Both)}),this._offscreen.highlight,this._offscreen.tmpDepth,[0,0,0,0],!0,!0);this._bindParameters.highlightColorTexture=s.colorTexture,this._needsShadowHighlight&&this._shadowHighlight.render(r,e),t.render(this._bindParameters,s,e)}get _needsShadowCast(){return this._shadowAccumulator.isAccumulating}_accumulateShadows(e,r,t){this._needsShadowCast&&null!=this._offscreen.linearDepthTexture&&this._shadowAccumulator.renderAccumulation(this._offscreen.linearDepthTexture,e,r,t)}_prepareTransparencySlots(){this._renderContext.output=b.Alpha,this._bindParameters.transparencyPassType=K.Alpha,this._prepareInternalSlots(this._materialRenderers,B.TRANSPARENT_MATERIAL),this._prepareSlots(B.TRANSPARENT_MATERIAL),this._renderContext.output=b.Color,this._bindParameters.transparencyPassType=K.Color,this._prepareInternalSlots(this._materialRenderers,B.TRANSPARENT_MATERIAL),this._prepareSlots(B.TRANSPARENT_MATERIAL),this._bindParameters.transparencyPassType=K.FrontFace,this._prepareInternalSlots(this._materialRenderers,B.TRANSPARENT_MATERIAL),this._prepareSlots(B.TRANSPARENT_MATERIAL),this._bindParameters.transparencyPassType=K.NONE}_renderOITPass(e,r=y.Both){const t=e===de.HUD,s=t?()=>this._renderHUDElements(r):()=>this._renderTransparentGeometry(),i=e=>{this._bindParameters.transparencyPassType=e,this._offscreen.renderOITPass(s,e,t)},a=this._renderContext.output;this._renderContext.output=b.Alpha,i(K.Alpha),this._renderContext.output=b.Color,i(K.Color),i(K.FrontFace),this._offscreen.compositeTransparentOntoOpaque(this._bindParameters,t),this._bindParameters.transparencyPassType=K.NONE,this._renderContext.output=a,this._oitUsed=!0}_disposeOITBuffers(){this._oitUsed||(this._offscreen.disposeTarget(this._offscreen.alphaFloatTarget),this._offscreen.disposeTarget(this._offscreen.colorFloatTarget),this._offscreen.disposeTarget(this._offscreen.frontFaceTarget))}_renderOccluded(){let e=0;_e.clear(),this._materialRenderers.forAll((r=>{r.material&&r.material.isVisible()&&r.material.renderOccluded===v.OccludeAndTransparentStencil&&(e|=r.material.renderOccluded,_e.push(r))}));const r=this._offscreen,t=(t,s,i,a,n)=>{0!=(e&s)&&(r.renderToTargets(i,r.tmpColor,r.mainDepth,[0,0,0,0],a,n),r.compositeOccludedOntoMain(this._bindParameters,t))};0!==_e.length&&(this._prepareInternalSlots(_e,B.OCCLUDER_MATERIAL,B.TRANSPARENT_OCCLUDER_MATERIAL),this._renderInternalSlot(B.OCCLUDER_MATERIAL,_e),t(.5,v.OccludeAndTransparentStencil,(()=>this._renderInternalSlot(B.TRANSPARENT_OCCLUDER_MATERIAL,_e)),!1,!1)),_e.clear(),this._materialRenderers.forAll((r=>{r.material&&r.material.isVisible()&&(r.material.renderOccluded===v.OccludeAndTransparent||r.material.renderOccluded===v.Transparent||r.material.renderOccluded===v.Opaque)&&(e|=r.material.renderOccluded,_e.push(r))}));const s=this._renderPlugins.renderOccludedFlags;if(e|=s,!e)return;const i=e=>{this._renderContext.renderOccludedMask=e,this._prepareInternalSlots(_e,B.OPAQUE_MATERIAL,B.TRANSPARENT_MATERIAL,B.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),s>v.Occlude&&this._renderSlot(B.OCCLUDED_TERRAIN),this._renderInternalSlot(B.OPAQUE_MATERIAL,_e),this._renderInternalSlot(B.TRANSPARENT_MATERIAL,_e),this._renderInternalSlot(B.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,_e),this._renderContext.resetRenderOccludedMask()};this._renderContext.output=b.Color,t(.5,v.OccludeAndTransparent,(()=>i(v.OccludeAndTransparent)),!0,D.OutlineVisualElementMask),t(.5,v.Transparent,(()=>i(v.Transparent)),!0,D.OutlineVisualElementMask),t(1,v.Opaque,(()=>i(v.Opaque)),!0,D.OutlineVisualElementMask),_e.clear()}_renderAntiAliasing(e){if(this._antialiasing){if(this._smaaPass.enable((()=>this._requestRender()))&&null!=e)return this._smaaPass.render(e),!0}else this._smaaPass.disable();return!1}_prepare(e,r){this._needsTransparentPass=this._materialRenderers.some((e=>e.requiresSlot(B.TRANSPARENT_MATERIAL,b.Color))),this._bindParameters.camera=e,this._bindParameters.contentCamera=r}_ensureBindParameters(e,r){this._bindParameters.camera=e,this._bindParameters.contentCamera=r;const t=this._renderContext.offscreenRenderingHelper;this._bindParameters.hudVisibilityTexture=t.hudVisibilityTexture,this._bindParameters.mainColorTexture=t.mainColorTexture,this._bindParameters.highlightDepthTexture=t.depthTexture??this._getFallbackDepthTexture()}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.enabled=this.hasReflections,this._bindParameters.ssr.enabled){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=g:(f(ce,this._bindParameters.camera.viewMatrix),f(pe,this._bindParameters.camera.projectionMatrix),T(me,ce,pe),T(me,this._renderContext.lastFrameCamera.viewMatrix,me),T(me,this._renderContext.lastFrameCamera.projectionMatrix,me),this._reprojectionMatrix=me),this._bindParameters.ssr.lastFrameColorTexture=this._offscreen.lastFrameColorTexture;const r=this._stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=r>0?Math.min(r,e-this._ssrEnableTime)/r:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=g,this._bindParameters.ssr.lastFrameColorTexture=null,this._ssrEnableTime=null}_prepareInternalSlots(e,...r){for(const t of r)this._bindParameters.slot=t,e.forAll((e=>{e.material.shouldRender(this._renderContext)&&e.prepareTechnique(this._renderContext)}))}_renderInternalSlot(e,r=this._materialRenderers){let t=!1;return this._bindParameters.slot=e,r.forAll((e=>{if(e.material.shouldRender(this._renderContext)){const r=e.prepareTechnique(this._renderContext);null!=r&&(e.render(this._renderContext,r),t=!0)}})),t}_getFallbackDepthTexture(){return this._fallbackDepthStencilTexture||(this._fallbackDepthStencilTexture=H(this._rctx)),this._fallbackDepthStencilTexture}get gpuMemoryUsage(){return{offscreen:this._offscreen?.gpuMemoryUsage??0,highlights:(this._highlight?.gpuMemoryUsage??0)+(this._shadowHighlight?.gpuMemoryUsage??0),shadows:this._shadowMap?.gpuMemoryUsage??0,ssao:this._ssaoHelper?.gpuMemoryUsage??0}}get test(){const e=this;return{offscreen:this._offscreen,shadowMap:this._shadowMap,ssao:this._ssaoHelper,highlight:this._highlight,lighting:this._bindParameters.lighting,materialRenderers:this._materialRenderers,shadowAccumulator:this._shadowAccumulator,weatherIsFading:this._bindParameters.cloudsFade.isFading,resetRenderStateFeatures:()=>{e._renderStateFeatures=G()},getFramebufferTexture:r=>{switch(r){case le.Color:return e._offscreen.colorTexture;case le.LinearDepth:return e._offscreen.linearDepthTexture;case le.Normals:return e._offscreen.normalTexture;case le.ShadowMap:return e._shadowMap.depthTexture;case le.HudVisibility:return e._offscreen.hudVisibilityTexture;case le.Highlight:return e._offscreen.highlightTexture}}}}};var de,le;e([c()],oe.prototype,"_renderPlugins",void 0),e([c()],oe.prototype,"_shadowAccumulator",void 0),e([c()],oe.prototype,"_state",void 0),e([c()],oe.prototype,"_renderStateFeatures",void 0),e([c()],oe.prototype,"_antialiasingEnabled",void 0),e([c({readOnly:!0})],oe.prototype,"_antialiasing",null),e([c()],oe.prototype,"_ssaoEnabled",void 0),e([c()],oe.prototype,"_smaaPass",void 0),e([c({autoDestroy:!0})],oe.prototype,"_edgeView",void 0),e([c()],oe.prototype,"updating",null),e([c()],oe.prototype,"isCameraFinal",null),oe=e([m("esri.views.3d.webgl-engine.lib.Renderer")],oe),function(e){e[e.Geometry=0]="Geometry",e[e.HUD=1]="HUD"}(de||(de={})),function(e){e[e.Color=0]="Color",e[e.LinearDepth=1]="LinearDepth",e[e.Normals=2]="Normals",e[e.ShadowMap=3]="ShadowMap",e[e.HudVisibility=4]="HudVisibility",e[e.Highlight=5]="Highlight"}(le||(le={}));const _e=new o,pe=R(),ce=R(),me=R();function ue(e){return r=>e.immediate.schedule(r)}export{le as FramebufferId,oe 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.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{equals as i}from"../../../../core/arrayUtils.js";import s from"../../../../core/Handles.js";import{smoothstep as r}from"../../../../core/mathUtils.js";import{disposeMaybe as o,releaseMaybe as a}from"../../../../core/maybe.js";import{watch as n,syncAndInitial as h,sync as c}from"../../../../core/reactiveUtils.js";import{property as _}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/has.js";import{subclass as
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{equals as i}from"../../../../core/arrayUtils.js";import s from"../../../../core/Handles.js";import{smoothstep as r}from"../../../../core/mathUtils.js";import{disposeMaybe as o,releaseMaybe as a}from"../../../../core/maybe.js";import{watch as n,syncAndInitial as h,sync as c}from"../../../../core/reactiveUtils.js";import{property as _}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/has.js";import{subclass as u}from"../../../../core/accessorSupport/decorators/subclass.js";import{F as l,c as m}from"../../../../chunks/vec3.js";import{c as p}from"../../../../chunks/vec3f64.js";import{BindParameters as d}from"./BindParameters.js";import{ZERO as g}from"./depthRange.js";import{createQuadVAO as f}from"./glUtil3D.js";import{ShadowCastRenderer as b,shadowCastDisabledElevationThreshold as v,shadowCastDisableElevationMax as w,shadowCastDisableElevationMin as A}from"./ShadowCastRenderer.js";import{ShadowMap as y}from"./ShadowMap.js";import{S as R,a as C}from"../../../../chunks/ShadowCastAccumulate.glsl.js";import{ShadowCastAccumulateTechnique as D}from"../shaders/ShadowCastAccumulateTechnique.js";import{TaskPriority as S}from"../../../support/Scheduler.js";import{PixelFormat as j,PixelType as F,TextureWrapMode as T,ClearBufferBit as P}from"../../../webgl/enums.js";import{FramebufferObject as x}from"../../../webgl/FramebufferObject.js";import{TextureDescriptor as q}from"../../../webgl/TextureDescriptor.js";import{vertexCount as E}from"../../../webgl/Util.js";let M=class extends t{constructor(e,t,i,r,o,a){super({}),this._rctx=e,this._stage=i,this._prepareForShadowMapPass=r,this._renderToShadowMap=o,this._requestRender=a,this._progress=0,this._sampleCount=0,this._passParameters=new R,this._cachedLightDirections=[],this._depthRange=g,this._previewing=!1,this._handles=new s,this._cameraForcedForScreenshot=!1,this._bindParameters=new d(new y(e,i.viewingMode),null,null),this._bindParameters.shadowMap.enabled=!0,this._vao=f(e),this._accumulationRenderer=new b(t,e,this,a);const _=this._stage.view.resourceController.scheduler;this._handles.add([_.registerTask(S.SHADOW_ACCUMULATOR,this),n((()=>i.renderView),(e=>{this._handles.remove(L),null!=e&&this._handles.add(e.events.on("force-camera-for-screenshot",(()=>this._cameraForcedForScreenshot=!0)),L)}),h),n((()=>this._previewing),(()=>this._requestRenderIfEnabled()),c)])}normalizeCtorArgs(){return{}}dispose(){this._disable(),this._handles.destroy(),this._accumulationRenderer=o(this._accumulationRenderer),this._bindParameters.shadowMap.dispose(),this._fbo=o(this._fbo),this._vao=o(this._vao),this._accumulationTechniqueCached=a(this._accumulationTechniqueCached),this._cachedLightDirections.length=0,this._sampleCount=0}get computedSamples(){return this._progress}get shadowCastTexture(){return this._fbo?.colorTexture}get isAccumulating(){return this._isPreviewing||this._isRefining}get _accumulationTechnique(){if(null==this._accumulationTechniqueCached){const e={rctx:this._rctx,viewingMode:this._stage.viewingMode};this._accumulationTechniqueCached=new D(e)}return this._accumulationTechniqueCached}get _isRefining(){return this._isActive&&!this._isDoneAccumulating&&!this._previewing}get _isPreviewing(){return this._isActive&&this._previewing}get _isActive(){return null!=this._fbo&&this._sampleCount>0}get canAccumulate(){return null!==this._passParameters.linearDepthTexture&&this._depthRange!==g&&this._opacityFromElevation>v}get _isDoneAccumulating(){return this._progress>=this._sampleCount}get _lightDirections(){return this._cachedLightDirections}set _lightDirections(e){const t=this._cachedLightDirections;if(i(t,e,l))return;const s=Math.min(C,e.length);t.length=s,this._sampleCount=s;for(let i=0;i<s;++i)t[i]=m(t[i]??p(),e[i]);this._invalidate()}get _opacityFromElevation(){return this._accumulationRenderer.opacityFromElevation}set _opacityFromElevation(e){this._accumulationRenderer.opacityFromElevation=e}get running(){return this._isRefining&&this.canAccumulate&&this._progress>0}runTask(e){for(this._prepareForShadowMapPass(this._bindParameters);!e.done&&!this._isDoneAccumulating;)this._accumulateShadow(),e.madeProgress();this._requestRender()}renderAccumulation(e,t,i,s){if(this._depthRange=t,this._updateCamera(i),this._bindParameters.contentCamera=s,this._passParameters.linearDepthTexture=e,this._passParameters.origin=this._bindParameters.camera.center,this.notifyChange("canAccumulate"),!this.isAccumulating||!this.canAccumulate)return;(this._previewing||0===this._progress||this._cameraForcedForScreenshot)&&this._clear();const r=this._cameraForcedForScreenshot?this._sampleCount:Math.min(U,this._sampleCount-this._progress);for(let o=0;o<r;++o)this._accumulateShadow();this._cameraForcedForScreenshot=!1,this._requestRender()}render(e){this._accumulationRenderer.render(e)}setOptions(e){if(void 0!==e.enabled){const t=null!=this._fbo;e.enabled!==t&&(e.enabled?this._enable():this._disable())}void 0!==e.previewing&&(this._previewing=e.previewing),void 0!==e.lightDirections&&(this._lightDirections=e.lightDirections),this._accumulationRenderer.setOptions(e)}readAccumulatedShadow(e,t){return!this._isActive||!this._fbo||this._progress<1||e<0||e>=this._fbo.width||t<0||t>=this._fbo.height?0:(this._fbo.readPixels(e,t,1,1,j.RGBA,F.UNSIGNED_BYTE,k),k[0]/this._progress)}_enable(){this._progress=0;const e=new q;e.wrapMode=T.CLAMP_TO_EDGE,this._fbo=new x(this._rctx,e)}_disable(){this._fbo=o(this._fbo)}_invalidate(){this._progress=0,this._requestRenderIfEnabled()}_clear(){this._rctx.bindFramebuffer(this._fbo),this._rctx.setClearColor(0,0,0,0),this._rctx.clearSafe(P.COLOR_BUFFER_BIT),this._progress=0}_accumulateShadow(){this._renderToShadowMap(this._bindParameters,this._sampleLightDirection(),this._depthRange);const e=this._accumulationTechnique;this._rctx.bindFramebuffer(this._fbo),this._rctx.bindTechnique(e,this._passParameters,this._bindParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(e.primitiveType,0,E(this._vao,"geometry"))}_sampleLightDirection(){return this._progress++,this._lightDirections[this._progress*O%this._lightDirections.length]}_updateCamera(e){!e.equals(this._bindParameters.camera)&&this._fbo&&(this._bindParameters.camera.copyFrom(e),this._fbo.resize(e.fullWidth,e.fullHeight),this._opacityFromElevation=1-r(A,w,e.relativeElevation))}_requestRenderIfEnabled(){this._fbo&&this._requestRender()}get test(){const e=this;return{lightDirections:this._lightDirections,get isDone(){return e._isDoneAccumulating},get isActive(){return e._isActive}}}};e([_()],M.prototype,"_progress",void 0),e([_()],M.prototype,"_sampleCount",void 0),e([_()],M.prototype,"_fbo",void 0),e([_()],M.prototype,"_depthRange",void 0),e([_()],M.prototype,"_previewing",void 0),e([_()],M.prototype,"_accumulationRenderer",void 0),e([_()],M.prototype,"_isRefining",null),e([_()],M.prototype,"_isActive",null),e([_()],M.prototype,"canAccumulate",null),e([_()],M.prototype,"_isDoneAccumulating",null),e([_()],M.prototype,"_opacityFromElevation",null),e([_()],M.prototype,"running",null),M=e([u("esri.views.3d.webgl-engine.lib.ShadowAccumulator")],M);const U=6,L="renderView",O=104729,k=new Uint8Array(4);export{M as ShadowAccumulator};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{disposeMaybe as s}from"../../../../core/maybe.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{g as r,c as o}from"../../../../chunks/vec4.js";import{createQuadVAO as n}from"./glUtil3D.js";import{S as h}from"../../../../chunks/ShadowCastVisualize.glsl.js";import{ShadowCastVisualizeTechnique as _}from"../shaders/ShadowCastVisualizeTechnique.js";import{ShadowCastVisualizeTechniqueConfiguration as l,ShadowCastVisualization as u}from"../shaders/ShadowCastVisualizeTechniqueConfiguration.js";import{vertexCount as d}from"../../../webgl/Util.js";const c=4e4,p=5e4,m=1/512;let b=class extends t{constructor(e,t,s,i){super({}),this._techniqueRepository=e,this._rctx=t,this._data=s,this._requestRender=i,this._passParameters=new h(this._data
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{disposeMaybe as s}from"../../../../core/maybe.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{g as r,c as o}from"../../../../chunks/vec4.js";import{createQuadVAO as n}from"./glUtil3D.js";import{S as h}from"../../../../chunks/ShadowCastVisualize.glsl.js";import{ShadowCastVisualizeTechnique as _}from"../shaders/ShadowCastVisualizeTechnique.js";import{ShadowCastVisualizeTechniqueConfiguration as l,ShadowCastVisualization as u}from"../shaders/ShadowCastVisualizeTechniqueConfiguration.js";import{vertexCount as d}from"../../../webgl/Util.js";const c=4e4,p=5e4,m=1/512;let b=class extends t{constructor(e,t,s,i){super({}),this._techniqueRepository=e,this._rctx=t,this._data=s,this._requestRender=i,this._passParameters=new h(this._data),this._techniqueConfig=new l,this._enabled=!1,this._vao=n(t),this._techniqueConfig.visualization=u.Gradient}normalizeCtorArgs(){return{}}dispose(){this._stop(),this._vao=s(this._vao),this._techniqueRepository.release(this._technique),this._technique=null}get _visualizeShadowCastTechnique(){return this._technique=this._techniqueRepository.releaseAndAcquire(_,this._techniqueConfig,this._technique),this._technique}render(e){if(!this._showVisualization)return;this._passParameters.sampleScale=1/this._data.computedSamples;const t=this._visualizeShadowCastTechnique;this._rctx.bindVAO(this._vao),this._rctx.bindTechnique(t,this._passParameters,e),this._rctx.drawArrays(t.primitiveType,0,d(this._vao,"geometry"))}setOptions(e){void 0!==e.enabled&&this._setEnabled(e.enabled),void 0!==e.color&&this._setColor(e.color),void 0!==e.threshold&&(this._threshold=e.threshold),void 0!==e.visualization&&(this._visualization=e.visualization),void 0!==e.bandSize&&(this._bandSize=e.bandSize),void 0!==e.bandsEnabled&&(this._bandsEnabled=e.bandsEnabled)}get opacityFromElevation(){return this._passParameters.opacityFromElevation}set opacityFromElevation(e){this._passParameters.opacityFromElevation!==e&&(this._passParameters.opacityFromElevation=e,this.notifyChange("opacityFromElevation"))}get _showVisualization(){return this._enabled&&this._data.computedSamples>0&&this.opacityFromElevation>m}get _threshold(){return this._passParameters.threshold}set _threshold(e){this._threshold!==e&&(this._passParameters.threshold=e,this._requestRenderIfRunning())}get _visualization(){return this._techniqueConfig.visualization}set _visualization(e){e!==this._visualization&&(this._techniqueConfig.visualization=e,this._techniqueRepository.release(this._technique),this._technique=null,this._requestRenderIfRunning())}get _bandSize(){return this._passParameters.bandSize}set _bandSize(e){e!==this._bandSize&&(this._passParameters.bandSize=e,this._requestRenderIfRunning())}get _bandsEnabled(){return this._techniqueConfig.bandsEnabled}set _bandsEnabled(e){e!==this._bandsEnabled&&(this._techniqueConfig.bandsEnabled=e,this._techniqueRepository.release(this._technique),this._technique=null,this._requestRenderIfRunning())}_setColor(e){const t=this._passParameters.color;r(e,t)||(o(this._passParameters.color,e),this._requestRenderIfRunning())}_setEnabled(e){e!==this._enabled&&(e?this._start():this._stop())}_requestRenderIfRunning(){this._enabled&&this._requestRender()}_start(){this._enabled=!0,this._requestRender()}_stop(){this._enabled=!1,this._requestRender()}};e([i()],b.prototype,"opacityFromElevation",null),b=e([a("esri.views.3d.webgl-engine.lib.ShadowCastRenderer")],b);export{b as ShadowCastRenderer,p as shadowCastDisableElevationMax,c as shadowCastDisableElevationMin,m as shadowCastDisabledElevationThreshold};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import has from"../../../../core/has.js";import{clamp as t,lerp as s,acosClamped as e}from"../../../../core/mathUtils.js";import{disposeMaybe as i}from"../../../../core/maybe.js";import{c as a}from"../../../../chunks/mat3f64.js";import{w as r,m as h,a as n,u as c}from"../../../../chunks/mat4.js";import{c as o}from"../../../../chunks/mat4f64.js";import{s as u,j as _,b as m,l as d,k as l,a as p,h as f,n as x,f as g,c as w}from"../../../../chunks/vec2.js";import{a as M}from"../../../../chunks/vec2f64.js";import{k as b,c as T,o as S,m as C,s as j}from"../../../../chunks/vec3.js";import{c as y}from"../../../../chunks/vec3f64.js";import{s as D,t as v}from"../../../../chunks/vec4.js";import{c as z}from"../../../../chunks/vec4f64.js";import{ViewingMode as E}from"../../../ViewingMode.js";import{CascadeCamera as O}from"./CascadeCamera.js";import{applyTextureResizeModulo as R}from"./textureUtils.js";import{assert as H,logWithBase as U,verify as F,rayRay2D as N}from"./Util.js";import{TextureType as Q,ClearBufferBit as A,TextureWrapMode as k,TextureSamplingMode as L,RenderbufferFormat as V}from"../../../webgl/enums.js";import{FramebufferObject as I}from"../../../webgl/FramebufferObject.js";import{RenderbufferDescriptor as P}from"../../../webgl/RenderbufferDescriptor.js";import{Texture as B}from"../../../webgl/Texture.js";import{TextureDescriptor as G}from"../../../webgl/TextureDescriptor.js";var X;!function(t){t[t.Highlight=0]="Highlight",t[t.Default=1]="Default"}(X||(X={}));class q{constructor(){this.camera=new O,this.lightMat=o()}}class W{constructor(){this.maxNumCascadesHighQuality=4,this.maxNumCascadesLowQuality=4,this.textureSizeModHighQuality=1,this.textureSizeModLowQuality=.8,this.splitSchemeLambda=0}}class J{get depthTexture(){return this._fbo?.colorTexture}get textureSize(){return this._textureSize}get numCascades(){return this._numCascades}get cascadeDistances(){return D(this._usedCascadeDistances,this._cascadeDistances[0],this._numCascades>1?this._cascadeDistances[1]:1/0,this._numCascades>2?this._cascadeDistances[2]:1/0,this._numCascades>3?this._cascadeDistances[3]:1/0)}constructor(t,s){this._rctx=t,this._viewingMode=s,this._enabled=!1,this._snapshots=new Array,this._textureSize=0,this._numCascades=1,this._renderHighQuality=!0,this.settings=new W,this._projectionView=o(),this._projectionViewInverse=o(),this._modelViewLight=o(),this._cascadeDistances=[0,0,0,0,0],this._usedCascadeDistances=z(),this._cascades=[new q,new q,new q,new q],this._lastOrigin=null,this._maxTextureSize=Math.min(has("esri-mobile")?2048:8192,this._rctx.parameters.maxTextureSize)}dispose(){this.enabled=!1,this.disposeOffscreenBuffers()}disposeOffscreenBuffers(){this._discardDepthTexture(),this._discardAllSnapshots()}set maxCascades(s){this.settings.maxNumCascadesHighQuality=t(Math.floor(s),1,4)}get maxCascades(){return this.settings.maxNumCascadesHighQuality}set enabled(t){this._enabled=t,t||(this._discardDepthTexture(),this._discardAllSnapshots())}get enabled(){return this._enabled}get ready(){return this._enabled&&null!=this.depthTexture}getSnapshot(t){return this.enabled?this._snapshots[t]:null}get cascades(){for(let t=0;t<this._numCascades;++t)rt[t]=this._cascades[t];return rt.length=this._numCascades,rt}start(t,s,e,i){H(this.enabled),this._renderHighQuality=i,this._textureSize=this._computeTextureSize(t),this._ensureDepthTexture();const{near:a,far:r}=this._clampNearFar(e);this._computeCascadeDistances(r,a),this._setupMatrices(t,s);const{viewMatrix:h,projectionMatrix:n}=t;for(let c=0;c<this._numCascades;++c)this._constructCascade(c,n,h,s);this._lastOrigin=null,this.clear()}finish(t){H(this.enabled),this._rctx.bindFramebuffer(t)}getShadowMapMatrices(t){if(!this._lastOrigin||!b(t,this._lastOrigin)){this._lastOrigin=this._lastOrigin||y(),T(this._lastOrigin,t);for(let s=0;s<this._numCascades;++s){r(ht,this._cascades[s].lightMat,t);for(let t=0;t<16;++t)nt[16*s+t]=ht[t]}}return nt}takeCascadeSnapshotTo(t,s){H(this.enabled);const e=this._ensureSnapshot(s);this._bindFbo();const i=this._rctx,a=i.bindTexture(e,B.TEXTURE_UNIT_FOR_UPDATES);i.gl.copyTexSubImage2D(Q.TEXTURE_2D,0,t.camera.viewport[0],t.camera.viewport[1],t.camera.viewport[0],t.camera.viewport[1],t.camera.viewport[2],t.camera.viewport[3]),i.bindTexture(a,B.TEXTURE_UNIT_FOR_UPDATES)}clear(){const t=this._rctx;this._bindFbo(),t.setClearColor(1,1,1,1),t.clearSafe(A.COLOR_BUFFER_BIT|A.DEPTH_BUFFER_BIT)}_computeTextureSize(t){const s=R(Math.max(t.fullWidth,t.fullHeight)/t.pixelRatio),e=this._renderHighQuality?this.settings.textureSizeModHighQuality:this.settings.textureSizeModLowQuality,i=Math.floor(Math.min(this._maxTextureSize,(1===this.numCascades?1:2)*s)*e);return Math.min(i,this._rctx.parameters.maxTextureSize)}_ensureDepthTexture(){if(this.depthTexture&&this.depthTexture.descriptor.width===this._textureSize)return;this._discardDepthTexture();const t=new G(this._textureSize);t.wrapMode=k.CLAMP_TO_EDGE,t.samplingMode=L.NEAREST,this._fbo=new I(this._rctx,t,new P(V.DEPTH_COMPONENT16,this._textureSize))}_ensureSnapshot(t){let s=this._snapshots[t];if(null!=s&&s.descriptor.width===this._textureSize)return s;this._discardSnapshot(t);const e=new G;return e.wrapMode=k.CLAMP_TO_EDGE,e.samplingMode=L.NEAREST,e.width=this._textureSize,e.height=this._textureSize,s=new B(this._rctx,e),this._snapshots[t]=s,s}_discardDepthTexture(){this._fbo=i(this._fbo)}_discardSnapshot(t){this._snapshots[t]=i(this._snapshots[t])}_discardAllSnapshots(){for(let t=0;t<this._snapshots.length;++t)this._discardSnapshot(t);this._snapshots.length=0}_bindFbo(){const t=this._rctx;t.unbindTexture(this.depthTexture),t.bindFramebuffer(this._fbo)}_constructCascade(t,s,e,i){const a=this._cascades[t],n=-this._cascadeDistances[t],c=-this._cascadeDistances[t+1],o=(s[10]*n+s[14])/Math.abs(s[11]*n+s[15]),u=(s[10]*c+s[14])/Math.abs(s[11]*c+s[15]);H(o<u);for(let r=0;r<8;++r){D(Y,r%4==0||r%4==3?-1:1,r%4==0||r%4==1?-1:1,r<4?o:u,1);const t=Z[r];v(t,Y,this._projectionViewInverse),t[0]/=t[3],t[1]/=t[3],t[2]/=t[3]}S(at,Z[0]),a.camera.viewMatrix=r(K,this._modelViewLight,at);for(let r=0;r<8;++r)C(Z[r],Z[r],a.camera.viewMatrix);let _=Z[0][2],m=Z[0][2];for(let r=1;r<8;++r)_=Math.min(_,Z[r][2]),m=Math.max(m,Z[r][2]);_-=200,m+=200,a.camera.near=-m,a.camera.far=-_,jt(e,i,_,m,a.camera),h(a.lightMat,a.camera.projectionMatrix,a.camera.viewMatrix);const d=this._textureSize/(1===this.numCascades?1:2);a.camera.viewport=[t%2==0?0:d,0===Math.floor(t/2)?0:d,d,d]}_setupMatrices(t,s){h(this._projectionView,t.projectionMatrix,t.viewMatrix),n(this._projectionViewInverse,this._projectionView);const e=this._viewingMode===E.Global?t.eye:j(at,0,0,1);c(this._modelViewLight,[0,0,0],[-s[0],-s[1],-s[2]],e)}_clampNearFar(t){let{near:s,far:e}=t;return s<2&&(s=2),e<2&&(e=2),s>=e&&(s=2,e=4),{near:s,far:e}}_computeCascadeDistances(t,e){const i=this._renderHighQuality?this.settings.maxNumCascadesHighQuality:this.settings.maxNumCascadesLowQuality;this._numCascades=Math.min(1+Math.floor(U(t/e,4)),i);const a=(t-e)/this._numCascades,r=(t/e)**(1/this._numCascades);let h=e,n=e;for(let c=0;c<this._numCascades+1;++c)this._cascadeDistances[c]=s(h,n,this.settings.splitSchemeLambda),h*=r,n+=a}get gpuMemoryUsage(){return this._snapshots.reduce(((t,s)=>t+(s?.gpuMemoryUsage??0)),this._fbo?.gpuMemoryUsage??0)}get test(){return{cascades:this._cascades,textureSize:this._textureSize}}}const K=o(),Y=z(),Z=[];for(let yt=0;yt<8;++yt)Z.push(z());const $=M(),tt=M(),st=M(),et=M(),it=M(),at=y(),rt=[],ht=o(),nt=new Array(64),ct=M(),ot=M(),ut=[M(),M(),M(),M()],_t=M(),mt=M(),dt=M(),lt=M(),pt=M(),ft=M(),xt=M();function gt(t,s,e,i,a,r,h,n){u(ct,0,0);for(let u=0;u<4;++u)_(ct,ct,t[u]);m(ct,ct,.25),u(ot,0,0);for(let u=4;u<8;++u)_(ot,ot,t[u]);m(ot,ot,.25),d(ut[0],t[4],t[5],.5),d(ut[1],t[5],t[6],.5),d(ut[2],t[6],t[7],.5),d(ut[3],t[7],t[4],.5);let c=0,o=l(ut[0],ct);for(let u=1;u<4;++u){const t=l(ut[u],ct);t<o&&(o=t,c=u)}p(_t,ut[c],t[c+4]);const M=_t[0];let b,T;_t[0]=-_t[1],_t[1]=M,p(mt,ot,ct),f(mt,_t)<0&&x(_t,_t),d(_t,_t,mt,e),g(_t,_t),b=T=f(p(dt,t[0],ct),_t);for(let u=1;u<8;++u){const s=f(p(dt,t[u],ct),_t);s<b?b=s:s>T&&(T=s)}w(i,ct),m(dt,_t,b-s),_(i,i,dt);let S=-1,C=1,j=0,y=0;for(let u=0;u<8;++u){p(lt,t[u],i),g(lt,lt);const s=_t[0]*lt[1]-_t[1]*lt[0];s>0?s>S&&(S=s,j=u):s<C&&(C=s,y=u)}F(S>0,"leftArea"),F(C<0,"rightArea"),m(pt,_t,b),_(pt,pt,ct),m(ft,_t,T),_(ft,ft,ct),xt[0]=-_t[1],xt[1]=_t[0];const D=N(i,t[y],ft,_(dt,ft,xt),1,a),v=N(i,t[j],ft,dt,1,r),z=N(i,t[j],pt,_(dt,pt,xt),1,h),E=N(i,t[y],pt,dt,1,n);F(D,"rayRay"),F(v,"rayRay"),F(z,"rayRay"),F(E,"rayRay")}function wt(t,s){return 3*s+t}const Mt=M();function bt(t,s){return u(Mt,t[s],t[s+3]),Mt}const Tt=M(),St=a();function Ct(t,s,e,i,a){p(Tt,e,i),m(Tt,Tt,.5),St[0]=Tt[0],St[1]=Tt[1],St[2]=0,St[3]=Tt[1],St[4]=-Tt[0],St[5]=0,St[6]=Tt[0]*Tt[0]+Tt[1]*Tt[1],St[7]=Tt[0]*Tt[1]-Tt[1]*Tt[0],St[8]=1,St[wt(0,2)]=-f(bt(St,0),t),St[wt(1,2)]=-f(bt(St,1),t);let r=f(bt(St,0),e)+St[wt(0,2)],h=f(bt(St,1),e)+St[wt(1,2)],n=f(bt(St,0),i)+St[wt(0,2)],c=f(bt(St,1),i)+St[wt(1,2)];r=-(r+n)/(h+c),St[wt(0,0)]+=St[wt(1,0)]*r,St[wt(0,1)]+=St[wt(1,1)]*r,St[wt(0,2)]+=St[wt(1,2)]*r,r=1/(f(bt(St,0),e)+St[wt(0,2)]),h=1/(f(bt(St,1),e)+St[wt(1,2)]),St[wt(0,0)]*=r,St[wt(0,1)]*=r,St[wt(0,2)]*=r,St[wt(1,0)]*=h,St[wt(1,1)]*=h,St[wt(1,2)]*=h,St[wt(2,0)]=St[wt(1,0)],St[wt(2,1)]=St[wt(1,1)],St[wt(2,2)]=St[wt(1,2)],St[wt(1,2)]+=1,r=f(bt(St,1),s)+St[wt(1,2)],h=f(bt(St,2),s)+St[wt(2,2)],n=f(bt(St,1),e)+St[wt(1,2)],c=f(bt(St,2),e)+St[wt(2,2)],r=-.5*(r/h+n/c),St[wt(1,0)]+=St[wt(2,0)]*r,St[wt(1,1)]+=St[wt(2,1)]*r,St[wt(1,2)]+=St[wt(2,2)]*r,r=f(bt(St,1),s)+St[wt(1,2)],h=f(bt(St,2),s)+St[wt(2,2)],n=-h/r,St[wt(1,0)]*=n,St[wt(1,1)]*=n,St[wt(1,2)]*=n,a[0]=St[0],a[1]=St[1],a[2]=0,a[3]=St[2],a[4]=St[3],a[5]=St[4],a[6]=0,a[7]=St[5],a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=St[6],a[13]=St[7],a[14]=0,a[15]=St[8]}function jt(t,s,i,a,r){const h=1/Z[0][3],n=1/Z[4][3];H(h<n);let c=h+Math.sqrt(h*n);const o=Math.sin(e(t[2]*s[0]+t[6]*s[1]+t[10]*s[2]));c/=o,gt(Z,c,o,$,tt,st,et,it),Ct($,tt,et,it,r.projectionMatrix),r.projectionMatrix[10]=2/(i-a),r.projectionMatrix[14]=-(i+a)/(i-a)}export{J as ShadowMap,X as SnapshotSlot};
|
|
5
|
+
import has from"../../../../core/has.js";import{clamp as t,lerp as s,acosClamped as e}from"../../../../core/mathUtils.js";import{disposeMaybe as i}from"../../../../core/maybe.js";import{c as a}from"../../../../chunks/mat3f64.js";import{w as r,m as n,a as h,u as o}from"../../../../chunks/mat4.js";import{c}from"../../../../chunks/mat4f64.js";import{s as u,j as m,b as _,l,k as d,a as p,h as f,n as x,f as g,c as w}from"../../../../chunks/vec2.js";import{a as M}from"../../../../chunks/vec2f64.js";import{k as b,c as S,o as C,m as T,s as j}from"../../../../chunks/vec3.js";import{c as y}from"../../../../chunks/vec3f64.js";import{s as D,t as v}from"../../../../chunks/vec4.js";import{c as z}from"../../../../chunks/vec4f64.js";import{ViewingMode as E}from"../../../ViewingMode.js";import{CascadeCamera as O}from"./CascadeCamera.js";import{applyTextureResizeModulo as R}from"./textureUtils.js";import{assert as H,logWithBase as U,verify as F,rayRay2D as N}from"./Util.js";import{TextureType as Q,ClearBufferBit as k,TextureWrapMode as A,TextureSamplingMode as L,RenderbufferFormat as V}from"../../../webgl/enums.js";import{FramebufferObject as I}from"../../../webgl/FramebufferObject.js";import{RenderbufferDescriptor as P}from"../../../webgl/RenderbufferDescriptor.js";import{Texture as B}from"../../../webgl/Texture.js";import{TextureDescriptor as G}from"../../../webgl/TextureDescriptor.js";var X;!function(t){t[t.Highlight=0]="Highlight",t[t.Default=1]="Default"}(X||(X={}));class q{constructor(){this.camera=new O,this.lightMat=c()}}class W{constructor(){this.maxNumCascadesHighQuality=4,this.maxNumCascadesLowQuality=4,this.textureSizeModHighQuality=1.3,this.textureSizeModLowQuality=.9,this.splitSchemeLambda=0}}class J{get depthTexture(){return this._fbo?.colorTexture}get textureSize(){return this._textureSize}get numCascades(){return this._numCascades}get cascadeDistances(){return D(this._usedCascadeDistances,this._cascadeDistances[0],this._numCascades>1?this._cascadeDistances[1]:1/0,this._numCascades>2?this._cascadeDistances[2]:1/0,this._numCascades>3?this._cascadeDistances[3]:1/0)}constructor(t,s){this._rctx=t,this._viewingMode=s,this._enabled=!1,this._snapshots=new Array,this._textureSize=0,this._numCascades=1,this._renderHighQuality=!0,this.settings=new W,this._projectionView=c(),this._projectionViewInverse=c(),this._modelViewLight=c(),this._cascadeDistances=[0,0,0,0,0],this._usedCascadeDistances=z(),this._cascades=[new q,new q,new q,new q],this._lastOrigin=null,this._maxTextureSize=Math.min(has("esri-mobile")?2048:8192,this._rctx.parameters.maxTextureSize)}dispose(){this.enabled=!1,this.disposeOffscreenBuffers()}disposeOffscreenBuffers(){this._fbo=i(this._fbo),this._discardAllSnapshots()}set maxCascades(s){this.settings.maxNumCascadesHighQuality=t(Math.floor(s),1,4)}get maxCascades(){return this.settings.maxNumCascadesHighQuality}set enabled(t){this._enabled=t,t||this.disposeOffscreenBuffers()}get enabled(){return this._enabled}get ready(){return this._enabled&&null!=this.depthTexture}getSnapshot(t){return this.enabled?this._snapshots[t]:null}get cascades(){for(let t=0;t<this._numCascades;++t)rt[t]=this._cascades[t];return rt.length=this._numCascades,rt}start(t,s,e,i,a){H(this.enabled),this._renderHighQuality=i,this._textureSize=this._computeTextureSize(t,a),this._ensureDepthTexture();const{near:r,far:n}=this._clampNearFar(e);this._computeCascadeDistances(n,r),this._setupMatrices(t,s);const{viewMatrix:h,projectionMatrix:o}=t;for(let c=0;c<this._numCascades;++c)this._constructCascade(c,o,h,s);this._lastOrigin=null,this.clear()}finish(t){H(this.enabled),this._rctx.bindFramebuffer(t)}getShadowMapMatrices(t){if(!this._lastOrigin||!b(t,this._lastOrigin)){this._lastOrigin=this._lastOrigin||y(),S(this._lastOrigin,t);for(let s=0;s<this._numCascades;++s){r(nt,this._cascades[s].lightMat,t);for(let t=0;t<16;++t)ht[16*s+t]=nt[t]}}return ht}takeCascadeSnapshotTo(t,s){H(this.enabled);const e=this._ensureSnapshot(s);this._bindFbo();const i=this._rctx,a=i.bindTexture(e,B.TEXTURE_UNIT_FOR_UPDATES);i.gl.copyTexSubImage2D(Q.TEXTURE_2D,0,t.camera.viewport[0],t.camera.viewport[1],t.camera.viewport[0],t.camera.viewport[1],t.camera.viewport[2],t.camera.viewport[3]),i.bindTexture(a,B.TEXTURE_UNIT_FOR_UPDATES)}clear(){const t=this._rctx;this._bindFbo(),t.setClearColor(1,1,1,1),t.clearSafe(k.COLOR_BUFFER_BIT|k.DEPTH_BUFFER_BIT)}_computeTextureSize(t,s){const e=Math.min(window.devicePixelRatio,s)/t.pixelRatio,i=R(Math.max(t.fullWidth,t.fullHeight)*e),a=this._renderHighQuality?this.settings.textureSizeModHighQuality:this.settings.textureSizeModLowQuality,r=Math.floor(Math.min(this._maxTextureSize,(1===this.numCascades?1:2)*i)*a);return Math.min(r,this._rctx.parameters.maxTextureSize)}_ensureDepthTexture(){if(this._fbo?.width===this._textureSize)return;const t=new G(this._textureSize);t.wrapMode=A.CLAMP_TO_EDGE,t.samplingMode=L.NEAREST,this._fbo?.dispose(),this._fbo=new I(this._rctx,t,new P(V.DEPTH_COMPONENT16,this._textureSize))}_ensureSnapshot(t){let s=this._snapshots[t];if(null!=s&&s.descriptor.width===this._textureSize)return s;this._discardSnapshot(t);const e=new G;return e.wrapMode=A.CLAMP_TO_EDGE,e.samplingMode=L.NEAREST,e.width=this._textureSize,e.height=this._textureSize,s=new B(this._rctx,e),this._snapshots[t]=s,s}_discardSnapshot(t){this._snapshots[t]=i(this._snapshots[t])}_discardAllSnapshots(){for(let t=0;t<this._snapshots.length;++t)this._discardSnapshot(t);this._snapshots.length=0}_bindFbo(){const t=this._rctx;t.unbindTexture(this.depthTexture),t.bindFramebuffer(this._fbo)}_constructCascade(t,s,e,i){const a=this._cascades[t],h=-this._cascadeDistances[t],o=-this._cascadeDistances[t+1],c=(s[10]*h+s[14])/Math.abs(s[11]*h+s[15]),u=(s[10]*o+s[14])/Math.abs(s[11]*o+s[15]);H(c<u);for(let r=0;r<8;++r){D(Y,r%4==0||r%4==3?-1:1,r%4==0||r%4==1?-1:1,r<4?c:u,1);const t=Z[r];v(t,Y,this._projectionViewInverse),t[0]/=t[3],t[1]/=t[3],t[2]/=t[3]}C(at,Z[0]),a.camera.viewMatrix=r(K,this._modelViewLight,at);for(let r=0;r<8;++r)T(Z[r],Z[r],a.camera.viewMatrix);let m=Z[0][2],_=Z[0][2];for(let r=1;r<8;++r)m=Math.min(m,Z[r][2]),_=Math.max(_,Z[r][2]);m-=200,_+=200,a.camera.near=-_,a.camera.far=-m,jt(e,i,m,_,a.camera),n(a.lightMat,a.camera.projectionMatrix,a.camera.viewMatrix);const l=this._textureSize/(1===this.numCascades?1:2);a.camera.viewport=[t%2==0?0:l,0===Math.floor(t/2)?0:l,l,l]}_setupMatrices(t,s){n(this._projectionView,t.projectionMatrix,t.viewMatrix),h(this._projectionViewInverse,this._projectionView);const e=this._viewingMode===E.Global?t.eye:j(at,0,0,1);o(this._modelViewLight,[0,0,0],[-s[0],-s[1],-s[2]],e)}_clampNearFar(t){let{near:s,far:e}=t;return s<2&&(s=2),e<2&&(e=2),s>=e&&(s=2,e=4),{near:s,far:e}}_computeCascadeDistances(t,e){const i=this._renderHighQuality?this.settings.maxNumCascadesHighQuality:this.settings.maxNumCascadesLowQuality;this._numCascades=Math.min(1+Math.floor(U(t/e,4)),i);const a=(t-e)/this._numCascades,r=(t/e)**(1/this._numCascades);let n=e,h=e;for(let o=0;o<this._numCascades+1;++o)this._cascadeDistances[o]=s(n,h,this.settings.splitSchemeLambda),n*=r,h+=a}get gpuMemoryUsage(){return this._snapshots.reduce(((t,s)=>t+(s?.gpuMemoryUsage??0)),this._fbo?.gpuMemoryUsage??0)}get test(){return{cascades:this._cascades,textureSize:this._textureSize}}}const K=c(),Y=z(),Z=[];for(let yt=0;yt<8;++yt)Z.push(z());const $=M(),tt=M(),st=M(),et=M(),it=M(),at=y(),rt=[],nt=c(),ht=new Array(64),ot=M(),ct=M(),ut=[M(),M(),M(),M()],mt=M(),_t=M(),lt=M(),dt=M(),pt=M(),ft=M(),xt=M();function gt(t,s,e,i,a,r,n,h){u(ot,0,0);for(let u=0;u<4;++u)m(ot,ot,t[u]);_(ot,ot,.25),u(ct,0,0);for(let u=4;u<8;++u)m(ct,ct,t[u]);_(ct,ct,.25),l(ut[0],t[4],t[5],.5),l(ut[1],t[5],t[6],.5),l(ut[2],t[6],t[7],.5),l(ut[3],t[7],t[4],.5);let o=0,c=d(ut[0],ot);for(let u=1;u<4;++u){const t=d(ut[u],ot);t<c&&(c=t,o=u)}p(mt,ut[o],t[o+4]);const M=mt[0];let b,S;mt[0]=-mt[1],mt[1]=M,p(_t,ct,ot),f(_t,mt)<0&&x(mt,mt),l(mt,mt,_t,e),g(mt,mt),b=S=f(p(lt,t[0],ot),mt);for(let u=1;u<8;++u){const s=f(p(lt,t[u],ot),mt);s<b?b=s:s>S&&(S=s)}w(i,ot),_(lt,mt,b-s),m(i,i,lt);let C=-1,T=1,j=0,y=0;for(let u=0;u<8;++u){p(dt,t[u],i),g(dt,dt);const s=mt[0]*dt[1]-mt[1]*dt[0];s>0?s>C&&(C=s,j=u):s<T&&(T=s,y=u)}F(C>0,"leftArea"),F(T<0,"rightArea"),_(pt,mt,b),m(pt,pt,ot),_(ft,mt,S),m(ft,ft,ot),xt[0]=-mt[1],xt[1]=mt[0];const D=N(i,t[y],ft,m(lt,ft,xt),1,a),v=N(i,t[j],ft,lt,1,r),z=N(i,t[j],pt,m(lt,pt,xt),1,n),E=N(i,t[y],pt,lt,1,h);F(D,"rayRay"),F(v,"rayRay"),F(z,"rayRay"),F(E,"rayRay")}function wt(t,s){return 3*s+t}const Mt=M();function bt(t,s){return u(Mt,t[s],t[s+3]),Mt}const St=M(),Ct=a();function Tt(t,s,e,i,a){p(St,e,i),_(St,St,.5),Ct[0]=St[0],Ct[1]=St[1],Ct[2]=0,Ct[3]=St[1],Ct[4]=-St[0],Ct[5]=0,Ct[6]=St[0]*St[0]+St[1]*St[1],Ct[7]=St[0]*St[1]-St[1]*St[0],Ct[8]=1,Ct[wt(0,2)]=-f(bt(Ct,0),t),Ct[wt(1,2)]=-f(bt(Ct,1),t);let r=f(bt(Ct,0),e)+Ct[wt(0,2)],n=f(bt(Ct,1),e)+Ct[wt(1,2)],h=f(bt(Ct,0),i)+Ct[wt(0,2)],o=f(bt(Ct,1),i)+Ct[wt(1,2)];r=-(r+h)/(n+o),Ct[wt(0,0)]+=Ct[wt(1,0)]*r,Ct[wt(0,1)]+=Ct[wt(1,1)]*r,Ct[wt(0,2)]+=Ct[wt(1,2)]*r,r=1/(f(bt(Ct,0),e)+Ct[wt(0,2)]),n=1/(f(bt(Ct,1),e)+Ct[wt(1,2)]),Ct[wt(0,0)]*=r,Ct[wt(0,1)]*=r,Ct[wt(0,2)]*=r,Ct[wt(1,0)]*=n,Ct[wt(1,1)]*=n,Ct[wt(1,2)]*=n,Ct[wt(2,0)]=Ct[wt(1,0)],Ct[wt(2,1)]=Ct[wt(1,1)],Ct[wt(2,2)]=Ct[wt(1,2)],Ct[wt(1,2)]+=1,r=f(bt(Ct,1),s)+Ct[wt(1,2)],n=f(bt(Ct,2),s)+Ct[wt(2,2)],h=f(bt(Ct,1),e)+Ct[wt(1,2)],o=f(bt(Ct,2),e)+Ct[wt(2,2)],r=-.5*(r/n+h/o),Ct[wt(1,0)]+=Ct[wt(2,0)]*r,Ct[wt(1,1)]+=Ct[wt(2,1)]*r,Ct[wt(1,2)]+=Ct[wt(2,2)]*r,r=f(bt(Ct,1),s)+Ct[wt(1,2)],n=f(bt(Ct,2),s)+Ct[wt(2,2)],h=-n/r,Ct[wt(1,0)]*=h,Ct[wt(1,1)]*=h,Ct[wt(1,2)]*=h,a[0]=Ct[0],a[1]=Ct[1],a[2]=0,a[3]=Ct[2],a[4]=Ct[3],a[5]=Ct[4],a[6]=0,a[7]=Ct[5],a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=Ct[6],a[13]=Ct[7],a[14]=0,a[15]=Ct[8]}function jt(t,s,i,a,r){const n=1/Z[0][3],h=1/Z[4][3];H(n<h);let o=n+Math.sqrt(n*h);const c=Math.sin(e(t[2]*s[0]+t[6]*s[1]+t[10]*s[2]));o/=c,gt(Z,o,c,$,tt,st,et,it),Tt($,tt,et,it,r.projectionMatrix),r.projectionMatrix[10]=2/(i-a),r.projectionMatrix[14]=-(i+a)/(i-a)}export{J as ShadowMap,X as SnapshotSlot};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{glLayout as
|
|
5
|
+
import{glLayout as r}from"../../../support/buffer/glUtil.js";import{Default3D as t}from"../DefaultVertexAttributeLocations.js";import{GLMaterials as e}from"../GLMaterials.js";import{newIntersectorResult as s}from"../Intersector.js";import{IntersectorType as o,StoreResults as i}from"../IntersectorInterfaces.js";import{VertexArrayObject as a}from"../VertexArrayObject.js";import{LodTarget as n}from"./Intersector.js";import{BufferObject as m}from"../../../../webgl/BufferObject.js";import{Usage as l}from"../../../../webgl/enums.js";class u{constructor(s,o){const i=s.renderContext.rctx,n=o.geometry;this._materialRepository=s.materialRepository,n.material.setParameters({instancedDoublePrecision:!0});const u=n.material.createBufferWriter(),f=u.vertexBufferLayout,d=u.elementCount(n),p=f.createBuffer(d);u.write(null,null,n,p,0),this.geometry=n,this.material=n.material,this.glMaterials=new e(n.material,this._materialRepository),this.vertexBufferLayout=f,this.vbo=m.createVertex(i,l.STATIC_DRAW,p.buffer),this.vao=new a(i,t,{geometry:r(f)},{geometry:this.vbo}),this.vertexCount=d}destroy(){this.glMaterials.destroy(),this.vbo.dispose(),this.vao.dispose()}get boundingInfo(){return this.geometry.boundingInfo}get triangleCount(){return this.vertexCount/3}intersect(r,t,e,a,m,l,u,f){const d=this.geometry.id;this.material.intersect(this.geometry,r.transform.transform,r,e,a,((e,a,p,c,y)=>{if(e>=0){if(null!=t&&!t(r.rayBegin,r.rayEnd,e))return;const c=new n(l.layerUid,l.graphicUid(m),d,p,u,f);if((null==r.results.min.drapedLayerOrder||y>=r.results.min.drapedLayerOrder)&&(null==r.results.min.dist||e<r.results.min.dist)&&r.results.min.set(o.LOD,c,e,a,r.transform.transform,y),r.options.store!==i.MIN&&(null==r.results.max.drapedLayerOrder||y>=r.results.max.drapedLayerOrder)&&(null==r.results.max.dist||e>r.results.max.dist)&&r.results.max.set(o.LOD,c,e,a,r.transform.transform,y),r.options.store===i.ALL){const t=s(r.results.min.ray);t.set(o.LOD,c,e,a,r.transform.transform,y),r.results.all.push(t)}}}))}}export{u as LodComponentData};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{VertexAttribute as t}from"../lib/VertexAttribute.js";import{writeDefaultAttributes as e}from"./internal/bufferWriterUtils.js";class r{constructor(t){this.vertexBufferLayout=t}
|
|
5
|
+
import{VertexAttribute as t}from"../lib/VertexAttribute.js";import{writeDefaultAttributes as e}from"./internal/bufferWriterUtils.js";class r{constructor(t){this.vertexBufferLayout=t}elementCount(e){return e.indices.get(t.POSITION).length}write(t,r,i,o,s){e(i,this.vertexBufferLayout,t,r,o,s)}}export{r as DefaultBufferWriter};
|