@arcgis/core 5.0.0-next.34 → 5.0.0-next.36
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/applications/Components/SketchTooltipControls.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/06462b267ff8d5984882.js +1 -0
- package/assets/esri/core/workers/chunks/{b48bb38e5d60fc7a9097.js → 08ef90e3fcfd4eda4301.js} +1 -1
- package/assets/esri/core/workers/chunks/0a58b57e1777a8b0ea23.js +1 -0
- package/assets/esri/core/workers/chunks/{7115c52e22b7becff8de.js → 103153951ba312dc5e9e.js} +1 -1
- package/assets/esri/core/workers/chunks/15c1a48e8cd2a8882d85.js +1 -0
- package/assets/esri/core/workers/chunks/{f55328aabf84770c8e6a.js → 1817cf11e85afca947d3.js} +1 -1
- package/assets/esri/core/workers/chunks/{1dd867fa7c58c06b79ea.js → 1bacdd17e199e22b5cd1.js} +1 -1
- package/assets/esri/core/workers/chunks/20e4243ea563d05a5256.js +1 -0
- package/assets/esri/core/workers/chunks/234ffd08c2be03a0b9fe.js +1 -0
- package/assets/esri/core/workers/chunks/24a3c6f0154787968724.js +1 -0
- package/assets/esri/core/workers/chunks/{fafbacf2467e6883b6c9.js → 28db329528def851efd7.js} +1 -1
- package/assets/esri/core/workers/chunks/{2367bd1cb34799a3f08a.js → 30184e39129d9c66ea54.js} +1 -1
- package/assets/esri/core/workers/chunks/32d32d3c3b38a215d20d.js +1 -0
- package/assets/esri/core/workers/chunks/36130910ba141f34531b.js +1 -0
- package/assets/esri/core/workers/chunks/3f03165487c1c2340fff.js +1 -0
- package/assets/esri/core/workers/chunks/48d1a443b324753921de.js +1 -0
- package/assets/esri/core/workers/chunks/48e2737182c75005fb8f.js +1 -0
- package/assets/esri/core/workers/chunks/4f4d51181ae7db9fbe6d.js +1 -0
- package/assets/esri/core/workers/chunks/{05e55118dc0023d500fc.js → 5000a37fba27464d10ca.js} +1 -1
- package/assets/esri/core/workers/chunks/{fa01d1813fa78034526e.js → 51355866a0dcf41cfded.js} +1 -1
- package/assets/esri/core/workers/chunks/{486e69261aa2caf9ec3c.js → 52c8687b473c9953c2f2.js} +1 -1
- package/assets/esri/core/workers/chunks/{fee942ef802a162e0248.js → 5dc0d853c21ccb6054c7.js} +1 -1
- package/assets/esri/core/workers/chunks/640085b5ade5c7f16228.js +1 -0
- package/assets/esri/core/workers/chunks/727804cf901094b1d620.js +1 -0
- package/assets/esri/core/workers/chunks/{0446562aee0639c61485.js → 7420fa18ba12014b22ea.js} +1 -1
- package/assets/esri/core/workers/chunks/768d9b6eaba7bfa18dde.js +1 -0
- package/assets/esri/core/workers/chunks/{c9c2e00fed979c21e2f0.js → 8a946cbc816f373c136b.js} +1 -1
- package/assets/esri/core/workers/chunks/8c271e9272e4eaf1325a.js +1 -0
- package/assets/esri/core/workers/chunks/{2a0fe1aede5c68374ccf.js → 8ec238b5b59ef18a1713.js} +1 -1
- package/assets/esri/core/workers/chunks/{f1dfb1323d50247e80f9.js → 9110287f272141f60c35.js} +1 -1
- package/assets/esri/core/workers/chunks/951a3442d4342539f2ea.js +1 -0
- package/assets/esri/core/workers/chunks/9664d9e679abc41f6c42.js +1 -0
- package/assets/esri/core/workers/chunks/{2921f05a40fda12f9f81.js → a00bba1c7cbf8cd7892c.js} +1 -1
- package/assets/esri/core/workers/chunks/a716b8fdeda4e16f03ab.js +1 -0
- package/assets/esri/core/workers/chunks/aead7c9830fa310e5b53.js +1 -0
- package/assets/esri/core/workers/chunks/{483dc4ee5d73cdfe6229.js → b075d3714fab0591d67c.js} +1 -1
- package/assets/esri/core/workers/chunks/{82cc758bddd9f8397b9f.js → b451dc416eebd0931ef8.js} +4 -4
- package/assets/esri/core/workers/chunks/b59be95949445ff5afab.js +1 -0
- package/assets/esri/core/workers/chunks/b6dec5dfdeca54bae88d.js +1 -0
- package/assets/esri/core/workers/chunks/{4356274cfa477eb6d749.js → bfb9cbe59d36d18f9157.js} +1 -1
- package/assets/esri/core/workers/chunks/{6afd59412bfc134bdf75.js → c052fb8c952cda0b5d13.js} +1 -1
- package/assets/esri/core/workers/chunks/{f2ebd6471e1259a6eac0.js → c9e7cc5d853908ab5b2f.js} +1 -1
- package/assets/esri/core/workers/chunks/{97650ee3d0eecb69ccbb.js → d8623f5f13a084e439c2.js} +5 -5
- package/assets/esri/core/workers/chunks/dd105d6e0fcedee32644.js +1 -0
- package/assets/esri/core/workers/chunks/e1148067ceae7d9eaaf8.js +1 -0
- package/assets/esri/core/workers/chunks/{b536fdb655ad293d9024.js → eb6218634a492667506a.js} +1 -1
- package/assets/esri/core/workers/chunks/{7804be2f5b3d86188a24.js → edc3d98f33d7bf959154.js} +1 -1
- package/assets/esri/core/workers/chunks/eefad79be500667af96e.js +1 -0
- package/assets/esri/core/workers/chunks/{63933cbcb5c12df09715.js → f1ac1c8b1331ec79e898.js} +1 -1
- package/assets/esri/core/workers/chunks/{2b7f9a57a2cfbc108673.js → f1b99529e2055873b65a.js} +1 -1
- package/assets/esri/core/workers/chunks/f693a4d97b2762d0e6ff.js +1 -0
- package/assets/esri/core/workers/chunks/f8caceeaa14d99c35526.js +1 -0
- package/assets/esri/core/workers/chunks/febce0d80f019dc2a427.js +1 -0
- package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
- package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core-simd.wasm +0 -0
- package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core.wasm +0 -0
- package/assets/esri/themes/base/widgets/_Attribution.scss +1 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/Magnifier.glsl.js +1 -1
- package/chunks/arcgis-knowledge-client-core-simd.js +1 -1
- package/chunks/arcgis-knowledge-client-core.js +1 -1
- package/chunks/cameraUtilsSpherical.js +1 -1
- package/chunks/vec42.js +1 -1
- package/config.js +1 -1
- package/core/libs/gl-matrix-2/math/quat.js +1 -1
- package/core/libs/gl-matrix-2/math/vec4.js +1 -1
- package/core/workers/registry.js +1 -1
- package/geometry/geometryEngineJSON.js +1 -1
- package/geometry/support/aaBoundingRect.js +1 -1
- package/geometry/support/buffer/BufferView.js +1 -1
- package/geometry/support/buffer/internals/Vec4.js +1 -1
- package/geometry/support/coordsUtils.js +1 -1
- package/geometry/support/curves/curveUtils.js +1 -1
- package/geometry/support/curves/interpolateCurve.js +5 -0
- package/geometry/support/meshUtils/Metadata.js +1 -1
- package/geometry/support/vector.js +1 -1
- package/interfaces.d.ts +134 -420
- package/kernel.js +1 -1
- package/layers/GaussianSplatLayer.js +1 -1
- package/layers/IntegratedMesh3DTilesLayer.js +1 -1
- package/layers/IntegratedMeshLayer.js +1 -1
- package/layers/SceneLayer.js +1 -1
- package/layers/graphics/data/QueryEngine.js +1 -1
- package/layers/graphics/data/QueryEngineResult.js +1 -1
- package/layers/graphics/sources/support/uploadAssets.js +1 -1
- package/package.json +1 -1
- package/rest/knowledgeGraph/DataModel.js +1 -1
- package/rest/knowledgeGraph/GraphDataModelSingletonOperationResult.d.ts +4 -0
- package/rest/knowledgeGraph/GraphDataModelSingletonOperationResult.js +5 -0
- package/rest/knowledgeGraph/GraphProperty.js +1 -1
- package/rest/knowledgeGraph/wasmInterface/WasmDataModelWrapperInterfaces.js +1 -1
- package/rest/knowledgeGraph/wasmInterface/updateToWasmEncodedFactories.js +1 -1
- package/rest/knowledgeGraph/wasmInterface/wasmToDataModelChangeResponseFactories.js +1 -1
- package/rest/knowledgeGraph/wasmInterface/wasmToDataModelFactories.js +1 -1
- package/rest/knowledgeGraphService.d.ts +3 -0
- package/rest/knowledgeGraphService.js +1 -1
- package/smartMapping/statistics/support/statsWorker.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/interactive/SegmentLabels2D.js +5 -0
- package/views/3d/GroundView3D.js +1 -1
- package/views/3d/analysis/ElevationProfile/ElevationProfileLineSceneComputation.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
- package/views/3d/environment/ChapmanAtmosphere.js +1 -1
- package/views/3d/environment/Fog.js +1 -1
- package/views/3d/interactive/SegmentLabels3D.js +1 -1
- package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/MeasurementAreaVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/MeasurementArrowVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/SlicePlaneVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/VerticesVisualElement.js +1 -1
- package/views/3d/layers/DrapedSubView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/graphics/Graphics3DFrustumVisibility.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/graphicUtils.js +1 -1
- package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
- package/views/3d/layers/support/FastSymbolUpdates.js +1 -1
- package/views/3d/layers/support/Tiles3DIntersectionHandler.js +1 -1
- package/views/3d/state/ConstraintsManager.js +1 -1
- package/views/3d/state/ViewStateManager.js +1 -1
- package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatFadeTexture.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatOrderTexture.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatTextureAtlas.js +1 -1
- package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
- package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
- package/views/3d/support/pointsOfInterest/StableSurfaceCenter.js +1 -1
- package/views/3d/terrain/Overlay.js +1 -1
- package/views/3d/terrain/OverlayManager.js +1 -1
- package/views/3d/terrain/PatchRenderData.js +1 -1
- package/views/3d/terrain/ScaleRangeQueries.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/TextureFader.js +1 -1
- package/views/3d/terrain/TextureReference.js +1 -1
- package/views/3d/terrain/Tile.js +1 -1
- package/views/3d/webgl/RenderCamera.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentData.glsl.js +18 -12
- package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBuffer.glsl.js +8 -8
- package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBufferFields.glsl.js +7 -12
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/VerticalOffset.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateAmbientLighting.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/WaterDistortion.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/CameraSpace.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderModules/Texture2DUintDrawUniform.js +5 -0
- package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
- package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
- package/views/3d/webgl-engine/lib/PathGeometryData.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.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/TextTextureAtlas.js +1 -1
- package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBuffer.js +1 -1
- package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferFields.js +1 -1
- package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferLayout.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/bufferLayouts.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultLayouts.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedBuffer.js +1 -1
- package/views/3d/webgl-engine/shaders/AnimatedLine.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/ensureColor4.js +1 -1
- package/views/3d/webgl-engine/shaders/sources/edgeRenderer/EdgeUtil.glsl.js +18 -18
- package/views/Attribution.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/draw/support/Reshape.js +1 -1
- package/views/interactive/SegmentLabels.js +1 -1
- package/views/interactive/coordinateHelper.js +1 -1
- package/views/interactive/editGeometry/EditGeometry.js +1 -1
- package/views/interactive/editGeometry/EditGeometryOperations.js +1 -1
- package/views/interactive/editGeometry/operations/SetAllVertexPositions.js +1 -1
- package/views/interactive/sketch/constraints.js +1 -1
- package/views/interactive/sketch/normalizedPoint.js +1 -1
- package/views/support/GroundElevationSampler.js +1 -1
- package/widgets/Editor/UpdateFeatureWorkflow.js +1 -1
- package/widgets/Editor/Upload.js +1 -1
- package/widgets/Editor/components/Settings.js +1 -1
- package/widgets/Editor/support/SketchController.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/Sketch.js +1 -1
- package/widgets/support/SelectionList.js +1 -1
- package/widgets/support/SketchTooltipControls.js +1 -1
- package/assets/esri/core/workers/chunks/089221bac1f019692f48.js +0 -1
- package/assets/esri/core/workers/chunks/08957e462d06c4dc8ab5.js +0 -1
- package/assets/esri/core/workers/chunks/1bfe0b2bf38d4dee7fd6.js +0 -1
- package/assets/esri/core/workers/chunks/22d66d1c8dfccdbbcf30.js +0 -1
- package/assets/esri/core/workers/chunks/27bd88e1101873d4ce12.js +0 -1
- package/assets/esri/core/workers/chunks/484cd728dd17b8dc1f72.js +0 -1
- package/assets/esri/core/workers/chunks/53d95ba86d010231fc4e.js +0 -1
- package/assets/esri/core/workers/chunks/61cb30e2e8edd18ebbf0.js +0 -1
- package/assets/esri/core/workers/chunks/6c8f5a56e94fdbe6a4a5.js +0 -1
- package/assets/esri/core/workers/chunks/745fc2b89fd7d816f2e0.js +0 -1
- package/assets/esri/core/workers/chunks/79c7391f00a55e7bcf6b.js +0 -1
- package/assets/esri/core/workers/chunks/7f8b85de079614b9c336.js +0 -1
- package/assets/esri/core/workers/chunks/a4b7ba8aec109beb5b4d.js +0 -1
- package/assets/esri/core/workers/chunks/a5f2da24497349239648.js +0 -1
- package/assets/esri/core/workers/chunks/a7b1b42bdb9cb9ecac45.js +0 -1
- package/assets/esri/core/workers/chunks/acaaefd4997316d319b8.js +0 -1
- package/assets/esri/core/workers/chunks/c6cc3db057da49755d15.js +0 -1
- package/assets/esri/core/workers/chunks/cc7c37f9ed3f831fd25c.js +0 -1
- package/assets/esri/core/workers/chunks/d14bd320f72d8e8a0ad8.js +0 -1
- package/assets/esri/core/workers/chunks/d6d03f22c91f528b97e5.js +0 -1
- package/assets/esri/core/workers/chunks/d86e59da76eea888ba86.js +0 -1
- package/assets/esri/core/workers/chunks/de99c4fd1582a8e610cf.js +0 -1
- package/assets/esri/core/workers/chunks/ded3ef385d5a3a2ec8ca.js +0 -1
- package/assets/esri/core/workers/chunks/e3a994587f9b2e88db85.js +0 -1
- package/assets/esri/core/workers/chunks/ea5bf896acfcc3106bf5.js +0 -1
- package/assets/esri/core/workers/chunks/eab0938d4ad7d7cc7309.js +0 -1
- package/assets/esri/core/workers/chunks/ed1dabed10ff9f4e0369.js +0 -1
- package/assets/esri/core/workers/chunks/effbc4d240752e8ba0ab.js +0 -1
- package/assets/esri/core/workers/chunks/f403d8e414766fab2936.js +0 -1
- package/assets/esri/core/workers/chunks/f8a5b26e0231244972d8.js +0 -1
- package/chunks/geometryEngineJSON.js +0 -5
- package/geometry/geometryEngineAsync.d.ts +0 -39
- package/geometry/geometryEngineAsync.js +0 -5
- package/geometry/geometryEngineWorker.js +0 -5
- package/views/3d/webgl-engine/collections/Component/Material/ComponentDataConstants.js +0 -5
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{generateUID as e}from"../../../../../core/uid.js";import{
|
|
6
|
-
struct ${
|
|
7
|
-
${
|
|
8
|
-
${
|
|
9
|
-
float index = itemIndex * ${
|
|
10
|
-
float texSize = float(textureSize(${
|
|
5
|
+
import{generateUID as e}from"../../../../../core/uid.js";import{unpackFloat4x8 as t,unpackHalf2x8 as o,glslType as d,glslDecodeField as a}from"./TextureBackedBufferFields.glsl.js";import{glsl as r}from"../shaderModules/glsl.js";import{assert as n}from"../../lib/Util.js";class i{constructor(t,o,d,a=()=>!0){this.moduleId=e(),this.namespace=`_tbb_${this.moduleId}_`,this.TextureBackedBufferModule=(e,r)=>c(this.namespace,e,r,o,d,t,a),this.getTextureAttribute=s(this.namespace)}}function c(e,i,c,s,l,u,m){const{vertex:$}=i;$.include(t),$.include(o);const x=`${e}tbbStride`,h=`${e}TextureBackedBufferItemData`,p=`${e}fetchTextureBackedBufferItemData`,T=f(e);for(const t of[x,h,p,T])n(t.length<1024,"Identifiers do not have a valid length");$.constants.add(x,"float",u.numTexels),$.uniforms.add(l);const B=u.fields.filter(e=>m(e.name,c));if(0===B.length)return;const I=[];for(let t=0;t<u.numTexels;++t)I.push(!1);for(const t of B)for(let e=0;e<t.numTexels;++e)I[t.startTexel+e]=!0;$.code.add(r`
|
|
6
|
+
struct ${h} {`);for(const t of B)$.code.add(r`\t${d(t)} ${t.name};`);$.code.add(r`};`),$.code.add(r`
|
|
7
|
+
${h} ${p}(float itemIndex) {
|
|
8
|
+
${h} itemData;
|
|
9
|
+
float index = itemIndex * ${x};
|
|
10
|
+
float texSize = float(textureSize(${l.name}, 0).x);
|
|
11
11
|
float coordX = mod(index, texSize) + 0.5;
|
|
12
12
|
float coordY = floor(index / texSize) + 0.5;
|
|
13
|
-
`);for(let t=0;t<I.length;++t)!1!==I[t]
|
|
14
|
-
}`)
|
|
13
|
+
`);for(let t=0;t<I.length;++t)!1!==I[t]&&$.code.add(r`lowp uvec4 texel${r.int(t)} = texelFetch(${l.name}, ivec2(coordX + ${r.float(t)}, coordY), 0);`);for(const t of B)$.code.add(r`itemData.${t.name} = ${a(t)};`);$.code.add(r`return itemData;
|
|
14
|
+
}`),$.code.add(r`${h} ${T};`),$.main.add(r`${T} = ${p}(${s});`)}function s(e){const t=f(e);return e=>r`${t}.${e}`}function f(e){return`${e}ItemData`}export{i as TextureBackedBufferModule};
|
|
@@ -2,15 +2,10 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{glsl as
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
float
|
|
12
|
-
float y;
|
|
13
|
-
float z;
|
|
14
|
-
float w;
|
|
15
|
-
float v;
|
|
16
|
-
};`)}function n(e){switch(e.elementCount){case 1:return o`float`;case 2:return o`vec2`;case 3:return o`vec3`;case 4:return o`vec4`;case 5:return o`vec5`;default:throw new Error("unsupported elementCount")}}function a(o){const{declaration:e,glslDecodeArgumentString:t}=o;return`${(0,c[e.type])(t,e)}`}const c={u8:e=>o`${e}`,"packed-f24":(e,t)=>o`uninterpolatedRGBToFloat(vec3(${e})) * ${o.float(t.maxValue)}`,"packed-f32":(e,t)=>o`uninterpolatedRGBAToFloat(vec4(${e})) * ${o.float(t.maxValue)}`,vec4u8:e=>o`vec4(${e})`,u8u8u7xu8:e=>o`decode_u8u8u7xu8(${e})`};export{e as decode_u8u8u7xu8,a as glslDecodeField,n as glslType,t as vec5Type};
|
|
5
|
+
import{neverReached as t}from"../../../../../core/compilerUtils.js";import{hasNativeFloat16Array as e}from"../../../../../geometry/support/float16.js";import{glsl as n}from"../shaderModules/glsl.js";function u(e){switch(e.elementType){case"float":switch(e.elementCount){case 1:return n`float`;case 2:return n`vec2`;case 3:return n`vec3`;case 4:return n`vec4`;default:t(e.elementCount)}break;case"int":switch(e.elementCount){case 1:return n`int`;case 2:return n`ivec2`;case 3:return n`ivec3`;case 4:return n`ivec4`;default:t(e.elementCount)}break;case"uint":switch(e.elementCount){case 1:return n`uint`;case 2:return n`uvec2`;case 3:return n`uvec3`;case 4:return n`uvec4`;default:t(e.elementCount)}break;default:t(e.elementType)}throw new Error("unsupported field")}function i(t){t.code.add(n`mediump float unpackHalf2x8(highp uint bits0, highp uint bits1) {
|
|
6
|
+
highp uint halfBits = (bits1 << 8u) | bits0;
|
|
7
|
+
return unpackHalf2x16(halfBits).x;
|
|
8
|
+
}`)}function r(t){t.code.add(n`highp float unpackFloat4x8(highp uint bits0, highp uint bits1, highp uint bits2, highp uint bits3) {
|
|
9
|
+
highp uint floatBits = (bits3 << 24u) |(bits2 << 16u) | (bits1 << 8u) | bits0;
|
|
10
|
+
return uintBitsToFloat(floatBits);
|
|
11
|
+
}`)}function a(t){const{declaration:e,glslDecodeArgumentString:n}=t;return`${(0,c[e.type])(n)}`}const c={u8:t=>n`${t}`,unorm8:t=>n`float(${t})/255.0`,vec4unorm8:t=>n`vec4(${t})/255.0`,f16:e?t=>n`unpackHalf2x8(${t})`:t=>n`unpackFloat4x8(${t})`,f32:t=>n`unpackFloat4x8(${t})`,vec4u8:t=>n`uvec4(${t})`};export{a as glslDecodeField,u as glslType,r as unpackFloat4x8,i as unpackHalf2x8};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{pt2px as e}from"../../../../../../core/screenUtils.js";import{
|
|
5
|
+
import{pt2px as e}from"../../../../../../core/screenUtils.js";import{c as r}from"../../../../../../chunks/vec42.js";import{create as t}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ScreenSizePerspective as l,addScreenSizePerspectiveAlignment as o}from"../util/ScreenSizePerspective.glsl.js";import{addCameraPosition as c}from"../util/View.glsl.js";import{Float4PassUniform as s}from"../../shaderModules/Float4PassUniform.js";import{glsl as i}from"../../shaderModules/glsl.js";class a{constructor(r){this.screenLength=e(r.screenLength),this.minWorldLength=r.minWorldLength??0,this.maxWorldLength=r.maxWorldLength??1/0}}function n(e,r){const t=e.vertex;r.hasVerticalOffset?(d(t),r.hasScreenSizePerspective&&(e.include(l),o(t),c(e.vertex,r)),t.code.add(i`
|
|
6
6
|
vec3 calculateVerticalOffset(vec3 worldPos, vec3 localOrigin) {
|
|
7
7
|
float viewDistance = length((view * vec4(worldPos, 1.0)).xyz);
|
|
8
8
|
${r.spherical?i`vec3 worldNormal = normalize(worldPos + localOrigin);`:i`vec3 worldNormal = vec3(0.0, 0.0, 1.0);`}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{h as i}from"../../../../../../chunks/vec32.js";import{create as n}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{
|
|
5
|
+
import{h as i}from"../../../../../../chunks/vec32.js";import{create as n}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{c as t}from"../../../../../../chunks/vec42.js";import{create as e}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{Float3BindUniform as h}from"../../shaderModules/Float3BindUniform.js";import{Float4BindUniform as g}from"../../shaderModules/Float4BindUniform.js";import{glsl as s}from"../../shaderModules/glsl.js";function m(n,e){const m=n.fragment,a=void 0!==e.lightingSphericalHarmonicsOrder?e.lightingSphericalHarmonicsOrder:2;0===a?(m.uniforms.add(new h("lightingAmbientSH0",({lighting:n})=>i(r,n.sh.r[0],n.sh.g[0],n.sh.b[0]))),m.code.add(s`vec3 calculateAmbientIrradiance(vec3 normal, float ambientOcclusion) {
|
|
6
6
|
vec3 ambientLight = 0.282095 * lightingAmbientSH0;
|
|
7
7
|
return ambientLight * (1.0 - ambientOcclusion);
|
|
8
8
|
}`)):1===a?(m.uniforms.add(new g("lightingAmbientSH_R",({lighting:i})=>t(l,i.sh.r[0],i.sh.r[1],i.sh.r[2],i.sh.r[3])),new g("lightingAmbientSH_G",({lighting:i})=>t(l,i.sh.g[0],i.sh.g[1],i.sh.g[2],i.sh.g[3])),new g("lightingAmbientSH_B",({lighting:i})=>t(l,i.sh.b[0],i.sh.b[1],i.sh.b[2],i.sh.b[3]))),m.code.add(s`vec3 calculateAmbientIrradiance(vec3 normal, float ambientOcclusion) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{set as e}from"../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as t}from"../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{
|
|
5
|
+
import{set as e}from"../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as t}from"../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{c as r}from"../../../../../../chunks/vec42.js";import{create as a}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{FoamIntensity as o}from"./FoamRendering.glsl.js";import{ReadShadowMapPassParameters as m}from"./ReadShadowMap.glsl.js";import{Float2PassUniform as s}from"../../shaderModules/Float2PassUniform.js";import{Float4PassUniform as v}from"../../shaderModules/Float4PassUniform.js";import{glsl as l}from"../../shaderModules/glsl.js";import{Texture2DPassUniform as i}from"../../shaderModules/Texture2DPassUniform.js";function u(t){t.fragment.uniforms.add(new i("texWaveNormal",e=>e.waveNormal),new i("texWavePerturbation",e=>e.wavePerturbation),new v("waveParams",e=>r(c,e.waveStrength,e.waveTextureRepeat,e.flowStrength,e.flowOffset)),new s("waveDirection",t=>e(n,t.waveDirection[0]*t.waveVelocity,t.waveDirection[1]*t.waveVelocity))),t.fragment.include(o),t.fragment.code.add(l`const vec2 FLOW_JUMP = vec2(6.0/25.0, 5.0/24.0);
|
|
6
6
|
vec2 textureDenormalized2D(sampler2D _tex, vec2 _uv) {
|
|
7
7
|
return 2.0 * texture(_tex, _uv).rg - 1.0;
|
|
8
8
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{set as r}from"../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as o}from"../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{
|
|
5
|
+
import{set as r}from"../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as o}from"../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{c as t}from"../../../../../../chunks/vec42.js";import{create as e}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{Float2BindUniform as i}from"../../shaderModules/Float2BindUniform.js";import{Float4BindUniform as a}from"../../shaderModules/Float4BindUniform.js";import{glsl as c}from"../../shaderModules/glsl.js";function f(r){r.fragment.uniforms.add(new a("projInfo",r=>n(r.camera))),r.fragment.uniforms.add(new i("zScale",r=>m(r.camera))),r.fragment.code.add(c`vec3 reconstructPosition(vec2 fragCoord, float depth) {
|
|
6
6
|
return vec3((fragCoord * projInfo.xy + projInfo.zw) * (zScale.x * depth + zScale.y), depth);
|
|
7
|
-
}`)}function n(r){const o=r.projectionMatrix;return 0===o[11]?t(
|
|
7
|
+
}`)}function n(r){const o=r.projectionMatrix;return 0===o[11]?t(s,2/(r.fullWidth*o[0]),2/(r.fullHeight*o[5]),(1+o[12])/o[0],(1+o[13])/o[5]):t(s,-2/(r.fullWidth*o[0]),-2/(r.fullHeight*o[5]),(1-o[8])/o[0],(1-o[9])/o[5])}const s=e();function m(o){return 0===o.projectionMatrix[11]?r(l,0,1):r(l,1,0)}const l=o();export{f as CameraSpace,n as getProjectionInfo,m as getZScale};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{Uniform as r}from"../../../../webgl/Uniform.js";class e extends r{constructor(r,e){super(r,"usampler2D",2,(s,o,t)=>s.bindTexture(r,e(o,t)))}}export{e as Texture2DUintDrawUniform};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{lerp as t,clamp as s,smoothstep as i}from"../../../../../core/mathUtils.js";import{disposeMaybe as r}from"../../../../../core/maybe.js";import{watch as a,syncAndInitial as o}from"../../../../../core/reactiveUtils.js";import{subclass as n}from"../../../../../core/accessorSupport/decorators.js";import{set as h}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{b as m,F as p}from"../../../../../chunks/vec32.js";import{
|
|
5
|
+
import{__decorate as e}from"tslib";import{lerp as t,clamp as s,smoothstep as i}from"../../../../../core/mathUtils.js";import{disposeMaybe as r}from"../../../../../core/maybe.js";import{watch as a,syncAndInitial as o}from"../../../../../core/reactiveUtils.js";import{subclass as n}from"../../../../../core/accessorSupport/decorators.js";import{set as h}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{b as m,F as p}from"../../../../../chunks/vec32.js";import{c}from"../../../../../chunks/vec42.js";import{earth as d}from"../../../../../geometry/support/Ellipsoid.js";import{InternalRenderCategory as u}from"../../../webgl.js";import{TransparentEnvironment as f}from"../TransparentEnvironment.js";import{H as _}from"../../../../../chunks/HazeCompositing.glsl.js";import{HazeCompositingTechnique as l}from"./HazeCompositingTechnique.js";import{HazePassParameters as g,HazeTechnique as b}from"./HazeTechnique.js";import{HazeTechniqueConfiguration as w}from"./HazeTechniqueConfiguration.js";import{createQuadVAO as P}from"../../lib/glUtil3D.js";import{applyTextureResizeModulo as v}from"../../lib/textureUtils.js";import{DepthStencilAttachment as j,PrimitiveType as A}from"../../../../webgl/enums.js";let T=class extends f{constructor(e){super(e),this._compositingPassParameters=new _,this._passParameters=new g,this._hazeConfiguration=new w,this.requireGeometryDepth=!0,this._oldAmount=1,this._newAmount=1,this._amount=this._newAmount;const t=e.view.stage.renderView.techniques;t.precompile(b,new w);const s=new w;s.reduced=!0,t.precompile(b,s),t.precompile(l)}initialize(){this.addHandles([a(()=>this.view.environment.atmosphereEnabled,e=>e?this._enable():this._disable(),o),a(()=>this.view.stage?.renderer.renderContext.bind.clouds.fadeFactor??1,e=>this._fade(e),o),a(()=>this.view.environment.weather.type,e=>this._newAmount="rainy"===e?0:1,o),a(()=>this.view.stage.renderer?.highResolutionAtmosphere,e=>this._hazeConfiguration.reduced=!e,o)])}_fade(e){e>=1?(this._amount=this._newAmount,this._oldAmount=this._newAmount):this._amount=e<=0?this._oldAmount:t(this._oldAmount,this._newAmount,e)}destroy(){this._vao=r(this._vao)}render(e){const s=e.find(({name:e})=>e===u.TRANSPARENT_ENVIRONMENT);if(!this.bindParameters.mainDepth)return s;const i=this.renderingContext,r=this.techniques.get(b,this._hazeConfiguration);if(!r.compiled)return s;const a=s.getAttachment(j);if(this._update(),!this._hazeConfiguration.reduced)return s.detachDepth(),i.bindFramebuffer(s.fbo),i.bindTechnique(r,this.bindParameters,this._passParameters),this._renderCommon(i),s.attachDepth(a),s;const o=this.techniques.get(l);if(!o.compiled)return s;const n=i.getViewport(),h=this.camera,p=m(h.eye)-d.radius;let c;const f=d.atmosphereHeight;if(p<f){const e=Math.min(1,Math.max(0,p/f));c=t(.4,.5,e)}else{const e=Math.min(1,Math.max(0,(p-f)/(15*f)));c=t(.5,1,e)}const _=this.renderingContext.parameters.maxTextureSize,g=v(Math.round(c*h.fullViewport[2]),_),w=v(Math.round(c*h.fullViewport[3]),_);i.setViewport(0,0,g,w);const P=this.fboCache.acquire(g,w,"haze",5);return i.bindFramebuffer(P.fbo),i.clearFramebuffer([0,0,0,1],!0,!0),i.bindTechnique(r,this.bindParameters,this._passParameters),this._renderCommon(i),i.setViewport(n.x,n.y,n.width,n.height),this._compositingPassParameters.color=P.getTexture(),s.detachDepth(),i.bindFramebuffer(s.fbo),i.bindTechnique(o,this.bindParameters,this._compositingPassParameters),i.screen.draw(),s.attachDepth(a),P.release(),s}_renderCommon(e){this._vao??=P(e,1),e.bindVAO(this._vao),e.drawArrays(A.TRIANGLE_STRIP,0,4)}_update(){const e=this.bindParameters.camera,r=p(e.eye),a=Math.sqrt(r),o=r-this._passParameters.radii[1]*this._passParameters.radii[1],n=s((a-this._passParameters.radii[0])/d.atmosphereHeight,0,1);c(this._passParameters.heightParameters,a,r,o,n);const m=this.view.basemapTerrain?.getLowerBoundRadius()??0;h(this._passParameters.radii,m,m+d.atmosphereHeight),this._passParameters.hazeStrength=t(t(.6,1,i(9500,10500,a-d.radius)),1,this._amount)}};T=e([n("esri.views.3d.webgl-engine.effects.haze.Haze")],T);export{T as Haze};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{watch as e}from"../../../../core/reactiveUtils.js";import{property as s,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{set as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{e as n,b as o,j as h,q as l,g as u,F as p,J as c,d as m}from"../../../../chunks/vec32.js";import{create as d,clone as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{
|
|
5
|
+
import{__decorate as t}from"tslib";import{watch as e}from"../../../../core/reactiveUtils.js";import{property as s,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{set as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{e as n,b as o,j as h,q as l,g as u,F as p,J as c,d as m}from"../../../../chunks/vec32.js";import{create as d,clone as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{c as f}from"../../../../chunks/vec42.js";import{create as _}from"../../../../geometry/support/plane.js";import{fromPoints as b}from"../../../../geometry/support/ray.js";import{Sphere as C}from"../../../../geometry/support/sphere.js";import{RenderCategory as P}from"../../webgl.js";import{GaussianSplatTarget as S}from"../../layers/i3s/Intersector.js";import{GaussianSplatDataStore as v}from"../../support/gaussianSplatting/GaussianSplatDataStore.js";import q from"../../webgl/RenderNode.js";import{IntersectorResult as T}from"./IntersectorResult.js";import{G as w}from"../../../../chunks/GaussianSplat.glsl.js";import{G as x}from"../../../../chunks/GaussianSplatComposition.glsl.js";import{GaussianSplatCompositionTechnique as y}from"../shaders/GaussianSplatCompositionTechnique.js";import{G as D}from"../../../../chunks/GaussianSplatDepthComposition.glsl.js";import{GaussianSplatDepthCompositionTechnique as j}from"../shaders/GaussianSplatDepthCompositionTechnique.js";import{GaussianSplatDepthTechnique as G}from"../shaders/GaussianSplatDepthTechnique.js";import{GaussianSplatTechnique as F}from"../shaders/GaussianSplatTechnique.js";import{GaussianSplatTechniqueConfiguration as A}from"../shaders/GaussianSplatTechniqueConfiguration.js";import{DepthStencilAttachment as R,PrimitiveType as E}from"../../../webgl/enums.js";var V;let H=class extends q{static{V=this}constructor(t){super(t),this.gaussianPosition=d(),this.intersectionRayDir=d(),this.intersectionPlane=_(),this._slicePlaneEnabled=!1,this._data=null,this.produces=P.OPAQUE,this.type=0,this.isGround=!1,this.layerViewUid="",this._gaussianSplatParameters=new w,this._gaussianSplatCompositionParameters=new x,this._gaussianSplatDepthCompositionParameters=new D,this._splatTechniqueConfiguration=new A,this._splatDepthTechniqueConfiguration=new A(!0),this._previousCameraPosition=d(),this._previousCameraDirection=d(),this._tanFov=r(),this._tempVec=d(),this._cameraDelta=d(),this._coarseCameraPosition=d(),this.fadeHelper=null}async initialize(){this._data=new v(this),this.view.sceneIntersectionHelper.addIntersectionHandler(this),this.addHandles([e(()=>this.view.state.camera,()=>this._onCameraChange())])}precompile(){this._splatTechniqueConfiguration.alphaCutoff=this.view.qualitySettings.gaussianSplat.minimumOpacity,this._splatTechniqueConfiguration.terrainDepthTest=this.bindParameters.terrainDepthTest,this._splatTechniqueConfiguration.fadingEnabled=this.fadeHelper.fadingEnabled,this.techniques.precompile(F,this._splatTechniqueConfiguration),this._splatDepthTechniqueConfiguration.alphaCutoff=this.view.qualitySettings.gaussianSplat.minimumOpacity,this._splatDepthTechniqueConfiguration.terrainDepthTest=this.bindParameters.terrainDepthTest,this.techniques.precompile(G,this._splatDepthTechniqueConfiguration),this.techniques.precompile(y),this.techniques.precompile(j)}render(t){const e=t.find(({name:t})=>t===P.OPAQUE);if(this._handleFading(),!this._data.visibleGaussians||!this._data.orderTexture.texture||!this._data.textureAtlas.texture)return e;const s=this.techniques.get(F,this._splatTechniqueConfiguration),i=this.techniques.get(G,this._splatDepthTechniqueConfiguration),r=this.techniques.get(y),n=this.techniques.get(j);if(!(s.compiled&&i.compiled&&n.compiled&&r.compiled))return this.requestRender(1),e;const{fullWidth:o,fullHeight:h}=this.bindParameters.camera,l=this.fboCache,u=l.acquire(o,h,"gaussian color output");u.attachDepth(e.getAttachment(R));const p=this.renderingContext;p.bindFramebuffer(u.fbo),p.setClearColor(0,0,0,0),p.clear(16384),this._gaussianSplatParameters.totalGaussians=this._data.visibleGaussians,this._gaussianSplatParameters.splatOrder=this._data.orderTexture.texture,this._gaussianSplatParameters.splatFading=this._data.fadingTexture.texture,this._gaussianSplatParameters.splatAtlas=this._data.textureAtlas.texture;const c=Math.tan(.5*this.camera.fovY),m=c/h*o;a(this._tanFov,m,c);const d=h/(2*c);this._gaussianSplatParameters.focalLength=d,this._gaussianSplatParameters.tanFov=this._tanFov;const g=this.view.qualitySettings.gaussianSplat.minimumSplatPixelRadius*Math.sqrt(o*h)/Math.sqrt(2073600);this._gaussianSplatParameters.minSplatRadius=g,this._prepareHighPrecisionCameraPosition(),this.renderingContext.bindTechnique(s,this.bindParameters,this._gaussianSplatParameters),this.renderingContext.drawArraysInstanced(E.TRIANGLE_STRIP,0,4,this._data.visibleGaussians);const f=l.acquire(o,h,"splat depth",8);f.attachDepth(e.getAttachment(R)),p.bindFramebuffer(f.fbo),p.setClearColor(0,0,0,0),p.clear(16384),this.renderingContext.bindTechnique(i,this.bindParameters,this._gaussianSplatParameters),this.renderingContext.drawArraysInstanced(E.TRIANGLE_STRIP,0,4,this._data.visibleGaussians);const _=l.acquire(o,h,this.produces);return this._gaussianSplatDepthCompositionParameters.splatDepth=f.getTexture(),_.attachDepth(e.getAttachment(R)),p.bindFramebuffer(_.fbo),p.bindTechnique(n,this.bindParameters,this._gaussianSplatDepthCompositionParameters),p.screen.draw(),this._gaussianSplatCompositionParameters.color=e.getTexture(),this._gaussianSplatCompositionParameters.splatColor=u.getTexture(),p.bindFramebuffer(_.fbo),p.bindTechnique(r,this.bindParameters,this._gaussianSplatCompositionParameters),p.screen.draw(),u.release(),f.release(),_}intersect(t,e,s,i){const{gaussianPosition:a,intersectionRayDir:r,intersectionPlane:c,layerViewUid:m}=this,_=b(s,i);n(r,i,s);const P=1/o(r);h(r,r,P);const v=d();l(v,r),f(c,r[0],r[1],r[2],-u(r,s));const q=new M,w=new M,x=new Array;this._data.visibleGaussianTiles.forEach(n=>{const{maxScale:o}=n,h=n.obb.minimumDistancePlane(c),l=n.obb.maximumDistancePlane(c),d=l<0,f=null!=q.dist&&null!=w.dist&&q.dist<h*P&&w.dist>l*P;if(d||f)return;if(!new C(n.obb.center,n.obb.radius+o).intersectRay(_,null))return;if(!n.obb.intersectRay(s,r,o))return;const{positions:b,squaredScales:S,gaussianAtlasIndices:T}=n,y=T.length;for(let c=0;c<y;c++){const n=3*c;a[0]=b[n]-s[0],a[1]=b[n+1]-s[1],a[2]=b[n+2]-s[2];const o=S[c],h=u(a,r),l=h*h;if(p(a)-l>o)continue;const d=h*P,f=t=>(t.point=t.point?t.point.fill(a[0],a[1],a[2]):g(a),t.dist=d,t.normal=v,t.layerViewUid=m,t);if((null==q.dist||d<q.dist)&&(null==e||e(s,i,d))&&f(q),0!==t.options.store&&(null==w.dist||d>w.dist)&&(null==e||e(s,i,d))&&f(w),2===t.options.store&&(null==e||e(s,i,d))){const t=new M;x.push(f(t))}}});const y=(t,e)=>{const{layerViewUid:s}=e,i=new S(e.point,s);t.set(0,i,e.dist,e.normal)};if(I(q)){const e=t.results.min;(null==e.distance||q.dist<e.distance)&&y(e,q)}if(I(w)&&0!==t.options.store){const e=t.results.max;(null==e.distance||w.dist>e.distance)&&y(e,w)}if(2===t.options.store)for(const n of x){const e=new T(_);y(e,n),t.results.all.push(e)}}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(t){this._slicePlaneEnabled!==t&&(this._slicePlaneEnabled=t,this.requestRender(1))}get data(){return this._data}destroy(){this._data.destroy(),super.destroy()}_onCameraChange(){const t=this.view.state.camera.eye,e=this.view.state.camera.ray.direction,s=.001;(Math.abs(t[0]-this._previousCameraPosition[0])>s||Math.abs(t[1]-this._previousCameraPosition[1])>s||Math.abs(t[2]-this._previousCameraPosition[2])>s||Math.abs(e[0]-this._previousCameraDirection[0])>s||Math.abs(e[1]-this._previousCameraDirection[1])>s||Math.abs(e[2]-this._previousCameraDirection[2])>s)&&this._data.requestSort()}_prepareHighPrecisionCameraPosition(){h(this._tempVec,this.camera.eye,1/V.tileSize),c(this._tempVec,this._tempVec),m(this._coarseCameraPosition,this._tempVec),this._gaussianSplatParameters.cameraPos8k=this._coarseCameraPosition,h(this._tempVec,this._tempVec,V.tileSize),n(this._cameraDelta,this.camera.eye,this._tempVec),this._gaussianSplatParameters.cameraDelta=this._cameraDelta}_handleFading(){if(0===this.fadeHelper.numFadingTiles)return void(this._previousFrameStart=null);this._previousFrameStart??=this.view.stage.renderer.renderContext.time;const t=this.view.stage?.renderer.renderContext.time-this._previousFrameStart;this.fadeHelper.updateAllTileFading(t),this._previousFrameStart=this.view.stage.renderer.renderContext.time,this._data.fadingTexture.updateTexture(this._data.textureAtlas.pageAllocator.pageCount)}static{this.tileSize=2.048}};function I(t){return null!=t.dist&&null!=t.point}t([s({constructOnly:!0})],H.prototype,"fadeHelper",void 0),H=V=t([i("esri.views.3d.webgl-engine.lib.GaussianSplatRenderNode")],H);class M{constructor(){this.point=null,this.dist=null,this.normal=null,this.layerViewUid=""}}export{H as GaussianSplatRenderNode};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{releaseMaybe as e}from"../../../../core/maybe.js";import{
|
|
5
|
+
import{releaseMaybe as e}from"../../../../core/maybe.js";import{f as i}from"../../../../chunks/vec42.js";import{ZEROS as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ViewportSize as r}from"./BindParameters.js";import{ColorAttachment1 as o}from"../../../webgl/enums.js";import{ensureAttachmentMaxSize as h}from"../../../webgl/FramebufferObject.js";class l{constructor(e){this._fbos=e,this._requiresEmission=!1,this._size=new r(0,0),this._clearColor=s()}dispose(){this._color=e(this._color),this.releaseDepth()}initialize(e,t,s,r){this._size.width=e,this._size.height=t,h(this._size,this._fbos.rctx.parameters.maxTextureSize);const o=this._color;return this._color=null,this.releaseDepth(),this._requiresEmission=r,i(this._clearColor,s),o}releaseDepth(){this._color?.detachDepth(),this._depth=e(this._depth)}update(e){const i=this._ensureColor();i.attachDepth(this.depth),this._color=e(i)}bind(){const{rctx:e}=this._fbos,i=null==this._color;this.color.attachDepth(this.depth),e.bindFramebuffer(this.color.fbo),i&&(e.setClearStencil(0),e.setClearColor(this._clearColor[0],this._clearColor[1],this._clearColor[2],this._clearColor[3]),e.clear(17664),this._requiresEmission&&e.clearBuffer(1,t))}_acquireColor(){return this._requiresEmission?this._fbos.acquire(this._size.width,this._size.height,"main color").acquireColor(o,8,"emissive"):this._fbos.acquire(this._size.width,this._size.height,"main color")}_acquireDepth(){return this._fbos.acquireDepth(13,this._size.width,this._size.height,"main depth")}get size(){return this._size}get color(){return this._ensureColor()}get depth(){return this._depth??=this._acquireDepth(),this._depth}_ensureColor(){return this._color??=this._acquireColor(),this._color}}export{l as MainFramebuffer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{copy as t,set as e,length as s,normalize as i,dot as o,scale as r,add as n}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{f as l,h}from"../../../../chunks/vec32.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{
|
|
5
|
+
import{copy as t,set as e,length as s,normalize as i,dot as o,scale as r,add as n}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{f as l,h}from"../../../../chunks/vec32.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{f as p}from"../../../../chunks/vec42.js";import{fromValues as u}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{newFloatArray as m}from"../../../../geometry/support/FloatArray.js";import{newHalfFloatArray as f}from"../../../../geometry/support/HalfFloatArray.js";import{getZeroIndexArray as d}from"../../../../geometry/support/Indices.js";import{Attribute as b,Vertices as v}from"./Attribute.js";import{decompressNormal as g,compressNormal as x}from"./Normals.js";import{intersectTriangles as A}from"./RayIntersections.js";class w{constructor(t){this.builder=t}onPathChanged(t){this.builder.onPathChanged()}}class y extends w{constructor(t){super(t),this.color=u(255,255,255,255),this._size=a(),this.positions=m(3*this.builder.numVerticesTotal),this.normals=new Int16Array(2*this.builder.numVerticesTotal)}bakeVertexColors(t){p(this.color,t)}bake(a){t(this._size,a);const{numVerticesTotal:c,pathVertexData:p,positions:u,profileRightAxes:m,profileUpAxes:f,profileVertexAndNormals:d,profileAuxData:b}=this.builder;for(let t=0;t<c;++t){let c=p[t];c*=3;const v=_;let A=0,w=0;const y=g(I,m,t),j=g(k,f,t),D=4*t,P=e(V,d[D]*a[0],d[D+1]*a[1]),F=3*t;if(1===b[F+2])l(v,j,y),A=b[F]*a[0],w=b[F+1];else{const t=C,a=z;e(t,b[F],b[F+1]);const l=s(t);i(t,t);const c=o(P,t);if(Math.abs(c)>l){e(a,-t[1],t[0]);const s=o(P,a);r(t,t,l*Math.sign(c)),r(a,a,s),n(P,t,a)}h(v,0,0,0)}const N=y[0]*P[0]+j[0]*P[1],R=y[1]*P[0]+j[1]*P[1],M=y[2]*P[0]+j[2]*P[1];this.positions[F]=u[c]+N+v[0]*A,this.positions[F+1]=u[c+1]+R+v[1]*A,this.positions[F+2]=u[c+2]+M+v[2]*A;const T=d[D+2],U=d[D+3];x(this.normals,t,y[0]*T+j[0]*U+v[0]*w,y[1]*T+j[1]*U+v[1]*w,y[2]*T+j[2]*U+v[2]*w)}}createGeometryData(){const t=this.builder.vertexIndices;return[["position",new b(this.positions,t,3,!0)],["normalCompressed",new b(this.normals,t,2,!0)],["color",new b(this.color,d(t.length),4,!0)]]}onPathChanged(t){super.onPathChanged(t),this.bake(this.size)}intersect(t,e,s,i){const o=this.builder.vertexIndices,r=new v(this.positions,3),n=o.length/3;A(t,e,0,n,o,r,void 0,s,(t,e,s)=>i(t,s,e))}get size(){return this._size}}class j extends w{constructor(t,e,s,i){super(t),this.sizeAttributeValue=e,this.colorAttributeValue=s,this.opacityAttributeValue=i,this.baked=new y(t),this._vvSize=m(this.builder.path.vertices.length).fill(e),this._vvColor=f(this.builder.path.vertices.length).fill(s),this._vvOpacity=f(this.builder.path.vertices.length).fill(i)}createGeometryData(){const t=this.builder,{pathVertexIndices:e,vertexIndices:s}=t;return[["position",new b(t.positions,e,3,!0)],["profileVertexAndNormal",new b(t.profileVertexAndNormals,s,4,!0)],["profileAuxData",new b(t.profileAuxData,s,3,!0)],["profileRight",new b(t.profileRightAxes,s,2,!0)],["profileUp",new b(t.profileUpAxes,s,2,!0)],["sizeFeatureAttribute",new b(this._vvSize,e,1,!0)],["colorFeatureAttribute",new b(this._vvColor,e,1,!0)],["opacityFeatureAttribute",new b(this._vvOpacity,e,1,!0)]]}onPathChanged(t){super.onPathChanged(t);const e=t.getMutableAttribute("position");e&&(e.data=this.builder.positions)}}const V=a(),C=a(),z=a(),_=c(),I=c(),k=c();export{j as FastUpdatePathGeometry,w as PathGeometryData,y as StaticPathGeometry};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import{unitRGBAFromColor as i}from"../../../../core/colorUtils.js";import"../../../../core/has.js";import{clamp as s,lerp as a}from"../../../../core/mathUtils.js";import{removeMaybe as n,abortMaybe as h,destroyMaybe as o,releaseMaybe as d}from"../../../../core/maybe.js";import{throwIfAborted as _}from"../../../../core/promiseUtils.js";import{watch as l,syncAndInitial as u,initial as p,sync as m}from"../../../../core/reactiveUtils.js";import{signal as c}from"../../../../core/signal.js";import{Milliseconds as f}from"../../../../core/time.js";import{property as g,subclass as b}from"../../../../core/accessorSupport/decorators.js";import{equals as P,invert as C,multiply as w}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as T,create as S}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as x}from"../../../../chunks/vec42.js";import{ZEROS as E}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{fromValues as A,ZEROS as D}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as I}from"../../../../geometry/support/Indices.js";import{RenderCategory as R,InternalRenderCategory as y}from"../../webgl.js";import{innerAtmosphereFadeStart as O}from"../../environment/atmosphereUtils.js";import{minNearDistanceInMeters as F}from"../../state/NearFarHeuristic.js";import{debugFlags as v}from"../../support/debugFlags.js";import{FBOCache as H,defaultWebGLFBO as M}from"../core/FBOCache.js";import{RenderPassManager as N}from"../core/renderPasses/RenderPassManager.js";import{isColor as q}from"../core/shaderLibrary/ShaderOutput.js";import{distanceFadeEnd as G}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as L}from"../effects/RenderNodes.js";import{RenderPluginManager as U}from"../effects/RenderPluginManager.js";import{Blit as V}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as j,renderHighlightBuffer as B}from"../effects/highlight/Highlight.js";import{OITBlend as k}from"../effects/transparency/OITBlend.js";import{AnimationTimer as z}from"./AnimationTimer.js";import{AnimationTimeStep as W}from"./AnimationTimeStep.js";import{BoundingInfo as Q}from"./BoundingInfo.js";import{DepthRange as Y}from"./DepthRange.js";import{depthRangeFromScene as Z}from"./depthRangeUtils.js";import{hudFragmentOpacityParameters as J}from"./hudFragmentOpacityParameters.js";import{MainFramebuffer as K}from"./MainFramebuffer.js";import{RenderContext as X,defaultRenderOccludedMask as $}from"./RenderContext.js";import{RendererBase as ee}from"./RendererBase.js";import{setupFeatureDefaults as te}from"./RenderFeature.js";import{RenderPluginInput as re}from"./RenderPluginInput.js";import{ShadowAccumulator as ie}from"./ShadowAccumulator.js";import{ShadowMap as se}from"./ShadowMap.js";import ae from"./SliceHelper.js";import{MergedRenderer as ne}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as he}from"../parts/renderUtils.js";import{RendererPerformanceInfo as oe,PerformanceCategory as de}from"../statistics/RendererPerformanceInfo.js";import{PixelType as _e,ColorAttachment1 as le,ColorAttachment2 as ue}from"../../../webgl/enums.js";let pe=class extends ee{constructor(e,t,r,s,a,n){super({stage:e}),this._techniques=r,this._rctx=s,this._compositingHelper=a,this._requestRender=n,this._pluginsHas={hudElements:!1,water:!1},this.renderPassManager=new N,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=A(0,0,0,1),this._sliceHelper=new ae,this._blit=null,this._oitblend=null,this.sceneDepthRange=c(Y.Infinite),this._state=c(2),this._hasAnimations=!1,this._animationTimestep=new W,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=c(0),this._lastFrameTime=f(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new re,this._releaseNormals=e=>{e.some(({name:e})=>"normals"===e)&&this._pluginInput.release("normals")},this._debugNeedsDepth=!1,this._fboCache=new H(s),this._renderStateFeatures=c(te(e.view.qualityProfile)),this._framebuffer=new K(this.fboCache),this._performanceInfo=new oe(this._rctx),this._shadowMap=new se(this.fboCache,e.viewingMode),this._shadowAccumulator=new ie(this.fboCache,r,e,e=>{const t=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),this._shadowMap.enabled=t},(t,r,i)=>{const s=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,r,i,!0,s),this._renderShadowCascades(3,t.shadowMap),t.shadowMap.finish(),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)},n),this._renderContext=new X(this._rctx,this._shadowMap,r),this._nodes=new L(this._renderContext),this._plugins=new U({renderContext:this._renderContext,techniques:r,materials:t,requestRender:n,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this._plugins.add(this.renderPassManager),this.addHandles([l(()=>e.view.state.camera,()=>n(),u),l(()=>v.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},n()},p),l(()=>e.view.environment.background?.color,e=>{const t=e?i(e):D;x(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),n()},u),l(()=>e.view.state.camera.relativeElevation,e=>this._inGlobeView=(e??1/0)>=G,u),l(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},m),l(()=>this._bindParameters.clouds.data?.state,()=>n(),m),l(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,n()},p)])}destroy(){this._gpuTimerHandle=n(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.destroy(),this._shadowAccumulator=null,this._loadEdgeViewTask=h(this._loadEdgeViewTask),this._edgeView=o(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this._fboCache.destroy(),this._fboCache=null,this._plugins.destroy(),this._plugins=null,this._pluginInput=null,this._blit=null,this._oitblend=null,this._compositingHelper=null,this._nodes=null,this._framebuffer=null,this._shadowMap=null,this._renderContext=null,this._performanceInfo=null,Q.prune(),ne.prune(),I()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _framebufferSize(){return this._framebuffer.size}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e){this._renderStateFeatures.value=te(e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,r){this._renderStateFeatures.mutate(i=>i.set(t,e,r)),this._requestRender()}get _highQualityTransparency(){return this.isFeatureEnabled(1)}get hasReflections(){return this._pluginsHas.water&&this.isFeatureEnabled(5)}get _hasHighlights(){return this._plugins.produces(8,2,4,18,13,14)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(8,13,14)}get hasSSAO(){return this.isFeatureEnabled(4)&&!this._inGlobeView}get hasSMAA(){return this.isFeatureEnabled(0)}get hasEmitters(){return this._plugins.hasEmitters&&this.stage.view.qualitySettings.physicallyBasedRenderingEnabled}get highResolutionAtmosphere(){return this.isFeatureEnabled(3)}get fboCache(){return this._fboCache}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=d(this._bindParameters.ssr.lastFrameColor),this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth),this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth)}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._bindParameters.depth=d(this._bindParameters.depth),this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility)}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._shadowAccumulator.readyToRun||this._plugins.updating||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=r(async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");_(e);const r=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:xe(this.stage.view.resourceController)});return this.addHandles(l(()=>r.updating,()=>this._requestRender(),m)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(r)),this._edgeViewCallbacks.length=0,r})),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&P(this._bindParameters.ssr.reprojectionMatrix,T)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:t,_bindParameters:r}=this;if(void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&t.maxCascades!==e.shadowMapMaxCascades&&(t.maxCascades=e.shadowMapMaxCascades,this._requestRender()),e.environment){void 0!==e.environment.weather&&(this._bindParameters.weather=e.environment.weather);const t="virtual"!==e.environment.lighting.type;r.enableFillLights!==t&&(r.enableFillLights=t,this._requestRender())}void 0!==e.shadowCast&&this._shadowAccumulator.setOptions(e.shadowCast)}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}rendererAdded(e){this._plugins.add(e)}rendererRemoved(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this.occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(8&this.plugins.renderOccludedFlags)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,9)}updateHasFlags(){const has=this._pluginsHas;has.hudElements=this._plugins.produces(0,...Pe),has.water=this._plugins.produces(2,19),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new z(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const r=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==r&&(this._gpuTimerHandle=r?n(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,r,i=!1){try{return this._isRendering=!0,this._render(e,t,r,i)}catch(s){console.error(`Exception during rendering: ${s}`)}finally{this._isRendering=!1}return new he(this._pluginInput.get(R.FINAL),null)}_updateHUDOccludedFragmentOpacity(e,t){const{idleOpacity:r,navigatingOpacity:i,maxDelta:n,tiltFadeStart:h,tiltFadeEnd:o,altitudeStart:d,altitudeEnd:_}=J,l=this.stage.view,u=l.stateManager.camera,p=l.qualitySettings.fadeDuration,m=2===e?r:i,c=s((u.tilt-h)/(o-h),0,1),f=s(((u.position.z??0)-d)/(_-d),0,1),g=a(a(1,m,c),1,f),b=this._bindParameters.hudOccludedFragmentOpacity;if(p<=0||b===g||0===this._lastFrameTime||this._lastFrameTime>t)return this._bindParameters.hudOccludedFragmentOpacity=g,void(this._lastFrameTime=t);const P=t-this._lastFrameTime;this._lastFrameTime=t;const C=Math.max(1-r,Math.abs(r-i)),w=Math.min(C*P/p,n);w>=Math.abs(g-b)?this._bindParameters.hudOccludedFragmentOpacity=g:(this._bindParameters.hudOccludedFragmentOpacity=b+Math.sign(g-b)*w,this._requestRender())}_render(e,t,r,i){const s=0===r;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=s,this._disposeBindBuffers();const{camera:a,contentCamera:n,mode:h,alignPixelEnabled:o}=e;this._state.value=h;const d=this._nodes.produces("magnifier-color"),_=this._nodes.produces(R.FINAL);this._renderContext.time=t,this._renderContext.output=0,this._bindParameters.hasEmission=this.hasEmitters,this._bindParameters.oitPass=0,this._bindParameters.alignPixelEnabled=o,this._bindParameters.decorations=!i,this._bindParameters.mainDepth=null;const l=!i||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=l?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(y.VIEWSHED),this._bindParameters.cutFillEnabled=this._nodes.produces(y.CUTFILL_DEPTH),this._renderOverlay(),a.setGLViewport(this._rctx);const u=this._framebuffer,p=u.initialize(a.fullWidth,a.fullHeight,this._backgroundColor,this._bindParameters.hasEmission);this.hasReflections?(p?.setName("last frame color"),this._bindParameters.ssr.lastFrameColor=p):p?.release(),this._ensureBindParametersCamera(a,n),this._updateHUDOccludedFragmentOpacity(h,t),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&!i;const m=this._highQualityTransparency&&this._hasTransparentTerrain,c=this._plugins.produces(0,...ge);this._precompilePrepasses(),this.performanceInfo.advance(de.PREPARE);const f=this._computeShadowDepthRange(a);this._renderShadowMap(a,this._bindParameters.lighting.mainLight.direction,f),this._pluginInput.set("normals",this._renderNormals()),this._renderRemainingGeometryDepth(),this._renderShadowAccumulation(f,a,n,!s),this._ensureBindParametersSSR(t),this._precompileShaders(m,c),this._renderContext.output=0,u.bind(),this._bindParameters.mainDepth=u.depth.attachment,this._renderOpaque(m),this._renderTransparent(c,m),this._shadowMap.disposeMainBuffer(),this._pluginInput.set(y.FOCUSAREA,this._renderFocusAreaGeometry()),this._pluginInput.set(y.CUTFILL_DEPTH,this._renderCutFillDepth()),u.update(e=>this._renderNodes(y.TRANSPARENT_ENVIRONMENT,e)),u.update(e=>this._renderNodes(y.VIEWSHED,e)),u.update(e=>this._renderNodes(y.LASERLINES,e)),u.update(e=>this._renderNodes(y.FOCUSAREA_COLOR,e)),this._pluginInput.release(y.FOCUSAREA),this._pluginInput.release(y.CUTFILL_DEPTH),u.update(e=>this._renderNodes(y.OCCLUDED,e)),this._pluginInput.set("highlights",this._renderHighlightPrepass()),this._renderHighlightShadowMap(a,this._bindParameters.lighting.mainLight.direction,f);const g=2===r?this._renderObjectAndLayerIdColor():null;u.update(e=>this._renderNodes(R.COMPOSITE,e)),this._shadowMap.disposeOffscreenBuffers();const b=s&&!_&&!(d&&!i),P=this._pluginInput.get(R.COMPOSITE),C=b?M:this.fboCache.acquire(P.fbo.width,P.fbo.height,y.ANTIALIASING),w=this._nodes.produces(y.ANTIALIASING)?this._renderNodes(y.ANTIALIASING,C):this.blitFBO(P,C,!1);let T;this._pluginInput.set(y.ANTIALIASING,w),this._hasHUDHighlights?(this._renderHUD(1,w),T=this._renderNodes(y.HIGHLIGHTS,w)):(T=this._renderNodes(y.HIGHLIGHTS,w),this._renderHUD(1,T));const S=this._renderNodes(y.MAGNIFIER,T);return s&&d&&!i&&!_&&this.blitFBO(S),_?(S.attachDepth(u.depth),this.blitFBO(this._renderNodes(R.FINAL,S)),S.detachDepth()):this._pluginInput.set(R.FINAL,S),this._pluginInput.release("highlights"),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),u.releaseDepth(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),this.performanceInfo.finishFrame(),s||(this._releaseFBOs(),this._disposeOffscreenBuffers()),new he(this._pluginInput.get(R.FINAL),g)}_precompileShaders(e,t){++this._plugins.context.techniques.precompiling,this._renderContext.output=0,this._precompileOpaqueGeometry(),this._nodes.precompile(y.OPAQUE_ENVIRONMENT),this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,this._renderContext.output=1,this._plugins.precompile(6),this._plugins.precompile(7),e&&(this._precompileOpaqueGeometry(),this._precompileTransparentGeometry()),this._renderContext.output=0,this._plugins.precompile(6),this._plugins.precompile(7),t&&(this._precompileTransparentGeometry(),this._hasTransparentTerrain&&(this._bindParameters.cullAboveTerrain=!1,this._precompileTransparentGeometry(),this._bindParameters.cullAboveTerrain=e)),this._nodes.precompile(y.FOCUSAREA),this._needsHUDVisibility&&this._plugins.precompile(12),this._plugins.precompile(15),this._precompileHUD(0),this._bindParameters.terrainDepthTest=!1,this._bindParameters.cullAboveTerrain=!1,this._nodes.precompile(y.VIEWSHED,y.CUTFILL_DEPTH,y.CUTFILL_COLOR,y.LASERLINES,y.FOCUSAREA_COLOR,y.OCCLUDED,y.ANTIALIASING,y.HIGHLIGHTS);const r=this._bindParameters;r.highlightMixTexture=r.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(1),this._hasHighlights&&(r.highlights.forEach((e,t)=>{r.highlightLevel=t,this._precompileAllGeometry(8)}),r.highlightLevel=null),r.highlightMixTexture=null,this._nodes.precompile(R.COMPOSITE,y.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(8),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(y.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(de.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces("olid"))return null;const e=this._renderContext.output;++this._techniques.precompiling;const t=this._framebufferSize;let r=this.fboCache.acquire(t.width,t.height,"olid");return r.acquireDepth(13),r=this._nodes.render(r,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(de.OBJECT_AND_LAYER_ID_COLOR),this._renderContext.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=0===e;if(r||t){const e=r?this.performanceInfo.elapsedTime:0;let i=0;t?i=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const s=Math.max(e,i);this._animationTimestep.frame(s,r)}}readMainDepth(e,t){const{mainDepth:r,camera:i}=this._bindParameters;if(!r)return;const s=this.fboCache.acquire(this._framebufferSize.width,this._framebufferSize.height,"linear depth");this._rctx.bindFramebuffer(s.fbo),i.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(D),this._compositingHelper.blitDepthToLinearDepth(this._bindParameters,r),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),s.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,_e.UNSIGNED_BYTE,t),s.release()}readHUDVisibility(e,t,r,i,s){this._bindParameters.hudVisibility?.fbo?.readPixels(e,t,r,i,6408,_e.UNSIGNED_BYTE,s)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_renderEdges(e){const t=this._edgeView;if(!t?.shouldRender())return;const r=this._framebufferSize,i=this.fboCache.acquire(r.width,r.height,"edges"),s=this._bindParameters.geometryDepth,a=()=>t.render(this._bindParameters,e);this.renderToTargets(a,i,s??this._framebuffer.depth,D),this._framebuffer.bind(),this._compositingHelper.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(1===e?de.OPAQUE_EDGES:de.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(),this._bindParameters.overlay&&this.performanceInfo.advance(de.OVERLAY)}_renderShadowMap(e,t,r){if(!this.shadowsEnabled)return;const i=this._shadowMap;i.start(e,t,r,this.isFeatureEnabled(6),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(5,this._shadowMap),i.copySnapshot(1),this._renderShadowCascades(4,this._shadowMap)):this._renderShadowCascades(3),i.finish(),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this.performanceInfo.advance(de.SHADOW_MAP)}_renderHighlightShadowMap(e,t,r){if(!this.shadowsEnabled||!this._needsShadowHighlight)return;const i=this._shadowMap;i.start(e,t,r,this.isFeatureEnabled(6),this.stage.view.qualitySettings.maximumPixelRatio),this._renderShadowCascades(4,this._shadowMap),i.moveSnapshot(0),i.finish(),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this.performanceInfo.advance(de.SHADOW_MAP)}_renderCutFillDepth(){return this._nodes.produce(y.CUTFILL_DEPTH,this._pluginInput)}_precompileShadowCascades(e){0!==this._shadowMap.cascades.length&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._shadowMap){t.bindFbo();for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this.renderAllGeometry(e)}get _needsDepth(){return this._plugins.consumes(1)||this._nodes.requireGeometryDepth()||this.hasReflections||this._needsShadowHighlight||this._shadowAccumulator.active||this._debugNeedsDepth}_renderRemainingGeometryDepth(){const e=this._pluginInput.get("normals");e?(this._pluginInput.set(y.SSAO,this._renderSSAO()),this._needsDepth?(this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(1),d(this._bindParameters.depth),this._bindParameters.depth=e.obtainDepthTexture(),this.performanceInfo.advance(de.DEPTH)):(e.detachDepth(),this._bindParameters.depth=d(this._bindParameters.depth)),this.hasSSAO&&this._pluginInput.release("normals")):this._renderAllGeometryDepth()}_renderAllGeometryDepth(){if(!this._needsDepth)return void(this._bindParameters.depth=d(this._bindParameters.depth));const e=this._framebufferSize,t=this.fboCache.acquire(e.width,e.height,"geometry depth",13);this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(1280),this.renderAllGeometry(1),d(this._bindParameters.depth),this._bindParameters.depth=t.obtainDepthTexture(),t.release(),this.performanceInfo.advance(de.DEPTH)}_renderTerrainDepth(e){if(this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth),this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,!e)return;const t=this._renderContext.output;this._renderContext.output=1;const r=this._framebufferSize,i=this.fboCache.acquire(r.width,r.height,"terrain depth",13);this._rctx.bindFramebuffer(i.fbo),this._rctx.clear(1280),this._renderTransparentTerrain(),this._bindParameters.terrainDepth=i.obtainDepthTexture(),i.release(),this._renderContext.output=t}_renderGeometryDepth(e){if(!e)return void(this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth));const t=this._renderContext.output,{width:r,height:i}=this._framebufferSize,s=this.fboCache.acquire(r,i,"geometry depth",13);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(1280),this._renderOpaqueAndTransparentGeometry(1),this._renderContext.output=t,d(this._bindParameters.geometryDepth),this._bindParameters.geometryDepth=s.obtainDepthTexture(),s.release()}get _needsShadowDepthRange(){return this._shadowMap.enabled||this._shadowAccumulator.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return Y.Zero;const t=Z(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal)return void(this.sceneDepthRange.value=Y.Infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<O)return void(this.sceneDepthRange.value=Y.Infinite);const t=e.clone();t.near=F,t.far=1e10;const r=Z(t,this._plugins.plugins,this.stage.layers,1);r.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(r)||(this.sceneDepthRange.value=r)}get _normalsRequired(){const e=this._nodes.require("normals",R.FINAL,R.COMPOSITE,R.OPAQUE,R.TRANSPARENT,y.VIEWSHED,y.LASERLINES);return(this.hasSSAO?1:0)+e}_precompilePrepasses(){this._normalsRequired&&this._precompileAllGeometry(2),this._needsDepth&&this._precompileAllGeometry(1),this.shadowsEnabled&&(this._needsShadowHighlight?(this._precompileShadowCascades(4),this._precompileShadowCascades(5)):this._precompileShadowCascades(3)),this._shadowAccumulator.active&&this._precompileAllGeometry(3)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"normals",5);r.acquireDepth(13),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(D,!0,!0),this._renderGeometryWithNormals(2);const i=this._nodes.optional("normals",R.FINAL,R.COMPOSITE,R.OPAQUE,R.TRANSPARENT,y.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(de.NORMALS),r}_renderSSAO(){const e=this._pluginInput.get("normals");if(!this.hasSSAO||!e)return;const t=this._nodes.produce(y.SSAO,this._pluginInput);return this._bindParameters.ssao=t,t&&this.performanceInfo.advance(de.SSAO),t}_precompileAllGeometry(e){const t=this._renderContext.output;this._renderContext.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(6),this._plugins.precompile(7),this._renderContext.output=t}renderAllGeometry(e){this._renderContext.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentTerrain()}precompileSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const r of t)this._renderContext.renderOccludedMask=r,this.precompileSlots(e,...be);this._renderContext.renderOccludedMask=$}renderSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.forAll(e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)})}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>1&&this._plugins.render(9),this.renderSlots(e,...be),this._renderContext.renderOccludedMask=$}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(13)}precompileViewshedShadowMap(){this._precompileAllGeometry(6)}precompileCutFill(){const e=7,t=this._renderContext.output;this._renderContext.output=e,this._plugins.precompile(0,1,6),this._renderContext.output=t}renderViewshedShadowMap(e){const{camera:t,contentCamera:r}=this._bindParameters,i=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(6),this._ensureBindParametersCamera(t,r),this._bindParameters.camera.setGLViewport(this._rctx),this._renderContext.output=i}renderCutFillReferenceDepth(e){const{camera:t,contentCamera:r}=this._bindParameters,i=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._renderContext.output=7,this._plugins.render(0,1),this._plugins.render(6),this._ensureBindParametersCamera(t,r),t.setGLViewport(this._rctx),this._renderContext.output=i}_renderOpaqueAndTransparentGeometry(e){this._renderContext.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithNormals(e){this._renderContext.output=e,this._plugins.render(...me),this._renderTransparentTerrain()}_renderGeometryWithoutNormals(e){this._renderContext.output=e,this._plugins.render(...ce)}_precompileOpaqueGeometry(){this._plugins.precompile(...fe),this._nodes.precompile("opaque-color")}_renderOpaqueGeometry(){this._plugins.render(...fe)}_renderTransparentGeometry(){this._plugins.render(...ge)}get _hasTransparentTerrain(){return this._plugins.produces(0,6)}get _hasTransparentIntegratedMesh(){return this._plugins.produces(this._renderContext.output,7)}_renderTransparentTerrain(){const e=()=>this._plugins.render(6);if(!q(this._renderContext.output))return void e();const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"transparent terrain");return this.renderToTargets(e,r,this._framebuffer.depth,D),r}_renderTransparentIntegratedMesh(){const e=()=>this._plugins.render(7);if(!q(this._renderContext.output))return void e();const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"transparent integrated mesh");return this.renderToTargets(e,r,this._framebuffer.depth,D),r}get _needsHUDVisibility(){return this._plugins.produces(this._renderContext.output,12)}_renderHUDVisibility(){if(!this._needsHUDVisibility)return void(this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility));const{width:e,height:t}=this._framebufferSize;let r=this._bindParameters.hudVisibility;r?.fbo?.width===e&&r?.fbo?.height===t||(r?.release(),r=this.fboCache.acquire(e,t,"hud visibility",4),this._bindParameters.hudVisibility=r);const i=this._bindParameters.geometryDepth;r.attachDepth(i||this._framebuffer.depth),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer([0,1,0,1]),this._plugins.render(12),r.detachDepth(),this._framebuffer.bind(),this.performanceInfo.advance(de.HUD_VISIBILITY)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,0===e){const e=()=>this._plugins.render(15),t=this._framebufferSize,r=this.fboCache.acquireDepth(12,t.width,t.height,"line callouts");this.renderToTargets(e,this._framebuffer.color,r,void 0,!0,!0),r.release()}else this._plugins.render(15)}_precompileHUD(e){if(this._precompileHUDOutput(e),this._hasHighlights){const t=this._renderContext.output;this._renderContext.output=8,this._precompileHUDOutput(e),this._renderContext.output=t}}_precompileHUDOutput(e){const t=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this._oitEnabled&&q(this._renderContext.output)?(this._bindParameters.oitPass=1,this._plugins.precompile(...Pe),this._bindParameters.oitPass=2,this._plugins.precompile(...Pe),this._bindParameters.oitPass=0):this._plugins.precompile(...Pe),this._bindParameters.hudRenderStyle=t}_renderHUD(e,t){if(this._pluginsHas.hudElements){if(this._oitEnabled){const r=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,r.getTexture(),!1),r.release()}else if(this._renderContext.output=0,0===e){const t=()=>this._renderHUDElements(e),r=this._framebufferSize,i=this.fboCache.acquireDepth(12,r.width,r.height,"hud");this.renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(12),this._rctx.bindFramebuffer(t.fbo),this._renderHUDElements(e),t.detachDepth();this.performanceInfo.advance(0===e?de.HUD_OCCLUDED:de.HUD)}}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Pe)}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(4,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:r}=this,i=this._framebufferSize,{highlights:s}=r,a=e.acquire(i.width,i.height,"highlights",s.length>j?3:1);a.acquireDepth(13);const n=this._plugins.produces(8,0);return n&&this._framebuffer.color.fbo&&a.fbo&&t.blitFramebuffer(this._framebuffer.color.fbo,a.fbo,1024),t.bindFramebuffer(a.fbo),t.gl.clearBufferuiv(6144,0,[0,0,0,0]),n||t.clear(1024),this._renderContext.output=8,t.bindFramebuffer(a.fbo),B(t,e,i,r,()=>this._renderHighlightGeometries()),a.detachDepth(),this.performanceInfo.advance(de.HIGHLIGHTS),a}_renderHighlightGeometries(){this._plugins.render(...Ce),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e,t,r,i){this._shadowAccumulator.updateDepthRange(e),this._shadowAccumulator.accumulating&&this._bindParameters.depth&&this._shadowAccumulator.renderAccumulation(this._bindParameters.depth,t,r,i)&&this.performanceInfo.advance(de.ACCUMULATED_SHADOWS)}_precompileTransparentGeometry(){this._oitEnabled&&q(this._renderContext.output)?(this._bindParameters.oitPass=1,this._plugins.precompile(...ge),this._bindParameters.oitPass=2,this._plugins.precompile(...ge),this._bindParameters.oitPass=0):this._plugins.precompile(...ge)}_renderOIT(e,t=2){const r=1===e,i=this._framebufferSize,s=r?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),a=this._bindParameters,n=this._renderContext.output;this._renderContext.output=0,a.oitPass=1;const h=r?"oit hud":"oit",o=this.fboCache.acquire(i.width,i.height,h,8),d=this._bindParameters.hasEmission;d&&o.acquireColor(le,8,"oit emissive"),o.acquireColor(d?ue:le,7,"oit alpha"),r||o.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(o.fbo),this._rctx.clearFramebuffer([0,0,0,1]),d&&this._rctx.clearBuffer(1,E),s(),o.detachDepth(),a.oitPass=2;const _=this.fboCache.acquire(i.width,i.height,r?"oit hud front":"oit front");let l;return d&&_.acquireColor(le,8,"oit emissive front"),r?_.acquireDepth(12):_.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(_.fbo),this._rctx.clearFramebuffer(D,r),s(),_.detachDepth(),a.oitPass=0,r?(l=this.fboCache.acquire(i.width,i.height,"oit hud composite"),this._rctx.bindFramebuffer(l.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):this._framebuffer.bind(),this._oitblend??=new k(this._techniques),this._oitblend.blend(this._rctx,o,_,a,d,!r),l?.detachDepth(),_.release(),o.release(),this._renderContext.output=n,l}_renderOpaque(e){const t=this.plugins.produces(0,...fe);if(t){this._plugins.render(0,1);const e=this._framebuffer;e.update(e=>this._renderNodes(y.CUTFILL_COLOR,e)),e.update(e=>this._renderNodes(y.OPAQUE_TERRAIN,e)),e.bind(),this._plugins.render(2,3)}const r=this._framebuffer;this._renderTerrainDepth(e),r.update(e=>this._renderNodes(R.OPAQUE,e,t)),this.fboCache.debugCallback?.(R.OPAQUE,r.color.fbo),r.update(e=>this._renderNodes(y.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(y.OPAQUE_ENVIRONMENT,r.color.fbo),this._renderEdges(1)}_renderTransparent(e,t){const r=this._framebuffer;r.bind(),this._renderPlugins(20,de.VOXEL),this._renderHiddenTransparentEdges(),e&&(this._oitEnabled?this._renderOIT(0):this._renderTransparentGeometry()),r.update(t=>this._renderNodes(R.TRANSPARENT,t,e)),this.fboCache.debugCallback?.(R.TRANSPARENT,r.color.fbo),this._renderGeometryDepth(t),this._renderHUDVisibility(),t||this._plugins.render(15),this._renderEdges(0);const i=this._hasTransparentTerrain?this._renderTransparentTerrain():null;i&&(this.performanceInfo.advance(de.TRANSPARENT_TERRAIN),this._bindParameters.hudVisibility&&(t?this._renderLineCallouts(0):(this._rctx.bindFramebuffer(this._bindParameters.hudVisibility?.fbo),this._compositingHelper.compositeHUD(this._bindParameters,i.getTexture())),this._renderHUD(0,r.color))),this._bindParameters.cullAboveTerrain=!1,i&&(r.bind(),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,i.getTexture()),i.release(),t&&(this._renderEdges(1),e&&(this._oitEnabled?this._renderOIT(0):this._renderTransparentGeometry(),this.performanceInfo.advance(de.TRANSPARENT)),this._renderEdges(0)));const s=this._hasTransparentIntegratedMesh?this._renderTransparentIntegratedMesh():null;s&&(r.bind(),this._compositingHelper.composite(this._bindParameters,s.getTexture()),s.release()),this._bindParameters.ssao=d(this._bindParameters.ssao),t&&this._renderLineCallouts(1),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(de.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(8),this.performanceInfo.advance(de.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderPlugins(e,t){this._plugins.produces(this._renderContext.output,e)&&(this._plugins.render(e),this.performanceInfo.advance(t))}_renderNodes(e,t,r=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return r&&this.performanceInfo.advance(e),t;const i=this._nodes.render(t,this._pluginInput,this._releaseNormals);return this.performanceInfo.advance(e),i}blitFBO(e,t=M,r=!0){return this._blit??=new V(this._techniques),this._blit.blit(this._rctx,e,t,this._bindParameters),this._pluginInput.set(e.name,t),r&&e.release(),t}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=T:(C(Te,this._bindParameters.camera.viewMatrix),C(we,this._bindParameters.camera.projectionMatrix),w(Se,Te,we),w(Se,this._renderContext.lastFrameCamera.viewMatrix,Se),w(Se,this._renderContext.lastFrameCamera.projectionMatrix,Se),this._reprojectionMatrix=Se);const t=this.stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=t>0?Math.min(t,e-this._ssrEnableTime)/t:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=T,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,r,i){this._bindParameters.updateLighting(e,t,r,i),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0}}renderToTargets(e,t,r,i,s=!1,a=!1){t.attachDepth(r),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(i,s,a),e(),t.detachDepth()}get test(){}};e([g({readOnly:!0})],pe.prototype,"highResolutionAtmosphere",null),e([g()],pe.prototype,"_edgeView",void 0),e([g()],pe.prototype,"updating",null),pe=e([b("esri.views.3d.webgl-engine.lib.Renderer")],pe);const me=[0,1,2,4],ce=[3,5],fe=[0,1,2,3],ge=[4,5],be=[2,4,8],Pe=[16,13,14],Ce=[4,5,2,3,6,0,1],we=S(),Te=S(),Se=S();function xe(e){return t=>e.immediate.schedule(t)}export{pe as Renderer};
|
|
5
|
+
import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import{unitRGBAFromColor as i}from"../../../../core/colorUtils.js";import"../../../../core/has.js";import{clamp as s,lerp as a}from"../../../../core/mathUtils.js";import{removeMaybe as n,abortMaybe as h,destroyMaybe as o,releaseMaybe as d}from"../../../../core/maybe.js";import{throwIfAborted as _}from"../../../../core/promiseUtils.js";import{watch as l,syncAndInitial as u,initial as p,sync as m}from"../../../../core/reactiveUtils.js";import{signal as c}from"../../../../core/signal.js";import{Milliseconds as f}from"../../../../core/time.js";import{property as g,subclass as b}from"../../../../core/accessorSupport/decorators.js";import{equals as P,invert as C,multiply as w}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as T,create as S}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{c as x}from"../../../../chunks/vec42.js";import{ZEROS as E}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{fromValues as A,ZEROS as D}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as I}from"../../../../geometry/support/Indices.js";import{RenderCategory as R,InternalRenderCategory as y}from"../../webgl.js";import{innerAtmosphereFadeStart as O}from"../../environment/atmosphereUtils.js";import{minNearDistanceInMeters as F}from"../../state/NearFarHeuristic.js";import{debugFlags as v}from"../../support/debugFlags.js";import{FBOCache as H,defaultWebGLFBO as M}from"../core/FBOCache.js";import{RenderPassManager as N}from"../core/renderPasses/RenderPassManager.js";import{isColor as q}from"../core/shaderLibrary/ShaderOutput.js";import{distanceFadeEnd as G}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as L}from"../effects/RenderNodes.js";import{RenderPluginManager as U}from"../effects/RenderPluginManager.js";import{Blit as V}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as j,renderHighlightBuffer as B}from"../effects/highlight/Highlight.js";import{OITBlend as k}from"../effects/transparency/OITBlend.js";import{AnimationTimer as z}from"./AnimationTimer.js";import{AnimationTimeStep as W}from"./AnimationTimeStep.js";import{BoundingInfo as Q}from"./BoundingInfo.js";import{DepthRange as Y}from"./DepthRange.js";import{depthRangeFromScene as Z}from"./depthRangeUtils.js";import{hudFragmentOpacityParameters as J}from"./hudFragmentOpacityParameters.js";import{MainFramebuffer as K}from"./MainFramebuffer.js";import{RenderContext as X,defaultRenderOccludedMask as $}from"./RenderContext.js";import{RendererBase as ee}from"./RendererBase.js";import{setupFeatureDefaults as te}from"./RenderFeature.js";import{RenderPluginInput as re}from"./RenderPluginInput.js";import{ShadowAccumulator as ie}from"./ShadowAccumulator.js";import{ShadowMap as se}from"./ShadowMap.js";import ae from"./SliceHelper.js";import{MergedRenderer as ne}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as he}from"../parts/renderUtils.js";import{RendererPerformanceInfo as oe,PerformanceCategory as de}from"../statistics/RendererPerformanceInfo.js";import{PixelType as _e,ColorAttachment1 as le,ColorAttachment2 as ue}from"../../../webgl/enums.js";let pe=class extends ee{constructor(e,t,r,s,a,n){super({stage:e}),this._techniques=r,this._rctx=s,this._compositingHelper=a,this._requestRender=n,this._pluginsHas={hudElements:!1,water:!1},this.renderPassManager=new N,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=A(0,0,0,1),this._sliceHelper=new ae,this._blit=null,this._oitblend=null,this.sceneDepthRange=c(Y.Infinite),this._state=c(2),this._hasAnimations=!1,this._animationTimestep=new W,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=c(0),this._lastFrameTime=f(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new re,this._releaseNormals=e=>{e.some(({name:e})=>"normals"===e)&&this._pluginInput.release("normals")},this._debugNeedsDepth=!1,this._fboCache=new H(s),this._renderStateFeatures=c(te(e.view.qualityProfile)),this._framebuffer=new K(this.fboCache),this._performanceInfo=new oe(this._rctx),this._shadowMap=new se(this.fboCache,e.viewingMode),this._shadowAccumulator=new ie(this.fboCache,r,e,e=>{const t=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),this._shadowMap.enabled=t},(t,r,i)=>{const s=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,r,i,!0,s),this._renderShadowCascades(3,t.shadowMap),t.shadowMap.finish(),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)},n),this._renderContext=new X(this._rctx,this._shadowMap,r),this._nodes=new L(this._renderContext),this._plugins=new U({renderContext:this._renderContext,techniques:r,materials:t,requestRender:n,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this._plugins.add(this.renderPassManager),this.addHandles([l(()=>e.view.state.camera,()=>n(),u),l(()=>v.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},n()},p),l(()=>e.view.environment.background?.color,e=>{const t=e?i(e):D;x(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),n()},u),l(()=>e.view.state.camera.relativeElevation,e=>this._inGlobeView=(e??1/0)>=G,u),l(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},m),l(()=>this._bindParameters.clouds.data?.state,()=>n(),m),l(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,n()},p)])}destroy(){this._gpuTimerHandle=n(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.destroy(),this._shadowAccumulator=null,this._loadEdgeViewTask=h(this._loadEdgeViewTask),this._edgeView=o(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this._fboCache.destroy(),this._fboCache=null,this._plugins.destroy(),this._plugins=null,this._pluginInput=null,this._blit=null,this._oitblend=null,this._compositingHelper=null,this._nodes=null,this._framebuffer=null,this._shadowMap=null,this._renderContext=null,this._performanceInfo=null,Q.prune(),ne.prune(),I()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _framebufferSize(){return this._framebuffer.size}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e){this._renderStateFeatures.value=te(e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,r){this._renderStateFeatures.mutate(i=>i.set(t,e,r)),this._requestRender()}get _highQualityTransparency(){return this.isFeatureEnabled(1)}get hasReflections(){return this._pluginsHas.water&&this.isFeatureEnabled(5)}get _hasHighlights(){return this._plugins.produces(8,2,4,18,13,14)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(8,13,14)}get hasSSAO(){return this.isFeatureEnabled(4)&&!this._inGlobeView}get hasSMAA(){return this.isFeatureEnabled(0)}get hasEmitters(){return this._plugins.hasEmitters&&this.stage.view.qualitySettings.physicallyBasedRenderingEnabled}get highResolutionAtmosphere(){return this.isFeatureEnabled(3)}get fboCache(){return this._fboCache}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=d(this._bindParameters.ssr.lastFrameColor),this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth),this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth)}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._bindParameters.depth=d(this._bindParameters.depth),this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility)}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._shadowAccumulator.readyToRun||this._plugins.updating||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=r(async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");_(e);const r=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:xe(this.stage.view.resourceController)});return this.addHandles(l(()=>r.updating,()=>this._requestRender(),m)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(r)),this._edgeViewCallbacks.length=0,r})),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&P(this._bindParameters.ssr.reprojectionMatrix,T)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:t,_bindParameters:r}=this;if(void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&t.maxCascades!==e.shadowMapMaxCascades&&(t.maxCascades=e.shadowMapMaxCascades,this._requestRender()),e.environment){void 0!==e.environment.weather&&(this._bindParameters.weather=e.environment.weather);const t="virtual"!==e.environment.lighting.type;r.enableFillLights!==t&&(r.enableFillLights=t,this._requestRender())}void 0!==e.shadowCast&&this._shadowAccumulator.setOptions(e.shadowCast)}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}rendererAdded(e){this._plugins.add(e)}rendererRemoved(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this.occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(8&this.plugins.renderOccludedFlags)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,9)}updateHasFlags(){const has=this._pluginsHas;has.hudElements=this._plugins.produces(0,...Pe),has.water=this._plugins.produces(2,19),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new z(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const r=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==r&&(this._gpuTimerHandle=r?n(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,r,i=!1){try{return this._isRendering=!0,this._render(e,t,r,i)}catch(s){console.error(`Exception during rendering: ${s}`)}finally{this._isRendering=!1}return new he(this._pluginInput.get(R.FINAL),null)}_updateHUDOccludedFragmentOpacity(e,t){const{idleOpacity:r,navigatingOpacity:i,maxDelta:n,tiltFadeStart:h,tiltFadeEnd:o,altitudeStart:d,altitudeEnd:_}=J,l=this.stage.view,u=l.stateManager.camera,p=l.qualitySettings.fadeDuration,m=2===e?r:i,c=s((u.tilt-h)/(o-h),0,1),f=s(((u.position.z??0)-d)/(_-d),0,1),g=a(a(1,m,c),1,f),b=this._bindParameters.hudOccludedFragmentOpacity;if(p<=0||b===g||0===this._lastFrameTime||this._lastFrameTime>t)return this._bindParameters.hudOccludedFragmentOpacity=g,void(this._lastFrameTime=t);const P=t-this._lastFrameTime;this._lastFrameTime=t;const C=Math.max(1-r,Math.abs(r-i)),w=Math.min(C*P/p,n);w>=Math.abs(g-b)?this._bindParameters.hudOccludedFragmentOpacity=g:(this._bindParameters.hudOccludedFragmentOpacity=b+Math.sign(g-b)*w,this._requestRender())}_render(e,t,r,i){const s=0===r;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=s,this._disposeBindBuffers();const{camera:a,contentCamera:n,mode:h,alignPixelEnabled:o}=e;this._state.value=h;const d=this._nodes.produces("magnifier-color"),_=this._nodes.produces(R.FINAL);this._renderContext.time=t,this._renderContext.output=0,this._bindParameters.hasEmission=this.hasEmitters,this._bindParameters.oitPass=0,this._bindParameters.alignPixelEnabled=o,this._bindParameters.decorations=!i,this._bindParameters.mainDepth=null;const l=!i||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=l?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(y.VIEWSHED),this._bindParameters.cutFillEnabled=this._nodes.produces(y.CUTFILL_DEPTH),this._renderOverlay(),a.setGLViewport(this._rctx);const u=this._framebuffer,p=u.initialize(a.fullWidth,a.fullHeight,this._backgroundColor,this._bindParameters.hasEmission);this.hasReflections?(p?.setName("last frame color"),this._bindParameters.ssr.lastFrameColor=p):p?.release(),this._ensureBindParametersCamera(a,n),this._updateHUDOccludedFragmentOpacity(h,t),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&!i;const m=this._highQualityTransparency&&this._hasTransparentTerrain,c=this._plugins.produces(0,...ge);this._precompilePrepasses(),this.performanceInfo.advance(de.PREPARE);const f=this._computeShadowDepthRange(a);this._renderShadowMap(a,this._bindParameters.lighting.mainLight.direction,f),this._pluginInput.set("normals",this._renderNormals()),this._renderRemainingGeometryDepth(),this._renderShadowAccumulation(f,a,n,!s),this._ensureBindParametersSSR(t),this._precompileShaders(m,c),this._renderContext.output=0,u.bind(),this._bindParameters.mainDepth=u.depth.attachment,this._renderOpaque(m),this._renderTransparent(c,m),this._shadowMap.disposeMainBuffer(),this._pluginInput.set(y.FOCUSAREA,this._renderFocusAreaGeometry()),this._pluginInput.set(y.CUTFILL_DEPTH,this._renderCutFillDepth()),u.update(e=>this._renderNodes(y.TRANSPARENT_ENVIRONMENT,e)),u.update(e=>this._renderNodes(y.VIEWSHED,e)),u.update(e=>this._renderNodes(y.LASERLINES,e)),u.update(e=>this._renderNodes(y.FOCUSAREA_COLOR,e)),this._pluginInput.release(y.FOCUSAREA),this._pluginInput.release(y.CUTFILL_DEPTH),u.update(e=>this._renderNodes(y.OCCLUDED,e)),this._pluginInput.set("highlights",this._renderHighlightPrepass()),this._renderHighlightShadowMap(a,this._bindParameters.lighting.mainLight.direction,f);const g=2===r?this._renderObjectAndLayerIdColor():null;u.update(e=>this._renderNodes(R.COMPOSITE,e)),this._shadowMap.disposeOffscreenBuffers();const b=s&&!_&&!(d&&!i),P=this._pluginInput.get(R.COMPOSITE),C=b?M:this.fboCache.acquire(P.fbo.width,P.fbo.height,y.ANTIALIASING),w=this._nodes.produces(y.ANTIALIASING)?this._renderNodes(y.ANTIALIASING,C):this.blitFBO(P,C,!1);let T;this._pluginInput.set(y.ANTIALIASING,w),this._hasHUDHighlights?(this._renderHUD(1,w),T=this._renderNodes(y.HIGHLIGHTS,w)):(T=this._renderNodes(y.HIGHLIGHTS,w),this._renderHUD(1,T));const S=this._renderNodes(y.MAGNIFIER,T);return s&&d&&!i&&!_&&this.blitFBO(S),_?(S.attachDepth(u.depth),this.blitFBO(this._renderNodes(R.FINAL,S)),S.detachDepth()):this._pluginInput.set(R.FINAL,S),this._pluginInput.release("highlights"),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),u.releaseDepth(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),this.performanceInfo.finishFrame(),s||(this._releaseFBOs(),this._disposeOffscreenBuffers()),new he(this._pluginInput.get(R.FINAL),g)}_precompileShaders(e,t){++this._plugins.context.techniques.precompiling,this._renderContext.output=0,this._precompileOpaqueGeometry(),this._nodes.precompile(y.OPAQUE_ENVIRONMENT),this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,this._renderContext.output=1,this._plugins.precompile(6),this._plugins.precompile(7),e&&(this._precompileOpaqueGeometry(),this._precompileTransparentGeometry()),this._renderContext.output=0,this._plugins.precompile(6),this._plugins.precompile(7),t&&(this._precompileTransparentGeometry(),this._hasTransparentTerrain&&(this._bindParameters.cullAboveTerrain=!1,this._precompileTransparentGeometry(),this._bindParameters.cullAboveTerrain=e)),this._nodes.precompile(y.FOCUSAREA),this._needsHUDVisibility&&this._plugins.precompile(12),this._plugins.precompile(15),this._precompileHUD(0),this._bindParameters.terrainDepthTest=!1,this._bindParameters.cullAboveTerrain=!1,this._nodes.precompile(y.VIEWSHED,y.CUTFILL_DEPTH,y.CUTFILL_COLOR,y.LASERLINES,y.FOCUSAREA_COLOR,y.OCCLUDED,y.ANTIALIASING,y.HIGHLIGHTS);const r=this._bindParameters;r.highlightMixTexture=r.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(1),this._hasHighlights&&(r.highlights.forEach((e,t)=>{r.highlightLevel=t,this._precompileAllGeometry(8)}),r.highlightLevel=null),r.highlightMixTexture=null,this._nodes.precompile(R.COMPOSITE,y.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(8),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(y.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(de.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces("olid"))return null;const e=this._renderContext.output;++this._techniques.precompiling;const t=this._framebufferSize;let r=this.fboCache.acquire(t.width,t.height,"olid");return r.acquireDepth(13),r=this._nodes.render(r,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(de.OBJECT_AND_LAYER_ID_COLOR),this._renderContext.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=0===e;if(r||t){const e=r?this.performanceInfo.elapsedTime:0;let i=0;t?i=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const s=Math.max(e,i);this._animationTimestep.frame(s,r)}}readMainDepth(e,t){const{mainDepth:r,camera:i}=this._bindParameters;if(!r)return;const s=this.fboCache.acquire(this._framebufferSize.width,this._framebufferSize.height,"linear depth");this._rctx.bindFramebuffer(s.fbo),i.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(D),this._compositingHelper.blitDepthToLinearDepth(this._bindParameters,r),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),s.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,_e.UNSIGNED_BYTE,t),s.release()}readHUDVisibility(e,t,r,i,s){this._bindParameters.hudVisibility?.fbo?.readPixels(e,t,r,i,6408,_e.UNSIGNED_BYTE,s)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_renderEdges(e){const t=this._edgeView;if(!t?.shouldRender())return;const r=this._framebufferSize,i=this.fboCache.acquire(r.width,r.height,"edges"),s=this._bindParameters.geometryDepth,a=()=>t.render(this._bindParameters,e);this.renderToTargets(a,i,s??this._framebuffer.depth,D),this._framebuffer.bind(),this._compositingHelper.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(1===e?de.OPAQUE_EDGES:de.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(),this._bindParameters.overlay&&this.performanceInfo.advance(de.OVERLAY)}_renderShadowMap(e,t,r){if(!this.shadowsEnabled)return;const i=this._shadowMap;i.start(e,t,r,this.isFeatureEnabled(6),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(5,this._shadowMap),i.copySnapshot(1),this._renderShadowCascades(4,this._shadowMap)):this._renderShadowCascades(3),i.finish(),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this.performanceInfo.advance(de.SHADOW_MAP)}_renderHighlightShadowMap(e,t,r){if(!this.shadowsEnabled||!this._needsShadowHighlight)return;const i=this._shadowMap;i.start(e,t,r,this.isFeatureEnabled(6),this.stage.view.qualitySettings.maximumPixelRatio),this._renderShadowCascades(4,this._shadowMap),i.moveSnapshot(0),i.finish(),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this.performanceInfo.advance(de.SHADOW_MAP)}_renderCutFillDepth(){return this._nodes.produce(y.CUTFILL_DEPTH,this._pluginInput)}_precompileShadowCascades(e){0!==this._shadowMap.cascades.length&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._shadowMap){t.bindFbo();for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this.renderAllGeometry(e)}get _needsDepth(){return this._plugins.consumes(1)||this._nodes.requireGeometryDepth()||this.hasReflections||this._needsShadowHighlight||this._shadowAccumulator.active||this._debugNeedsDepth}_renderRemainingGeometryDepth(){const e=this._pluginInput.get("normals");e?(this._pluginInput.set(y.SSAO,this._renderSSAO()),this._needsDepth?(this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(1),d(this._bindParameters.depth),this._bindParameters.depth=e.obtainDepthTexture(),this.performanceInfo.advance(de.DEPTH)):(e.detachDepth(),this._bindParameters.depth=d(this._bindParameters.depth)),this.hasSSAO&&this._pluginInput.release("normals")):this._renderAllGeometryDepth()}_renderAllGeometryDepth(){if(!this._needsDepth)return void(this._bindParameters.depth=d(this._bindParameters.depth));const e=this._framebufferSize,t=this.fboCache.acquire(e.width,e.height,"geometry depth",13);this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(1280),this.renderAllGeometry(1),d(this._bindParameters.depth),this._bindParameters.depth=t.obtainDepthTexture(),t.release(),this.performanceInfo.advance(de.DEPTH)}_renderTerrainDepth(e){if(this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth),this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,!e)return;const t=this._renderContext.output;this._renderContext.output=1;const r=this._framebufferSize,i=this.fboCache.acquire(r.width,r.height,"terrain depth",13);this._rctx.bindFramebuffer(i.fbo),this._rctx.clear(1280),this._renderTransparentTerrain(),this._bindParameters.terrainDepth=i.obtainDepthTexture(),i.release(),this._renderContext.output=t}_renderGeometryDepth(e){if(!e)return void(this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth));const t=this._renderContext.output,{width:r,height:i}=this._framebufferSize,s=this.fboCache.acquire(r,i,"geometry depth",13);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(1280),this._renderOpaqueAndTransparentGeometry(1),this._renderContext.output=t,d(this._bindParameters.geometryDepth),this._bindParameters.geometryDepth=s.obtainDepthTexture(),s.release()}get _needsShadowDepthRange(){return this._shadowMap.enabled||this._shadowAccumulator.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return Y.Zero;const t=Z(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal)return void(this.sceneDepthRange.value=Y.Infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<O)return void(this.sceneDepthRange.value=Y.Infinite);const t=e.clone();t.near=F,t.far=1e10;const r=Z(t,this._plugins.plugins,this.stage.layers,1);r.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(r)||(this.sceneDepthRange.value=r)}get _normalsRequired(){const e=this._nodes.require("normals",R.FINAL,R.COMPOSITE,R.OPAQUE,R.TRANSPARENT,y.VIEWSHED,y.LASERLINES);return(this.hasSSAO?1:0)+e}_precompilePrepasses(){this._normalsRequired&&this._precompileAllGeometry(2),this._needsDepth&&this._precompileAllGeometry(1),this.shadowsEnabled&&(this._needsShadowHighlight?(this._precompileShadowCascades(4),this._precompileShadowCascades(5)):this._precompileShadowCascades(3)),this._shadowAccumulator.active&&this._precompileAllGeometry(3)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"normals",5);r.acquireDepth(13),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(D,!0,!0),this._renderGeometryWithNormals(2);const i=this._nodes.optional("normals",R.FINAL,R.COMPOSITE,R.OPAQUE,R.TRANSPARENT,y.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(de.NORMALS),r}_renderSSAO(){const e=this._pluginInput.get("normals");if(!this.hasSSAO||!e)return;const t=this._nodes.produce(y.SSAO,this._pluginInput);return this._bindParameters.ssao=t,t&&this.performanceInfo.advance(de.SSAO),t}_precompileAllGeometry(e){const t=this._renderContext.output;this._renderContext.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(6),this._plugins.precompile(7),this._renderContext.output=t}renderAllGeometry(e){this._renderContext.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentTerrain()}precompileSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const r of t)this._renderContext.renderOccludedMask=r,this.precompileSlots(e,...be);this._renderContext.renderOccludedMask=$}renderSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.forAll(e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)})}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>1&&this._plugins.render(9),this.renderSlots(e,...be),this._renderContext.renderOccludedMask=$}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(13)}precompileViewshedShadowMap(){this._precompileAllGeometry(6)}precompileCutFill(){const e=7,t=this._renderContext.output;this._renderContext.output=e,this._plugins.precompile(0,1,6),this._renderContext.output=t}renderViewshedShadowMap(e){const{camera:t,contentCamera:r}=this._bindParameters,i=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(6),this._ensureBindParametersCamera(t,r),this._bindParameters.camera.setGLViewport(this._rctx),this._renderContext.output=i}renderCutFillReferenceDepth(e){const{camera:t,contentCamera:r}=this._bindParameters,i=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._renderContext.output=7,this._plugins.render(0,1),this._plugins.render(6),this._ensureBindParametersCamera(t,r),t.setGLViewport(this._rctx),this._renderContext.output=i}_renderOpaqueAndTransparentGeometry(e){this._renderContext.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithNormals(e){this._renderContext.output=e,this._plugins.render(...me),this._renderTransparentTerrain()}_renderGeometryWithoutNormals(e){this._renderContext.output=e,this._plugins.render(...ce)}_precompileOpaqueGeometry(){this._plugins.precompile(...fe),this._nodes.precompile("opaque-color")}_renderOpaqueGeometry(){this._plugins.render(...fe)}_renderTransparentGeometry(){this._plugins.render(...ge)}get _hasTransparentTerrain(){return this._plugins.produces(0,6)}get _hasTransparentIntegratedMesh(){return this._plugins.produces(this._renderContext.output,7)}_renderTransparentTerrain(){const e=()=>this._plugins.render(6);if(!q(this._renderContext.output))return void e();const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"transparent terrain");return this.renderToTargets(e,r,this._framebuffer.depth,D),r}_renderTransparentIntegratedMesh(){const e=()=>this._plugins.render(7);if(!q(this._renderContext.output))return void e();const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"transparent integrated mesh");return this.renderToTargets(e,r,this._framebuffer.depth,D),r}get _needsHUDVisibility(){return this._plugins.produces(this._renderContext.output,12)}_renderHUDVisibility(){if(!this._needsHUDVisibility)return void(this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility));const{width:e,height:t}=this._framebufferSize;let r=this._bindParameters.hudVisibility;r?.fbo?.width===e&&r?.fbo?.height===t||(r?.release(),r=this.fboCache.acquire(e,t,"hud visibility",4),this._bindParameters.hudVisibility=r);const i=this._bindParameters.geometryDepth;r.attachDepth(i||this._framebuffer.depth),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer([0,1,0,1]),this._plugins.render(12),r.detachDepth(),this._framebuffer.bind(),this.performanceInfo.advance(de.HUD_VISIBILITY)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,0===e){const e=()=>this._plugins.render(15),t=this._framebufferSize,r=this.fboCache.acquireDepth(12,t.width,t.height,"line callouts");this.renderToTargets(e,this._framebuffer.color,r,void 0,!0,!0),r.release()}else this._plugins.render(15)}_precompileHUD(e){if(this._precompileHUDOutput(e),this._hasHighlights){const t=this._renderContext.output;this._renderContext.output=8,this._precompileHUDOutput(e),this._renderContext.output=t}}_precompileHUDOutput(e){const t=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this._oitEnabled&&q(this._renderContext.output)?(this._bindParameters.oitPass=1,this._plugins.precompile(...Pe),this._bindParameters.oitPass=2,this._plugins.precompile(...Pe),this._bindParameters.oitPass=0):this._plugins.precompile(...Pe),this._bindParameters.hudRenderStyle=t}_renderHUD(e,t){if(this._pluginsHas.hudElements){if(this._oitEnabled){const r=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,r.getTexture(),!1),r.release()}else if(this._renderContext.output=0,0===e){const t=()=>this._renderHUDElements(e),r=this._framebufferSize,i=this.fboCache.acquireDepth(12,r.width,r.height,"hud");this.renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(12),this._rctx.bindFramebuffer(t.fbo),this._renderHUDElements(e),t.detachDepth();this.performanceInfo.advance(0===e?de.HUD_OCCLUDED:de.HUD)}}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Pe)}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(4,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:r}=this,i=this._framebufferSize,{highlights:s}=r,a=e.acquire(i.width,i.height,"highlights",s.length>j?3:1);a.acquireDepth(13);const n=this._plugins.produces(8,0);return n&&this._framebuffer.color.fbo&&a.fbo&&t.blitFramebuffer(this._framebuffer.color.fbo,a.fbo,1024),t.bindFramebuffer(a.fbo),t.gl.clearBufferuiv(6144,0,[0,0,0,0]),n||t.clear(1024),this._renderContext.output=8,t.bindFramebuffer(a.fbo),B(t,e,i,r,()=>this._renderHighlightGeometries()),a.detachDepth(),this.performanceInfo.advance(de.HIGHLIGHTS),a}_renderHighlightGeometries(){this._plugins.render(...Ce),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e,t,r,i){this._shadowAccumulator.updateDepthRange(e),this._shadowAccumulator.accumulating&&this._bindParameters.depth&&this._shadowAccumulator.renderAccumulation(this._bindParameters.depth,t,r,i)&&this.performanceInfo.advance(de.ACCUMULATED_SHADOWS)}_precompileTransparentGeometry(){this._oitEnabled&&q(this._renderContext.output)?(this._bindParameters.oitPass=1,this._plugins.precompile(...ge),this._bindParameters.oitPass=2,this._plugins.precompile(...ge),this._bindParameters.oitPass=0):this._plugins.precompile(...ge)}_renderOIT(e,t=2){const r=1===e,i=this._framebufferSize,s=r?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),a=this._bindParameters,n=this._renderContext.output;this._renderContext.output=0,a.oitPass=1;const h=r?"oit hud":"oit",o=this.fboCache.acquire(i.width,i.height,h,8),d=this._bindParameters.hasEmission;d&&o.acquireColor(le,8,"oit emissive"),o.acquireColor(d?ue:le,7,"oit alpha"),r||o.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(o.fbo),this._rctx.clearFramebuffer([0,0,0,1]),d&&this._rctx.clearBuffer(1,E),s(),o.detachDepth(),a.oitPass=2;const _=this.fboCache.acquire(i.width,i.height,r?"oit hud front":"oit front");let l;return d&&_.acquireColor(le,8,"oit emissive front"),r?_.acquireDepth(12):_.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(_.fbo),this._rctx.clearFramebuffer(D,r),s(),_.detachDepth(),a.oitPass=0,r?(l=this.fboCache.acquire(i.width,i.height,"oit hud composite"),this._rctx.bindFramebuffer(l.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):this._framebuffer.bind(),this._oitblend??=new k(this._techniques),this._oitblend.blend(this._rctx,o,_,a,d,!r),l?.detachDepth(),_.release(),o.release(),this._renderContext.output=n,l}_renderOpaque(e){const t=this.plugins.produces(0,...fe);if(t){this._plugins.render(0,1);const e=this._framebuffer;e.update(e=>this._renderNodes(y.CUTFILL_COLOR,e)),e.update(e=>this._renderNodes(y.OPAQUE_TERRAIN,e)),e.bind(),this._plugins.render(2,3)}const r=this._framebuffer;this._renderTerrainDepth(e),r.update(e=>this._renderNodes(R.OPAQUE,e,t)),this.fboCache.debugCallback?.(R.OPAQUE,r.color.fbo),r.update(e=>this._renderNodes(y.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(y.OPAQUE_ENVIRONMENT,r.color.fbo),this._renderEdges(1)}_renderTransparent(e,t){const r=this._framebuffer;r.bind(),this._renderPlugins(20,de.VOXEL),this._renderHiddenTransparentEdges(),e&&(this._oitEnabled?this._renderOIT(0):this._renderTransparentGeometry()),r.update(t=>this._renderNodes(R.TRANSPARENT,t,e)),this.fboCache.debugCallback?.(R.TRANSPARENT,r.color.fbo),this._renderGeometryDepth(t),this._renderHUDVisibility(),t||this._plugins.render(15),this._renderEdges(0);const i=this._hasTransparentTerrain?this._renderTransparentTerrain():null;i&&(this.performanceInfo.advance(de.TRANSPARENT_TERRAIN),this._bindParameters.hudVisibility&&(t?this._renderLineCallouts(0):(this._rctx.bindFramebuffer(this._bindParameters.hudVisibility?.fbo),this._compositingHelper.compositeHUD(this._bindParameters,i.getTexture())),this._renderHUD(0,r.color))),this._bindParameters.cullAboveTerrain=!1,i&&(r.bind(),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,i.getTexture()),i.release(),t&&(this._renderEdges(1),e&&(this._oitEnabled?this._renderOIT(0):this._renderTransparentGeometry(),this.performanceInfo.advance(de.TRANSPARENT)),this._renderEdges(0)));const s=this._hasTransparentIntegratedMesh?this._renderTransparentIntegratedMesh():null;s&&(r.bind(),this._compositingHelper.composite(this._bindParameters,s.getTexture()),s.release()),this._bindParameters.ssao=d(this._bindParameters.ssao),t&&this._renderLineCallouts(1),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(de.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(8),this.performanceInfo.advance(de.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderPlugins(e,t){this._plugins.produces(this._renderContext.output,e)&&(this._plugins.render(e),this.performanceInfo.advance(t))}_renderNodes(e,t,r=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return r&&this.performanceInfo.advance(e),t;const i=this._nodes.render(t,this._pluginInput,this._releaseNormals);return this.performanceInfo.advance(e),i}blitFBO(e,t=M,r=!0){return this._blit??=new V(this._techniques),this._blit.blit(this._rctx,e,t,this._bindParameters),this._pluginInput.set(e.name,t),r&&e.release(),t}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=T:(C(Te,this._bindParameters.camera.viewMatrix),C(we,this._bindParameters.camera.projectionMatrix),w(Se,Te,we),w(Se,this._renderContext.lastFrameCamera.viewMatrix,Se),w(Se,this._renderContext.lastFrameCamera.projectionMatrix,Se),this._reprojectionMatrix=Se);const t=this.stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=t>0?Math.min(t,e-this._ssrEnableTime)/t:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=T,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,r,i){this._bindParameters.updateLighting(e,t,r,i),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0}}renderToTargets(e,t,r,i,s=!1,a=!1){t.attachDepth(r),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(i,s,a),e(),t.detachDepth()}get test(){}};e([g({readOnly:!0})],pe.prototype,"highResolutionAtmosphere",null),e([g()],pe.prototype,"_edgeView",void 0),e([g()],pe.prototype,"updating",null),pe=e([b("esri.views.3d.webgl-engine.lib.Renderer")],pe);const me=[0,1,2,4],ce=[3,5],fe=[0,1,2,3],ge=[4,5],be=[2,4,8],Pe=[16,13,14],Ce=[4,5,2,3,6,0,1],we=S(),Te=S(),Se=S();function xe(e){return t=>e.immediate.schedule(t)}export{pe 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/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{disposeMaybe as s}from"../../../../core/maybe.js";import{property as i,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{a as r,
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{disposeMaybe as s}from"../../../../core/maybe.js";import{property as i,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{a as r,f as o}from"../../../../chunks/vec42.js";import{createQuadVAO as n}from"./glUtil3D.js";import{S as h}from"../../../../chunks/ShadowCastVisualize.glsl.js";import{ShadowCastVisualizeTechnique as d}from"../shaders/ShadowCastVisualizeTechnique.js";import{ShadowCastVisualizeTechniqueConfiguration as l}from"../shaders/ShadowCastVisualizeTechniqueConfiguration.js";const _=4e4,p=5e4,m=1/512;let u=class extends t{constructor(e,t,s,i){super({}),this._techniques=e,this._rctx=t,this._data=s,this._requestRender=i,this._passParameters=new h(this._data),this._configuration=new l,this._enabled=!1,this._vao=n(t)}dispose(){this._stop(),this._vao=s(this._vao)}precompile(){this._showVisualization&&this._techniques.precompile(d,this._configuration)}render(e){if(!this._showVisualization)return;const[t,s]=this._data.computedSamples;this._passParameters.sampleScale=[t?1/t:0,s?1/s:0];const i=this._techniques.get(d,this._configuration);this._rctx.bindVAO(this._vao),this._rctx.bindTechnique(i,e,this._passParameters),this._rctx.drawArrays(i.primitiveType,0,this._vao.vertexCount("geometry"))}setOptions(e){void 0!==e.enabled&&this._setEnabled(e.enabled),void 0!==e.thresholdColor&&this._setThresholdColor(e.thresholdColor),void 0!==e.gradientColor&&this._setGradientColor(e.gradientColor),void 0!==e.bandedGradientColor&&this._setBandedGradientColor(e.bandedGradientColor),void 0!==e.threshold&&(this._threshold=e.threshold),void 0!==e.visualization&&(this._visualization=e.visualization),void 0!==e.bandSize&&(this._bandSize=e.bandSize)}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]>0||this._data.computedSamples[1]>0)&&this.opacityFromElevation>m}get _threshold(){return this._passParameters.threshold}set _threshold(e){this._threshold!==e&&(this._passParameters.threshold=e,this._requestRenderIfEnabled())}get _visualization(){return this._configuration.visualization}set _visualization(e){e!==this._visualization&&(this._configuration.visualization=e,this._requestRenderIfEnabled())}get _bandSize(){return this._passParameters.bandSize}set _bandSize(e){e!==this._bandSize&&(this._passParameters.bandSize=e,this._requestRenderIfEnabled())}_setThresholdColor(e){const t=this._passParameters.thresholdColor;r(e,t)||(o(this._passParameters.thresholdColor,e),this._requestRenderIfEnabled())}_setGradientColor(e){const t=this._passParameters.gradientColor;r(e,t)||(o(this._passParameters.gradientColor,e),this._requestRenderIfEnabled())}_setBandedGradientColor(e){const t=this._passParameters.bandedGradientColor;r(e,t)||(o(this._passParameters.bandedGradientColor,e),this._requestRenderIfEnabled())}_setEnabled(e){e!==this._enabled&&(e?this._start():this._stop())}_requestRenderIfEnabled(){this._enabled&&this._requestRender()}_start(){this._enabled=!0,this._requestRender()}_stop(){this._enabled=!1,this._requestRender()}};e([i()],u.prototype,"opacityFromElevation",null),u=e([a("esri.views.3d.webgl-engine.lib.ShadowCastRenderer")],u);export{u as ShadowCastRenderer,p as shadowCastDisableElevationMax,_ 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/5.0/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{releaseMaybe as i}from"../../../../core/maybe.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{translate as r,multiply as h,invert as n,lookAt as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as c,create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as d,add as u,scale as m,lerp as _,squaredDistance as f,subtract as g,dot as p,negate as x,normalize as b,copy as w}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as M}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{m as C,d as j,q as y,p as v,h as S}from"../../../../chunks/vec32.js";import{create as H}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{
|
|
5
|
+
import has from"../../../../core/has.js";import{clamp as t,lerp as s,acosClamped as e}from"../../../../core/mathUtils.js";import{releaseMaybe as i}from"../../../../core/maybe.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{translate as r,multiply as h,invert as n,lookAt as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as c,create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as d,add as u,scale as m,lerp as _,squaredDistance as f,subtract as g,dot as p,negate as x,normalize as b,copy as w}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as M}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{m as C,d as j,q as y,p as v,h as S}from"../../../../chunks/vec32.js";import{create as H}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{c as O,t as D}from"../../../../chunks/vec42.js";import{create as F}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{CascadeCamera as T}from"./CascadeCamera.js";import{applyTextureResizeModulo as Q}from"./textureUtils.js";import{assert as B,logWithBase as L,verify as V,rayRay2D as N}from"./Util.js";import{DepthStencilAttachment as q}from"../../../webgl/enums.js";class R{constructor(){this.camera=new T,this.lightMat=l()}}class W{constructor(){this.maxNumCascadesHighQuality=4,this.maxNumCascadesLowQuality=4,this.textureSizeModHighQuality=1.3,this.textureSizeModLowQuality=.9,this.splitSchemeLambda=0}}class z{constructor(t,s){this._fbos=t,this._viewingMode=s,this._snapshots=new Array,this._textureHeight=0,this._numCascades=1,this.settings=new W,this._projectionView=l(),this._projectionViewInverse=l(),this._modelViewLight=l(),this._cascadeDistances=[0,0,0,0,0],this._usedCascadeDistances=F(),this._cascades=[new R,new R,new R,new R],this._lastOrigin=null,this._enabled=!1,this._maxTextureWidth=Math.min(has("esri-mobile")?4096:16384,t.rctx.parameters.maxTextureSize)}dispose(){this.enabled=!1,this.disposeOffscreenBuffers()}get depthTexture(){return this._handle?.getTexture(q)}get _textureWidth(){return this._textureHeight*this._numCascades}get numCascades(){return this._numCascades}get cascadeDistances(){return O(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)}disposeMainBuffer(){this._handle=i(this._handle)}disposeOffscreenBuffers(){this.disposeMainBuffer(),this._discardSnapshots()}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}get cascades(){for(let t=0;t<this._numCascades;++t)X[t]=this._cascades[t];return X.length=this._numCascades,X}start(t,s,e,i,a){B(this.enabled);const{near:r,far:h}=xt(e);this._computeCascadeDistances(r,h,i),this._textureHeight=this._computeTextureHeight(t,a,i),this._setupMatrices(t,s);const{viewMatrix:n,projectionMatrix:o}=t;for(let c=0;c<this._numCascades;++c)this._constructCascade(c,o,n,s);this._lastOrigin=null,this.clear()}finish(){B(this.enabled)}getShadowMapMatrices(t){if(!this._lastOrigin||!C(t,this._lastOrigin)){this._lastOrigin=this._lastOrigin||H(),j(this._lastOrigin,t);for(let s=0;s<this._numCascades;++s){r(Z,this._cascades[s].lightMat,t);for(let t=0;t<16;++t)$[16*s+t]=Z[t]}}return $}moveSnapshot(t){B(this.enabled),this._snapshots[t]?.release(),this._snapshots[t]=this._handle,this._handle?.setName(0===t?"shadow map highlight":"shadow map excluding highlight"),this._handle=null}copySnapshot(t){if(!this.enabled)return;const s=this._handle?.getTexture(q)?.descriptor;if(!s)return;this._snapshots[t]?.release();const e=0===t?"shadow map highlight":"shadow map excluding highlight",i=this._acquireFBO(e);this._snapshots[t]=i;const a=this._handle?.fbo;if(!a||!i?.fbo)return void console.error("No FBO");const{rctx:r}=this._fbos;r.blitFramebuffer(a,i.fbo,256)}getSnapshot(t){return this.enabled?this._snapshots[t]?.getTexture(q):null}clear(){this._ensureFbo(),this.bindFbo(),this._fbos.rctx.clear(256)}_computeTextureHeight({pixelRatio:t,fullWidth:s,fullHeight:e},i,a){const r=Math.min(window.devicePixelRatio,i)/t,h=a?this.settings.textureSizeModHighQuality:this.settings.textureSizeModLowQuality;return Q(Math.max(s,e)*r*h,this._maxTextureWidth/this._numCascades)}_ensureFbo(){this._handle?.fbo?.width===this._textureWidth&&this._handle?.fbo.height===this._textureHeight||(this._handle?.release(),this._handle=this._acquireFBO("shadow map"))}_acquireFBO(t){const s=this._fbos.acquire(this._textureWidth,this._textureHeight,t,12);return s.getTexture(q)?.setShadowFiltering(!0),s}_discardSnapshot(t){this._snapshots[t]=i(this._snapshots[t])}_discardSnapshots(){for(let t=0;t<this._snapshots.length;++t)this._discardSnapshot(t);this._snapshots.length=0}bindFbo(){this._fbos.rctx.bindFramebuffer(this._handle?.fbo)}_constructCascade(t,s,e,i){const a=this._cascades[t],n=-this._cascadeDistances[t],o=-this._cascadeDistances[t+1],c=(s[10]*n+s[14])/Math.abs(s[11]*n+s[15]),l=(s[10]*o+s[14])/Math.abs(s[11]*o+s[15]);B(c<l);for(let r=0;r<8;++r){O(I,r%4==0||r%4==3?-1:1,r%4==0||r%4==1?-1:1,r<4?c:l,1);const t=U[r];D(t,I,this._projectionViewInverse),t[0]/=t[3],t[1]/=t[3],t[2]/=t[3]}y(K,U[0]),a.camera.viewMatrix=r(A,this._modelViewLight,K);for(let r=0;r<8;++r)v(U[r],U[r],a.camera.viewMatrix);let d=U[0][2],u=U[0][2];for(let r=1;r<8;++r)d=Math.min(d,U[r][2]),u=Math.max(u,U[r][2]);d-=200,u+=200,a.camera.near=-u,a.camera.far=-d,pt(e,i,d,u,a.camera),h(a.lightMat,a.camera.projectionMatrix,a.camera.viewMatrix);const m=this._textureHeight;a.camera.viewport=[t*m,0,m,m]}_setupMatrices(t,s){h(this._projectionView,t.projectionMatrix,t.viewMatrix),n(this._projectionViewInverse,this._projectionView);const e=1===this._viewingMode?t.eye:S(K,0,0,1);o(this._modelViewLight,[0,0,0],[-s[0],-s[1],-s[2]],e)}_computeCascadeDistances(t,e,i){const a=i?this.settings.maxNumCascadesHighQuality:this.settings.maxNumCascadesLowQuality;this._numCascades=Math.min(1+Math.floor(L(e/t,4)),a);const r=(e-t)/this._numCascades,h=(e/t)**(1/this._numCascades);let n=t,o=t;for(let c=0;c<this._numCascades+1;++c)this._cascadeDistances[c]=s(n,o,this.settings.splitSchemeLambda),n*=h,o+=r}get test(){}}const A=l(),I=F(),U=[];for(let bt=0;bt<8;++bt)U.push(F());const k=M(),P=M(),E=M(),G=M(),J=M(),K=H(),X=[];function Y(){X.length=0}const Z=l(),$=c.concat(c,c,c),tt=M(),st=M(),et=[M(),M(),M(),M()],it=M(),at=M(),rt=M(),ht=M(),nt=M(),ot=M(),ct=M();function lt(t,s,e,i,a,r,h,n){d(tt,0,0);for(let d=0;d<4;++d)u(tt,tt,t[d]);m(tt,tt,.25),d(st,0,0);for(let d=4;d<8;++d)u(st,st,t[d]);m(st,st,.25),_(et[0],t[4],t[5],.5),_(et[1],t[5],t[6],.5),_(et[2],t[6],t[7],.5),_(et[3],t[7],t[4],.5);let o=0,c=f(et[0],tt);for(let d=1;d<4;++d){const t=f(et[d],tt);t<c&&(c=t,o=d)}g(it,et[o],t[o+4]);const l=it[0];let M,C;it[0]=-it[1],it[1]=l,g(at,st,tt),p(at,it)<0&&x(it,it),_(it,it,at,e),b(it,it),M=C=p(g(rt,t[0],tt),it);for(let d=1;d<8;++d){const s=p(g(rt,t[d],tt),it);s<M?M=s:s>C&&(C=s)}w(i,tt),m(rt,it,M-s),u(i,i,rt);let j=-1,y=1,v=0,S=0;for(let d=0;d<8;++d){g(ht,t[d],i),b(ht,ht);const s=it[0]*ht[1]-it[1]*ht[0];s>0?s>j&&(j=s,v=d):s<y&&(y=s,S=d)}V(j>0,"leftArea"),V(y<0,"rightArea"),m(nt,it,M),u(nt,nt,tt),m(ot,it,C),u(ot,ot,tt),ct[0]=-it[1],ct[1]=it[0];const H=N(i,t[S],ot,u(rt,ot,ct),1,a),O=N(i,t[v],ot,rt,1,r),D=N(i,t[v],nt,u(rt,nt,ct),1,h),F=N(i,t[S],nt,rt,1,n);V(H,"rayRay"),V(O,"rayRay"),V(D,"rayRay"),V(F,"rayRay")}function dt(t,s){return 3*s+t}const ut=M();function mt(t,s){return d(ut,t[s],t[s+3]),ut}const _t=M(),ft=a();function gt(t,s,e,i,a){g(_t,e,i),m(_t,_t,.5),ft[0]=_t[0],ft[1]=_t[1],ft[2]=0,ft[3]=_t[1],ft[4]=-_t[0],ft[5]=0,ft[6]=_t[0]*_t[0]+_t[1]*_t[1],ft[7]=_t[0]*_t[1]-_t[1]*_t[0],ft[8]=1,ft[dt(0,2)]=-p(mt(ft,0),t),ft[dt(1,2)]=-p(mt(ft,1),t);let r=p(mt(ft,0),e)+ft[dt(0,2)],h=p(mt(ft,1),e)+ft[dt(1,2)],n=p(mt(ft,0),i)+ft[dt(0,2)],o=p(mt(ft,1),i)+ft[dt(1,2)];r=-(r+n)/(h+o),ft[dt(0,0)]+=ft[dt(1,0)]*r,ft[dt(0,1)]+=ft[dt(1,1)]*r,ft[dt(0,2)]+=ft[dt(1,2)]*r,r=1/(p(mt(ft,0),e)+ft[dt(0,2)]),h=1/(p(mt(ft,1),e)+ft[dt(1,2)]),ft[dt(0,0)]*=r,ft[dt(0,1)]*=r,ft[dt(0,2)]*=r,ft[dt(1,0)]*=h,ft[dt(1,1)]*=h,ft[dt(1,2)]*=h,ft[dt(2,0)]=ft[dt(1,0)],ft[dt(2,1)]=ft[dt(1,1)],ft[dt(2,2)]=ft[dt(1,2)],ft[dt(1,2)]+=1,r=p(mt(ft,1),s)+ft[dt(1,2)],h=p(mt(ft,2),s)+ft[dt(2,2)],n=p(mt(ft,1),e)+ft[dt(1,2)],o=p(mt(ft,2),e)+ft[dt(2,2)],r=-.5*(r/h+n/o),ft[dt(1,0)]+=ft[dt(2,0)]*r,ft[dt(1,1)]+=ft[dt(2,1)]*r,ft[dt(1,2)]+=ft[dt(2,2)]*r,r=p(mt(ft,1),s)+ft[dt(1,2)],h=p(mt(ft,2),s)+ft[dt(2,2)],n=-h/r,ft[dt(1,0)]*=n,ft[dt(1,1)]*=n,ft[dt(1,2)]*=n,a[0]=ft[0],a[1]=ft[1],a[2]=0,a[3]=ft[2],a[4]=ft[3],a[5]=ft[4],a[6]=0,a[7]=ft[5],a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=ft[6],a[13]=ft[7],a[14]=0,a[15]=ft[8]}function pt(t,s,i,a,r){const h=1/U[0][3],n=1/U[4][3];B(h<n);let o=h+Math.sqrt(h*n);const c=Math.sin(e(t[2]*s[0]+t[6]*s[1]+t[10]*s[2]));o/=c,lt(U,o,c,k,P,E,G,J),gt(k,P,G,J,r.projectionMatrix),r.projectionMatrix[10]=2/(i-a),r.projectionMatrix[14]=-(i+a)/(i-a)}function xt(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}}export{z as ShadowMap,Y as cleanupShadowmap};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{EventEmitter as s}from"../../../../core/Evented.js";import"../../../../core/has.js";import{disposeMaybe as i,removeMaybe as r}from"../../../../core/maybe.js";import{generateUID as h}from"../../../../core/uid.js";import{property as n,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{a as o,
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{EventEmitter as s}from"../../../../core/Evented.js";import"../../../../core/has.js";import{disposeMaybe as i,removeMaybe as r}from"../../../../core/maybe.js";import{generateUID as h}from"../../../../core/uid.js";import{property as n,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{a as o,c as l}from"../../../../chunks/vec42.js";import{ZEROS as _,create as c}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{textTextureAtlas as d}from"./testUtils.js";import{applyTextureResizeModuloCeil as u}from"./textureUtils.js";import{TaskPriority as m}from"../../../support/Scheduler.js";import{Yield as f}from"../../../support/Yield.js";import{Texture as p}from"../../../webgl/Texture.js";import{TextureDescriptor as x}from"../../../webgl/TextureDescriptor.js";const g=4096;let v=class extends t{constructor(e){super(e),this.id=h(),this.events=new s,this._texture=null,this._atlas=new R(256,256),this._needsRepack=!1,this._canRepack=!0,this._elementsToRender=new Map,this._elements=new Map,this._uvCallbacks=new Map,this.updating=!1}initialize(){this._canvas=document.createElement("canvas"),this._canvas.setAttribute("id","textAtlasCanvas"),this._canvas.setAttribute("style","display:none"),this._ctx=this._canvas.getContext("2d"),this._stage=this.view.stage,this._stage.addTexture(this),this._updateCanvasElementSize(this._atlas),this._reset()}unload(){this._texture=i(this._texture),this._frameWorker=r(this._frameWorker),this.updating=!1,this.events.emit("unloaded")}get loaded(){return null!=this._texture}get texture(){return this._texture}static get maxSize(){return b=d.stableRendering?w:0,[g-w-b,g-w-b-k]}load(e){if(this._texture)return this._texture;const t=new x;return t.wrapMode=33071,t.samplingMode=9987,t.hasMipmap=!0,t.preMultiplyAlpha=!0,t.maxAnisotropy=e.parameters.maxMaxAnisotropy,this._texture=new p(e,t,this._canvas),this._frameWorker=this.view.resourceController.scheduler.registerTask(m.TEXT_TEXTURE_ATLAS,this),this.setDirty(),this._texture}dispose(){this._elements.clear(),this._elementsToRender.clear(),this._frameWorker=r(this._frameWorker),this._texture&&(this._stage.removeTexture(this),this._texture=i(this._texture)),this._canvas.width=0,this._canvas.height=0,this._canvas=null,this._ctx=null}_updateCanvasElementSize(e){this._canvas.width=e.width,this._canvas.height=e.height}_resizeAtlas(e,t){const{width:s,height:i}=this._atlas;s===e&&i===t||(this._atlas.width=e,this._atlas.height=t,this._texture?.resize(e,t),this._texture?.updateData(0,0,0,s,i,this._canvas),this._updateCanvasElementSize(this._atlas),this._elements.forEach(e=>this._uvCallbacks.get(e.textRenderer.key)?.forEach(t=>t(e.uv))),this._reset())}_reset(){this._elementsToRender.clear(),this._atlas.reset(),this._needsRepack=!0,this.setDirty()}_addAtlasElement(e,t,s,i){const r=this._atlas;if(r.width<s||r.height<i)return!1;let h=r.cursors.get(i);if(!h){if(r.height<r.nextY+i)return!1;h=[new T(r.nextY)],r.cursors.set(i,h),r.nextY+=i}let n=h.find(e=>r.width>=e.x+s);if(null==n){if(r.height<r.nextY+i)return!1;n=new T(r.nextY),r.nextY+=i,h.push(n)}return e.setNewPosition(n),this._elements.set(t,e),this._elementsToRender.set(t,e),n.x+=s,!0}_ensureCallbacks(e){const t=this._uvCallbacks.get(e);if(t)return t;const s=new Set;return this._uvCallbacks.set(e,s),s}_addCallback(e,t){this._ensureCallbacks(e).add(t)}_removeCallback(e,t){const s=this._uvCallbacks.get(e);return!(!s?.delete(t)||0!==s.size)&&(this._uvCallbacks.delete(e),!0)}_processAddition(e){const t=e.textRenderer.key;if(this._needsRepack)return void this._elements.set(t,e);const s=this._atlas,i=e.textRenderer.renderedWidth,r=e.textRenderer.renderedHeight,h=i+w,n=r+w+k;if(!this._addAtlasElement(e,t,h,n)){if(this._canRepack)this._reset();else if(s.width<h){const e=u(Math.max(h,1.5*s.width),g);this._resizeAtlas(e,s.height)}else{const e=s.nextY+n,t=u(Math.max(e,1.5*s.height),g);if(t>s.height)this._resizeAtlas(s.width,t);else if(s.width<g){const e=u(1.5*s.width,g);this._resizeAtlas(e,s.height)}}this._elements.set(t,e)}}_renderElement(e){const t=e.commitNewPosition(),s=e.textRenderer;this._ctx.clearRect(t[0]-w,t[1]-w,s.renderedWidth+2*w,s.renderedHeight+2*w),s.render(this._ctx,t[0],t[1]),this._uvCallbacks.get(s.key)?.forEach(t=>t(e.uv))}get readyToRun(){return this.updating}runTask(e){if(null==this._texture)return f;for(;this._needsRepack&&(this._canRepack||this._atlas.height<g&&this._atlas.height<g);){this._canRepack=this._needsRepack=!1;const t=this._elements;this._elements=new Map,t.forEach(e=>this._processAddition(e)),e.madeProgress()}if(this._elementsToRender.size>0){for(const[t,s]of this._elementsToRender){if(e.done)break;this._renderElement(s),this._elementsToRender.delete(t),e.madeProgress()}this._texture.setData(this._canvas)}this.updating=this._elementsToRender.size>0}addText(e,t){const s=e.key;this._addCallback(s,t);let i=this._elements.get(s);return i?o(i.uv,_)||t(i.uv):(i=new y(e),this._processAddition(i),this.setDirty()),{remove:()=>this._removeText(e,t)}}_removeText(e,t){const s=e.key;this._elements.get(s)&&this._removeCallback(s,t)&&(this._elements.delete(s),this._elementsToRender.delete(s),this._canRepack=!0)}setDirty(){this._texture&&(this.updating=!0)}get test(){}get usedMemory(){return(this._texture?.usedMemory??0)+(this._canvas?.width??0)*(this._canvas?.height??0)*4}};e([n({constructOnly:!0})],v.prototype,"view",void 0),e([n({type:Boolean})],v.prototype,"updating",void 0),v=e([a("esri.views.3d.webgl-engine.lib.TextTextureAtlas")],v);const w=2,k=2;class y{constructor(e){this.textRenderer=e,this._uv=c(),this._newPosition=[0,0]}get uv(){if(null==this._xOffset||null==this._yOffset)return _;const{renderedWidth:e,renderedHeight:t}=this.textRenderer;return l(this._uv,this._xOffset,this._yOffset+t,this._xOffset+e,this._yOffset)}setNewPosition(e){this._newPosition[0]=e.x,this._newPosition[1]=e.y}commitNewPosition(){return this._xOffset=this._newPosition[0],this._yOffset=this._newPosition[1],this._newPosition}get xOffset(){return this._xOffset}get yOffset(){return this._yOffset}}class R{constructor(e,t){this.width=e,this.height=t,this.cursors=new Map,this.nextY=0}reset(){this.cursors.clear(),this.nextY=b}}class T{constructor(e){this.y=e,this.x=b}}let b=0;export{v as TextTextureAtlas};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{
|
|
5
|
+
import{disposeMaybe as t}from"../../../../../core/maybe.js";import{SizedPixelFormat as e,PixelType as i}from"../../../../webgl/enums.js";import{Texture as r}from"../../../../webgl/Texture.js";import{TextureDescriptor as s}from"../../../../webgl/TextureDescriptor.js";class u{constructor(t,e){this._rctx=t,this._fields=[],this._nameToFieldMap=new Map,this._textureData=new Uint8Array(new ArrayBuffer),this._textureWidth=0,this._textureHeight=0,this._texture=null,this._dirty=!0,this._layout=e,this._setupFields(e)}get layout(){return this._layout}dispose(){this._texture=t(this._texture),this._texture=void 0,this._textureData=void 0}get test(){return{data:this._textureData,fields:this._fields}}getScalarField(t){const e=this._nameToFieldMap.get(t);return 1===e?.elementCount?e:null}getVec4Field(t){const e=this._nameToFieldMap.get(t);return 4===e?.elementCount?e:null}resizeToFit(t){const e=t+1;e>this._textureData.length/this._layout.byteStride&&this._resize(e)}updateTexture(){if(!this._dirty)return;const{_textureWidth:e,_textureHeight:i}=this;if(0===i||0===i)return this._texture=t(this._texture),void(this._dirty=!1);const r=this._texture?.descriptor.width,s=this._texture?.descriptor.height;null!=this._texture&&r===e&&s===i||(this._texture=t(this.texture),this._texture=this._allocateTexture()),this._texture.setData(this._textureData),this._dirty=!1}get texture(){return this._texture}_resize(t){const{_fields:e,_layout:i}=this,r=i.byteStride;if(0===t){const t=new ArrayBuffer;this._textureData=new Uint8Array(t);for(const i of e)i.updateBuffer(t);return void(this._dirty=!0)}const s=Math.ceil(Math.sqrt(t)),u=Math.ceil(t/s),a=s*r,h=Math.ceil(a/4),_=new ArrayBuffer(a*u);for(const n of e)n.updateBuffer(_);const o=new Uint8Array(_);o.set(this._textureData),this._textureData=o,this._textureWidth=h,this._textureHeight=u,this._dirty=!0}_setupFields(t){const e=this._textureData.buffer;this._fields=t.fields.map(t=>{const i=t.createField(()=>this._dirty=!0);return i.updateBuffer(e),this._nameToFieldMap.set(i.name,i),i})}_allocateTexture(){const t=new s(this._textureWidth,this._textureHeight);return t.samplingMode=9728,t.wrapMode=33071,t.internalFormat=e.RGBA8UI,t.pixelFormat=36249,t.dataType=i.UNSIGNED_BYTE,t.isImmutable=!0,t.hasMipmap=!1,new r(this._rctx,t)}}export{u as TextureBackedBuffer};
|