@arcgis/core 5.2.0-next.90 → 5.2.0-next.93

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/arcgisGlobal.d.ts +1 -0
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/19ab024f6f732fd6c69b.js +1 -0
  4. package/assets/esri/core/workers/chunks/24a6b28db94e07a702a4.js +1 -0
  5. package/assets/esri/core/workers/chunks/{c6ec0e966106f66360d9.js → 349b0c7febc46267441d.js} +3 -3
  6. package/assets/esri/core/workers/chunks/75b90fb05e4a2d32b7bb.js +1 -0
  7. package/assets/esri/core/workers/chunks/9246e2468528650bdc7c.js +1 -0
  8. package/assets/esri/core/workers/chunks/9509bef285929c52c244.js +1 -0
  9. package/assets/esri/core/workers/chunks/a74182ff402c3a808323.js +1 -0
  10. package/assets/esri/core/workers/chunks/bb23e670736bcace8b6f.js +1 -0
  11. package/config.js +1 -1
  12. package/core/has.js +1 -1
  13. package/geometry/support/HalfFloatArray.js +1 -1
  14. package/geometry/support/buffer/BufferView.js +1 -1
  15. package/kernel.js +1 -1
  16. package/layers/ImageryTileLayer.d.ts +20 -20
  17. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  18. package/layers/MapImageLayer.d.ts +20 -21
  19. package/layers/catalog/CatalogFootprintLayer.d.ts +1 -1
  20. package/layers/mixins/FeatureLayerBase.d.ts +20 -21
  21. package/layers/support/DateTimeFieldFormat.d.ts +1 -1
  22. package/layers/support/FieldConfiguration.d.ts +1 -1
  23. package/package.json +4 -4
  24. package/popup/FeatureContent.d.ts +3 -3
  25. package/popup/FeatureContentCollection.d.ts +3 -3
  26. package/popup/FieldInfo.d.ts +18 -12
  27. package/popup/support/FieldInfoFormat.d.ts +13 -8
  28. package/portal/Portal.js +1 -1
  29. package/smartMapping/symbology/types.d.ts +1 -1
  30. package/support/revision.js +1 -1
  31. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  32. package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
  33. package/views/3d/layers/graphics/GraphicsProcessor.js +1 -1
  34. package/views/3d/layers/graphics/Labeler.js +1 -1
  35. package/views/3d/support/buffer/InterleavedLayout.js +1 -1
  36. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBufferFields.glsl.js +11 -11
  37. package/views/3d/webgl-engine/effects/RenderNodes.js +1 -1
  38. package/views/3d/webgl-engine/effects/glow/Glow.js +1 -1
  39. package/views/3d/webgl-engine/effects/raymarching/DistanceFalloff.glsl.js +2 -2
  40. package/views/3d/webgl-engine/lib/AttributeArray.js +1 -1
  41. package/views/3d/webgl-engine/lib/DefaultVertexBufferLayouts.js +1 -1
  42. package/views/3d/webgl-engine/lib/EmissionComposite.js +1 -1
  43. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  44. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferFieldCreation.js +1 -1
  45. package/views/3d/webgl-engine/lib/glUtil3D.js +1 -1
  46. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  47. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  48. package/views/SceneView.d.ts +64 -1
  49. package/views/SceneView.js +1 -1
  50. package/views/View2D.d.ts +17 -4
  51. package/views/support/LayerLayerViewInfo.js +1 -1
  52. package/views/support/LayerViewManager.js +1 -1
  53. package/webmap/InitialViewProperties.d.ts +1 -1
  54. package/webscene/SunLighting.d.ts +3 -1
  55. package/widgets/BatchAttributeForm/expressions/ExpressionsManager.js +1 -1
  56. package/widgets/BatchAttributeForm/expressions/ExpressionsModel.js +1 -1
  57. package/widgets/BatchAttributeForm/inputs/EditableInput.js +1 -1
  58. package/widgets/BatchAttributeForm/inputs/FieldInput.d.ts +4 -4
  59. package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
  60. package/widgets/BatchAttributeForm/inputs/GroupInput.js +1 -1
  61. package/widgets/BatchAttributeForm/inputs/InputBase.js +1 -1
  62. package/widgets/BatchAttributeForm/inputs/TextElementInput.js +1 -1
  63. package/widgets/BatchAttributeForm/inputs/support/DynamicChoiceController.d.ts +12 -0
  64. package/widgets/BatchAttributeForm/inputs/support/DynamicChoiceController.js +2 -0
  65. package/widgets/BatchAttributeForm/inputs/support/controllerUtils.d.ts +5 -0
  66. package/widgets/BatchAttributeForm/inputs/support/controllerUtils.js +2 -0
  67. package/widgets/BatchAttributeForm/inputs/support/createBatchFormInputs.js +1 -1
  68. package/widgets/BatchAttributeForm.js +1 -1
  69. package/widgets/Daylight.d.ts +4 -0
  70. package/widgets/Directions.d.ts +1 -1
  71. package/widgets/Editor.d.ts +1 -1
  72. package/widgets/Feature/FeatureViewModel.d.ts +3 -3
  73. package/widgets/Feature.d.ts +3 -3
  74. package/widgets/FeatureTable/FeatureTableViewModel.d.ts +3 -3
  75. package/widgets/FeatureTable/support/ColumnTemplateBase.d.ts +1 -0
  76. package/widgets/FeatureTable.d.ts +1 -1
  77. package/widgets/Features/FeaturesViewModel.d.ts +3 -3
  78. package/widgets/Features.d.ts +2 -2
  79. package/widgets/OrientedImageryViewer/components/VideoEnhancementTools.js +1 -1
  80. package/widgets/OrientedImageryViewer.js +1 -1
  81. package/widgets/TimeSlider.d.ts +3 -3
  82. package/widgets/support/FilterBuilder.js +1 -1
  83. package/assets/esri/core/workers/chunks/05fbd1f373cfa3724f0c.js +0 -1
  84. package/assets/esri/core/workers/chunks/07613ecf13c38ad58b79.js +0 -1
  85. package/assets/esri/core/workers/chunks/27c0bed59626c7f64125.js +0 -1
  86. package/assets/esri/core/workers/chunks/41cf6163758d28fb1968.js +0 -1
  87. package/assets/esri/core/workers/chunks/48e2d0bfb62e1f4f2ad9.js +0 -1
  88. package/assets/esri/core/workers/chunks/bf11319138facf44752c.js +0 -1
  89. package/assets/esri/core/workers/chunks/e55507e4114b34d1ef4e.js +0 -1
  90. package/geometry/support/float16.js +0 -2
@@ -1,41 +1,41 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{maxUint8 as n}from"../../../../../core/typedArrayUtil.js";import{hasNativeFloat16Array as e}from"../../../../../geometry/support/float16.js";import{FloatBindUniform as o}from"../shaderModules/FloatBindUniform.js";import{glsl as u,If as i}from"../shaderModules/glsl.js";import{ShaderTechniqueConfiguration as a,parameter as r}from"../shaderTechnique/ShaderTechniqueConfiguration.js";function s(t){switch(t.elementType){case"float":switch(t.elementCount){case 1:return u`float`;case 2:return u`vec2`;case 3:return u`vec3`;case 4:return u`vec4`;case 9:return u`mat3`;default:t.elementCount}break;case"int":switch(t.elementCount){case 1:return u`int`;case 2:return u`ivec2`;case 3:return u`ivec3`;case 4:return u`ivec4`;case 9:throw new Error("Invalid element count 9 for type int");default:t.elementCount}break;case"uint":switch(t.elementCount){case 1:return u`uint`;case 2:return u`uvec2`;case 3:return u`uvec3`;case 4:return u`uvec4`;case 9:throw new Error("Invalid element count 9 for type uint");default:t.elementCount}break;default:t.elementType}throw new Error("unsupported field")}const c=new o("constNaN",()=>NaN,{supportsNaN:!0});class p extends a{constructor(t){super(),this.supportNaN=t}}function f(t,n){const e=n?.supportNaN;e&&(t.uniforms.add(c),t.code.add(u`bool bitsEncodeFloat16NaN(highp uint bits) {
2
+ import{__decorate as t}from"tslib";import{maxUint8 as n}from"../../../../../core/typedArrayUtil.js";import{FloatBindUniform as e}from"../shaderModules/FloatBindUniform.js";import{glsl as o,If as u}from"../shaderModules/glsl.js";import{ShaderTechniqueConfiguration as i,parameter as a}from"../shaderTechnique/ShaderTechniqueConfiguration.js";function r(t){switch(t.elementType){case"float":switch(t.elementCount){case 1:return o`float`;case 2:return o`vec2`;case 3:return o`vec3`;case 4:return o`vec4`;case 9:return o`mat3`;default:t.elementCount}break;case"int":switch(t.elementCount){case 1:return o`int`;case 2:return o`ivec2`;case 3:return o`ivec3`;case 4:return o`ivec4`;case 9:throw new Error("Invalid element count 9 for type int");default:t.elementCount}break;case"uint":switch(t.elementCount){case 1:return o`uint`;case 2:return o`uvec2`;case 3:return o`uvec3`;case 4:return o`uvec4`;case 9:throw new Error("Invalid element count 9 for type uint");default:t.elementCount}break;default:t.elementType}throw new Error("unsupported field")}const s=new e("constNaN",()=>NaN,{supportsNaN:!0});class c extends i{constructor(t){super(),this.supportNaN=t}}function p(t,n){const e=n?.supportNaN;e&&(t.uniforms.add(s),t.code.add(o`bool bitsEncodeFloat16NaN(highp uint bits) {
3
3
  const highp uint nanExponent = 0x00007c00u;
4
4
  highp uint exponent = bits & nanExponent;
5
5
  highp uint mantissa = bits & 0x000003ffu;
6
6
  return exponent == nanExponent && mantissa != 0u;
7
- }`)),t.code.add(u`
7
+ }`)),t.code.add(o`
8
8
  mediump float unpackHalf1x16(highp uint bits) {
9
- ${i(e,u`
9
+ ${u(e,o`
10
10
  if (bitsEncodeFloat16NaN(bits)) {
11
11
  return constNaN;
12
12
  }`)}
13
13
  return unpackHalf2x16(bits).x;
14
- }`),t.code.add(u`
14
+ }`),t.code.add(o`
15
15
  mediump vec2 unpackHalf2x16NaNSupport(highp uint bits) {
16
16
  vec2 result = unpackHalf2x16(bits);
17
- ${i(e,u`
17
+ ${u(e,o`
18
18
  if (bitsEncodeFloat16NaN(bits)) {
19
19
  result.x = constNaN;
20
20
  }
21
- if (bitsEncodeFloat16NaN(bits >> ${u.uint(k[2])})) {
21
+ if (bitsEncodeFloat16NaN(bits >> ${o.uint(g[2])})) {
22
22
  result.y = constNaN;
23
23
  }
24
24
  `)}
25
25
  return result;
26
- }`)}function l(t,n){const e=n?.supportNaN;e&&(t.uniforms.add(c),t.code.add(u`bool bitsEncodeFloat32NaN(highp uint bits) {
26
+ }`)}function f(t,n){const e=n?.supportNaN;e&&(t.uniforms.add(s),t.code.add(o`bool bitsEncodeFloat32NaN(highp uint bits) {
27
27
  const highp uint nanExponent = 0x7f800000u;
28
28
  highp uint exponent = bits & nanExponent;
29
29
  highp uint mantissa = bits & 0x007fffffu;
30
30
  return exponent == nanExponent && mantissa != 0u;
31
- }`)),t.code.add(u`
31
+ }`)),t.code.add(o`
32
32
  highp float unpackFloat1x32(highp uint bits) {
33
- ${i(e,u`
33
+ ${u(e,o`
34
34
  if (bitsEncodeFloat32NaN(bits)) {
35
35
  return constNaN;
36
36
  }`)}
37
37
  return uintBitsToFloat(bits);
38
- }`)}function d(t){t.code.add(u`mediump int unpackInt1x16(highp uint bits) {
38
+ }`)}function l(t){t.code.add(o`mediump int unpackInt1x16(highp uint bits) {
39
39
  highp uint signExtendedBits = (bits & 0x8000u) != 0u ? (bits | 0xffff0000u) : bits;
40
40
  return int(signExtendedBits);
41
- }`)}function h(t,n){const{fieldType:e}=t;return`${(0,g[e])(y(t,n))}`}function m(t,n){const e=[];for(const o of t){const t=u`unpackFloat1x32(${o})`;e.push(t)}return e.join(n)}t([r()],p.prototype,"supportNaN",void 0);const $=t=>u`${t[0]}`,x=t=>{const n=t[0],e=u`uvec4(${u.uint(k[0])}, ${u.uint(k[1])}, ${u.uint(k[2])}, ${u.uint(k[3])})`,o=u`uvec4(${u.hexuint(w[1])})`;return u`((uvec4(${n}) >> ${e}) & ${o})`},N=t=>u`(float(${$(t)})/${u.float(n)})`,b=t=>u`unpackFloat1x32(${t[0]})`,v=t=>u`vec4(${m(t,", ")})`,g={u8:$,u32:t=>u`${t[0]}`,vec4u32:t=>u`uvec4(${t.join(", ")})`,unorm8:N,vec4unorm8:t=>u`(vec4(${x(t)})/${u.float(n)})`,snorm16:t=>u`unpackSnorm2x16(${t[0]}).x`,vec2snorm16:t=>u`unpackSnorm2x16(${t[0]})`,f16:e?t=>u`unpackHalf1x16(${t[0]})`:b,vec4f16:e?t=>u`vec4(unpackHalf2x16NaNSupport(${t[0]}), unpackHalf2x16NaNSupport(${t[1]}))`:v,f32:b,vec4u8:x,vec2f32:t=>u`vec2(${m(t,", ")})`,vec3f32:t=>u`vec3(${m(t,", ")})`,vec4f32:v,mat3f32:t=>u`mat3(${m(t,",\n")})`};function y(t,n){const{byteOffset:e,byteSize:o}=t,i=n.channelByteStride,a=n.byteStride,r=Math.ceil(o/E),s=F[n.channels],c=new Array;for(let p=0;p<r;++p){const t=p*E,n=e+t,r=o-t,f=Math.min(r,E);let l=0;const d=new Array;for(;l<f;){const t=n+l,e=Math.floor(t/a),o=t%a,r=Math.floor(o/i),c=o%i,p=i-c,h=f-l,m=Math.min(p,h),$=u`texel${u.int(e)}${s[r]}`,x=4===m?"":u` & ${u.hexuint(w[m])}`,N=0===c?"":u` >> ${u.uint(k[c])}`,b=u`((${$}${N})${x})`,v=0===l?"":u` << ${u.uint(k[l])}`,g=u`(${b})${v}`;d.push(g),l+=m}c.push(u`(${d.join(" | ")})`)}return c}const E=4,k=[0,8,16,24],w=[0,255,65535,16777215,4294967295],F={1:[u``],2:[u`.x`,u`.y`],4:[u`.x`,u`.y`,u`.z`,u`.w`]};export{p as TextureBufferNaNSupportConfiguration,h as glslDecodeField,s as glslType,l as unpackFloat1x32,f as unpackHalf,d as unpackInt1x16};
41
+ }`)}function d(t,n){const{fieldType:e}=t;return`${(0,N[e])(b(t,n))}`}function h(t,n){const e=[];for(const u of t){const t=o`unpackFloat1x32(${u})`;e.push(t)}return e.join(n)}t([a()],c.prototype,"supportNaN",void 0);const m=t=>o`${t[0]}`,$=t=>{const n=t[0],e=o`uvec4(${o.uint(g[0])}, ${o.uint(g[1])}, ${o.uint(g[2])}, ${o.uint(g[3])})`,u=o`uvec4(${o.hexuint(y[1])})`;return o`((uvec4(${n}) >> ${e}) & ${u})`},x=t=>o`(float(${m(t)})/${o.float(n)})`,N={u8:m,u32:t=>o`${t[0]}`,vec4u32:t=>o`uvec4(${t.join(", ")})`,unorm8:x,vec4unorm8:t=>o`(vec4(${$(t)})/${o.float(n)})`,snorm16:t=>o`unpackSnorm2x16(${t[0]}).x`,vec2snorm16:t=>o`unpackSnorm2x16(${t[0]})`,f16:t=>o`unpackHalf1x16(${t[0]})`,vec4f16:t=>o`vec4(unpackHalf2x16NaNSupport(${t[0]}), unpackHalf2x16NaNSupport(${t[1]}))`,f32:t=>o`unpackFloat1x32(${t[0]})`,vec4u8:$,vec2f32:t=>o`vec2(${h(t,", ")})`,vec3f32:t=>o`vec3(${h(t,", ")})`,vec4f32:t=>o`vec4(${h(t,", ")})`,mat3f32:t=>o`mat3(${h(t,",\n")})`};function b(t,n){const{byteOffset:e,byteSize:u}=t,i=n.channelByteStride,a=n.byteStride,r=Math.ceil(u/v),s=E[n.channels],c=new Array;for(let p=0;p<r;++p){const t=p*v,n=e+t,r=u-t,f=Math.min(r,v);let l=0;const d=new Array;for(;l<f;){const t=n+l,e=Math.floor(t/a),u=t%a,r=Math.floor(u/i),c=u%i,p=i-c,h=f-l,m=Math.min(p,h),$=o`texel${o.int(e)}${s[r]}`,x=4===m?"":o` & ${o.hexuint(y[m])}`,N=0===c?"":o` >> ${o.uint(g[c])}`,b=o`((${$}${N})${x})`,v=0===l?"":o` << ${o.uint(g[l])}`,E=o`(${b})${v}`;d.push(E),l+=m}c.push(o`(${d.join(" | ")})`)}return c}const v=4,g=[0,8,16,24],y=[0,255,65535,16777215,4294967295],E={1:[o``],2:[o`.x`,o`.y`],4:[o`.x`,o`.y`,o`.z`,o`.w`]};export{c as TextureBufferNaNSupportConfiguration,d as glslDecodeField,r as glslType,f as unpackFloat1x32,p as unpackHalf,l as unpackInt1x16};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../../core/Error.js";import"../../../../core/has.js";import r from"../../../../core/Logger.js";import t from"../../../../core/PooledArray.js";import{DepthRange as o}from"../lib/DepthRange.js";class n{constructor(e){this._context=e,this._nodes=new t,this._debug=!1}destroy(){this._nodes.forEach(e=>e.destroy()),this._nodes.prune()}add(e){this._nodes.push(e)}remove(e){this._nodes.remove(e)}produces(e){return this._nodes.some(({produces:r})=>r===e)}require(e,...r){const t=this._nodes,o=r=>t.reduce((t,{consumes:o,produces:n})=>t+(!o.required.includes(e)||null!=r&&n!==r?0:1),0);return 0===r.length?o():r.reduce((e,r)=>e+o(r),0)}optional(e,...r){const t=this._nodes,o=r=>t.reduce((t,{consumes:o,produces:n})=>t+(!o.optional?.includes(e)||null!=r&&n!==r?0:1),0);return 0===r.length?o():r.reduce((e,r)=>e+o(r),0)}updateAnimation(e){return this._nodes.reduce((r,t)=>t.updateAnimation(e)||r,!1)}precompile(e,...r){++this._context.techniques.precompiling;for(const t of r)this._nodes.forEach(r=>{const o=e||!r.consumes.required.includes("emissive");r.produces===t&&o&&r.precompile()});--this._context.techniques.precompiling}queryDepthRange(e,t){return this._nodes.reduce((o,n)=>{if(n.produces!==e)return o;try{return o.union(n.queryDepthRange(t))}catch(s){return r.getLogger(n).errorOnce(s),o}},new o)}render(e,r,t=()=>{}){return this._render(e,r,t)??e}produce(e,r,t=()=>{}){return this._render(e,r,t)}_render(t,o,n=()=>{}){const s="string"==typeof t?t:t.name,i=this._nodes.filter(({produces:e})=>e===s);if(0===i.length)return;let u="string"==typeof t?null:t;return i.some(t=>{const i=new Array,d=null==u;for(const e of t.consumes.required){const r=o.get(e);if(r)i.push(r);else if("emissive"!==e||!o.get(s)?.hasAttachment(e))return n?.(i),!1}if(t.consumes.optional)for(const e of t.consumes.optional){if(e===s)continue;const r=o.get(e);r&&i.push(r)}try{const n=t.doRender(i);if(this._debug&&!n&&!d)throw new e("render-node:invalid-output",`${t.declaredClass} did not produce an output`);if(n&&n!==u){if(s!==n.name&&(r.getLogger(t).errorOnce(`RenderNode produced ${n.name}, expected ${s}`),n.setName(s)),this._debug&&u&&n.fbo.usedMemory!==u.usedMemory)throw new e("render-node:invalid-output",`${t.declaredClass} did not return a framebuffer with the same attachments as the input framebuffer`);u?.release(),u=n,o.set(s,u)}}catch(c){if(r.getLogger(t).errorOnce(c),c instanceof e)throw c}return n?.(i),d&&null!=u}),this._context.rctx.enforceState(),u}get requireGeometryDepth(){return this._nodes.some(e=>"disabled"!==e.produces&&e.requireGeometryDepth)}get test(){return{nodes:this._nodes}}}export{n as RenderNodes};
2
+ import e from"../../../../core/Error.js";import"../../../../core/has.js";import r from"../../../../core/Logger.js";import t from"../../../../core/PooledArray.js";import{DepthRange as o}from"../lib/DepthRange.js";class n{constructor(e){this._context=e,this._nodes=new t,this._debug=!1}destroy(){this._nodes.forEach(e=>e.destroy()),this._nodes.prune()}add(e){this._nodes.push(e)}remove(e){this._nodes.remove(e)}produces(e){return this._nodes.some(({produces:r})=>r===e)}require(e,...r){const t=this._nodes,o=r=>t.reduce((t,{consumes:o,produces:n})=>t+(!o.required.includes(e)||null!=r&&n!==r?0:1),0);return 0===r.length?o():r.reduce((e,r)=>e+o(r),0)}optional(e,...r){const t=this._nodes,o=r=>t.reduce((t,{consumes:o,produces:n})=>t+(!o.optional?.includes(e)||null!=r&&n!==r?0:1),0);return 0===r.length?o():r.reduce((e,r)=>e+o(r),0)}updateAnimation(e){return this._nodes.reduce((r,t)=>t.updateAnimation(e)||r,!1)}precompile(...e){++this._context.techniques.precompiling;for(const r of e)this._nodes.forEach(e=>{e.produces===r&&e.precompile()});--this._context.techniques.precompiling}queryDepthRange(e,t){return this._nodes.reduce((o,n)=>{if(n.produces!==e)return o;try{return o.union(n.queryDepthRange(t))}catch(s){return r.getLogger(n).errorOnce(s),o}},new o)}render(e,r,t=()=>{}){return this._render(e,r,t)??e}produce(e,r,t=()=>{}){return this._render(e,r,t)}_render(t,o,n=()=>{}){const s="string"==typeof t?t:t.name,u=this._nodes.filter(({produces:e})=>e===s);if(0===u.length)return;let i="string"==typeof t?null:t;return u.some(t=>{const u=new Array,d=null==i;for(const e of t.consumes.required){const r=o.get(e);if(!r)return n?.(u),!1;u.push(r)}if(t.consumes.optional)for(const e of t.consumes.optional){if(e===s)continue;const r=o.get(e);r&&u.push(r)}try{const n=t.doRender(u);if(this._debug&&!n&&!d)throw new e("render-node:invalid-output",`${t.declaredClass} did not produce an output`);if(n&&n!==i){if(s!==n.name&&(r.getLogger(t).errorOnce(`RenderNode produced ${n.name}, expected ${s}`),n.setName(s)),this._debug&&i&&n.fbo.usedMemory!==i.usedMemory)throw new e("render-node:invalid-output",`${t.declaredClass} did not return a framebuffer with the same attachments as the input framebuffer`);i?.release(),i=n,o.set(s,i)}}catch(c){if(r.getLogger(t).errorOnce(c),c instanceof e)throw c}return n?.(u),d&&null!=i}),this._context.rctx.enforceState(),i}get requireGeometryDepth(){return this._nodes.some(e=>"disabled"!==e.produces&&e.requireGeometryDepth)}get test(){return{nodes:this._nodes}}}export{n as RenderNodes};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{lerp as t}from"../../../../../core/mathUtils.js";import{releaseMaybe as s}from"../../../../../core/maybe.js";import{watch as r,initial as i}from"../../../../../core/reactiveUtils.js";import{property as o,subclass as a}from"../../../../../core/accessorSupport/decorators.js";import{set as m}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{length as n}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as l}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as h}from"../../../../../geometry/ellipsoidUtils.js";import{InternalRenderCategory as c}from"../../../webgl.js";import{TransparentEnvironment as p}from"../TransparentEnvironment.js";import{G as u}from"../../../../../chunks/GlowBlur.glsl.js";import{GlowBlurTechnique as b}from"./GlowBlurTechnique.js";import{G as f}from"../../../../../chunks/GlowComposite.glsl.js";import{GlowCompositeTechnique as _}from"./GlowCompositeTechnique.js";import{FloatBlendScaleConfiguration as g,floatBlendReductionFactor as d}from"../../shaders/floatBlendScale.glsl.js";import{ColorAttachment1 as w,DrawBufferNone as P}from"../../../../webgl/enums.js";import{noParameters as v}from"../../../../webgl/NoParameters.js";let B=class extends p{constructor(e){super(e),this.consumes={required:[c.TRANSPARENT_ENVIRONMENT,"emissive"]},this.produces=c.TRANSPARENT_ENVIRONMENT,this._glowBoost={realistic:0,cartographicMin:.5,cartographicDefault:2.5,cartographicMax:5},this._compositeConfiguration=new g,this._compositeParameters=new f,this._blurParameters=new u;const t=h(e.view.spatialReference);this._atmosphereRadius=t.radius+t.atmosphereHeight}initialize(){this.addHandles([r(()=>this._mode,e=>2===e?this._disable():this._enable(),i),r(()=>this._boost,e=>{this._compositeParameters.boost=e,this.requestRender(1)},i),r(()=>this.view.stage.renderView.fog?.strength??0,e=>{this._compositeParameters.scattering=e,this.requestRender(1)},i)])}precompile(){this.techniques.precompile(b),this._compositeConfiguration.useFloatBlend=this.bindParameters.useFloatBlend.value,this.techniques.precompile(_,this._compositeConfiguration)}render(){const e=this.input;if(this._compositeParameters.emission=e.obtainAttachment(w),!this._compositeParameters.emission?.attachment)return e;const{fullWidth:t,fullHeight:r,eye:i}=this.bindParameters.camera,o=n(i);this._compositeParameters.atmosphereC=o**2-this._atmosphereRadius**2,this._compositeParameters.mipmapLevels=this._renderGlowMipMap();const a=this.renderingContext,m=e.obtainDepthTexture();e.acquireColor(w,8,"emissive"),a.bindFramebuffer(e.fbo),a.setViewport(0,0,t,r),a.clearBuffer(1,l);const h=a.setDrawBuffers([P,w]),c=this.techniques.get(_,this._compositeConfiguration);return a.bindTechnique(c,this.bindParameters,this._compositeParameters),a.screen.draw(),a.setDrawBuffers(h),this._compositeParameters.emission=s(this._compositeParameters.emission),this._compositeParameters.mipmapTexture=s(this._compositeParameters.mipmapTexture),e.attachDepth(m),m?.release(),this.fboCache.debugCallback?.("glow-color",e.fbo),e}_renderGlowMipMap(){const e=this.fboCache,{fullWidth:t,fullHeight:s}=this.camera,r=this.renderingContext;this._blurParameters.input=this._compositeParameters.emission?.attachment,this._blurParameters.inputScale=this.bindParameters.useFloatBlend.value?1:d,this._blurParameters.level=0,m(this._blurParameters.size,1,1);const i=Math.floor(.5*t),o=Math.floor(.5*s),a=e.acquire(i,s,"glow horizontal",8);let n,l=i,h=s;const c=this.techniques.get(b),p=r.bindTechnique(c,this.bindParameters,v);for(;l>=1&&h>=1;)this._blurParameters.isHorizontal=!0,this._setupFBO(a,l,h),p.bindDraw(this.bindParameters,v,this._blurParameters),r.screen.draw(),h=Math.floor(.5*h),this._blurParameters.input=a.getTexture(),this._blurParameters.inputScale=1,this._blurParameters.isHorizontal=!1,m(this._blurParameters.size,l/i,h/o),n??=e.acquire(l,h,"glow mipmap",9),this._setupFBO(n,l,h,this._blurParameters.level),p.bindDraw(this.bindParameters,v,this._blurParameters),r.screen.draw(),e.debugCallback?.(n.name,n.fbo),l=Math.floor(.5*l),this._blurParameters.input=n.getTexture(),++this._blurParameters.level;return a.release(),this._compositeParameters.mipmapTexture=n,n&&(n.fbo.level=0),this._blurParameters.level}get _boost(){return 0===this._mode?this._glowBoost.realistic:this._intensity<=.5?t(this._glowBoost.cartographicMin,this._glowBoost.cartographicDefault,2*this._intensity):t(this._glowBoost.cartographicDefault,this._glowBoost.cartographicMax,2*(this._intensity-.5))}get _mode(){return null==this.view.environment.lighting.glow?this.view.environment.atmosphereEnabled?0:2:1}get _intensity(){return this.view.environment.lighting.glow?.intensity??0}_setupFBO(e,t,s,r=0){e.fbo.level=r;const i=this.renderingContext;i.bindFramebuffer(e.fbo),i.setViewport(0,0,t,s),i.setClearColor(0,0,0,0),i.clear(16384)}};e([o()],B.prototype,"consumes",void 0),e([o()],B.prototype,"produces",void 0),B=e([a("esri.views.3d.webgl-engine.effects.glow.Glow")],B);export{B as Glow};
2
+ import{__decorate as e}from"tslib";import{lerp as t}from"../../../../../core/mathUtils.js";import{releaseMaybe as s}from"../../../../../core/maybe.js";import{watch as r,initial as i}from"../../../../../core/reactiveUtils.js";import{property as o,subclass as a}from"../../../../../core/accessorSupport/decorators.js";import{set as m}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{length as n}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as l}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as h}from"../../../../../geometry/ellipsoidUtils.js";import{InternalRenderCategory as c}from"../../../webgl.js";import{TransparentEnvironment as p}from"../TransparentEnvironment.js";import{G as u}from"../../../../../chunks/GlowBlur.glsl.js";import{GlowBlurTechnique as b}from"./GlowBlurTechnique.js";import{G as f}from"../../../../../chunks/GlowComposite.glsl.js";import{GlowCompositeTechnique as _}from"./GlowCompositeTechnique.js";import{FloatBlendScaleConfiguration as g,floatBlendReductionFactor as d}from"../../shaders/floatBlendScale.glsl.js";import{ColorAttachment1 as w,DrawBufferNone as P}from"../../../../webgl/enums.js";import{noParameters as v}from"../../../../webgl/NoParameters.js";let B=class extends p{constructor(e){super(e),this.consumes={required:[c.TRANSPARENT_ENVIRONMENT]},this.produces=c.TRANSPARENT_ENVIRONMENT,this._glowBoost={realistic:0,cartographicMin:.5,cartographicDefault:2.5,cartographicMax:5},this._compositeConfiguration=new g,this._compositeParameters=new f,this._blurParameters=new u;const t=h(e.view.spatialReference);this._atmosphereRadius=t.radius+t.atmosphereHeight}initialize(){this.addHandles([r(()=>this._mode,e=>2===e?this._disable():this._enable(),i),r(()=>this._boost,e=>{this._compositeParameters.boost=e,this.requestRender(1)},i),r(()=>this.view.stage.renderView.fog?.strength??0,e=>{this._compositeParameters.scattering=e,this.requestRender(1)},i)])}precompile(){0!==this.bindParameters.emissions&&(this.techniques.precompile(b),this._compositeConfiguration.useFloatBlend=this.bindParameters.useFloatBlend.value,this.techniques.precompile(_,this._compositeConfiguration))}render(){const e=this.input;if(this._compositeParameters.emission=e.obtainAttachment(w),!this._compositeParameters.emission?.attachment)return e;const{fullWidth:t,fullHeight:r,eye:i}=this.bindParameters.camera,o=n(i);this._compositeParameters.atmosphereC=o**2-this._atmosphereRadius**2,this._compositeParameters.mipmapLevels=this._renderGlowMipMap();const a=this.renderingContext,m=e.obtainDepthTexture();e.acquireColor(w,8,"emissive"),a.bindFramebuffer(e.fbo),a.setViewport(0,0,t,r),a.clearBuffer(1,l);const h=a.setDrawBuffers([P,w]),c=this.techniques.get(_,this._compositeConfiguration);return a.bindTechnique(c,this.bindParameters,this._compositeParameters),a.screen.draw(),a.setDrawBuffers(h),this._compositeParameters.emission=s(this._compositeParameters.emission),this._compositeParameters.mipmapTexture=s(this._compositeParameters.mipmapTexture),e.attachDepth(m),m?.release(),this.fboCache.debugCallback?.("glow-color",e.fbo),e}_renderGlowMipMap(){const e=this.fboCache,{fullWidth:t,fullHeight:s}=this.camera,r=this.renderingContext;this._blurParameters.input=this._compositeParameters.emission?.attachment,this._blurParameters.inputScale=this.bindParameters.useFloatBlend.value?1:d,this._blurParameters.level=0,m(this._blurParameters.size,1,1);const i=Math.floor(.5*t),o=Math.floor(.5*s),a=e.acquire(i,s,"glow horizontal",8);let n,l=i,h=s;const c=this.techniques.get(b),p=r.bindTechnique(c,this.bindParameters,v);for(;l>=1&&h>=1;)this._blurParameters.isHorizontal=!0,this._setupFBO(a,l,h),p.bindDraw(this.bindParameters,v,this._blurParameters),r.screen.draw(),h=Math.floor(.5*h),this._blurParameters.input=a.getTexture(),this._blurParameters.inputScale=1,this._blurParameters.isHorizontal=!1,m(this._blurParameters.size,l/i,h/o),n??=e.acquire(l,h,"glow mipmap",9),this._setupFBO(n,l,h,this._blurParameters.level),p.bindDraw(this.bindParameters,v,this._blurParameters),r.screen.draw(),e.debugCallback?.(n.name,n.fbo),l=Math.floor(.5*l),this._blurParameters.input=n.getTexture(),++this._blurParameters.level;return a.release(),this._compositeParameters.mipmapTexture=n,n&&(n.fbo.level=0),this._blurParameters.level}get _boost(){return 0===this._mode?this._glowBoost.realistic:this._intensity<=.5?t(this._glowBoost.cartographicMin,this._glowBoost.cartographicDefault,2*this._intensity):t(this._glowBoost.cartographicDefault,this._glowBoost.cartographicMax,2*(this._intensity-.5))}get _mode(){return null==this.view.environment.lighting.glow?this.view.environment.atmosphereEnabled?0:2:1}get _intensity(){return this.view.environment.lighting.glow?.intensity??0}_setupFBO(e,t,s,r=0){e.fbo.level=r;const i=this.renderingContext;i.bindFramebuffer(e.fbo),i.setViewport(0,0,t,s),i.setClearColor(0,0,0,0),i.clear(16384)}};e([o()],B.prototype,"consumes",void 0),e([o()],B.prototype,"produces",void 0),B=e([a("esri.views.3d.webgl-engine.effects.glow.Glow")],B);export{B as Glow};
@@ -1,7 +1,7 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{Float3BindUniform as e}from"../../core/shaderModules/Float3BindUniform.js";import{FloatPassUniform as r}from"../../core/shaderModules/FloatPassUniform.js";import{glsl as o}from"../../core/shaderModules/glsl.js";import{SphereIntersect as s}from"../../shaders/SphereIntersect.glsl.js";import{NoParameters as t}from"../../../../webgl/NoParameters.js";class a extends t{constructor(){super(...arguments),this.atmosphereC=1}}function i(t){t.include(s),t.uniforms.add(new r("atmosphereC",e=>e.atmosphereC),new e("cameraPosition",e=>e.camera.eye)).code.add(o`float getDistanceFalloff(float dist, vec3 rayDir, float weight) {
2
+ import{Float3BindUniform as e}from"../../core/shaderModules/Float3BindUniform.js";import{FloatPassUniform as r}from"../../core/shaderModules/FloatPassUniform.js";import{glsl as s}from"../../core/shaderModules/glsl.js";import{SphereIntersect as o}from"../../shaders/SphereIntersect.glsl.js";import{NoParameters as t}from"../../../../webgl/NoParameters.js";class a extends t{constructor(){super(...arguments),this.atmosphereC=1}}function i(t){t.include(o),t.uniforms.add(new r("atmosphereC",e=>e.atmosphereC),new e("cameraPosition",e=>e.camera.eye)).constants.add("skyFalloffHeuristic","float",.11).code.add(s`float getDistanceFalloff(float dist, vec3 rayDir, float weight) {
3
3
  if(dist == -1.0){
4
- dist = 0.055 * sphereIntersect(cameraPosition, rayDir, atmosphereC).y;
4
+ dist = skyFalloffHeuristic * sphereIntersect(cameraPosition, rayDir, atmosphereC).y;
5
5
  }
6
6
  return (1.0 - exp(-dist * weight));
7
7
  }`)}export{a as DistanceFalloffPassParameters,i as getDistanceFalloff};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{nativeArrayMaxSize as r,isFloat32Array as t,isFloat16Array as o,isUint16Array as a}from"../../../../core/typedArrayUtil.js";import{getFloat16ArrayConstructor as f}from"../../../../geometry/support/float16.js";function e(e){if(e.length<r)return Array.from(e);if(Array.isArray(e))return Float64Array.from(e);if(!("BYTES_PER_ELEMENT"in e))return Array.from(e);switch(e.BYTES_PER_ELEMENT){case 1:return Uint8Array.from(e);case 2:return o(e)?f().from(e):a(e)?Uint16Array.from(e):Int16Array.from(e);case 4:return t(e)?Float32Array.from(e):Uint32Array.from(e);default:return Float64Array.from(e)}}export{e as cloneAttributeData};
2
+ import{nativeArrayMaxSize as r,isFloat32Array as t,isFloat16Array as a,isUint16Array as o}from"../../../../core/typedArrayUtil.js";function f(f){if(f.length<r)return Array.from(f);if(Array.isArray(f))return Float64Array.from(f);if(!("BYTES_PER_ELEMENT"in f))return Array.from(f);switch(f.BYTES_PER_ELEMENT){case 1:return Uint8Array.from(f);case 2:return a(f)?Float16Array.from(f):o(f)?Uint16Array.from(f):Int16Array.from(f);case 4:return t(f)?Float32Array.from(f):Uint32Array.from(f);default:return Float64Array.from(f)}}export{f as cloneAttributeData};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{DataType as e}from"../../../webgl/enums.js";import{fromLayout as o}from"../../../webgl/VertexAttributeLocations.js";import{VertexElementDescriptor as t}from"../../../webgl/VertexElementDescriptor.js";const i=[],n=[new t("position",3,e.FLOAT,0,12)],r=[new t("position",2,e.FLOAT,0,8)],s=o(r),p=[new t("position",2,e.FLOAT,0,12),new t("uv0",2,e.HALF_FLOAT,8,12)],w=[new t("position",2,e.FLOAT,0,16),new t("uv0",2,e.FLOAT,8,16)];export{i as NoVertex,r as Pos2,s as Pos2Locations,p as Pos2TexF16,w as Pos2TexF32,n as Pos3};
2
+ import{DataType as e}from"../../../webgl/enums.js";import{fromLayout as o}from"../../../webgl/VertexAttributeLocations.js";import{VertexElementDescriptor as t}from"../../../webgl/VertexElementDescriptor.js";const i=[],r=[new t("position",3,e.FLOAT,0,12)],n=[new t("position",2,e.FLOAT,0,8)],s=o(n),m=[new t("position",2,e.FLOAT,0,12),new t("uv0",2,e.HALF_FLOAT,8,12)];export{i as NoVertex,n as Pos2,s as Pos2Locations,m as Pos2TexF16,r as Pos3};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{watch as s,syncAndInitial as t}from"../../../../core/reactiveUtils.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import{subclass as i}from"../../../../core/accessorSupport/decorators/subclass.js";import{RenderNodeOutput as o}from"../../webgl.js";import a from"../../webgl/RenderNode.js";import{E as m}from"../../../../chunks/EmissionComposite.glsl.js";import{EmissionCompositeTechnique as n}from"./EmissionCompositeTechnique.js";import{floatBlendReductionFactor as p}from"../shaders/floatBlendScale.glsl.js";import{ColorAttachment1 as c,ColorAttachment0 as h,SizedPixelFormat as d}from"../../../webgl/enums.js";let l=class extends a{constructor(){super(...arguments),this.produces=o.COMPOSITE,this.consumes={required:[o.COMPOSITE,"emissive"]},this._passParameters=new m}initialize(){this.addHandles([s(()=>0!==this.bindParameters.emissions,e=>this.produces=e?o.COMPOSITE:"disabled",t)])}precompile(){this.techniques.precompile(n)}render(){const e=this.input,s=e.getAttachment(c);if(!s?.attachment)return e;this._passParameters.color=e.getAttachment(h)?.attachment,this._passParameters.emission=s.attachment,this._passParameters.inputScale=this._passParameters.emission?.descriptor.internalFormat===d.RGBA8?p:1;const t=this.renderingContext,r=this.techniques.get(n),i=this.acquireOutputFramebuffer();return t.clear(16384),t.bindTechnique(r,this.bindParameters,this._passParameters),t.screen.draw(),i.moveAttachments(e),i}};e([r()],l.prototype,"produces",void 0),e([r()],l.prototype,"consumes",void 0),l=e([i("esri.views.3d.webgl-engine.lib.EmissionComposite")],l);export{l as EmissionComposite};
2
+ import{__decorate as s}from"tslib";import{watch as e,syncAndInitial as t}from"../../../../core/reactiveUtils.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import{subclass as i}from"../../../../core/accessorSupport/decorators/subclass.js";import{RenderNodeOutput as o}from"../../webgl.js";import a from"../../webgl/RenderNode.js";import{E as m}from"../../../../chunks/EmissionComposite.glsl.js";import{EmissionCompositeTechnique as n}from"./EmissionCompositeTechnique.js";import{floatBlendReductionFactor as p}from"../shaders/floatBlendScale.glsl.js";import{ColorAttachment1 as c,ColorAttachment0 as h,SizedPixelFormat as d}from"../../../webgl/enums.js";let l=class extends a{constructor(){super(...arguments),this.produces=o.COMPOSITE,this.consumes={required:[o.COMPOSITE]},this._passParameters=new m}initialize(){this.addHandles([e(()=>0!==this.bindParameters.emissions,s=>this.produces=s?o.COMPOSITE:"disabled",t)])}precompile(){0!==this.bindParameters.emissions&&this.techniques.precompile(n)}render(){const s=this.input,e=s.getAttachment(c);if(!e?.attachment)return s;this._passParameters.color=s.getAttachment(h)?.attachment,this._passParameters.emission=e.attachment,this._passParameters.inputScale=this._passParameters.emission?.descriptor.internalFormat===d.RGBA8?p:1;const t=this.renderingContext,r=this.techniques.get(n),i=this.acquireOutputFramebuffer();return t.clear(16384),t.bindTechnique(r,this.bindParameters,this._passParameters),t.screen.draw(),i.moveAttachments(s),i}};s([r()],l.prototype,"produces",void 0),s([r()],l.prototype,"consumes",void 0),l=s([i("esri.views.3d.webgl-engine.lib.EmissionComposite")],l);export{l as EmissionComposite};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as s}from"../../../../core/asyncUtils.js";import has from"../../../../core/has.js";import{removeMaybe as i,abortMaybe as r,destroyMaybe as a,releaseMaybe as n,releaseReferencedMaybe as h}from"../../../../core/maybe.js";import{throwIfAborted as o}from"../../../../core/promiseUtils.js";import{watch as d,syncAndInitial as l,initial as u,sync as m}from"../../../../core/reactiveUtils.js";import{signal as _}from"../../../../core/signal.js";import{property as p,subclass as c}from"../../../../core/accessorSupport/decorators.js";import{equals as b,invert as f,multiply as g,copy as P}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as A,create as I}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as E}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as w,ZEROS as C}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as S}from"../../../../geometry/support/Indices.js";import{RenderNodeOutput as T,InternalRenderCategory as D,AllRenderNodeOutputs as O,AllInternalRenderNodeOutputs as R}from"../../webgl.js";import{minNearDistanceInMeters as N}from"../../state/NearFarHeuristic.js";import{debugFlags as G}from"../../support/debugFlags.js";import{FBOCache as F}from"../core/FBOCache.js";import{RenderPassManager as H}from"../core/renderPasses/RenderPassManager.js";import{isColor as x}from"../core/shaderLibrary/ShaderOutput.js";import{distanceFadeEnd as y}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as v}from"../effects/RenderNodes.js";import{RenderPluginManager as M}from"../effects/RenderPluginManager.js";import{WeatherFader as L}from"../effects/WeatherFader.js";import{innerAtmosphereFadeStart as U}from"../effects/atmosphere/atmosphereUtils.js";import{Blit as q}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as j,renderHighlightBuffer as B}from"../effects/highlight/Highlight.js";import{OITBlend as V}from"../effects/transparency/OITBlend.js";import{AnimationTimer as k}from"./AnimationTimer.js";import{AnimationTimeStep as W}from"./AnimationTimeStep.js";import{BoundingInfo as Q}from"./BoundingInfo.js";import{Compositor as z}from"./Compositor.js";import{DepthRange as Y}from"./DepthRange.js";import{depthRangeFromScene as K}from"./depthRangeUtils.js";import{MainFramebuffer as J}from"./MainFramebuffer.js";import{NavigationDepthCache as X}from"./NavigationDepthCache.js";import{blendingColorAlphaClear as $}from"./OrderIndependentTransparency.js";import{RenderContext as Z,defaultRenderOccludedMask as ee}from"./RenderContext.js";import{RendererBase as te}from"./RendererBase.js";import{setupFeatureDefaults as se}from"./RenderFeature.js";import{RenderPluginInput as ie}from"./RenderPluginInput.js";import{ShadowMap as re}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{ColorAttachment1 as le,PixelType as ue,ColorAttachment2 as me,ColorAttachment0 as _e,DrawBufferNone as pe}from"../../../webgl/enums.js";const ce=has("disable-feature:async-navigation-3d-depth-readback");let be=class extends te{constructor(e,t,s,i,r){super({stage:e}),this._techniques=s,this._rctx=i,this._requestRender=r,this._pluginsHas={occludedHudElements:!1,hudElements:!1,water:!1},this.renderPassManager=new H,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=w(0,0,0,1),this._sliceHelper=new ae,this._shadowAccumulator=null,this._shadowCastOptions=null,this.sceneDepthRange=_(Y.Infinite),this._state=_(2),this._hasGlobalIlluminationFlag=!!has("enable-feature:global-illumination"),this._hasAnimations=!1,this._animationTimestep=new W,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=_(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new ie,this._hasTransparentGeometry=!1,this._releaseNodeInputs=e=>{for(const t of Oe)e.some(({name:e})=>e===t)&&this._pluginInput.release(t)},this._testsNeedsDepth=!1,this._fboCache=new F(i),this._compositor=new z(i,s),this._renderStateFeatures=_(se(e.view.qualityProfile));const a=new re(this._fboCache,e.viewingMode);this._renderContext=new Z(this._rctx,a,s),this._framebuffer=new J(this._fboCache,this._bindParameters),this._performanceInfo=new oe(this._rctx),this._blit=new q(s),this.navigationDepthCache=new X(this._rctx,this._fboCache,s,()=>this._requestRender(0)),this._nodes=new v(this._renderContext),this._plugins=new M({renderContext:this._renderContext,techniques:s,materials:t,requestRender:r,controller:e}),this._plugins.add(this.renderPassManager),this.weatherFader=new L({view:e.view,context:this._renderContext}),this.addHandles([d(()=>e.view.state.camera,()=>r(),l),d(()=>G.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},r()},u),d(()=>e.view.environment.background?.color,e=>{const t=e?e.toUnitRGBA():C;E(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),r()},l),d(()=>e.view.environmentManager.shadowsAvailable,e=>{this._bindParameters.shadowMap.enabled=e,this._requestRender(1)},l),d(()=>e.view.state.camera.relativeElevation,e=>this._inGlobeView=(e??1/0)>=y,l),d(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},m),d(()=>this._bindParameters.clouds.data?.state,()=>r(),m),d(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,r()},u),d(()=>"sun"===e.view.environment.lighting?.type,e=>{this._bindParameters.enableFillLights=e,this._requestRender()},l)])}destroy(){this._gpuTimerHandle=i(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowAccumulator=null,this._shadowCastOptions=null,this._loadEdgeViewTask=r(this._loadEdgeViewTask),this._edgeView=a(this._edgeView),this.renderPassManager.dispose(),this.weatherFader=a(this.weatherFader),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.navigationDepthCache.destroy(),this._fboCache.destroy(),this._fboCache=null,this._renderContext.destroy(),this._plugins.destroy(),this._pluginInput=null,this._oitBlendOrNil=null,this._nodes=null,this._framebuffer=null,this._performanceInfo=null,Q.prune(),ne.prune(),S()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _oitBlend(){return this._oitBlendOrNil??=new V(this._techniques),this._oitBlendOrNil}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e){this._renderStateFeatures.value=se(e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,s){this._renderStateFeatures.mutate(i=>i.set(t,e,s)),this._requestRender()}setTime(e){this._renderContext.time=e}get hasReflections(){return this._bindParameters.screenSpaceReflections.enabled=this._pluginsHas.water&&this.isFeatureEnabled(4),this._bindParameters.screenSpaceReflections.enabled}get _hasHighlights(){return this._plugins.produces(10,2,4,18,12,13,14)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(10,12,13,14)}get hasAmbientIllumination(){return this.isFeatureEnabled(3)&&!this._inGlobeView}get hasGlobalIllumination(){return this._hasGlobalIlluminationFlag&&this.hasAmbientIllumination}get hasGlobalIlluminationHighQuality(){return this.hasGlobalIllumination&&this.isFeatureEnabled(10)}get _keepGlobalIlluminationShadingAlive(){return this._hasGlobalIlluminationFlag&&!this._inGlobeView}get hasSMAA(){return this.isFeatureEnabled(0)}get _emissions(){const e=this._plugins.emissions;return this._hasTransparentGeometry?e:1===e||3===e?1:0}get hasFloatBlend(){return this._rctx.driverTest.floatBufferBlend.result&&this.isFeatureEnabled(9)}get highResolutionAtmosphere(){return this.isFeatureEnabled(2)}get fboCache(){return this._fboCache}setShadowAccumulator(e){this._shadowAccumulator=e,this._shadowCastOptions&&e.setParameters(this._shadowCastOptions)}_releaseFBOs(){this._bindParameters.hudOcclusion=n(this._bindParameters.hudOcclusion),this._bindParameters.depth=null}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._bindParameters.globalIllumination=n(this._bindParameters.globalIllumination),this._bindParameters.reprojection.lastFrameDepth=n(this._bindParameters.reprojection.lastFrameDepth),this._bindParameters.reprojection.lastFrameEmission=n(this._bindParameters.reprojection.lastFrameEmission),this._disposeBindBuffers()}_disposeBindBuffers(){this._bindParameters.shadowMap.disposeOutputs()}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._plugins.updating||this.weatherFader?.readyToRun||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=s(async e=>{const{EdgeView:t}=await(import("./edgeRendering/EdgeView.js"));o(e);const s=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:He(this.stage.view.resourceController)});return this.addHandles(d(()=>s.updating,()=>this._requestRender(),m)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(s)),this._edgeViewCallbacks.length=0,s})),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&&b(this._bindParameters.reprojection.matrix,A)}set _reprojectionMatrix(e){t(this._bindParameters.reprojection.matrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._bindParameters.shadowMap.enabled}setParameters(e){e.shadowCast&&(this._shadowCastOptions={...this._shadowCastOptions,...e.shadowCast},this._shadowAccumulator?.setParameters(e.shadowCast))}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}addRenderer(e){this._plugins.add(e)}removeRenderer(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.occludedHudElements=this._plugins.produces(0,13),has.hudElements=has.occludedHudElements||this._plugins.produces(0,...we),has.water=this._plugins.produces(4,19),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new k(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const s=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==s&&(this._gpuTimerHandle=s?i(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,s=!1){try{return this._isRendering=!0,this._render(e,t,s)}catch(i){console.error(`Exception during rendering: ${i}:\n${i.stack}`)}finally{this._isRendering=!1}return new he(this._pluginInput.get(T.FINAL),null)}_render(e,t,s){const i=0===t;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=i,this._disposeBindBuffers();const{camera:r,contentCamera:a,mode:o,alignPixelEnabled:d}=e;this._state.value=o,this._bindParameters.frameRendererTarget=t,this._bindParameters.output=0,this._bindParameters.emissions=this._emissions,this._bindParameters.alignPixelEnabled=d,this._bindParameters.decorations=!s,this._bindParameters.mainDepth=null,this._bindParameters.useFloatBlend.value=this.hasFloatBlend;const l=!s||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=l?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(D.VIEWSHED),this._bindParameters.cutFillComputationEnabled=this._nodes.produces(D.CUTFILL_COMPUTATION),this._bindParameters.cutFillVisualizationEnabled=this._nodes.produces(D.CUTFILL),this._ensureBindParameters(r,a),this._plugins.sortTestsTransparentOrderedSlots(Se),this._plugins.prepareRender(),this._hasTransparentGeometry=this._plugins.produces(1,...ge),this._renderOverlay(),r.setGLViewport(this._rctx);const u=this._framebuffer,m=u.initialize(r.fullWidth,r.fullHeight,this._backgroundColor),_=this._needsLastFrameColor;_?(m?.retain(_-1),m?.setName("last frame color"),this._bindParameters.reprojection.lastFrameColor?.release(),this._bindParameters.reprojection.lastFrameColor=m):m?.release(),this._bindParameters.hasShadowHighlights=this._needsShadowHighlight&&!s,this._precompilePrepasses(),this.performanceInfo.advance(de.PREPARE);const p=this._computeShadowDepthRange(r);this._pluginInput.set("normals",this._renderNormals()),this._renderAmbientIlluminationAndDepth(),this._renderShadowMap(r,a,this._bindParameters.lighting.mainLight.direction,p),this._renderShadowAccumulation(p),u.bind(),this._bindParameters.mainDepth=u.depth.attachment,this._precompileShaders(i),this._bindParameters.output=0,this._renderOpaque(),this._renderPreTransparent(),this._renderTransparent(),this.hasReflections&&(this._bindParameters.depth=h(this._bindParameters.depth),this._bindParameters.reprojection.lastFrameColor=h(this._bindParameters.reprojection.lastFrameColor)),this._bindParameters.shadowMap.disposeOutput(5),u.update(e=>this._renderNodes(D.CUTFILL_COMPUTATION,e)),this._pluginInput.set(D.FOCUSAREA_MASK,this._renderFocusAreaMask()),u.update(e=>this._renderNodes(D.TRANSPARENT_ENVIRONMENT,e)),u.update(e=>this._renderNodes(D.VIEWSHED,e)),u.update(e=>this._renderNodes(D.LASERLINES,e)),this._nodes.requireGeometryDepth&&(this._bindParameters.depth=h(this._bindParameters.depth)),u.update(e=>this._renderNodes(D.FOCUSAREA,e)),this._pluginInput.release(D.FOCUSAREA_MASK),u.update(e=>this._renderNodes(D.CUTFILL,e)),this._pluginInput.release(D.GROUND_DEPTH),u.update(e=>this._renderNodes(D.OCCLUDED,e)),this._pluginInput.set("highlights",this._renderHighlightPrepass());const c=2===t?this._renderObjectAndLayerIdColor():null;u.update(e=>this._renderNodes(T.COMPOSITE,e)),this._bindParameters.shadowMap.disposeOutputs(),this._bindParameters.shadowHighlight=n(this._bindParameters.shadowHighlight),u.update(e=>this._renderNodes(D.ANTIALIASING,e));const b=this._hasTransparentGeometry?2:1,f=this._bindParameters.emissions;let g;return this._bindParameters.emissions=0,this._hasHUDHighlights&&u.update(e=>this._renderHUD(b,e)),u.update(e=>this._renderNodes(D.HIGHLIGHT,e)),this._hasHUDHighlights||u.update(e=>this._renderHUD(b,e)),this._bindParameters.emissions=f,u.update(e=>this._renderNodes(D.MAGNIFIER,e)),u.update(e=>this._renderNodes(T.FINAL,e)),i&&(this._blit.toFramebuffer(u.color,this._bindParameters),ce||2!==o&&0!==o||this.navigationDepthCache.update(this._bindParameters,u.depth.attachment,this._renderContext.time)),this._bindParameters.reprojection.lastFrameDepth?.release(),this._bindParameters.reprojection.lastFrameEmission?.release(),this.hasGlobalIllumination&&(this._bindParameters.reprojection.lastFrameDepth?.release(),this._bindParameters.reprojection.lastFrameDepth=this._bindParameters.depth,0!==this._emissions&&(this._bindParameters.reprojection.lastFrameEmission?.release(),this._bindParameters.reprojection.lastFrameEmission=u.color.obtainAttachment(le))),this._testsNeedsDepth&&(this._bindParameters.depth=h(this._bindParameters.depth)),this._releaseFBOs(),u.releaseDepth(),this._bindParameters.reprojection.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),i||(g=u.color,g.retain(),this._releaseFBOs(),this._disposeOffscreenBuffers()),this.performanceInfo.finishFrame(),new he(g,c)}_precompileShaders(e){++this._plugins.context.techniques.precompiling;const t=this._bindParameters;t.output=0;const s=t.emissions;if(this._precompileOpaqueGeometry(),this._nodes.precompile(t.hasOpaqueEmission,D.OPAQUE_ENVIRONMENT,D.GAUSSIAN_SPLAT,D.OPAQUE_OCCLUSION_QUERY,D.VOXEL),this._precompileOpaqueGeometry(),t.output=3,this._plugins.precompile(...Pe),t.output=0,this._plugins.precompile(...Pe),this._hasTransparentGeometry){const e=this._pluginsHas.occludedHudElements;this._oitBlend.precompile(t,e,0),this._pluginsHas.hudElements&&this._oitBlend.precompile(t,!1,1),this._precompileTransparentGeometry(),t.hasTransparentEmission&&(t.emissions=3)}this._nodes.precompile(t.hasOpaqueEmission,D.FOCUSAREA_MASK),this._compositor.precompile(this._usesPremultipliedAlphaBlit,!!this._needsEdges,t),this._hasTransparentGeometry||this._plugins.precompile(15),this._nodes.precompile(t.hasOpaqueEmission,D.TRANSPARENT_ENVIRONMENT,D.VIEWSHED,D.CUTFILL_COMPUTATION,D.CUTFILL,D.LASERLINES,D.FOCUSAREA,D.OCCLUDED,D.ANTIALIASING),t.highlightMixTexture=t.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(0),t.emissions=0,this._precompileHUD(0),this._precompileHUD(1),t.emissions=s,this._hasHighlights&&(t.highlights.forEach((e,s)=>{t.highlightLevel=s,this._precompileAllGeometry(10),this._hasHUDHighlights&&this._plugins.precompile(13,12)}),t.highlightLevel=null,this._nodes.precompile(t.hasEmissions,D.HIGHLIGHT)),t.highlightMixTexture=null,this._nodes.precompile(t.hasEmissions,T.COMPOSITE,D.MAGNIFIER),this._nodes.precompile(t.hasEmissions,D.TRANSPARENT_NO_DEPTH),this._plugins.precompile(8),t.hasOpaqueEmission&&(t.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.precompile(8),t.transparentWithoutDepthEmissionDimmingPass=!1),e&&this._blit.precompile(),--this._plugins.context.techniques.precompiling}_renderFocusAreaMask(){const e=this._nodes.produce(D.FOCUSAREA_MASK,this._pluginInput);return e&&this.performanceInfo.advance(de.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces(D.OBJECT_AND_LAYER_ID_COLOR))return null;const e=this._bindParameters.output;++this._techniques.precompiling;const{width:t,height:s}=this._framebuffer.size;let i=this.fboCache.acquire(t,s,D.OBJECT_AND_LAYER_ID_COLOR).acquireDepth(14);return i=this._renderNodes(D.OBJECT_AND_LAYER_ID_COLOR,i),--this._techniques.precompiling,this._bindParameters.output=e,i}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,s=0===e;if(s||t){const e=s?this.performanceInfo.elapsedTime:0;let i=0;t?i=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const r=Math.max(e,i);this._animationTimestep.frame(r,s)}}readAccumulatedShadow(e){return this._shadowAccumulator?.readAccumulatedShadow(e[0],e[1])??0}readMainDepth(e,t){const{mainDepth:s,camera:i}=this._bindParameters;if(!s)return;const r=this.fboCache.acquire(this._framebuffer.size.width,this._framebuffer.size.height,"linear depth");this._rctx.bindFramebuffer(r.fbo),i.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(C),this._compositor.blitDepthToLinearDepth(this._bindParameters,s),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),r.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,ue.UNSIGNED_BYTE,t),r.release()}get _needsEdges(){return this._edgeView?.shouldRender()?this._edgeView:null}_renderEdges(e){const t=this._needsEdges;if(!t)return;const{width:s,height:i}=this._framebuffer.size,r=this.fboCache.acquire(s,i,"edges");r.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(C),t.render(this._bindParameters,e),r.detachDepth(),this._framebuffer.bind(),this._compositor.composite(this._bindParameters,r.getTexture()),r.release(),this.performanceInfo.advance(1===e?de.OPAQUE_EDGES:de.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(this._renderContext.time),this._bindParameters.overlay&&this.performanceInfo.advance(de.OVERLAY)}_renderShadowMap(e,t,s,i){if(!this.shadowsEnabled)return;const r=this._bindParameters.shadowMap;if(r.start(e,s,i,this.isFeatureEnabled(5),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight){this._renderShadowCascades(6,r),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t);const s=this._bindParameters.output;this._bindParameters.output=0,this._bindParameters.shadowHighlight=this._nodes.produce(D.SHADOW_HIGHLIGHT,this._pluginInput),this._bindParameters.output=s,r.disposeOutput(6),r.clear(),this._renderShadowCascades(7,r)}else this._renderShadowCascades(5);e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this._needsShadowHighlight&&(this._bindParameters.depth=h(this._bindParameters.depth)),this.performanceInfo.advance(D.SHADOWMAP)}_precompileShadowCascades(e){0!==this._bindParameters.shadowMap.cascades.length&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._bindParameters.shadowMap){const s=this._bindParameters.output,i=6!==e;t.bindFramebuffer();for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this.renderAllGeometry(e),i&&this._renderShadowNodes(t.renderTarget);t.finish(e),this._bindParameters.output=s}_renderShadowNodes(e){this._renderInternalNodeCategory(D.SHADOWMAP,e)}get _needsLastFrameColor(){return+this.hasReflections+ +this.hasGlobalIllumination}get _needsDepth(){return+this._nodes.requireGeometryDepth+ +this.hasReflections+ +this.hasGlobalIllumination+ +this._testsNeedsDepth+ +this._needsShadowHighlight}get _usesPremultipliedAlphaBlit(){return this._pluginsHas.hudElements}_renderAmbientIlluminationAndDepth(){this._bindParameters.depth=n(this._bindParameters.depth);const e=this._pluginInput.get("normals");if(e){this._pluginInput.set(D.AMBIENT_ILLUMINATION,this._hasGlobalIlluminationFlag?this._renderGlobalIllumination():this._renderSSAO());const t=this._needsDepth;t?(this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(3),this._bindParameters.depth=e.obtainDepthTexture(),this._bindParameters.depth?.retain(t-1),this.performanceInfo.advance(de.DEPTH)):e.detachDepth(),this.hasAmbientIllumination&&this._pluginInput.release("normals")}else this._hasGlobalIlluminationFlag&&(this._releaseGlobalIlluminationBuffers(),this._bindParameters.globalIlluminationEnabled=this._keepGlobalIlluminationShadingAlive),this._renderAllGeometryDepth()}_renderAllGeometryDepth(){const e=this._needsDepth;if(0===e)return;const{width:t,height:s}=this._framebuffer.size,i=this.fboCache.acquire(t,s,"geometry depth",14);this._rctx.bindFramebuffer(i.fbo),this._rctx.clear(1280),this.renderAllGeometry(3),this._renderGaussianSplatPrepassDepth(i),this._bindParameters.depth=i.obtainDepthTexture(),this._bindParameters.depth?.retain(e-1),i.release(),this.performanceInfo.advance(de.DEPTH)}_renderGaussianSplatPrepassDepth(e){const t=this._shadowAccumulator;if(!t?.active||!t.requireGeometryDepth)return;const s=this._bindParameters.output;this._bindParameters.output=3,this._renderInternalNodeCategory(D.GAUSSIAN_SPLAT_DEPTH,e),this._bindParameters.output=s}_renderGaussianSplatDepthAndNormals(e){const t=this._bindParameters.output;this._bindParameters.output=4,this._renderInternalNodeCategory(D.GAUSSIAN_SPLAT_DEPTH,e),this._bindParameters.output=t}get _needsShadowDepthRange(){return this._bindParameters.shadowMap.enabled||!!this._shadowAccumulator?.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return Y.Zero;const t=K(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),t.union(this._nodes.queryDepthRange(D.SHADOWMAP,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)<U)return void(this.sceneDepthRange.value=Y.Infinite);const t=e.clone();t.near=N,t.far=1e10;const s=K(t,this._plugins.plugins,this.stage.layers,1);s.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(s)||(this.sceneDepthRange.value=s)}get _normalsRequired(){return this._nodes.require("normals",...O,D.VIEWSHED,D.LASERLINES)+(this.hasAmbientIllumination?1:0)}_precompilePrepasses(){const e=!!this._normalsRequired;if(e?(this._precompilePlugins(4,Ae),this._needsDepth&&this._precompilePlugins(3,Ie)):this._needsDepth&&this._precompileAllGeometry(3),this.shadowsEnabled&&(this._needsShadowHighlight?(this._nodes.precompile(this._bindParameters.hasEmission,D.SHADOW_HIGHLIGHT),this._precompileShadowCascades(6),this._precompileShadowCascades(7)):this._precompileShadowCascades(5)),this._shadowAccumulator?.active&&(this._nodes.precompile(!1,D.SHADOW_ACCUMULATION),this._precompileAllGeometry(5)),this._shadowAccumulator?.active||e){const t=this._bindParameters.output;this._bindParameters.output=e?4:3,this._nodes.precompile(!1,D.GAUSSIAN_SPLAT_DEPTH),this._bindParameters.output=t}(this.shadowsEnabled||this._shadowAccumulator?.active)&&this._nodes.precompile(!1,D.SHADOWMAP),this.hasAmbientIllumination&&e&&this._nodes.precompile(this._bindParameters.hasEmission,D.AMBIENT_ILLUMINATION)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const{width:t,height:s}=this._framebuffer.size,i=this.fboCache.acquire(t,s,"normals");i.acquireDepth(14),this._rctx.bindFramebuffer(i.fbo),this._rctx.clearFramebuffer(C,!0,!0),this._bindParameters.output=4,this._plugins.render(...Ae),this._renderGaussianSplatDepthAndNormals(i);const r=this._nodes.optional("normals",...O,D.VIEWSHED);return i.retain(e+r-1),this.performanceInfo.advance(de.NORMALS),i}_renderSSAO(){this._bindParameters.globalIlluminationEnabled=!1;const e=this._pluginInput.get("normals");return this.hasAmbientIllumination&&e?(this._bindParameters.ssao=this._nodes.produce(D.AMBIENT_ILLUMINATION,this._pluginInput),this._bindParameters.ssao&&this.performanceInfo.advance(de.AMBIENT_ILLUMINATION),this._bindParameters.ssao):null}_renderGlobalIllumination(){const e=this._bindParameters;if(!this.hasGlobalIllumination)return this._releaseGlobalIlluminationBuffers(),e.globalIlluminationEnabled=this._keepGlobalIlluminationShadingAlive,null;const t=this._nodes.produce(D.AMBIENT_ILLUMINATION,this._pluginInput);return this._releaseGlobalIlluminationBuffers(),this._bindParameters.globalIllumination=t,this._bindParameters.globalIlluminationEnabled=!0,this.performanceInfo.advance(this.hasGlobalIlluminationHighQuality?de.AMBIENT_ILLUMINATION_HIGH_QUALITY:de.AMBIENT_ILLUMINATION),e.globalIllumination}_releaseGlobalIlluminationBuffers(){const e=this._bindParameters;e.reprojection.lastFrameColor=h(e.reprojection.lastFrameColor),e.reprojection.lastFrameDepth=n(e.reprojection.lastFrameDepth),e.reprojection.lastFrameEmission=n(e.reprojection.lastFrameEmission),e.globalIllumination=h(e.globalIllumination),e.globalIlluminationEnabled=!1}_precompileAllGeometry(e){const t=this._bindParameters.output;this._bindParameters.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(...Pe),this._bindParameters.output=t}renderAllGeometry(e){this._bindParameters.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentGround()}precompileSlots(e,...t){for(const s of t)this._bindParameters.slot=s,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const s of t)this._renderContext.renderOccludedMask=s,this.precompileSlots(e,...Ee);this._renderContext.renderOccludedMask=ee}renderSlots(e,...t){for(const s of t)this._bindParameters.slot=s,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,...Ee),this._renderContext.renderOccludedMask=ee}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Te[e])}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(16),this.renderHUD(e),this._bindParameters.hudRenderStyle=e,this._plugins.render(14)}precompileViewshedShadowMap(){const e=this._bindParameters.output;this._bindParameters.output=8,this._precompileAllGeometry(8),this._nodes.precompile(!1,D.SHADOWMAP),this._bindParameters.output=e}precompileCutFillDepth(){this._precompilePlugins(9,De)}_precompilePlugins(e,t){const s=this._bindParameters.output;this._bindParameters.output=e,this._plugins.precompile(...t),this._bindParameters.output=s}renderViewshedShadowMap(e,t){const{camera:s,contentCamera:i}=this._bindParameters,r=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(8),this._renderShadowNodes(t),this._ensureBindParametersCamera(s,i),this._bindParameters.camera.setGLViewport(this._rctx),this._bindParameters.output=r}renderCutFillDepth(e){const{camera:t,contentCamera:s}=this._bindParameters,i=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._bindParameters.output=9,this._plugins.render(...De),this._ensureBindParametersCamera(t,s),t.setGLViewport(this._rctx),this._bindParameters.output=i}get _needsGroundDepth(){return this._bindParameters.cutFillVisualizationEnabled}_blitGroundDepth(){if(!this._needsGroundDepth)return null;const{width:e,height:t}=this._framebuffer.size,s=this.fboCache.acquire(e,t,D.GROUND_DEPTH,14);return this._rctx.blitFramebuffer(this._framebuffer.color.fbo,s.fbo,256),this._framebuffer.bind(),s}_renderOpaqueAndTransparentGeometry(e){this._bindParameters.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithoutNormals(e){this._bindParameters.output=e,this._plugins.render(...Ie)}_precompileOpaqueGeometry(){this._needsOpaquePass&&(this._plugins.precompile(...fe),this._nodes.precompile(this._bindParameters.hasEmission,"opaque-color"))}_renderOpaqueGeometry(){this._plugins.render(...fe)}_renderTransparentGeometry(){this._plugins.render(...ge),this._hasTransparentGeometry&&this._plugins.render(15)}_renderTransparentGround(){this._plugins.render(...Pe)}_precompileHUD(e){if(!this._pluginsHas.hudElements)return;const t=this._bindParameters.output,s=this._bindParameters.hudRenderStyle,i=this._bindParameters.emissions;this._bindParameters.emissions=0,this._bindParameters.hudRenderStyle=e,this._bindParameters.output=1,this._plugins.precompile(...we),this._bindParameters.output=2,this._plugins.precompile(...we),this._bindParameters.output=0,this._oitBlend.precompile(this._bindParameters,!1,1),this._hasHighlights&&(this._bindParameters.output=10,this._plugins.precompile(...we)),this._bindParameters.emissions=i,this._bindParameters.output=t,this._bindParameters.hudRenderStyle=s}_renderHUD(e,t){if(!this._pluginsHas.hudElements)return t;const s=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo);const i=!!t.getTexture(le);return this._compositor.compositePreMultipliedAlpha(this._bindParameters,s.getTexture(),i),s.release(),this.performanceInfo.advance(0===e?de.HUD_OCCLUDED:de.HUD),t}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(6,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:s}=this,{width:i,height:r}=this._framebuffer.size,{highlights:a}=s,n=a.length>j?3:1,h=e.acquire(i,r,"highlights",n);h.acquireDepth(14);const o=this._plugins.produces(10,0);return o&&this._framebuffer.color.fbo&&h.fbo&&t.blitFramebuffer(this._framebuffer.color.fbo,h.fbo,1024),t.bindFramebuffer(h.fbo),t.gl.clearBufferuiv(6144,0,[0,0,0,0]),o||t.clear(1024),this._bindParameters.output=10,t.bindFramebuffer(h.fbo),B(t,e,i,r,s,()=>this._renderHighlightGeometries()),h.detachDepth(),this.performanceInfo.advance(de.HIGHLIGHTS),h.retain(this._nodes.require("highlights",...R)+this._nodes.optional("highlights",...R)-1),h}_renderHighlightGeometries(){this._plugins.render(...Ce),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e){const t=this._shadowAccumulator;if(!t)return;t.updateDepthRange(e);const s=t.requireGeometryDepth;this._bindParameters.output=0;const i=this._nodes.produce(D.SHADOW_ACCUMULATION,this._pluginInput);t.didAccumulate&&this.performanceInfo.advance(de.ACCUMULATED_SHADOWS),this._pluginInput.set(D.SHADOW_ACCUMULATION,null),i?.release(),s&&(this._bindParameters.depth=h(this._bindParameters.depth))}renderShadowAccumulationShadowMap(e,t,s,i,r){const a=this.stage.view.qualitySettings.maximumPixelRatio;this._bindParameters.renderingShadowAnalysisMap=!0;try{s.start(e,i,r,!0,a),this._renderShadowCascades(5,s),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t)}finally{this._bindParameters.renderingShadowAnalysisMap=!1}}_precompileTransparentGeometry(){x(this._bindParameters.output)?(this._bindParameters.output=1,this._plugins.precompile(...ge),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=2,this._plugins.precompile(...ge),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=0):this._plugins.precompile(...ge)}_renderOIT(e,t=2){const s=1===e,{width:i,height:r}=this._framebuffer.size,a=s?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=h.useFloatBlend.value?8:5,d=h.output;h.output=1;const l=s?"oit hud":"oit",u=this.fboCache.acquire(i,r,l,o).acquireColor(le,this.hasFloatBlend?7:0,"oit alpha"),m=h.hasEmission&&(0===e||1!==t);m&&u.acquireColor(me,o,"oit emissive"),s||u.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(u.fbo),this._rctx.clearFramebuffer($),m&&this._rctx.clearBuffer(2,$),a(),u.detachDepth(),h.output=2;const _=this.fboCache.acquire(i,r,s?"oit front hud":"oit front");m&&_.acquireColor(le,o,"oit front emissive"),s?_.acquireDepth(this._hudDepthFormat):_.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(_.fbo),this._rctx.clearFramebuffer(C,s),a(),_.detachDepth();const p=this._pluginsHas.occludedHudElements&&!s,c=p&&0!==h.emissions?me:le;let b;return h.hudOcclusion=n(this._bindParameters.hudOcclusion),h.output=0,s?(b=this.fboCache.acquire(i,r,"oit composite hud"),this._rctx.bindFramebuffer(b.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):(0!==h.emissions&&this._framebuffer.ensureEmissionAttachment(),p&&(this._framebuffer.color.acquireColor(c,0,"hud occlusion"),this._rctx.clearBuffer(c-_e,C)),this._framebuffer.bind()),this._oitBlend.blend(this._rctx,u,_,h,p,e,this._fboCache.debugCallback),b?.detachDepth(),s||(m&&(this._bindParameters.emissions=3),p&&(h.hudOcclusion=this._framebuffer.color.obtainAttachment(c))),_.release(),u.release(),h.output=d,b}get _hudDepthFormat(){return this.isFeatureEnabled(7)?14:13}get _needsOpaquePass(){return this.plugins.produces(0,...fe)||this.plugins.produces(5,...fe)||this.plugins.produces(3,3)}_renderOpaque(){const e=this._needsOpaquePass;e&&(this._plugins.render(0,1),this._pluginInput.set(D.GROUND_DEPTH,this._blitGroundDepth()),this._plugins.render(2,3));const t=this._framebuffer;t.update(t=>this._renderNodes(T.OPAQUE,t,e)),this.fboCache.debugCallback?.(T.OPAQUE,t.color.fbo),t.update(e=>this._renderNodes(D.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(D.OPAQUE_ENVIRONMENT,t.color.fbo),this._renderEdges(1)}_renderPreTransparent(){this._framebuffer.update(e=>this._renderNodes(D.GAUSSIAN_SPLAT,e)),this.fboCache.debugCallback?.(D.GAUSSIAN_SPLAT,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(D.OPAQUE_OCCLUSION_QUERY,e)),this.fboCache.debugCallback?.(D.OPAQUE_OCCLUSION_QUERY,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(D.VOXEL,e)),this.fboCache.debugCallback?.(D.VOXEL,this._framebuffer.color.fbo)}_renderTransparent(){const e=this._framebuffer;if(this._renderHiddenTransparentEdges(),this._hasTransparentGeometry&&this._renderOIT(0),e.update(e=>this._renderNodes(T.TRANSPARENT,e,this._hasTransparentGeometry)),this.fboCache.debugCallback?.(T.TRANSPARENT,e.color.fbo),this._hasTransparentGeometry||this._plugins.render(15),this._renderEdges(0),this._bindParameters.ssao=n(this._bindParameters.ssao),e.update(e=>this._renderNodes(D.TRANSPARENT_NO_DEPTH,e)),this.fboCache.debugCallback?.(D.TRANSPARENT_NO_DEPTH,e.color.fbo),this._framebuffer.bind(),this._plugins.render(8),this._bindParameters.hasEmission){const e=this._rctx.setDrawBuffers([pe,le]);this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.render(8),this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!1,this._rctx.setDrawBuffers(e)}this.performanceInfo.advance(de.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderNodes(e,t,s=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return s&&this.performanceInfo.advance(e),t;const i=this._nodes.render(t,this._pluginInput,this._releaseNodeInputs);return this.performanceInfo.advance(e),this._fboCache.debugCallback?.(e,i.fbo),i}_renderInternalNodeCategory(e,t){if(!t)return;const s=t.name;try{this._renderNodes(e,t)}finally{this._pluginInput.set(e,null),t.setName(s)}}_ensureBindParameters(e,t){this._ensureBindParametersCamera(e,t),this._ensureBindParametersWeatherFader(),this._ensureBindParametersScreenSpaceReflections(),this._ensureBindParametersReprojection()}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersWeatherFader(){1===this.stage.viewingMode&&(this._bindParameters.clouds.data&&(this._bindParameters.clouds.fade(this._bindParameters.camera,this.renderContext.time,this.stage.view.qualitySettings.fadeDuration,this.stage.view.state.stationary),this.weatherFader?.cleanupCubemap()),this._bindParameters.snowCover=this.weatherFader?.snowCover??0)}_ensureBindParametersScreenSpaceReflections(){const{time:e}=this.renderContext,{screenSpaceReflections:t}=this._bindParameters;if(this.hasReflections){null==this._ssrEnableTime&&(this._ssrEnableTime=e);const s=this.stage.view.qualitySettings.fadeDuration;t.fadeFactor=s>0?Math.min(s,e-this._ssrEnableTime)/s:1,t.fadeFactor<1&&this._requestRender()}else this._ssrEnableTime=null}_ensureBindParametersReprojection(){if(!(this.hasReflections||this.hasGlobalIllumination))return void(this._reprojectionMatrix=A);const{reprojection:e,camera:t}=this._bindParameters,{lastFrameCamera:s}=e,i=!s.equals(t);if(i?(f(Ne,t.viewMatrix),f(Re,t.projectionMatrix),g(Ge,Ne,Re),g(Ge,s.viewMatrix,Ge),g(Ge,s.projectionMatrix,Ge),this._reprojectionMatrix=Ge):this._reprojectionMatrix=A,this.hasGlobalIllumination){const{viewMatrix:t}=e;i?(g(Fe,s.viewMatrix,Ne),P(t,Fe)):P(t,A)}}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,s,i){this._bindParameters.updateLighting(e,t,s,i),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0,clouds:this.weatherFader?.usedMemory??0}}get test(){}};e([p()],be.prototype,"_inGlobeView",void 0),e([p({readOnly:!0})],be.prototype,"highResolutionAtmosphere",null),e([p()],be.prototype,"_edgeView",void 0),e([p()],be.prototype,"updating",null),be=e([c("esri.views.3d.webgl-engine.lib.Renderer")],be);const fe=[0,1,2,3],ge=[7,6,4,5],Pe=[7,6],Ae=[0,1,2,4,...Pe],Ie=[3,5],Ee=[2,4,8],we=[16,12,14,13],Ce=[4,5,2,3,0,1,...Pe],Se=[4,8,5,11],Te={0:[13],1:[12],2:[13,12],3:[13,12]},De=[0,1,...Pe],Oe=["normals","highlights"],Re=I(),Ne=I(),Ge=I(),Fe=I();function He(e){return t=>e.immediate.schedule(t)}export{be as Renderer};
2
+ import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as s}from"../../../../core/asyncUtils.js";import has from"../../../../core/has.js";import{removeMaybe as i,abortMaybe as r,destroyMaybe as a,releaseMaybe as n,releaseReferencedMaybe as h}from"../../../../core/maybe.js";import{throwIfAborted as o}from"../../../../core/promiseUtils.js";import{watch as d,syncAndInitial as l,initial as u,sync as _}from"../../../../core/reactiveUtils.js";import{signal as m}from"../../../../core/signal.js";import{property as p,subclass as c}from"../../../../core/accessorSupport/decorators.js";import{equals as b,invert as f,multiply as g,copy as P}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as A,create as I}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as w}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as E,ZEROS as C}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as S}from"../../../../geometry/support/Indices.js";import{RenderNodeOutput as T,InternalRenderCategory as D,AllRenderNodeOutputs as O,AllInternalRenderNodeOutputs as R}from"../../webgl.js";import{minNearDistanceInMeters as N}from"../../state/NearFarHeuristic.js";import{debugFlags as G}from"../../support/debugFlags.js";import{FBOCache as F}from"../core/FBOCache.js";import{RenderPassManager as H}from"../core/renderPasses/RenderPassManager.js";import{isColor as x}from"../core/shaderLibrary/ShaderOutput.js";import{distanceFadeEnd as y}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as v}from"../effects/RenderNodes.js";import{RenderPluginManager as M}from"../effects/RenderPluginManager.js";import{WeatherFader as L}from"../effects/WeatherFader.js";import{innerAtmosphereFadeStart as U}from"../effects/atmosphere/atmosphereUtils.js";import{Blit as q}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as j,renderHighlightBuffer as B}from"../effects/highlight/Highlight.js";import{OITBlend as V}from"../effects/transparency/OITBlend.js";import{AnimationTimer as k}from"./AnimationTimer.js";import{AnimationTimeStep as W}from"./AnimationTimeStep.js";import{BoundingInfo as Q}from"./BoundingInfo.js";import{Compositor as z}from"./Compositor.js";import{DepthRange as Y}from"./DepthRange.js";import{depthRangeFromScene as K}from"./depthRangeUtils.js";import{MainFramebuffer as J}from"./MainFramebuffer.js";import{NavigationDepthCache as X}from"./NavigationDepthCache.js";import{blendingColorAlphaClear as $}from"./OrderIndependentTransparency.js";import{RenderContext as Z,defaultRenderOccludedMask as ee}from"./RenderContext.js";import{RendererBase as te}from"./RendererBase.js";import{setupFeatureDefaults as se}from"./RenderFeature.js";import{RenderPluginInput as ie}from"./RenderPluginInput.js";import{ShadowMap as re}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{ColorAttachment1 as le,PixelType as ue,ColorAttachment2 as _e,ColorAttachment0 as me,DrawBufferNone as pe}from"../../../webgl/enums.js";const ce=has("disable-feature:async-navigation-3d-depth-readback");let be=class extends te{constructor(e,t,s,i,r){super({stage:e}),this._techniques=s,this._rctx=i,this._requestRender=r,this._pluginsHas={occludedHudElements:!1,hudElements:!1,water:!1},this.renderPassManager=new H,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=E(0,0,0,1),this._sliceHelper=new ae,this._shadowAccumulator=null,this._shadowCastOptions=null,this.sceneDepthRange=m(Y.Infinite),this._state=m(2),this._hasGlobalIlluminationFlag=!!has("enable-feature:global-illumination"),this._hasAnimations=!1,this._animationTimestep=new W,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=m(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new ie,this._hasTransparentGeometry=!1,this._releaseNodeInputs=e=>{for(const t of Oe)e.some(({name:e})=>e===t)&&this._pluginInput.release(t)},this._testsNeedsDepth=!1,this._fboCache=new F(i),this._compositor=new z(i,s),this._renderStateFeatures=m(se(e.view.qualityProfile));const a=new re(this._fboCache,e.viewingMode);this._renderContext=new Z(this._rctx,a,s),this._framebuffer=new J(this._fboCache,this._bindParameters),this._performanceInfo=new oe(this._rctx),this._blit=new q(s),this.navigationDepthCache=new X(this._rctx,this._fboCache,s,()=>this._requestRender(0)),this._nodes=new v(this._renderContext),this._plugins=new M({renderContext:this._renderContext,techniques:s,materials:t,requestRender:r,controller:e}),this._plugins.add(this.renderPassManager),this.weatherFader=new L({view:e.view,context:this._renderContext}),this.addHandles([d(()=>e.view.state.camera,()=>r(),l),d(()=>G.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},r()},u),d(()=>e.view.environment.background?.color,e=>{const t=e?e.toUnitRGBA():C;w(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),r()},l),d(()=>e.view.environmentManager.shadowsAvailable,e=>{this._bindParameters.shadowMap.enabled=e,this._requestRender(1)},l),d(()=>e.view.state.camera.relativeElevation,e=>this._inGlobeView=(e??1/0)>=y,l),d(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},_),d(()=>this._bindParameters.clouds.data?.state,()=>r(),_),d(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,r()},u),d(()=>"sun"===e.view.environment.lighting?.type,e=>{this._bindParameters.enableFillLights=e,this._requestRender()},l)])}destroy(){this._gpuTimerHandle=i(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowAccumulator=null,this._shadowCastOptions=null,this._loadEdgeViewTask=r(this._loadEdgeViewTask),this._edgeView=a(this._edgeView),this.renderPassManager.dispose(),this.weatherFader=a(this.weatherFader),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.navigationDepthCache.destroy(),this._fboCache.destroy(),this._fboCache=null,this._renderContext.destroy(),this._plugins.destroy(),this._pluginInput=null,this._oitBlendOrNil=null,this._nodes=null,this._framebuffer=null,this._performanceInfo=null,Q.prune(),ne.prune(),S()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _oitBlend(){return this._oitBlendOrNil??=new V(this._techniques),this._oitBlendOrNil}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e){this._renderStateFeatures.value=se(e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,s){this._renderStateFeatures.mutate(i=>i.set(t,e,s)),this._requestRender()}setTime(e){this._renderContext.time=e}get hasReflections(){return this._bindParameters.screenSpaceReflections.enabled=this._pluginsHas.water&&this.isFeatureEnabled(4),this._bindParameters.screenSpaceReflections.enabled}get _hasHighlights(){return this._plugins.produces(10,2,4,18,12,13,14)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(10,12,13,14)}get hasAmbientIllumination(){return this.isFeatureEnabled(3)&&!this._inGlobeView}get hasGlobalIllumination(){return this._hasGlobalIlluminationFlag&&this.hasAmbientIllumination}get hasGlobalIlluminationHighQuality(){return this.hasGlobalIllumination&&this.isFeatureEnabled(10)}get _keepGlobalIlluminationShadingAlive(){return this._hasGlobalIlluminationFlag&&!this._inGlobeView}get hasSMAA(){return this.isFeatureEnabled(0)}get _emissions(){const e=this._plugins.emissions;return this._hasTransparentGeometry?e:1===e||3===e?1:0}get hasFloatBlend(){return this._rctx.driverTest.floatBufferBlend.result&&this.isFeatureEnabled(9)}get highResolutionAtmosphere(){return this.isFeatureEnabled(2)}get fboCache(){return this._fboCache}setShadowAccumulator(e){this._shadowAccumulator=e,this._shadowCastOptions&&e.setParameters(this._shadowCastOptions)}_releaseFBOs(){this._bindParameters.hudOcclusion=n(this._bindParameters.hudOcclusion),this._bindParameters.depth=null}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._bindParameters.globalIllumination=n(this._bindParameters.globalIllumination),this._bindParameters.reprojection.lastFrameDepth=n(this._bindParameters.reprojection.lastFrameDepth),this._bindParameters.reprojection.lastFrameEmission=n(this._bindParameters.reprojection.lastFrameEmission),this._disposeBindBuffers()}_disposeBindBuffers(){this._bindParameters.shadowMap.disposeOutputs()}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._plugins.updating||this.weatherFader?.readyToRun||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=s(async e=>{const{EdgeView:t}=await(import("./edgeRendering/EdgeView.js"));o(e);const s=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:He(this.stage.view.resourceController)});return this.addHandles(d(()=>s.updating,()=>this._requestRender(),_)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(s)),this._edgeViewCallbacks.length=0,s})),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&&b(this._bindParameters.reprojection.matrix,A)}set _reprojectionMatrix(e){t(this._bindParameters.reprojection.matrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._bindParameters.shadowMap.enabled}setParameters(e){e.shadowCast&&(this._shadowCastOptions={...this._shadowCastOptions,...e.shadowCast},this._shadowAccumulator?.setParameters(e.shadowCast))}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}addRenderer(e){this._plugins.add(e)}removeRenderer(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.occludedHudElements=this._plugins.produces(0,13),has.hudElements=has.occludedHudElements||this._plugins.produces(0,...Ee),has.water=this._plugins.produces(4,19),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new k(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const s=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==s&&(this._gpuTimerHandle=s?i(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,s=!1){try{return this._isRendering=!0,this._render(e,t,s)}catch(i){console.error(`Exception during rendering: ${i}:\n${i.stack}`)}finally{this._isRendering=!1}return new he(this._pluginInput.get(T.FINAL),null)}_render(e,t,s){const i=0===t;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=i,this._disposeBindBuffers();const{camera:r,contentCamera:a,mode:o,alignPixelEnabled:d}=e;this._state.value=o,this._bindParameters.frameRendererTarget=t,this._bindParameters.output=0,this._bindParameters.emissions=this._emissions,this._bindParameters.alignPixelEnabled=d,this._bindParameters.decorations=!s,this._bindParameters.mainDepth=null,this._bindParameters.useFloatBlend.value=this.hasFloatBlend;const l=!s||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=l?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(D.VIEWSHED),this._bindParameters.cutFillComputationEnabled=this._nodes.produces(D.CUTFILL_COMPUTATION),this._bindParameters.cutFillVisualizationEnabled=this._nodes.produces(D.CUTFILL),this._ensureBindParameters(r,a),this._plugins.sortTestsTransparentOrderedSlots(Se),this._plugins.prepareRender(),this._hasTransparentGeometry=this._plugins.produces(1,...ge),this._renderOverlay(),r.setGLViewport(this._rctx);const u=this._framebuffer,_=u.initialize(r.fullWidth,r.fullHeight,this._backgroundColor),m=this._needsLastFrameColor;m?(_?.retain(m-1),_?.setName("last frame color"),this._bindParameters.reprojection.lastFrameColor?.release(),this._bindParameters.reprojection.lastFrameColor=_):_?.release(),this._bindParameters.hasShadowHighlights=this._needsShadowHighlight&&!s,this._precompilePrepasses(),this.performanceInfo.advance(de.PREPARE);const p=this._computeShadowDepthRange(r);this._pluginInput.set("normals",this._renderNormals()),this._renderAmbientIlluminationAndDepth(),this._renderShadowMap(r,a,this._bindParameters.lighting.mainLight.direction,p),this._renderShadowAccumulation(p),u.bind(),this._bindParameters.mainDepth=u.depth.attachment,this._precompileShaders(i),this._bindParameters.output=0,this._renderOpaque(),this._renderPreTransparent(),this._renderTransparent(),this.hasReflections&&(this._bindParameters.depth=h(this._bindParameters.depth),this._bindParameters.reprojection.lastFrameColor=h(this._bindParameters.reprojection.lastFrameColor)),this._bindParameters.shadowMap.disposeOutput(5),u.update(e=>this._renderNodes(D.CUTFILL_COMPUTATION,e)),this._pluginInput.set(D.FOCUSAREA_MASK,this._renderFocusAreaMask()),u.update(e=>this._renderNodes(D.TRANSPARENT_ENVIRONMENT,e)),u.update(e=>this._renderNodes(D.VIEWSHED,e)),u.update(e=>this._renderNodes(D.LASERLINES,e)),this._nodes.requireGeometryDepth&&(this._bindParameters.depth=h(this._bindParameters.depth)),u.update(e=>this._renderNodes(D.FOCUSAREA,e)),this._pluginInput.release(D.FOCUSAREA_MASK),u.update(e=>this._renderNodes(D.CUTFILL,e)),this._pluginInput.release(D.GROUND_DEPTH),u.update(e=>this._renderNodes(D.OCCLUDED,e)),this._pluginInput.set("highlights",this._renderHighlightPrepass());const c=2===t?this._renderObjectAndLayerIdColor():null;u.update(e=>this._renderNodes(T.COMPOSITE,e)),this._bindParameters.shadowMap.disposeOutputs(),this._bindParameters.shadowHighlight=n(this._bindParameters.shadowHighlight),u.update(e=>this._renderNodes(D.ANTIALIASING,e));const b=this._hasTransparentGeometry?2:1,f=this._bindParameters.emissions;let g;return this._bindParameters.emissions=0,this._hasHUDHighlights&&u.update(e=>this._renderHUD(b,e)),u.update(e=>this._renderNodes(D.HIGHLIGHT,e)),this._hasHUDHighlights||u.update(e=>this._renderHUD(b,e)),this._bindParameters.emissions=f,u.update(e=>this._renderNodes(D.MAGNIFIER,e)),u.update(e=>this._renderNodes(T.FINAL,e)),i&&(this._blit.toFramebuffer(u.color,this._bindParameters),ce||2!==o&&0!==o||this.navigationDepthCache.update(this._bindParameters,u.depth.attachment,this._renderContext.time)),this._bindParameters.reprojection.lastFrameDepth?.release(),this._bindParameters.reprojection.lastFrameEmission?.release(),this.hasGlobalIllumination&&(this._bindParameters.reprojection.lastFrameDepth?.release(),this._bindParameters.reprojection.lastFrameDepth=this._bindParameters.depth,0!==this._emissions&&(this._bindParameters.reprojection.lastFrameEmission?.release(),this._bindParameters.reprojection.lastFrameEmission=u.color.obtainAttachment(le))),this._testsNeedsDepth&&(this._bindParameters.depth=h(this._bindParameters.depth)),this._releaseFBOs(),u.releaseDepth(),this._bindParameters.reprojection.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),i||(g=u.color,g.retain(),this._releaseFBOs(),this._disposeOffscreenBuffers()),this.performanceInfo.finishFrame(),new he(g,c)}_precompileShaders(e){++this._plugins.context.techniques.precompiling;const t=this._bindParameters;t.output=0;const s=t.emissions;if(this._precompileOpaqueGeometry(),this._nodes.precompile(D.OPAQUE_ENVIRONMENT,D.GAUSSIAN_SPLAT,D.OPAQUE_OCCLUSION_QUERY,D.VOXEL),this._precompileOpaqueGeometry(),t.output=3,this._plugins.precompile(...Pe),t.output=0,this._plugins.precompile(...Pe),this._hasTransparentGeometry){const e=this._pluginsHas.occludedHudElements;this._oitBlend.precompile(t,e,0),this._pluginsHas.hudElements&&this._oitBlend.precompile(t,!1,1),this._precompileTransparentGeometry(),t.hasTransparentEmission&&(t.emissions=3)}this._nodes.precompile(D.FOCUSAREA_MASK),this._compositor.precompile(this._usesPremultipliedAlphaBlit,!!this._needsEdges,t),this._hasTransparentGeometry||this._plugins.precompile(15),this._nodes.precompile(D.TRANSPARENT_ENVIRONMENT,D.VIEWSHED,D.CUTFILL_COMPUTATION,D.CUTFILL,D.LASERLINES,D.FOCUSAREA,D.OCCLUDED,D.ANTIALIASING),t.highlightMixTexture=t.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(0),t.emissions=0,this._precompileHUD(0),this._precompileHUD(1),t.emissions=s,this._hasHighlights&&(t.highlights.forEach((e,s)=>{t.highlightLevel=s,this._precompileAllGeometry(10),this._hasHUDHighlights&&this._plugins.precompile(13,12)}),t.highlightLevel=null,this._nodes.precompile(D.HIGHLIGHT)),t.highlightMixTexture=null,this._nodes.precompile(T.COMPOSITE,D.MAGNIFIER),this._nodes.precompile(D.TRANSPARENT_NO_DEPTH),this._plugins.precompile(8),t.hasOpaqueEmission&&(t.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.precompile(8),t.transparentWithoutDepthEmissionDimmingPass=!1),e&&this._blit.precompile(),--this._plugins.context.techniques.precompiling}_renderFocusAreaMask(){const e=this._nodes.produce(D.FOCUSAREA_MASK,this._pluginInput);return e&&this.performanceInfo.advance(de.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces(D.OBJECT_AND_LAYER_ID_COLOR))return null;const e=this._bindParameters.output;++this._techniques.precompiling;const{width:t,height:s}=this._framebuffer.size;let i=this.fboCache.acquire(t,s,D.OBJECT_AND_LAYER_ID_COLOR).acquireDepth(14);return i=this._renderNodes(D.OBJECT_AND_LAYER_ID_COLOR,i),--this._techniques.precompiling,this._bindParameters.output=e,i}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,s=0===e;if(s||t){const e=s?this.performanceInfo.elapsedTime:0;let i=0;t?i=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const r=Math.max(e,i);this._animationTimestep.frame(r,s)}}readAccumulatedShadow(e){return this._shadowAccumulator?.readAccumulatedShadow(e[0],e[1])??0}readMainDepth(e,t){const{mainDepth:s,camera:i}=this._bindParameters;if(!s)return;const r=this.fboCache.acquire(this._framebuffer.size.width,this._framebuffer.size.height,"linear depth");this._rctx.bindFramebuffer(r.fbo),i.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(C),this._compositor.blitDepthToLinearDepth(this._bindParameters,s),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),r.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,ue.UNSIGNED_BYTE,t),r.release()}get _needsEdges(){return this._edgeView?.shouldRender()?this._edgeView:null}_renderEdges(e){const t=this._needsEdges;if(!t)return;const{width:s,height:i}=this._framebuffer.size,r=this.fboCache.acquire(s,i,"edges");r.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(C),t.render(this._bindParameters,e),r.detachDepth(),this._framebuffer.bind(),this._compositor.composite(this._bindParameters,r.getTexture()),r.release(),this.performanceInfo.advance(1===e?de.OPAQUE_EDGES:de.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(this._renderContext.time),this._bindParameters.overlay&&this.performanceInfo.advance(de.OVERLAY)}_renderShadowMap(e,t,s,i){if(!this.shadowsEnabled)return;const r=this._bindParameters.shadowMap;if(r.start(e,s,i,this.isFeatureEnabled(5),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight){this._renderShadowCascades(6,r),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t);const s=this._bindParameters.output;this._bindParameters.output=0,this._bindParameters.shadowHighlight=this._nodes.produce(D.SHADOW_HIGHLIGHT,this._pluginInput),this._bindParameters.output=s,r.disposeOutput(6),r.clear(),this._renderShadowCascades(7,r)}else this._renderShadowCascades(5);e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this._needsShadowHighlight&&(this._bindParameters.depth=h(this._bindParameters.depth)),this.performanceInfo.advance(D.SHADOWMAP)}_precompileShadowCascades(e){0!==this._bindParameters.shadowMap.cascades.length&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._bindParameters.shadowMap){const s=this._bindParameters.output,i=6!==e;t.bindFramebuffer();for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this.renderAllGeometry(e),i&&this._renderShadowNodes(t.renderTarget);t.finish(e),this._bindParameters.output=s}_renderShadowNodes(e){this._renderInternalNodeCategory(D.SHADOWMAP,e)}get _needsLastFrameColor(){return+this.hasReflections+ +this.hasGlobalIllumination}get _needsDepth(){return+this._nodes.requireGeometryDepth+ +this.hasReflections+ +this.hasGlobalIllumination+ +this._testsNeedsDepth+ +this._needsShadowHighlight}get _usesPremultipliedAlphaBlit(){return this._pluginsHas.hudElements}_renderAmbientIlluminationAndDepth(){this._bindParameters.depth=n(this._bindParameters.depth);const e=this._pluginInput.get("normals");if(e){this._pluginInput.set(D.AMBIENT_ILLUMINATION,this._hasGlobalIlluminationFlag?this._renderGlobalIllumination():this._renderSSAO());const t=this._needsDepth;t?(this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(3),this._bindParameters.depth=e.obtainDepthTexture(),this._bindParameters.depth?.retain(t-1),this.performanceInfo.advance(de.DEPTH)):e.detachDepth(),this.hasAmbientIllumination&&this._pluginInput.release("normals")}else this._hasGlobalIlluminationFlag&&(this._releaseGlobalIlluminationBuffers(),this._bindParameters.globalIlluminationEnabled=this._keepGlobalIlluminationShadingAlive),this._renderAllGeometryDepth()}_renderAllGeometryDepth(){const e=this._needsDepth;if(0===e)return;const{width:t,height:s}=this._framebuffer.size,i=this.fboCache.acquire(t,s,"geometry depth",14);this._rctx.bindFramebuffer(i.fbo),this._rctx.clear(1280),this.renderAllGeometry(3),this._renderGaussianSplatPrepassDepth(i),this._bindParameters.depth=i.obtainDepthTexture(),this._bindParameters.depth?.retain(e-1),i.release(),this.performanceInfo.advance(de.DEPTH)}_renderGaussianSplatPrepassDepth(e){const t=this._shadowAccumulator;if(!t?.active||!t.requireGeometryDepth)return;const s=this._bindParameters.output;this._bindParameters.output=3,this._renderInternalNodeCategory(D.GAUSSIAN_SPLAT_DEPTH,e),this._bindParameters.output=s}_renderGaussianSplatDepthAndNormals(e){const t=this._bindParameters.output;this._bindParameters.output=4,this._renderInternalNodeCategory(D.GAUSSIAN_SPLAT_DEPTH,e),this._bindParameters.output=t}get _needsShadowDepthRange(){return this._bindParameters.shadowMap.enabled||!!this._shadowAccumulator?.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return Y.Zero;const t=K(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),t.union(this._nodes.queryDepthRange(D.SHADOWMAP,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)<U)return void(this.sceneDepthRange.value=Y.Infinite);const t=e.clone();t.near=N,t.far=1e10;const s=K(t,this._plugins.plugins,this.stage.layers,1);s.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(s)||(this.sceneDepthRange.value=s)}get _normalsRequired(){return this._nodes.require("normals",...O,D.VIEWSHED,D.LASERLINES)+(this.hasAmbientIllumination?1:0)}_precompilePrepasses(){const e=!!this._normalsRequired;if(e?(this._precompilePlugins(4,Ae),this._needsDepth&&this._precompilePlugins(3,Ie)):this._needsDepth&&this._precompileAllGeometry(3),this.shadowsEnabled&&(this._needsShadowHighlight?(this._nodes.precompile(D.SHADOW_HIGHLIGHT),this._precompileShadowCascades(6),this._precompileShadowCascades(7)):this._precompileShadowCascades(5)),this._shadowAccumulator?.active&&(this._nodes.precompile(D.SHADOW_ACCUMULATION),this._precompileAllGeometry(5)),this._shadowAccumulator?.active||e){const t=this._bindParameters.output;this._bindParameters.output=e?4:3,this._nodes.precompile(D.GAUSSIAN_SPLAT_DEPTH),this._bindParameters.output=t}(this.shadowsEnabled||this._shadowAccumulator?.active)&&this._nodes.precompile(D.SHADOWMAP),this.hasAmbientIllumination&&e&&this._nodes.precompile(D.AMBIENT_ILLUMINATION)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const{width:t,height:s}=this._framebuffer.size,i=this.fboCache.acquire(t,s,"normals");i.acquireDepth(14),this._rctx.bindFramebuffer(i.fbo),this._rctx.clearFramebuffer(C,!0,!0),this._bindParameters.output=4,this._plugins.render(...Ae),this._renderGaussianSplatDepthAndNormals(i);const r=this._nodes.optional("normals",...O,D.VIEWSHED);return i.retain(e+r-1),this.performanceInfo.advance(de.NORMALS),i}_renderSSAO(){this._bindParameters.globalIlluminationEnabled=!1;const e=this._pluginInput.get("normals");return this.hasAmbientIllumination&&e?(this._bindParameters.ssao=this._nodes.produce(D.AMBIENT_ILLUMINATION,this._pluginInput),this._bindParameters.ssao&&this.performanceInfo.advance(de.AMBIENT_ILLUMINATION),this._bindParameters.ssao):null}_renderGlobalIllumination(){const e=this._bindParameters;if(!this.hasGlobalIllumination)return this._releaseGlobalIlluminationBuffers(),e.globalIlluminationEnabled=this._keepGlobalIlluminationShadingAlive,null;const t=this._nodes.produce(D.AMBIENT_ILLUMINATION,this._pluginInput);return this._releaseGlobalIlluminationBuffers(),this._bindParameters.globalIllumination=t,this._bindParameters.globalIlluminationEnabled=!0,this.performanceInfo.advance(this.hasGlobalIlluminationHighQuality?de.AMBIENT_ILLUMINATION_HIGH_QUALITY:de.AMBIENT_ILLUMINATION),e.globalIllumination}_releaseGlobalIlluminationBuffers(){const e=this._bindParameters;e.reprojection.lastFrameColor=h(e.reprojection.lastFrameColor),e.reprojection.lastFrameDepth=n(e.reprojection.lastFrameDepth),e.reprojection.lastFrameEmission=n(e.reprojection.lastFrameEmission),e.globalIllumination=h(e.globalIllumination),e.globalIlluminationEnabled=!1}_precompileAllGeometry(e){const t=this._bindParameters.output;this._bindParameters.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(...Pe),this._bindParameters.output=t}renderAllGeometry(e){this._bindParameters.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentGround()}precompileSlots(e,...t){for(const s of t)this._bindParameters.slot=s,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const s of t)this._renderContext.renderOccludedMask=s,this.precompileSlots(e,...we);this._renderContext.renderOccludedMask=ee}renderSlots(e,...t){for(const s of t)this._bindParameters.slot=s,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,...we),this._renderContext.renderOccludedMask=ee}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Te[e])}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(16),this.renderHUD(e),this._bindParameters.hudRenderStyle=e,this._plugins.render(14)}precompileViewshedShadowMap(){const e=this._bindParameters.output;this._bindParameters.output=8,this._precompileAllGeometry(8),this._nodes.precompile(D.SHADOWMAP),this._bindParameters.output=e}precompileCutFillDepth(){this._precompilePlugins(9,De)}_precompilePlugins(e,t){const s=this._bindParameters.output;this._bindParameters.output=e,this._plugins.precompile(...t),this._bindParameters.output=s}renderViewshedShadowMap(e,t){const{camera:s,contentCamera:i}=this._bindParameters,r=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(8),this._renderShadowNodes(t),this._ensureBindParametersCamera(s,i),this._bindParameters.camera.setGLViewport(this._rctx),this._bindParameters.output=r}renderCutFillDepth(e){const{camera:t,contentCamera:s}=this._bindParameters,i=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._bindParameters.output=9,this._plugins.render(...De),this._ensureBindParametersCamera(t,s),t.setGLViewport(this._rctx),this._bindParameters.output=i}get _needsGroundDepth(){return this._bindParameters.cutFillVisualizationEnabled}_blitGroundDepth(){if(!this._needsGroundDepth)return null;const{width:e,height:t}=this._framebuffer.size,s=this.fboCache.acquire(e,t,D.GROUND_DEPTH,14);return this._rctx.blitFramebuffer(this._framebuffer.color.fbo,s.fbo,256),this._framebuffer.bind(),s}_renderOpaqueAndTransparentGeometry(e){this._bindParameters.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithoutNormals(e){this._bindParameters.output=e,this._plugins.render(...Ie)}_precompileOpaqueGeometry(){this._needsOpaquePass&&(this._plugins.precompile(...fe),this._nodes.precompile("opaque-color"))}_renderOpaqueGeometry(){this._plugins.render(...fe)}_renderTransparentGeometry(){this._plugins.render(...ge),this._hasTransparentGeometry&&this._plugins.render(15)}_renderTransparentGround(){this._plugins.render(...Pe)}_precompileHUD(e){if(!this._pluginsHas.hudElements)return;const t=this._bindParameters.output,s=this._bindParameters.hudRenderStyle,i=this._bindParameters.emissions;this._bindParameters.emissions=0,this._bindParameters.hudRenderStyle=e,this._bindParameters.output=1,this._plugins.precompile(...Ee),this._bindParameters.output=2,this._plugins.precompile(...Ee),this._bindParameters.output=0,this._oitBlend.precompile(this._bindParameters,!1,1),this._hasHighlights&&(this._bindParameters.output=10,this._plugins.precompile(...Ee)),this._bindParameters.emissions=i,this._bindParameters.output=t,this._bindParameters.hudRenderStyle=s}_renderHUD(e,t){if(!this._pluginsHas.hudElements)return t;const s=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo);const i=!!t.getTexture(le);return this._compositor.compositePreMultipliedAlpha(this._bindParameters,s.getTexture(),i),s.release(),this.performanceInfo.advance(0===e?de.HUD_OCCLUDED:de.HUD),t}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(6,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:s}=this,{width:i,height:r}=this._framebuffer.size,{highlights:a}=s,n=a.length>j?3:1,h=e.acquire(i,r,"highlights",n);h.acquireDepth(14);const o=this._plugins.produces(10,0);return o&&this._framebuffer.color.fbo&&h.fbo&&t.blitFramebuffer(this._framebuffer.color.fbo,h.fbo,1024),t.bindFramebuffer(h.fbo),t.gl.clearBufferuiv(6144,0,[0,0,0,0]),o||t.clear(1024),this._bindParameters.output=10,t.bindFramebuffer(h.fbo),B(t,e,i,r,s,()=>this._renderHighlightGeometries()),h.detachDepth(),this.performanceInfo.advance(de.HIGHLIGHTS),h.retain(this._nodes.require("highlights",...R)+this._nodes.optional("highlights",...R)-1),h}_renderHighlightGeometries(){this._plugins.render(...Ce),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e){const t=this._shadowAccumulator;if(!t)return;t.updateDepthRange(e);const s=t.requireGeometryDepth;this._bindParameters.output=0;const i=this._nodes.produce(D.SHADOW_ACCUMULATION,this._pluginInput);t.didAccumulate&&this.performanceInfo.advance(de.ACCUMULATED_SHADOWS),this._pluginInput.set(D.SHADOW_ACCUMULATION,null),i?.release(),s&&(this._bindParameters.depth=h(this._bindParameters.depth))}renderShadowAccumulationShadowMap(e,t,s,i,r){const a=this.stage.view.qualitySettings.maximumPixelRatio;this._bindParameters.renderingShadowAnalysisMap=!0;try{s.start(e,i,r,!0,a),this._renderShadowCascades(5,s),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t)}finally{this._bindParameters.renderingShadowAnalysisMap=!1}}_precompileTransparentGeometry(){x(this._bindParameters.output)?(this._bindParameters.output=1,this._plugins.precompile(...ge),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=2,this._plugins.precompile(...ge),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=0):this._plugins.precompile(...ge)}_renderOIT(e,t=2){const s=1===e,{width:i,height:r}=this._framebuffer.size,a=s?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=h.useFloatBlend.value?8:5,d=h.output;h.output=1;const l=s?"oit hud":"oit",u=this.fboCache.acquire(i,r,l,o).acquireColor(le,this.hasFloatBlend?7:0,"oit alpha"),_=h.hasEmission&&(0===e||1!==t);_&&u.acquireColor(_e,o,"oit emissive"),s||u.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(u.fbo),this._rctx.clearFramebuffer($),_&&this._rctx.clearBuffer(2,$),a(),u.detachDepth(),h.output=2;const m=this.fboCache.acquire(i,r,s?"oit front hud":"oit front");_&&m.acquireColor(le,o,"oit front emissive"),s?m.acquireDepth(this._hudDepthFormat):m.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(m.fbo),this._rctx.clearFramebuffer(C,s),a(),m.detachDepth();const p=this._pluginsHas.occludedHudElements&&!s,c=p&&0!==h.emissions?_e:le;let b;return h.hudOcclusion=n(this._bindParameters.hudOcclusion),h.output=0,s?(b=this.fboCache.acquire(i,r,"oit composite hud"),this._rctx.bindFramebuffer(b.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):(0!==h.emissions&&this._framebuffer.ensureEmissionAttachment(),p&&(this._framebuffer.color.acquireColor(c,0,"hud occlusion"),this._rctx.clearBuffer(c-me,C)),this._framebuffer.bind()),this._oitBlend.blend(this._rctx,u,m,h,p,e,this._fboCache.debugCallback),b?.detachDepth(),s||(_&&(this._bindParameters.emissions=3),p&&(h.hudOcclusion=this._framebuffer.color.obtainAttachment(c))),m.release(),u.release(),h.output=d,b}get _hudDepthFormat(){return this.isFeatureEnabled(7)?14:13}get _needsOpaquePass(){return this.plugins.produces(0,...fe)||this.plugins.produces(5,...fe)||this.plugins.produces(3,3)}_renderOpaque(){const e=this._needsOpaquePass;e&&(this._plugins.render(0,1),this._pluginInput.set(D.GROUND_DEPTH,this._blitGroundDepth()),this._plugins.render(2,3));const t=this._framebuffer;t.update(t=>this._renderNodes(T.OPAQUE,t,e)),this.fboCache.debugCallback?.(T.OPAQUE,t.color.fbo),t.update(e=>this._renderNodes(D.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(D.OPAQUE_ENVIRONMENT,t.color.fbo),this._renderEdges(1)}_renderPreTransparent(){this._framebuffer.update(e=>this._renderNodes(D.GAUSSIAN_SPLAT,e)),this.fboCache.debugCallback?.(D.GAUSSIAN_SPLAT,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(D.OPAQUE_OCCLUSION_QUERY,e)),this.fboCache.debugCallback?.(D.OPAQUE_OCCLUSION_QUERY,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(D.VOXEL,e)),this.fboCache.debugCallback?.(D.VOXEL,this._framebuffer.color.fbo)}_renderTransparent(){const e=this._framebuffer;if(this._renderHiddenTransparentEdges(),this._hasTransparentGeometry&&this._renderOIT(0),e.update(e=>this._renderNodes(T.TRANSPARENT,e,this._hasTransparentGeometry)),this.fboCache.debugCallback?.(T.TRANSPARENT,e.color.fbo),this._hasTransparentGeometry||this._plugins.render(15),this._renderEdges(0),this._bindParameters.ssao=n(this._bindParameters.ssao),e.update(e=>this._renderNodes(D.TRANSPARENT_NO_DEPTH,e)),this.fboCache.debugCallback?.(D.TRANSPARENT_NO_DEPTH,e.color.fbo),this._framebuffer.bind(),this._plugins.render(8),this._bindParameters.hasEmission){const e=this._rctx.setDrawBuffers([pe,le]);this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.render(8),this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!1,this._rctx.setDrawBuffers(e)}this.performanceInfo.advance(de.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderNodes(e,t,s=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return s&&this.performanceInfo.advance(e),t;const i=this._nodes.render(t,this._pluginInput,this._releaseNodeInputs);return this.performanceInfo.advance(e),this._fboCache.debugCallback?.(e,i.fbo),i}_renderInternalNodeCategory(e,t){if(!t)return;const s=t.name;try{this._renderNodes(e,t)}finally{this._pluginInput.set(e,null),t.setName(s)}}_ensureBindParameters(e,t){this._ensureBindParametersCamera(e,t),this._ensureBindParametersWeatherFader(),this._ensureBindParametersScreenSpaceReflections(),this._ensureBindParametersReprojection()}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersWeatherFader(){1===this.stage.viewingMode&&(this._bindParameters.clouds.data&&(this._bindParameters.clouds.fade(this._bindParameters.camera,this.renderContext.time,this.stage.view.qualitySettings.fadeDuration,this.stage.view.state.stationary),this.weatherFader?.cleanupCubemap()),this._bindParameters.snowCover=this.weatherFader?.snowCover??0)}_ensureBindParametersScreenSpaceReflections(){const{time:e}=this.renderContext,{screenSpaceReflections:t}=this._bindParameters;if(this.hasReflections){null==this._ssrEnableTime&&(this._ssrEnableTime=e);const s=this.stage.view.qualitySettings.fadeDuration;t.fadeFactor=s>0?Math.min(s,e-this._ssrEnableTime)/s:1,t.fadeFactor<1&&this._requestRender()}else this._ssrEnableTime=null}_ensureBindParametersReprojection(){if(!(this.hasReflections||this.hasGlobalIllumination))return void(this._reprojectionMatrix=A);const{reprojection:e,camera:t}=this._bindParameters,{lastFrameCamera:s}=e,i=!s.equals(t);if(i?(f(Ne,t.viewMatrix),f(Re,t.projectionMatrix),g(Ge,Ne,Re),g(Ge,s.viewMatrix,Ge),g(Ge,s.projectionMatrix,Ge),this._reprojectionMatrix=Ge):this._reprojectionMatrix=A,this.hasGlobalIllumination){const{viewMatrix:t}=e;i?(g(Fe,s.viewMatrix,Ne),P(t,Fe)):P(t,A)}}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,s,i){this._bindParameters.updateLighting(e,t,s,i),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0,clouds:this.weatherFader?.usedMemory??0}}get test(){}};e([p()],be.prototype,"_inGlobeView",void 0),e([p({readOnly:!0})],be.prototype,"highResolutionAtmosphere",null),e([p()],be.prototype,"_edgeView",void 0),e([p()],be.prototype,"updating",null),be=e([c("esri.views.3d.webgl-engine.lib.Renderer")],be);const fe=[0,1,2,3],ge=[7,6,4,5],Pe=[7,6],Ae=[0,1,2,4,...Pe],Ie=[3,5],we=[2,4,8],Ee=[16,12,14,13],Ce=[4,5,2,3,0,1,...Pe],Se=[4,8,5,11],Te={0:[13],1:[12],2:[13,12],3:[13,12]},De=[0,1,...Pe],Oe=["normals","highlights"],Re=I(),Ne=I(),Ge=I(),Fe=I();function He(e){return t=>e.immediate.schedule(t)}export{be as Renderer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{hasNativeFloat16Array as e}from"../../../../../geometry/support/float16.js";import{BufferViewMat3f as t,BufferViewVec4f as o,BufferViewVec3f as n,BufferViewVec2f as f,BufferViewFloat as r,BufferViewVec4f16 as u,BufferViewFloat16 as m,BufferViewVec2Snorm16 as s,BufferViewSnorm16 as l,BufferViewVec4Unorm8 as w,BufferViewUnorm8 as i,BufferViewVec4u8 as a,BufferViewVec4u32 as c,BufferViewUint32 as p,BufferViewUint8 as v}from"../../../../../geometry/support/buffer/BufferView.js";import{elementTypeSize as y}from"../../../../../geometry/support/buffer/types.js";class b{constructor(e,t,o){this.elementCount=e,this.elementType=t,this.bufferViewConstructor=o,this.byteSize=h(o)}}function h(e){return y(e.ElementType)*e.ElementCount}const g={u8:new b(1,"uint",v),u32:new b(1,"uint",p),vec4u32:new b(4,"uint",c),vec4u8:new b(4,"uint",a),unorm8:new b(1,"float",i),vec4unorm8:new b(4,"float",w),snorm16:new b(1,"float",l),vec2snorm16:new b(2,"float",s),f16:new b(1,"float",e?m:r),vec4f16:new b(4,"float",e?u:o),f32:new b(1,"float",r),vec2f32:new b(2,"float",f),vec3f32:new b(3,"float",n),vec4f32:new b(4,"float",o),mat3f32:new b(9,"float",t)};export{b as FieldCreationInfo,g as typeToCreationInfoMap};
2
+ import{BufferViewMat3f as e,BufferViewVec4f as t,BufferViewVec3f as n,BufferViewVec2f as o,BufferViewFloat as f,BufferViewVec4f16 as r,BufferViewFloat16 as u,BufferViewVec2Snorm16 as w,BufferViewSnorm16 as l,BufferViewVec4Unorm8 as s,BufferViewUnorm8 as m,BufferViewVec4u8 as c,BufferViewVec4u32 as i,BufferViewUint32 as a,BufferViewUint8 as p}from"../../../../../geometry/support/buffer/BufferView.js";import{elementTypeSize as v}from"../../../../../geometry/support/buffer/types.js";class y{constructor(e,t,n){this.elementCount=e,this.elementType=t,this.bufferViewConstructor=n,this.byteSize=b(n)}}function b(e){return v(e.ElementType)*e.ElementCount}const h={u8:new y(1,"uint",p),u32:new y(1,"uint",a),vec4u32:new y(4,"uint",i),vec4u8:new y(4,"uint",c),unorm8:new y(1,"float",m),vec4unorm8:new y(4,"float",s),snorm16:new y(1,"float",l),vec2snorm16:new y(2,"float",w),f16:new y(1,"float",u),vec4f16:new y(4,"float",r),f32:new y(1,"float",f),vec2f32:new y(2,"float",o),vec3f32:new y(3,"float",n),vec4f32:new y(4,"float",t),mat3f32:new y(9,"float",e)};export{y as FieldCreationInfo,h as typeToCreationInfoMap};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{hasNativeFloat16Array as r,makeFloat16Array as e}from"../../../../geometry/support/float16.js";import{Pos2TexF16 as t,Pos2TexF32 as o,Pos2 as n}from"./DefaultVertexBufferLayouts.js";import{VertexArrayObject as f}from"./VertexArrayObject.js";import m from"../../../webgl/Texture.js";import{TextureDescriptor as s}from"../../../webgl/TextureDescriptor.js";import{VertexBuffer as u}from"../../../webgl/VertexBuffer.js";function a(m,s=0,a=-1,i=1){const p=1===s,w=p?r?new Float32Array([a,a,0,i,a,0,a,i,0,i,i,0]):new Float32Array([a,a,0,0,i,a,1,0,a,i,0,1,i,i,1,1]):new Float32Array([a,a,i,a,a,i,i,i]);if(p&&r){const r=e(w.buffer);r[10]=r[17]=r[22]=r[23]=1}return new f(m,new u(m,p?r?t:o:n,w))}const i=4;function p(r){const e=new s(i);return e.samplingMode=9728,new m(r,e)}export{p as createEmptyTexture,a as createQuadVAO};
2
+ import{Pos2TexF16 as r,Pos2 as e}from"./DefaultVertexBufferLayouts.js";import{VertexArrayObject as t}from"./VertexArrayObject.js";import o from"../../../webgl/Texture.js";import{TextureDescriptor as n}from"../../../webgl/TextureDescriptor.js";import{VertexBuffer as f}from"../../../webgl/VertexBuffer.js";function s(o,n=0,s=-1,m=1){const u=1===n,a=u?new Float32Array([s,s,0,m,s,0,s,m,0,m,m,0]):new Float32Array([s,s,m,s,s,m,m,m]);if(u){const r=new Float16Array(a.buffer);r[10]=r[17]=r[22]=r[23]=1}return new t(o,new f(o,u?r:e,a))}const m=4;function u(r){const e=new n(m);return e.samplingMode=9728,new o(r,e)}export{u as createEmptyTexture,s as createQuadVAO};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{set as e,equals as t,transformMat4 as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{makeFloat16Array as s}from"../../../../geometry/support/float16.js";import{isColor as a,isDepth as o,isColorHighlightOLIDOrDepth as n}from"../core/shaderLibrary/ShaderOutput.js";import h from"../lib/GLMaterial.js";import{LineMaterial as c}from"../lib/LineMaterial.js";import{VisualVariablePassParameters as l}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as m}from"./internal/bufferWriterUtils.js";import{getLayout as p,LineMarkerTechnique as u}from"../shaders/LineMarkerTechnique.js";import{LineMarkerTechniqueConfiguration as d}from"../shaders/LineMarkerTechniqueConfiguration.js";import{alphaCutoff as f}from"../../../../webscene/support/AlphaCutoff.js";class g extends c{constructor(e,t){super(e,v),this.produces=new Map([[2,e=>10===e||a(e)&&8===this.parameters.renderOccluded],[3,e=>o(e)],[10,e=>n(e)&&8===this.parameters.renderOccluded],[11,e=>n(e)&&8===this.parameters.renderOccluded],[4,e=>a(e)],[18,e=>a(e)||10===e]]),this.intersectRayDraped=void 0,this.intersectScreenPolygonDraped=void 0,this._configuration=new d(t)}updateConfiguration(e){super.updateConfiguration(e),this._configuration.space=18===e.slot?0:this.parameters.worldSpace?2:1,this._configuration.hideOnShortSegments=this.parameters.hideOnShortSegments,this._configuration.hasCap=0!==this.parameters.cap,this._configuration.anchor=this.parameters.anchor,this._configuration.hasTip=this.parameters.hasTip,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=e.hasOccludees,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective}get visible(){return this.parameters.color[3]>=f}intersectRay(){}intersectScreenPolygon(){return null}createBufferWriter(){return new S(p(this.parameters),this.parameters)}createGLMaterial(e){return new _(e)}}class _ extends h{dispose(){super.dispose(),this._markerTextures?.release(this._markerPrimitive),this._markerPrimitive=null}beginSlot(e){const t=this._material.parameters.markerPrimitive;return t!==this._markerPrimitive&&(this._material.setParameters({markerTexture:this._markerTextures.swap(t,this._markerPrimitive)}),this._markerPrimitive=t),this.getTechnique(u,e)}}class v extends l{constructor(){super(...arguments),this.width=0,this.color=[1,1,1,1],this.markerPrimitive="arrow",this.placement="end",this.cap=0,this.anchor=0,this.hasTip=!1,this.worldSpace=!1,this.hideOnShortSegments=!1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.stipplePattern=null,this.markerTexture=null}}class S{constructor(e,t){this.layout=e,this._parameters=t}elementCount(){return"begin-end"===this._parameters.placement?12:6}write(i,a,o,n){if(null==n)return;const{buffer:h,offset:c}=n,l=o.get("position").data,p=l.length/3;let u=[1,0,0];const d=o.get("normal");this._parameters.worldSpace&&null!=d&&(u=d.data);let f=1,g=0;this._parameters.vvSize?g=o.get("sizeFeatureAttribute").data[0]:o.has("size")&&(f=o.get("size").data[0]);let _=[1,1,1,1],v=0;this._parameters.vvColor?v=o.get("colorFeatureAttribute").data[0]:o.has("color")&&(_=o.get("color").data);let S=0;this._parameters.vvOpacity&&(S=o.get("opacityFeatureAttribute").data[0]);const w=new Float32Array(h.buffer),y=s(h.buffer),O=new Uint8Array(h.buffer);let T=c*(this.layout.stride/4);const V=w.BYTES_PER_ELEMENT/y.BYTES_PER_ELEMENT,k=4/V,j=(e,t,r,i)=>{w[T++]=e[0],w[T++]=e[1],w[T++]=e[2],m(t,e,y,T*V),T+=k;let s=T*V;if(y[s++]=r[0],y[s++]=r[1],T=Math.ceil(s/V),this._parameters.vvColor)w[T++]=v;else{const e=Math.min(4*i,_.length-4),t=4*T++;O[t]=255*_[e],O[t+1]=255*_[e+1],O[t+2]=255*_[e+2],O[t+3]=255*_[e+3]}this._parameters.vvOpacity&&(w[T++]=S),s=T*V,this._parameters.vvSize?(w[T++]=g,s+=2):y[s++]=f,this._parameters.worldSpace&&(y[s++]=u[0],y[s++]=u[1],y[s++]=u[2]),T=Math.ceil(s/V)},M=(s,a)=>{const o=e(b,l[3*s],l[3*s+1],l[3*s+2]),n=P;let h=s+a;do{e(n,l[3*h],l[3*h+1],l[3*h+2]),h+=a}while(t(o,n)&&h>=0&&h<p);i&&(r(o,o,i),r(n,n,i)),j(o,n,[-1,-1],s),j(o,n,[1,-1],s),j(o,n,[1,1],s),j(o,n,[-1,-1],s),j(o,n,[1,1],s),j(o,n,[-1,1],s)},x=this._parameters.placement;"begin"!==x&&"begin-end"!==x||M(0,1),"end"!==x&&"begin-end"!==x||M(p-1,-1)}}const b=i(),P=i();export{g as LineMarkerMaterial,v as Parameters};
2
+ import{set as e,equals as t,transformMat4 as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isColor as a,isDepth as s,isColorHighlightOLIDOrDepth as o}from"../core/shaderLibrary/ShaderOutput.js";import n from"../lib/GLMaterial.js";import{LineMaterial as h}from"../lib/LineMaterial.js";import{VisualVariablePassParameters as c}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as l}from"./internal/bufferWriterUtils.js";import{getLayout as m,LineMarkerTechnique as p}from"../shaders/LineMarkerTechnique.js";import{LineMarkerTechniqueConfiguration as u}from"../shaders/LineMarkerTechniqueConfiguration.js";import{alphaCutoff as d}from"../../../../webscene/support/AlphaCutoff.js";class f extends h{constructor(e,t){super(e,_),this.produces=new Map([[2,e=>10===e||a(e)&&8===this.parameters.renderOccluded],[3,e=>s(e)],[10,e=>o(e)&&8===this.parameters.renderOccluded],[11,e=>o(e)&&8===this.parameters.renderOccluded],[4,e=>a(e)],[18,e=>a(e)||10===e]]),this.intersectRayDraped=void 0,this.intersectScreenPolygonDraped=void 0,this._configuration=new u(t)}updateConfiguration(e){super.updateConfiguration(e),this._configuration.space=18===e.slot?0:this.parameters.worldSpace?2:1,this._configuration.hideOnShortSegments=this.parameters.hideOnShortSegments,this._configuration.hasCap=0!==this.parameters.cap,this._configuration.anchor=this.parameters.anchor,this._configuration.hasTip=this.parameters.hasTip,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=e.hasOccludees,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective}get visible(){return this.parameters.color[3]>=d}intersectRay(){}intersectScreenPolygon(){return null}createBufferWriter(){return new v(m(this.parameters),this.parameters)}createGLMaterial(e){return new g(e)}}class g extends n{dispose(){super.dispose(),this._markerTextures?.release(this._markerPrimitive),this._markerPrimitive=null}beginSlot(e){const t=this._material.parameters.markerPrimitive;return t!==this._markerPrimitive&&(this._material.setParameters({markerTexture:this._markerTextures.swap(t,this._markerPrimitive)}),this._markerPrimitive=t),this.getTechnique(p,e)}}class _ extends c{constructor(){super(...arguments),this.width=0,this.color=[1,1,1,1],this.markerPrimitive="arrow",this.placement="end",this.cap=0,this.anchor=0,this.hasTip=!1,this.worldSpace=!1,this.hideOnShortSegments=!1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.stipplePattern=null,this.markerTexture=null}}class v{constructor(e,t){this.layout=e,this._parameters=t}elementCount(){return"begin-end"===this._parameters.placement?12:6}write(i,a,s,o){if(null==o)return;const{buffer:n,offset:h}=o,c=s.get("position").data,m=c.length/3;let p=[1,0,0];const u=s.get("normal");this._parameters.worldSpace&&null!=u&&(p=u.data);let d=1,f=0;this._parameters.vvSize?f=s.get("sizeFeatureAttribute").data[0]:s.has("size")&&(d=s.get("size").data[0]);let g=[1,1,1,1],_=0;this._parameters.vvColor?_=s.get("colorFeatureAttribute").data[0]:s.has("color")&&(g=s.get("color").data);let v=0;this._parameters.vvOpacity&&(v=s.get("opacityFeatureAttribute").data[0]);const P=new Float32Array(n.buffer),w=new Float16Array(n.buffer),y=new Uint8Array(n.buffer);let O=h*(this.layout.stride/4);const T=P.BYTES_PER_ELEMENT/w.BYTES_PER_ELEMENT,V=4/T,k=(e,t,r,i)=>{P[O++]=e[0],P[O++]=e[1],P[O++]=e[2],l(t,e,w,O*T),O+=V;let a=O*T;if(w[a++]=r[0],w[a++]=r[1],O=Math.ceil(a/T),this._parameters.vvColor)P[O++]=_;else{const e=Math.min(4*i,g.length-4),t=4*O++;y[t]=255*g[e],y[t+1]=255*g[e+1],y[t+2]=255*g[e+2],y[t+3]=255*g[e+3]}this._parameters.vvOpacity&&(P[O++]=v),a=O*T,this._parameters.vvSize?(P[O++]=f,a+=2):w[a++]=d,this._parameters.worldSpace&&(w[a++]=p[0],w[a++]=p[1],w[a++]=p[2]),O=Math.ceil(a/T)},M=(a,s)=>{const o=e(S,c[3*a],c[3*a+1],c[3*a+2]),n=b;let h=a+s;do{e(n,c[3*h],c[3*h+1],c[3*h+2]),h+=s}while(t(o,n)&&h>=0&&h<m);i&&(r(o,o,i),r(n,n,i)),k(o,n,[-1,-1],a),k(o,n,[1,-1],a),k(o,n,[1,1],a),k(o,n,[-1,-1],a),k(o,n,[1,1],a),k(o,n,[-1,1],a)},j=this._parameters.placement;"begin"!==j&&"begin-end"!==j||M(0,1),"end"!==j&&"begin-end"!==j||M(m-1,-1)}}const S=i(),b=i();export{f as LineMarkerMaterial,_ as Parameters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as i,createScreenPointArray as r}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as s,Seconds as n}from"../../../../core/time.js";import{copy as o,set as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as c,subtract as p,dot as u,scale as m,add as h,copy as f,length as d,distance as g,lerp as _,transformMat4 as b,normalize as S}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as P}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as y}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeFloat16Array as v}from"../../../../geometry/support/float16.js";import{fromPoints as w,distance2 as E,closestLineSegmentPoint as x,projectPoint as T,projectPointFraction as j,create as L}from"../../../../geometry/support/lineSegment.js";import{fromPoints as z,signedDistance as C,getNormal as A,create as M}from"../../../../geometry/support/plane.js";import{BufferViewVec3f as V,BufferViewFloat as R,BufferViewVec4Unorm8 as F,BufferViewVec4f16 as O,BufferViewUint32 as B}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOLID as U,isColor as I,isDepth as N,isColorHighlightOLIDOrDepth as k,is2DGeometryOutput as W}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as D}from"../effects/geometry/olidUtils.js";import Y from"../lib/GLMaterial.js";import{LineMaterial as J}from"../lib/LineMaterial.js";import{projectWorldLineSegmentToRenderScreen as q,screenPolygonIntersectsBufferedSegment as X}from"../lib/screenPolygonOverlapUtils.js";import{Hit as G,DrapedHit as H}from"../lib/screenPolygonTriangleIntersections.js";import{ScreenSizePerspectiveEvaluator as K}from"../lib/screenSizePerspectiveUtils.js";import{isTranslationMatrix as Q,assert as Z}from"../lib/Util.js";import{isImagePattern as $}from"./lineStippleUtils.js";import{VisualVariablePassParameters as ee}from"./VisualVariablePassParameters.js";import{writeColor as te}from"./internal/bufferWriterUtils.js";import{n as ie}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as re,getTextureBufferLayout as se}from"../shaders/RibbonLineLayouts.js";import{RibbonLineTechnique as ne}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as oe}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as ae}from"../../../../webscene/support/AlphaCutoff.js";class le extends J{constructor(e,t){super(e,pe),this.produces=new Map([[2,e=>U(e)||I(e)&&8===this.parameters.renderOccluded],[3,e=>N(e)],[10,e=>k(e)&&8===this.parameters.renderOccluded],[11,e=>k(e)&&8===this.parameters.renderOccluded],[4,e=>I(e)&&this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[8,e=>I(e)&&!this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[18,e=>W(e)]]),this._configuration=new oe(t)}updateConfiguration(e){super.updateConfiguration(e);const t=18===e.slot,i=null!=this.parameters.stipplePattern&&null!=this.parameters.stippleTexture&&10!==e.output,r=i&&t&&this.parameters.isImagePattern();this._configuration.draped=t,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.stippleEnabled=i,this._configuration.stippleOffColorEnabled=i&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=i&&this.parameters.stipplePreferContinuous,this._configuration.numJoinSubdivisions=_e(this.parameters.join,i),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&ge(this.parameters.markerParameters),this._configuration.polygonOffsetIndex=this.parameters.polygonOffsetIndex,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.hasOccludees=e.hasOccludees,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=this.emissions?1:0,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective&&!r,this._configuration.worldSizedImagePattern=r}get visible(){return this.parameters.color[3]>=ae||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>ae}get emissions(){return this.parameters.emissiveStrength>0?8!==this.parameters.renderOccluded?2:1:0}setParameters(e,t){e.animation=this.parameters.animation,super.setParameters(e,t)}intersectRayDraped({attributes:e},i,r,s,n,o){if(!i.options.selectionMode)return;const a=this._getLineSize(e,!0),l=r[0],c=r[1],p=fe(a,o);let u=Number.MAX_VALUE,m=0;for(const h of de(ye,ve,this.parameters,e)){const e=l-ye[0],i=c-ye[1],r=ve[0]-ye[0],s=ve[1]-ye[1],n=t((r*e+s*i)/(r*r+s*s),0,1),o=r*n-e,a=s*n-i,p=o*o+a*a;p<u&&(u=p,m=h)}u<p*p&&s(n.distance,n.renderDistance,n.normal,m)}intersectRay(t,i,r,s,n,a){const{options:l,camera:_,rayBegin:b,rayEnd:S}=r;if(!l.selectionMode||!t.visible||!_)return;if(!Q(i))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const P=t.attributes,y=P.get("position").data,v=this._getLineSize(P),T=Le;o(T,r.point);const j=v*_.pixelRatio,L=Je*_.pixelRatio,M=j/2+L;c(Ie[0],T[0]-M,T[1]+M,0),c(Ie[1],T[0]+M,T[1]+M,0),c(Ie[2],T[0]+M,T[1]-M,0),c(Ie[3],T[0]-M,T[1]-M,0);for(let e=0;e<4;e++)if(!_.unprojectFromRenderScreen(Ie[e],Ne[e]))return;z(_.eye,Ne[0],Ne[1],ke),z(_.eye,Ne[1],Ne[2],We),z(_.eye,Ne[2],Ne[3],De),z(_.eye,Ne[3],Ne[0],Ye);let V=Number.MAX_VALUE,R=0;for(const e of this._forEachTransformedLineSegment(Se,Pe,y,i,he(this.parameters,P))){if(C(ke,Se)<0&&C(ke,Pe)<0||C(We,Se)<0&&C(We,Pe)<0||C(De,Se)<0&&C(De,Pe)<0||C(Ye,Se)<0&&C(Ye,Pe)<0)continue;const t=_.projectToRenderScreen(Se,ze),i=_.projectToRenderScreen(Pe,Ce);if(null==t||null==i)continue;if(t[2]<0&&i[2]>0){p(Te,Se,Pe);const e=_.frustum,i=-C(e[4],Se)/u(Te,A(e[4]));if(m(Te,Te,i),h(Se,Se,Te),!_.projectToRenderScreen(Se,t))continue}else if(t[2]>0&&i[2]<0){p(Te,Pe,Se);const e=_.frustum,t=-C(e[4],Pe)/u(Te,A(e[4]));if(m(Te,Te,t),h(Pe,Pe,Te),!_.projectToRenderScreen(Pe,i))continue}else if(t[2]<0&&i[2]<0)continue;t[2]=0,i[2]=0;const r=w(t,i,Fe),s=E(r,T);if(!(s>=V)){if(this.parameters.screenSizePerspective){const e=this.computeScreenSizePerspectiveWidth(r,Se,Pe,T,_,v,L);if(s>=e*e)continue}V=s,f(Ve,Se),f(Re,Pe),R=e}}if(V<M*M){let e=Number.MAX_VALUE;if(x(w(Ve,Re,Fe),w(b,S,Oe),je)){p(je,je,b);const t=d(je);m(je,je,1/t),e=t/g(b,S)}a(e,e,je,R)}}intersectScreenPolygon(t,i,r,s){const{options:n,camera:o,screenPolygonPrimitiveProcessor:a}=r;if(!n.selectionMode||!t.visible)return null;if(!Q(i))return e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix"),null;const l=t.attributes,c=l.get("position").data,p=this._getLineSize(l),u=Je,m=u*o.pixelRatio,h=new G(4);for(const e of this._forEachTransformedLineSegment(Se,Pe,c,i,he(this.parameters,l)))for(const[t,i]of a.processLineSegment(qe,Se,Pe)){if(!q(o,t,i,ze,Ce))continue;const r=w(ze,Ce,Fe);let n=p/2+u;this.parameters.screenSizePerspective&&(_(Le,ze,Ce,.5),n=Math.max(n,this.computeScreenSizePerspectiveWidth(r,t,i,Le,o,p,m)/o.pixelRatio)),o.renderToScreen(ze,Ae),o.renderToScreen(Ce,Me),X(s,Ae,Me,n)&&(T(w(t,i,Oe),o.eye,we),h.updateIfCloserFromValues(g(o.eye,we),e,we,null))}return h}intersectScreenPolygonDraped({attributes:e},t,i,r,s){if(!i.options.selectionMode)return null;const n=fe(this._getLineSize(e,!0),s);for(const o of de(ye,ve,this.parameters,e,t))if(X(r,ye,ve,n))return new H(o);return null}createBufferWriter(){return new ue(re(this.parameters),se(this.parameters),this.parameters)}createGLMaterial(e){return new ce(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}update(e){return!!this.parameters.hasAnimation&&(this.setParameters({timeElapsed:s(e.time)},!1),0!==e.dt)}computeScreenSizePerspectiveWidth(e,t,i,r,s,n,o){const a=j(e,r);_(we,t,i,a),b(Ee,we,s.viewMatrix);const l=d(Ee),c=this.computeCameraAbsCosAngle(we,s,this._configuration.spherical);be.update(c,l,this.parameters.screenSizePerspective,this.parameters.screenSizePerspectiveMinPixelReferenceSize);return be.apply(n)*s.pixelRatio/2+o}computeCameraAbsCosAngle(e,t,i){return i?S(je,e):c(je,0,0,1),p(xe,e,t.eye),S(xe,xe),Math.abs(u(je,xe))}_getLineSize(e,i=!1){let r=this.parameters.width;if(this.parameters.vvSize){const s=e.get("sizeFeatureAttribute").data[0];Number.isNaN(s)?i&&(r*=this.parameters.vvSize.fallback[0]):r*=t(this.parameters.vvSize.offset[0]+s*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else e.has("size")&&(r*=e.get("size").data[0]);return r}*_forEachTransformedLineSegment(e,t,i,r,s){const n=s?i.length-2:i.length-5;for(let o=0;o<n;o+=3){e[0]=i[o]+r[12],e[1]=i[o+1]+r[13],e[2]=i[o+2]+r[14];const s=(o+3)%i.length;t[0]=i[s]+r[12],t[1]=i[s+1]+r[13],t[2]=i[s+2]+r[14],yield o/3}}}class ce extends Y{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){const{stipplePattern:t}=this._material.parameters;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(ne,e)}}class pe extends ee{constructor(){super(...arguments),this._width=0,this.color=y,this.join="miter",this.cap=0,this.miterLimit=5,this.writeDepth=!0,this.polygonOffset=0,this.polygonOffsetIndex=0,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1,this.timeElapsed=n(0),this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=n(0),this.endTime=n(1/0),this.emissiveStrength=0}get width(){return this.isImagePattern()?this.stipplePattern.width:this._width}set width(e){this._width=e}get transparent(){return this.color[3]<1||this.hasAnimation||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return 0!==this.animation}isImagePattern(){return $(this.stipplePattern)&&null!=this.stippleTexture}}class ue{constructor(e,t,i){this.layout=e,this.textureBufferLayout=t,this._parameters=i,this.numJoinSubdivisions=_e(this._parameters.join,null!=this._parameters.stipplePattern)}_isClosed(e){return he(this._parameters,e)}allocate(e){return this.layout.createBuffer(e)}elementCountTextureBuffer(e){return e.get("position").data.length/3+(this._isClosed(e)?3:2)}elementCount(e){const t=2,i=e.get("position").indices.length/2+1,r=this._isClosed(e);let s=r?2:2*t;return s+=((r?i:i-1)-(r?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(e,t,i,r,s,n){null!=n&&this._writeTextureBuffer(e,i,n),null!=r&&this._writeVertexBuffer(e,i,r,s)}_writeTextureBuffer(e,t,i){const r=t.get("position"),s=r.data.length/3,n=this._isClosed(t),{buffer:o,offset:a}=i,l=o.getField("position",V),c=o.getField("u0",R),p=o.getField("sizeFeatureAttribute",R),u=o.getField("size",R),m=o.getField("colorFeatureAttribute",R),h=o.getField("color",F),d=o.getField("olidColor",F),_=o.getField("timeStamps",O),b=o.getField("opacityFeatureAttribute",R),S=t.get("sizeFeatureAttribute")?.data,P=t.get("size")?.data,y=t.get("colorFeatureAttribute")?.data,v=t.get("color")?.data,w=t.get("opacityFeatureAttribute")?.data,E=t.get("distanceToStart")?.data,x=t.get("timeStamps");Z(null!==l,"Expected valid position field in texture buffer"),Z(null!==c,"Expected valid u0 field in texture buffer");let T=0;for(let L=0;L<s;++L){this._getTransformedPosition(Ue,r.data,L,e),L>0&&(null!=E?T=E[L]??T:T+=g(Be,Ue));const t=a+L+1;if(l.setVec(t,Ue),c.set(t,T),f(Be,Ue),p&&p.set(t,1===S?.length?S[0]:S?.[L]??0),u&&u.set(t,1===P?.length?P[0]:P?.[L]??1),m&&m.set(t,1===y?.length?y[0]:y?.[L]??0),h)if(null!=v){const e=Math.min(4*L,v.length-4);h.setValues(t,v[e],v[e+1],v[e+2],v[e+3])}else h.setValues(t,1,1,1,1);b&&b.set(t,1===w?.length?w[0]:w?.[L]??0)}if(null!=_&&null!=x){Z(4===x.size);const e=x.data;for(let t=0;t<s;++t){const i=4*t,r=a+t+1;_.set(r,0,e[i]),_.set(r,1,e[i+1]),_.set(r,2,e[i+2]),_.set(r,3,e[i+3])}}if(n){const e=a,t=a+1,i=a+2,r=a+s,n=r+1,p=r+2;o.copyItem(r,e),o.copyItem(t,n),o.copyItem(i,p),l.getVec(r,Be),l.getVec(t,Ue);const u=T+g(Be,Ue);c.set(n,u)}else{const e=a,t=a+1,i=a+s,r=i+1;o.copyItem(t,e),o.copyItem(i,r)}const j=t.get("olidColor");D()&&null!=j&&null!=d&&te(j,4,d,a)}_writeVertexBuffer(e,t,i,r){const{buffer:s,offset:n}=i,{layout:o}=this,a=t.get("position"),l=a.indices,c=a.data.length/3,p=this._isClosed(t),u=c+(p?3:2);l&&l.length!==2*(c-1)&&console.warn("RibbonLineMaterial does not support indices");const m=s.getField("textureElementIndex",B);Z(null!=m,"Missing texture buffer index field"),Z(null!=r,"Using a texture layout, but the texture range for this instance was not provided");const h=r.from;Z(r.numElements===u,"Expected number of elements in TextureBuffer to equal number of points");const f=new Float32Array(s.buffer),d=v(s.buffer),g=new Uint32Array(s.buffer),_=o.stride/4;let b=n*_;const S=b,P=f.BYTES_PER_ELEMENT/d.BYTES_PER_ELEMENT,y=(e,t,i)=>{const r=i+1;g[b]=h+r,b++;let s=b*P;d[s++]=e,d[s++]=t,b=Math.ceil(s/P)};b+=_;let w=0,E=0;p?(w=0,E=c):(y(1,-4,0),y(1,4,0),w=1,E=c-1);for(let v=w;v<E;v++){y(0,-1,v),y(0,1,v);const e=this.numJoinSubdivisions;for(let t=0;t<e;++t){const i=(t+1)/(e+1);y(i,-1,v),y(i,1,v)}y(1,-2,v),y(1,2,v)}p?(y(0,-1,E),y(0,1,E)):(y(0,-5,E),y(0,5,E)),me(f,S+_,f,S,_);b=me(f,b-_,f,b,_),this._parameters.wireframe&&this._addWireframeVertices(s,S,b,_)}_getTransformedPosition(e,t,i,r){const s=3*i;c(e,t[s+0],t[s+1],t[s+2]),r&&b(e,e,r)}_addWireframeVertices(e,t,i,r){const s=new Uint8Array(e.buffer,i*Float32Array.BYTES_PER_ELEMENT),n=new Uint8Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,(i-t)*Float32Array.BYTES_PER_ELEMENT),o=r*Float32Array.BYTES_PER_ELEMENT;let a=0;const l=e=>a=me(n,e,s,a,o);for(let c=0;c<=n.length-4*o;c+=2*o)l(c),l(c+2*o),l(c+1*o),l(c+2*o),l(c+1*o),l(c+3*o)}}function me(e,t,i,r,s){for(let n=0;n<s;n++)i[r++]=e[t++];return r}function he(e,t){if(!e.isClosed)return!1;return t.get("position").indices.length>2}function fe(e,t){return(e/2+Je)*t}function*de(e,t,i,r,s){const n=r.get("position").data,l=he(i,r)?n.length-2:n.length-5,c=s?.[0]??0,p=s?.[1]??0;a(e,n[0]+c,n[1]+p);for(let u=3;u<l+3;u+=3){const i=u%n.length;a(t,n[i]+c,n[i+1]+p),yield u/3,o(e,t)}}function ge(e){return 1===e.anchor&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}function _e(e,t){const i=t?1:0;switch(e){case"miter":case"bevel":return i;case"round":return ie+i}}const be=new K,Se=P(),Pe=P(),ye=l(),ve=l(),we=P(),Ee=P(),xe=P(),Te=P(),je=P(),Le=P(),ze=i(),Ce=i(),Ae=r(),Me=r(),Ve=P(),Re=P(),Fe=L(),Oe=L(),Be=P(),Ue=P(),Ie=[i(),i(),i(),i()],Ne=[P(),P(),P(),P()],ke=M(),We=M(),De=M(),Ye=M(),Je=4,qe=[P(),P()];export{pe as Parameters,le as RibbonLineMaterial};
2
+ import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as i,createScreenPointArray as r}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as s,Seconds as n}from"../../../../core/time.js";import{copy as a,set as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as c,subtract as p,dot as u,scale as m,add as h,copy as f,length as d,distance as g,lerp as _,transformMat4 as b,normalize as S}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as P}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as y}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromPoints as v,distance2 as w,closestLineSegmentPoint as E,projectPoint as x,projectPointFraction as T,create as j}from"../../../../geometry/support/lineSegment.js";import{fromPoints as L,signedDistance as z,getNormal as C,create as A}from"../../../../geometry/support/plane.js";import{BufferViewVec3f as M,BufferViewFloat as V,BufferViewVec4Unorm8 as F,BufferViewVec4f16 as R,BufferViewUint32 as O}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOLID as B,isColor as U,isDepth as I,isColorHighlightOLIDOrDepth as N,is2DGeometryOutput as k}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as W}from"../effects/geometry/olidUtils.js";import D from"../lib/GLMaterial.js";import{LineMaterial as Y}from"../lib/LineMaterial.js";import{projectWorldLineSegmentToRenderScreen as J,screenPolygonIntersectsBufferedSegment as q}from"../lib/screenPolygonOverlapUtils.js";import{Hit as X,DrapedHit as G}from"../lib/screenPolygonTriangleIntersections.js";import{ScreenSizePerspectiveEvaluator as H}from"../lib/screenSizePerspectiveUtils.js";import{isTranslationMatrix as K,assert as Q}from"../lib/Util.js";import{isImagePattern as Z}from"./lineStippleUtils.js";import{VisualVariablePassParameters as $}from"./VisualVariablePassParameters.js";import{writeColor as ee}from"./internal/bufferWriterUtils.js";import{n as te}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as ie,getTextureBufferLayout as re}from"../shaders/RibbonLineLayouts.js";import{RibbonLineTechnique as se}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as ne}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as ae}from"../../../../webscene/support/AlphaCutoff.js";class oe extends Y{constructor(e,t){super(e,ce),this.produces=new Map([[2,e=>B(e)||U(e)&&8===this.parameters.renderOccluded],[3,e=>I(e)],[10,e=>N(e)&&8===this.parameters.renderOccluded],[11,e=>N(e)&&8===this.parameters.renderOccluded],[4,e=>U(e)&&this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[8,e=>U(e)&&!this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[18,e=>k(e)]]),this._configuration=new ne(t)}updateConfiguration(e){super.updateConfiguration(e);const t=18===e.slot,i=null!=this.parameters.stipplePattern&&null!=this.parameters.stippleTexture&&10!==e.output,r=i&&t&&this.parameters.isImagePattern();this._configuration.draped=t,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.stippleEnabled=i,this._configuration.stippleOffColorEnabled=i&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=i&&this.parameters.stipplePreferContinuous,this._configuration.numJoinSubdivisions=ge(this.parameters.join,i),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&de(this.parameters.markerParameters),this._configuration.polygonOffsetIndex=this.parameters.polygonOffsetIndex,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.hasOccludees=e.hasOccludees,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=this.emissions?1:0,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective&&!r,this._configuration.worldSizedImagePattern=r}get visible(){return this.parameters.color[3]>=ae||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>ae}get emissions(){return this.parameters.emissiveStrength>0?8!==this.parameters.renderOccluded?2:1:0}setParameters(e,t){e.animation=this.parameters.animation,super.setParameters(e,t)}intersectRayDraped({attributes:e},i,r,s,n,a){if(!i.options.selectionMode)return;const o=this._getLineSize(e,!0),l=r[0],c=r[1],p=he(o,a);let u=Number.MAX_VALUE,m=0;for(const h of fe(Pe,ye,this.parameters,e)){const e=l-Pe[0],i=c-Pe[1],r=ye[0]-Pe[0],s=ye[1]-Pe[1],n=t((r*e+s*i)/(r*r+s*s),0,1),a=r*n-e,o=s*n-i,p=a*a+o*o;p<u&&(u=p,m=h)}u<p*p&&s(n.distance,n.renderDistance,n.normal,m)}intersectRay(t,i,r,s,n,o){const{options:l,camera:_,rayBegin:b,rayEnd:S}=r;if(!l.selectionMode||!t.visible||!_)return;if(!K(i))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const P=t.attributes,y=P.get("position").data,x=this._getLineSize(P),T=je;a(T,r.point);const j=x*_.pixelRatio,A=Ye*_.pixelRatio,M=j/2+A;c(Ue[0],T[0]-M,T[1]+M,0),c(Ue[1],T[0]+M,T[1]+M,0),c(Ue[2],T[0]+M,T[1]-M,0),c(Ue[3],T[0]-M,T[1]-M,0);for(let e=0;e<4;e++)if(!_.unprojectFromRenderScreen(Ue[e],Ie[e]))return;L(_.eye,Ie[0],Ie[1],Ne),L(_.eye,Ie[1],Ie[2],ke),L(_.eye,Ie[2],Ie[3],We),L(_.eye,Ie[3],Ie[0],De);let V=Number.MAX_VALUE,F=0;for(const e of this._forEachTransformedLineSegment(be,Se,y,i,me(this.parameters,P))){if(z(Ne,be)<0&&z(Ne,Se)<0||z(ke,be)<0&&z(ke,Se)<0||z(We,be)<0&&z(We,Se)<0||z(De,be)<0&&z(De,Se)<0)continue;const t=_.projectToRenderScreen(be,Le),i=_.projectToRenderScreen(Se,ze);if(null==t||null==i)continue;if(t[2]<0&&i[2]>0){p(xe,be,Se);const e=_.frustum,i=-z(e[4],be)/u(xe,C(e[4]));if(m(xe,xe,i),h(be,be,xe),!_.projectToRenderScreen(be,t))continue}else if(t[2]>0&&i[2]<0){p(xe,Se,be);const e=_.frustum,t=-z(e[4],Se)/u(xe,C(e[4]));if(m(xe,xe,t),h(Se,Se,xe),!_.projectToRenderScreen(Se,i))continue}else if(t[2]<0&&i[2]<0)continue;t[2]=0,i[2]=0;const r=v(t,i,Fe),s=w(r,T);if(!(s>=V)){if(this.parameters.screenSizePerspective){const e=this.computeScreenSizePerspectiveWidth(r,be,Se,T,_,x,A);if(s>=e*e)continue}V=s,f(Me,be),f(Ve,Se),F=e}}if(V<M*M){let e=Number.MAX_VALUE;if(E(v(Me,Ve,Fe),v(b,S,Re),Te)){p(Te,Te,b);const t=d(Te);m(Te,Te,1/t),e=t/g(b,S)}o(e,e,Te,F)}}intersectScreenPolygon(t,i,r,s){const{options:n,camera:a,screenPolygonPrimitiveProcessor:o}=r;if(!n.selectionMode||!t.visible)return null;if(!K(i))return e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix"),null;const l=t.attributes,c=l.get("position").data,p=this._getLineSize(l),u=Ye,m=u*a.pixelRatio,h=new X(4);for(const e of this._forEachTransformedLineSegment(be,Se,c,i,me(this.parameters,l)))for(const[t,i]of o.processLineSegment(Je,be,Se)){if(!J(a,t,i,Le,ze))continue;const r=v(Le,ze,Fe);let n=p/2+u;this.parameters.screenSizePerspective&&(_(je,Le,ze,.5),n=Math.max(n,this.computeScreenSizePerspectiveWidth(r,t,i,je,a,p,m)/a.pixelRatio)),a.renderToScreen(Le,Ce),a.renderToScreen(ze,Ae),q(s,Ce,Ae,n)&&(x(v(t,i,Re),a.eye,ve),h.updateIfCloserFromValues(g(a.eye,ve),e,ve,null))}return h}intersectScreenPolygonDraped({attributes:e},t,i,r,s){if(!i.options.selectionMode)return null;const n=he(this._getLineSize(e,!0),s);for(const a of fe(Pe,ye,this.parameters,e,t))if(q(r,Pe,ye,n))return new G(a);return null}createBufferWriter(){return new pe(ie(this.parameters),re(this.parameters),this.parameters)}createGLMaterial(e){return new le(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}update(e){return!!this.parameters.hasAnimation&&(this.setParameters({timeElapsed:s(e.time)},!1),0!==e.dt)}computeScreenSizePerspectiveWidth(e,t,i,r,s,n,a){const o=T(e,r);_(ve,t,i,o),b(we,ve,s.viewMatrix);const l=d(we),c=this.computeCameraAbsCosAngle(ve,s,this._configuration.spherical);_e.update(c,l,this.parameters.screenSizePerspective,this.parameters.screenSizePerspectiveMinPixelReferenceSize);return _e.apply(n)*s.pixelRatio/2+a}computeCameraAbsCosAngle(e,t,i){return i?S(Te,e):c(Te,0,0,1),p(Ee,e,t.eye),S(Ee,Ee),Math.abs(u(Te,Ee))}_getLineSize(e,i=!1){let r=this.parameters.width;if(this.parameters.vvSize){const s=e.get("sizeFeatureAttribute").data[0];Number.isNaN(s)?i&&(r*=this.parameters.vvSize.fallback[0]):r*=t(this.parameters.vvSize.offset[0]+s*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else e.has("size")&&(r*=e.get("size").data[0]);return r}*_forEachTransformedLineSegment(e,t,i,r,s){const n=s?i.length-2:i.length-5;for(let a=0;a<n;a+=3){e[0]=i[a]+r[12],e[1]=i[a+1]+r[13],e[2]=i[a+2]+r[14];const s=(a+3)%i.length;t[0]=i[s]+r[12],t[1]=i[s+1]+r[13],t[2]=i[s+2]+r[14],yield a/3}}}class le extends D{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){const{stipplePattern:t}=this._material.parameters;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(se,e)}}class ce extends ${constructor(){super(...arguments),this._width=0,this.color=y,this.join="miter",this.cap=0,this.miterLimit=5,this.writeDepth=!0,this.polygonOffset=0,this.polygonOffsetIndex=0,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1,this.timeElapsed=n(0),this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=n(0),this.endTime=n(1/0),this.emissiveStrength=0}get width(){return this.isImagePattern()?this.stipplePattern.width:this._width}set width(e){this._width=e}get transparent(){return this.color[3]<1||this.hasAnimation||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return 0!==this.animation}isImagePattern(){return Z(this.stipplePattern)&&null!=this.stippleTexture}}class pe{constructor(e,t,i){this.layout=e,this.textureBufferLayout=t,this._parameters=i,this.numJoinSubdivisions=ge(this._parameters.join,null!=this._parameters.stipplePattern)}_isClosed(e){return me(this._parameters,e)}allocate(e){return this.layout.createBuffer(e)}elementCountTextureBuffer(e){return e.get("position").data.length/3+(this._isClosed(e)?3:2)}elementCount(e){const t=2,i=e.get("position").indices.length/2+1,r=this._isClosed(e);let s=r?2:2*t;return s+=((r?i:i-1)-(r?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(e,t,i,r,s,n){null!=n&&this._writeTextureBuffer(e,i,n),null!=r&&this._writeVertexBuffer(e,i,r,s)}_writeTextureBuffer(e,t,i){const r=t.get("position"),s=r.data.length/3,n=this._isClosed(t),{buffer:a,offset:o}=i,l=a.getField("position",M),c=a.getField("u0",V),p=a.getField("sizeFeatureAttribute",V),u=a.getField("size",V),m=a.getField("colorFeatureAttribute",V),h=a.getField("color",F),d=a.getField("olidColor",F),_=a.getField("timeStamps",R),b=a.getField("opacityFeatureAttribute",V),S=t.get("sizeFeatureAttribute")?.data,P=t.get("size")?.data,y=t.get("colorFeatureAttribute")?.data,v=t.get("color")?.data,w=t.get("opacityFeatureAttribute")?.data,E=t.get("distanceToStart")?.data,x=t.get("timeStamps");Q(null!==l,"Expected valid position field in texture buffer"),Q(null!==c,"Expected valid u0 field in texture buffer");let T=0;for(let L=0;L<s;++L){this._getTransformedPosition(Be,r.data,L,e),L>0&&(null!=E?T=E[L]??T:T+=g(Oe,Be));const t=o+L+1;if(l.setVec(t,Be),c.set(t,T),f(Oe,Be),p&&p.set(t,1===S?.length?S[0]:S?.[L]??0),u&&u.set(t,1===P?.length?P[0]:P?.[L]??1),m&&m.set(t,1===y?.length?y[0]:y?.[L]??0),h)if(null!=v){const e=Math.min(4*L,v.length-4);h.setValues(t,v[e],v[e+1],v[e+2],v[e+3])}else h.setValues(t,1,1,1,1);b&&b.set(t,1===w?.length?w[0]:w?.[L]??0)}if(null!=_&&null!=x){Q(4===x.size);const e=x.data;for(let t=0;t<s;++t){const i=4*t,r=o+t+1;_.set(r,0,e[i]),_.set(r,1,e[i+1]),_.set(r,2,e[i+2]),_.set(r,3,e[i+3])}}if(n){const e=o,t=o+1,i=o+2,r=o+s,n=r+1,p=r+2;a.copyItem(r,e),a.copyItem(t,n),a.copyItem(i,p),l.getVec(r,Oe),l.getVec(t,Be);const u=T+g(Oe,Be);c.set(n,u)}else{const e=o,t=o+1,i=o+s,r=i+1;a.copyItem(t,e),a.copyItem(i,r)}const j=t.get("olidColor");W()&&null!=j&&null!=d&&ee(j,4,d,o)}_writeVertexBuffer(e,t,i,r){const{buffer:s,offset:n}=i,{layout:a}=this,o=t.get("position"),l=o.indices,c=o.data.length/3,p=this._isClosed(t),u=c+(p?3:2);l&&l.length!==2*(c-1)&&console.warn("RibbonLineMaterial does not support indices");const m=s.getField("textureElementIndex",O);Q(null!=m,"Missing texture buffer index field"),Q(null!=r,"Using a texture layout, but the texture range for this instance was not provided");const h=r.from;Q(r.numElements===u,"Expected number of elements in TextureBuffer to equal number of points");const f=new Float32Array(s.buffer),d=new Float16Array(s.buffer),g=new Uint32Array(s.buffer),_=a.stride/4;let b=n*_;const S=b,P=f.BYTES_PER_ELEMENT/d.BYTES_PER_ELEMENT,y=(e,t,i)=>{const r=i+1;g[b]=h+r,b++;let s=b*P;d[s++]=e,d[s++]=t,b=Math.ceil(s/P)};b+=_;let v=0,w=0;p?(v=0,w=c):(y(1,-4,0),y(1,4,0),v=1,w=c-1);for(let E=v;E<w;E++){y(0,-1,E),y(0,1,E);const e=this.numJoinSubdivisions;for(let t=0;t<e;++t){const i=(t+1)/(e+1);y(i,-1,E),y(i,1,E)}y(1,-2,E),y(1,2,E)}p?(y(0,-1,w),y(0,1,w)):(y(0,-5,w),y(0,5,w)),ue(f,S+_,f,S,_);b=ue(f,b-_,f,b,_),this._parameters.wireframe&&this._addWireframeVertices(s,S,b,_)}_getTransformedPosition(e,t,i,r){const s=3*i;c(e,t[s+0],t[s+1],t[s+2]),r&&b(e,e,r)}_addWireframeVertices(e,t,i,r){const s=new Uint8Array(e.buffer,i*Float32Array.BYTES_PER_ELEMENT),n=new Uint8Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,(i-t)*Float32Array.BYTES_PER_ELEMENT),a=r*Float32Array.BYTES_PER_ELEMENT;let o=0;const l=e=>o=ue(n,e,s,o,a);for(let c=0;c<=n.length-4*a;c+=2*a)l(c),l(c+2*a),l(c+1*a),l(c+2*a),l(c+1*a),l(c+3*a)}}function ue(e,t,i,r,s){for(let n=0;n<s;n++)i[r++]=e[t++];return r}function me(e,t){if(!e.isClosed)return!1;return t.get("position").indices.length>2}function he(e,t){return(e/2+Ye)*t}function*fe(e,t,i,r,s){const n=r.get("position").data,l=me(i,r)?n.length-2:n.length-5,c=s?.[0]??0,p=s?.[1]??0;o(e,n[0]+c,n[1]+p);for(let u=3;u<l+3;u+=3){const i=u%n.length;o(t,n[i]+c,n[i+1]+p),yield u/3,a(e,t)}}function de(e){return 1===e.anchor&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}function ge(e,t){const i=t?1:0;switch(e){case"miter":case"bevel":return i;case"round":return te+i}}const _e=new H,be=P(),Se=P(),Pe=l(),ye=l(),ve=P(),we=P(),Ee=P(),xe=P(),Te=P(),je=P(),Le=i(),ze=i(),Ce=r(),Ae=r(),Me=P(),Ve=P(),Fe=j(),Re=j(),Oe=P(),Be=P(),Ue=[i(),i(),i(),i()],Ie=[P(),P(),P(),P()],Ne=A(),ke=A(),We=A(),De=A(),Ye=4,Je=[P(),P()];export{ce as Parameters,oe as RibbonLineMaterial};