@arcgis/core 4.34.0-next.41 → 4.34.0-next.42

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/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/016d421114118307d4dd.js +1 -0
  3. package/assets/esri/core/workers/chunks/250b1629becca0410f2a.js +1 -0
  4. package/assets/esri/core/workers/chunks/3245d20ea4bb779f87ef.js +1 -0
  5. package/assets/esri/core/workers/chunks/6b73926feb5c5d957062.js +1 -0
  6. package/assets/esri/core/workers/chunks/{6269c4bbf0f224a954e9.js → 6f4079b7a2b45f304ee6.js} +1 -1
  7. package/assets/esri/core/workers/chunks/82955562805ad5514ed8.js +346 -0
  8. package/assets/esri/core/workers/chunks/{94850c094e076d81a016.js → dca2b487152cde45fb65.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{31ad9949b08a5b07218c.js → eea3e0bd17479a767160.js} +2 -2
  10. package/assets/esri/core/workers/chunks/fe6fa1f2c2d54d41645e.js +1 -0
  11. package/config.js +1 -1
  12. package/core/workers/registry.js +1 -1
  13. package/kernel.js +1 -1
  14. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  15. package/package.json +1 -1
  16. package/support/revision.js +1 -1
  17. package/views/2d/engine/flow/styles/Imagery.js +1 -1
  18. package/views/2d/engine/flow/styles/Particles.js +1 -1
  19. package/views/2d/engine/flow/styles/Streamlines.js +1 -1
  20. package/views/2d/engine/imagery/RasterVFDisplayObject.js +1 -1
  21. package/views/2d/engine/vectorTiles/RenderBucket.js +1 -1
  22. package/views/2d/engine/webgl/BitBlitRenderer.js +1 -1
  23. package/views/2d/engine/webgl/Mesh2D.js +1 -1
  24. package/views/2d/engine/webgl/VertexStream.js +1 -1
  25. package/views/2d/engine/webgl/brushes/WGLBrushStencil.js +1 -1
  26. package/views/2d/engine/webgl/brushes/WGLBrushTileDebugInfo.js +1 -1
  27. package/views/2d/engine/webgl/brushes/WGLBrushVTLBackground.js +1 -1
  28. package/views/2d/engine/webgl/cpuMapped/Buffer.js +1 -1
  29. package/views/2d/engine/webgl/cpuMapped/MappedMesh.js +1 -1
  30. package/views/2d/engine/webgl/effects/highlight/HighlightRenderer.js +1 -1
  31. package/views/2d/engine/webgl/meshing/Mesh.js +1 -1
  32. package/views/2d/engine/webgl/meshing/SimpleMesh.js +1 -1
  33. package/views/2d/engine/webgl/shaderGraph/techniques/overlay/OverlayTechnique.js +1 -1
  34. package/views/2d/engine/webgl/shaderGraph/techniques/videoScreenRenderer/VideoScreenTechnique.js +1 -1
  35. package/views/2d/layers/BaseDynamicLayerView2D.js +1 -1
  36. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  37. package/views/2d/layers/KMLLayerView2D.js +1 -1
  38. package/views/2d/layers/MapImageLayerView2D.js +1 -1
  39. package/views/2d/layers/MediaLayerView2D.js +1 -1
  40. package/views/2d/layers/TileLayerView2D.js +1 -1
  41. package/views/2d/layers/WMSLayerView2D.js +1 -1
  42. package/views/2d/layers/graphics/GraphicBoundsRenderer.js +1 -1
  43. package/views/2d/layers/support/DebugOverlay.js +1 -1
  44. package/views/3d/environment/LocalAtmosphere.js +1 -1
  45. package/views/3d/environment/MarsAtmosphere.js +1 -1
  46. package/views/3d/environment/Precipitation.js +1 -1
  47. package/views/3d/layers/FlowSubView3D.js +1 -1
  48. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  49. package/views/3d/layers/I3SMeshView3D.js +1 -1
  50. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  51. package/views/3d/layers/graphics/pipeline/rendering/DirectRenderer.js +1 -1
  52. package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
  53. package/views/3d/layers/support/FlowTileTree3DDebugger.js +1 -1
  54. package/views/3d/support/GaussianSplatSortWorker.js +5 -0
  55. package/views/3d/support/GaussianSplatWorkerHandle.js +5 -0
  56. package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
  57. package/views/3d/support/flow/geometryUtils.js +1 -1
  58. package/views/3d/support/flow/loadUtils.js +1 -1
  59. package/views/3d/terrain/PatchGeometryFactory.js +1 -1
  60. package/views/3d/terrain/PatchRenderData.js +1 -1
  61. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  62. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
  63. package/views/3d/webgl-engine/effects/ScreenSpaceGeometry.js +1 -1
  64. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
  65. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  66. package/views/3d/webgl-engine/effects/laserlines/LaserlinePathData.js +1 -1
  67. package/views/3d/webgl-engine/effects/stars/Stars.js +1 -1
  68. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  69. package/views/3d/webgl-engine/lib/edgeRendering/bufferLayouts.js +1 -1
  70. package/views/3d/webgl-engine/lib/edgeRendering/edgeBufferWriters.js +1 -1
  71. package/views/3d/webgl-engine/lib/glUtil3D.js +1 -1
  72. package/views/3d/webgl-engine/lib/lodRendering/BackedBufferObject.js +1 -1
  73. package/views/3d/webgl-engine/lib/lodRendering/LodComponentData.js +1 -1
  74. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  75. package/views/3d/webgl-engine/lib/lodRendering/RenderInstanceData.js +1 -1
  76. package/views/3d/webgl-engine/materials/renderers/MergedBuffer.js +1 -1
  77. package/views/3d/webgl-engine/materials/renderers/VaoCache.js +1 -1
  78. package/views/VideoView.js +1 -1
  79. package/views/support/TileTreeDebugger.js +1 -1
  80. package/views/webgl/BufferObject.js +1 -1
  81. package/views/webgl/Util.js +1 -1
  82. package/views/webgl/VertexArrayObject.js +1 -1
  83. package/views/webgl/VertexBuffer.js +1 -1
  84. package/views/webgl/testFloatBufferBlend.js +1 -1
  85. package/views/webgl/testSVGPremultipliedAlpha.js +1 -1
  86. package/assets/esri/core/workers/chunks/01bd8f90e55081e65b38.js +0 -1
  87. package/assets/esri/core/workers/chunks/0a27f9b11d03874809ee.js +0 -346
  88. package/assets/esri/core/workers/chunks/34f677e8c1691c10e4e9.js +0 -1
  89. package/assets/esri/core/workers/chunks/e95a8c988ef822723503.js +0 -1
  90. package/assets/esri/core/workers/chunks/fd3009164d5e38fda85f.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{BufferObject as e}from"../../../../webgl/BufferObject.js";class t{constructor(t,r,i){this._elementSize=r,this._buffer=e.createVertex(t,35044),this.resize(i)}destroy(){this._buffer.dispose()}get elementSize(){return this._elementSize}get capacity(){return this._capacity}get array(){return this._array}get buffer(){return this._buffer}get usedMemory(){return this._array.byteLength+this._buffer.usedMemory}copyRange(e,t,r,i=0){const s=new Uint8Array(this.array,e*this.elementSize,(t-e)*this.elementSize);new Uint8Array(r.array,i*this.elementSize).set(s)}transferAll(){this._buffer.setData(this._array)}transferRange(e,t){const r=e*this._elementSize,i=t*this._elementSize;this._buffer.setSubData(new Uint8Array(this._array),r,r,i)}resize(e){const t=e*this._elementSize,r=new ArrayBuffer(t);this._array&&(e>=this._capacity?new Uint8Array(r).set(new Uint8Array(this._array)):new Uint8Array(r).set(new Uint8Array(this._array).subarray(0,e*this._elementSize))),this._array=r,this._buffer.setSize(t),this._capacity=e}}export{t as default};
5
+ import{glLayout as e}from"../../../support/buffer/glUtil.js";import{VertexBuffer as t}from"../../../../webgl/VertexBuffer.js";class r{constructor(r,i,s){this.elementSize=i.stride,this._buffer=new t(r,e(i,1)),this.resize(s)}destroy(){this._buffer.dispose()}get capacity(){return this._capacity}get array(){return this._array}get buffer(){return this._buffer}get usedMemory(){return this._array.byteLength+this._buffer.usedMemory}copyRange(e,t,r,i=0){const s=new Uint8Array(this.array,e*this.elementSize,(t-e)*this.elementSize);new Uint8Array(r.array,i*this.elementSize).set(s)}transferAll(){this._buffer.setData(this._array)}transferRange(e,t){const r=e*this.elementSize,i=t*this.elementSize;this._buffer.setSubData(new Uint8Array(this._array),r,r,i)}resize(e){const t=e*this.elementSize,r=new ArrayBuffer(t);this._array&&(e>=this._capacity?new Uint8Array(r).set(new Uint8Array(this._array)):new Uint8Array(r).set(new Uint8Array(this._array).subarray(0,e*this.elementSize))),this._array=r,this._buffer.setSize(t),this._capacity=e}}export{r as BackedBufferObject};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{glLayout as e}from"../../../support/buffer/glUtil.js";import{GLMaterials as t}from"../GLMaterials.js";import{VertexArrayObject as r}from"../VertexArrayObject.js";import{BufferObject as s}from"../../../../webgl/BufferObject.js";import{VertexBuffer as o}from"../../../../webgl/VertexBuffer.js";class i{constructor(i,m){this.geometry=m;const n=i.renderContext.rctx,a=m.renderGeometry,{material:u,layout:l,buffer:g}=a;this._materials=i.materials,u.setParameters({instancedDoublePrecision:!0}),this.glMaterials=new t(u,this._materials),this.vbo=s.createVertex(n,35044,g),this.vao=new r(n,new o(e(l),this.vbo))}destroy(){this.glMaterials.dispose(),this.vbo.dispose(),this.vao.dispose()}get material(){return this.geometry.renderGeometry.material}get layout(){return this.geometry.renderGeometry.layout}get boundingInfo(){return this.geometry.boundingInfo}get numTriangles(){return this.numVertices/3}get numVertices(){return this.geometry.renderGeometry.numVertices}get usedMemory(){return 128+this.vbo.usedMemory+this.vao.usedMemory}intersect(e,t,r,s,o,i,m,n){return this.geometry.intersect(e,t,r,s,o,i,m,n)}}export{i as LodComponentData};
5
+ import{glLayout as e}from"../../../support/buffer/glUtil.js";import{GLMaterials as t}from"../GLMaterials.js";import{VertexArrayObject as r}from"../VertexArrayObject.js";import{VertexBuffer as s}from"../../../../webgl/VertexBuffer.js";class o{constructor(o,i){this.geometry=i;const n=o.renderContext.rctx,m=i.renderGeometry,{material:a,layout:u,buffer:l}=m;this._materials=o.materials,a.setParameters({instancedDoublePrecision:!0}),this.glMaterials=new t(a,this._materials),this.vbo=new s(n,e(u),l),this.vao=new r(n,this.vbo)}destroy(){this.glMaterials.dispose(),this.vbo.dispose(),this.vao.dispose()}get material(){return this.geometry.renderGeometry.material}get layout(){return this.geometry.renderGeometry.layout}get boundingInfo(){return this.geometry.boundingInfo}get numTriangles(){return this.numVertices/3}get numVertices(){return this.geometry.renderGeometry.numVertices}get usedMemory(){return 128+this.vbo.usedMemory+this.vao.usedMemory}intersect(e,t,r,s,o,i,n,m){return this.geometry.intersect(e,t,r,s,o,i,n,m)}}export{o as LodComponentData};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{isSome as t}from"../../../../../core/arrayUtils.js";import s from"../../../../../core/Error.js";import{someMap as r,getOrCreateMapValue as n}from"../../../../../core/MapUtils.js";import{destroyMaybe as a}from"../../../../../core/maybe.js";import{isAborted as i,throwIfAborted as o}from"../../../../../core/promiseUtils.js";import{property as l}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import{subclass as c}from"../../../../../core/accessorSupport/decorators/subclass.js";import{create as h}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{d,e as u,t as m}from"../../../../../chunks/vec32.js";import{create as f}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as p,freeze as _}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{debugFlags as g}from"../../../support/debugFlags.js";import{glLayout as y}from"../../../support/buffer/glUtil.js";import v from"../../../webgl/RenderCamera.js";import{AsyncRenderPlugin as b}from"../../effects/RenderPlugin.js";import{DepthRange as I}from"../DepthRange.js";import{assert as C}from"../Util.js";import{InstanceData as D}from"./InstanceData.js";import{InstanceOctree as R}from"./InstanceOctree.js";import{LevelSelector as E}from"./LevelSelector.js";import{LodLevel as x}from"./LodLevel.js";import{getRenderInstanceDataLayout as S,RenderInstanceData as w}from"./RenderInstanceData.js";import{colorMixModes as L}from"../../materials/internal/MaterialUtil.js";import{encodeDoubleVec3 as j}from"../../materials/renderers/utils.js";import{DefaultMaterialDrawParameters as U}from"../../shaders/DefaultMaterialTechnique.js";import{defaultHighlightName as T}from"../../../../support/HighlightDefaults.js";import{TaskPriority as O,noBudget as A}from"../../../../support/Scheduler.js";import{bindVertexBufferLayout as M}from"../../../../webgl/Util.js";import{fromLayout as q}from"../../../../webgl/VertexAttributeLocations.js";const B=e=>{const t=e.baseBoundingSphere.radius,s=e.levels.map(e=>e.minScreenSpaceRadius);return new E(t,s)};let F=class extends b{constructor(e,t){super(e),this.type=6,this.isGround=!1,this._levels=[],this._defaultRenderInstanceData=new Array,this._highlightRenderInstanceDatas=new Map,this._instanceIndex=0,this._cycleStartIndex=0,this._slicePlane=!1,this._camera=new v,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this.produces=new Map([[2,e=>this._produces(e)],[4,e=>!!this._hasTransparentLevels()&&this._produces(e)]]),this._instanceData=new D({shaderTransformation:e.shaderTransformation},e.symbol.materialParameters),this.addHandles(t.registerTask(O.LOD_RENDERER,this))}initialize(){this._instanceBufferLayout=S(this.symbol.materialParameters),this._glInstanceBufferLayout=y(this._instanceBufferLayout,1),this.addHandles([this._instanceData.events.on("instances-changed",()=>this._requestUpdateCycle()),this._instanceData.events.on("instance-transform-changed",({index:e})=>{this._requestUpdateCycle(),this.metadata.notifyGraphicGeometryChanged(e)}),this._instanceData.events.on("instance-visibility-changed",({index:e})=>{this._requestUpdateCycle(!0),this.metadata.notifyGraphicVisibilityChanged(e)}),this._instanceData.events.on("instance-highlight-changed",()=>this._requestUpdateCycle(!0))])}get _allRenderInstanceData(){return[this._defaultRenderInstanceData,...this._highlightRenderInstanceDatas.values()]}get _allRenderInstanceDataExceptHighlightShadow(){const e=[this._defaultRenderInstanceData];for(const t of this._highlightRenderInstanceDatas)t[0]!==T&&e.push(t[1]);return e}hasHighlight(e){return this._highlightRenderInstanceDatas.has(e)}get _enableLevelSelection(){return this.symbol.levels.length>1}get levels(){return this._levels}get baseBoundingBox(){return this._levels[this._levels.length-1].boundingBox}get baseBoundingSphere(){return this._levels[this._levels.length-1].boundingSphere}get baseMaterial(){return this._levels[this._levels.length-1].components[0].material}get slicePlaneEnabled(){return this._slicePlane}set slicePlaneEnabled(e){this._slicePlane=e}get layerViewUid(){return this.metadata.layerViewUid}get instanceData(){return this._instanceData}get hasEmissions(){return this._levels.some(e=>e.components.some(e=>e.material.hasEmissions))}get usedMemory(){return this._allRenderInstanceData.reduce((e,t)=>t.reduce((e,t)=>e+t.usedMemory,e),this._levels.reduce((e,t)=>e+t.components.reduce((e,t)=>e+t.usedMemory,0),0))}get renderStats(){const e=this._instanceData.size,t=[];return this._levels.forEach((e,s)=>{const r=this._allRenderInstanceData[0][s].size+this._allRenderInstanceData[1][s].size,n=e.triangleCount;t.push({renderedInstances:r,renderedTriangles:r*n,trianglesPerInstance:n})}),{totalInstances:e,renderedInstances:t.reduce((e,t)=>e+t.renderedInstances,0),renderedTriangles:t.reduce((e,t)=>e+t.renderedTriangles,0),levels:t}}_createRenderInstanceDataArray(){const{rctx:e}=this._context.renderContext;return this.symbol.levels.map(t=>new w(e,this._instanceBufferLayout))}async initializeRenderContext(e,s){this._context=e,this._defaultRenderInstanceData=this._createRenderInstanceDataArray();const r=await Promise.allSettled(this.symbol.levels.map(t=>x.create(e,t,s))),n=r.map(e=>"fulfilled"===e.status?e.value:null).filter(t);if(i(s)||n.length!==r.length){n.forEach(e=>e.destroy()),o(s);for(const e of r)if("rejected"===e.status)throw e.reason}this._levels=n,this._levelSelector=B(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach(e=>e.destroy()),this._defaultRenderInstanceData.forEach(e=>e.destroy()),this._highlightRenderInstanceDatas.forEach(e=>e.forEach(e=>e.destroy()))}_hasTransparentLevels(){return this._levels.some(e=>e.components.some(e=>{const t=e.material.produces.get(4);return t?.(0)}))}hasHighlights(){return r(this._highlightRenderInstanceDatas,e=>e.some(e=>e.size>0))}_produces(e){return(8!==e||this.hasHighlights())&&(5!==e||this.hasHighlight(T))}prepareRender(e){if(!g.LOD_INSTANCE_RENDERER_DISABLE_UPDATES){if(this._enableLevelSelection){const t=e.bind.contentCamera.equals(this._camera);this._camera.copyFrom(e.bind.contentCamera),t||this._requestUpdateCycle()}this._needFullCycle&&(this.runTask(A),this._needFullCycle=!1)}}acquireTechniques(e){if(!this.baseMaterial.visible||!this.baseMaterial.isVisibleForOutput(e.output))return null;const t=this._getInstanceDatas(e);if(!t)return null;const s=new Array,r=this.levels;return t.forEach(t=>r.forEach(({components:r},n)=>r.forEach(r=>s.push(this._beginComponent(e,t[n],r))))),s}render(e,t){const s=this._getInstanceDatas(e);if(!s||null==t)return;let r=0;const n=this.levels;s.forEach(s=>n.forEach(({components:n},a)=>n.forEach(n=>this._renderComponent(e,t[r++],s[a],n,a)))),e.rctx.unbindBuffer(34962),e.rctx.bindVAO(null)}_getInstanceDatas(e){const{output:t,bind:s}=e,r=8===t,n=5===t,a=6!==t;if(!r&&!n)return a?this._allRenderInstanceData:this._allRenderInstanceDataExceptHighlightShadow;const{_highlightRenderInstanceDatas:i}=this;if(a){if(r){const e=s.highlight?.name;if(!e)return null;const t=i.get(e);return t?[t]:null}const e=i.get(T);return n?e?[e]:null:Array.from(i.values())}return null}intersect(e,t,s,r){if(!this.baseMaterial.visible||null==this._octree)return;const n=f();d(n,r,s);const a=n=>{this._instanceData.getCombinedModelTransform(n,N),e.transform.set(N),m(W,s,e.transform.inverse),m(k,r,e.transform.inverse);const a=this._instanceData.getState(n),i=this._instanceData.getLodLevel(n),o=this._levels.length;C(!!(18&a),"invalid instance state"),C(i>=0&&i<o,"invaid lod level"),this._levels[i].intersect(e,t,W,k,n,this.metadata,o)};this.baseMaterial.parameters.verticalOffset?this._octree.forEach(a):this._octree.forEachAlongRay(s,n,a)}notifyShaderTransformationChanged(){this._invalidateOctree(),this._requestUpdateCycle()}get _octree(){if(null==this._octreeCached){const e=this._instanceData,t=e.view?.state;if(!t)return null;this._octreeCached=new R(e,this.baseBoundingSphere);for(let s=0;s<e.capacity;++s)18&t.get(s)&&this._octreeCached.addInstance(s)}return this._octreeCached}_invalidateOctree(){this._octreeCached=a(this._octreeCached)}queryDepthRange(e){if(null==this._octree)return new I;const t=e.viewForward,s=this._octree.findClosest(t,1,e.frustum),r=this._octree.findClosest(t,-1,e.frustum);if(null==s||null==r)return new I;const n=e.eye,a=this._instanceData.view;a.boundingSphere.getVec(s,z),d(z,z,n);const i=u(z,t)-z[3];a.boundingSphere.getVec(r,z),d(z,z,n);const o=u(z,t)+z[3];return new I(i,o)}_requestUpdateCycle(e=!1){this._updateCyclesWithStaticCamera=-1,this._cycleStartIndex=this._instanceIndex,e&&(this._needFullCycle=!0,this._context.requestRender())}_startUpdateCycle(){this._updateCyclesWithStaticCamera++,this._allRenderInstanceData.forEach(e=>e.forEach(e=>e.startUpdateCycle()))}get readyToRun(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}runTask(e){const{_enableLevelSelection:t,_camera:r,_levelSelector:a}=this;this._allRenderInstanceData.forEach(e=>e.forEach(e=>e.beginUpdate()));const i=this._instanceData,o=i.view;let l=i.size;const c=i.capacity;let h=this._instanceIndex;const d=Math.ceil(c/500),{_highlightRenderInstanceDatas:u}=this;for(let m=0;m<l&&!e.done;++m){h===this._cycleStartIndex&&this._startUpdateCycle();const m=o.state.get(h);let f=0;if(!(1&m)){h=h+1===c?0:h+1,l++;continue}const p=o.lodLevel.get(h);if(2&m&&this._defaultRenderInstanceData[p].freeTail(),16&m){const e=i.geHighlightOptionsPrev(h);if(e){const t=u.get(e);if(!t)throw new s("internal:lod-renderer","Internal error in lodRenderer");t[p].freeTail(),t.every(e=>e.isEmpty)&&(t.forEach(e=>e.destroy()),u.delete(e))}}if(32&m)i.freeInstance(h);else if(4&m){let e=0;if(t&&(o.modelOrigin.getVec(h,V),e=a.selectLevel(V,i.getCombinedMedianScaleFactor(h),r)),f=-83&m,e>=0)if(8&m){const t=i.getHighlightName(h);if(t){const r=()=>{const e=this._createRenderInstanceDataArray();return e.forEach(e=>e.beginUpdate()),e},a=n(u,t,r);if(e>=a.length)throw new s("internal:lod-renderer",`LodRenderer internal error - missing lodLevel ${e}`);H(a[e],o,h)}f|=16}else H(this._defaultRenderInstanceData[e],o,h),f|=2;o.state.set(h,f),o.lodLevel.set(h,e)}else f=-83&m,o.state.set(h,f);if(null!=this._octreeCached){const e=!!(18&m),t=!!(18&f);!e&&t?this._octreeCached.addInstance(h):e&&!t?this._octreeCached.removeInstance(h):e&&t&&64&m&&(this._octreeCached.removeInstance(h),this._octreeCached.addInstance(h))}h=h+1===c?0:h+1,h%d===0&&e.madeProgress()}this._instanceIndex=h,this._allRenderInstanceData.forEach(e=>e.forEach(e=>e.endUpdate())),this._context.requestRender()}_beginComponent(e,t,s){if(0===t.size)return null;const r=s.glMaterials.load(e.rctx,e.bind.slot,e.output);return r?.beginSlot(e.bind)}_renderComponent(e,t,s,r,n){if(!t)return;const{bind:a,rctx:i}=e;i.runAppleAmdDriverHelper();const o=i.bindTechnique(t,a,r.material.parameters,Y),l=this._glInstanceBufferLayout;o.assertCompatibleVertexAttributeLocations(r.vao,q(l)),i.bindVAO(r.vao),g.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&0===e.output&&(o.setUniform4fv("externalColor",G[Math.min(n,G.length-1)]),o.setUniform1i("symbolColorMixMode",L.replace));const c=s.capacity,h=s.headIndex,d=s.tailIndex,u=s.firstIndex,m=(e,n)=>{M(i,o.locations,s.buffer,l,e),i.drawArraysInstanced(t.primitiveType,0,r.numVertices,n-e)};r.material.transparent&&null!=u?h>d?(C(u>=d&&u<=h,"invalid firstIndex"),m(u,h),m(d,u)):h<d&&(u<=h?(C(u>=0&&u<=h,"invalid firstIndex"),m(u,h),m(d,c),m(0,u)):(C(u>=d&&u<=c,"invalid firstIndex"),m(u,c),m(0,h),m(d,u))):h>d?m(d,h):h<d&&(m(0,h),m(d,c))}};function H(e,t,s){const r=e.allocateHead();P(t,s,e.view,r)}function P(e,t,s,r){j(e.modelOrigin,t,s.modelOriginHi,s.modelOriginLo,r),s.model.copyFrom(r,e.model,t),s.modelNormal.copyFrom(r,e.modelNormal,t),e.color&&s.color&&s.color.copyFrom(r,e.color,t),e.olidColor&&s.olidColor&&s.olidColor.copyFrom(r,e.olidColor,t),e.featureAttribute&&s.featureAttribute&&s.featureAttribute.copyFrom(r,e.featureAttribute,t)}e([l({constructOnly:!0})],F.prototype,"symbol",void 0),e([l({constructOnly:!0})],F.prototype,"metadata",void 0),e([l({constructOnly:!0})],F.prototype,"shaderTransformation",void 0),e([l()],F.prototype,"_instanceData",void 0),e([l()],F.prototype,"_cycleStartIndex",void 0),e([l({readOnly:!0})],F.prototype,"_enableLevelSelection",null),e([l()],F.prototype,"_updateCyclesWithStaticCamera",void 0),e([l({readOnly:!0})],F.prototype,"readyToRun",null),F=e([c("esri.views.3d.webgl-engine.lib.lodRendering.LodRenderer")],F);const V=f(),z=p(),N=h(),W=f(),k=f(),G=[_(1,0,1,1),_(0,0,1,1),_(0,1,0,1),_(1,1,0,1),_(1,0,0,1)],Y=new U;export{F as LodRenderer};
5
+ import{__decorate as e}from"tslib";import{isSome as t}from"../../../../../core/arrayUtils.js";import s from"../../../../../core/Error.js";import{someMap as r,getOrCreateMapValue as n}from"../../../../../core/MapUtils.js";import{destroyMaybe as a}from"../../../../../core/maybe.js";import{isAborted as i,throwIfAborted as o}from"../../../../../core/promiseUtils.js";import{property as l}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import{subclass as c}from"../../../../../core/accessorSupport/decorators/subclass.js";import{create as h}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{d,e as u,t as m}from"../../../../../chunks/vec32.js";import{create as f}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as p,freeze as _}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{debugFlags as g}from"../../../support/debugFlags.js";import{glLayout as y}from"../../../support/buffer/glUtil.js";import v from"../../../webgl/RenderCamera.js";import{AsyncRenderPlugin as b}from"../../effects/RenderPlugin.js";import{DepthRange as I}from"../DepthRange.js";import{assert as C}from"../Util.js";import{InstanceData as D}from"./InstanceData.js";import{InstanceOctree as R}from"./InstanceOctree.js";import{LevelSelector as E}from"./LevelSelector.js";import{LodLevel as x}from"./LodLevel.js";import{getRenderInstanceDataLayout as S,RenderInstanceData as w}from"./RenderInstanceData.js";import{colorMixModes as L}from"../../materials/internal/MaterialUtil.js";import{encodeDoubleVec3 as j}from"../../materials/renderers/utils.js";import{DefaultMaterialDrawParameters as U}from"../../shaders/DefaultMaterialTechnique.js";import{defaultHighlightName as T}from"../../../../support/HighlightDefaults.js";import{TaskPriority as O,noBudget as A}from"../../../../support/Scheduler.js";import{bindVertexBufferLayout as M}from"../../../../webgl/Util.js";import{fromLayout as q}from"../../../../webgl/VertexAttributeLocations.js";const B=e=>{const t=e.baseBoundingSphere.radius,s=e.levels.map(e=>e.minScreenSpaceRadius);return new E(t,s)};let F=class extends b{constructor(e,t){super(e),this.type=6,this.isGround=!1,this._levels=[],this._defaultRenderInstanceData=new Array,this._highlightRenderInstanceDatas=new Map,this._instanceIndex=0,this._cycleStartIndex=0,this._slicePlane=!1,this._camera=new v,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this.produces=new Map([[2,e=>this._produces(e)],[4,e=>!!this._hasTransparentLevels()&&this._produces(e)]]),this._instanceData=new D({shaderTransformation:e.shaderTransformation},e.symbol.materialParameters),this.addHandles(t.registerTask(O.LOD_RENDERER,this))}initialize(){this._instanceBufferLayout=S(this.symbol.materialParameters),this._glInstanceBufferLayout=y(this._instanceBufferLayout,1),this.addHandles([this._instanceData.events.on("instances-changed",()=>this._requestUpdateCycle()),this._instanceData.events.on("instance-transform-changed",({index:e})=>{this._requestUpdateCycle(),this.metadata.notifyGraphicGeometryChanged(e)}),this._instanceData.events.on("instance-visibility-changed",({index:e})=>{this._requestUpdateCycle(!0),this.metadata.notifyGraphicVisibilityChanged(e)}),this._instanceData.events.on("instance-highlight-changed",()=>this._requestUpdateCycle(!0))])}get _allRenderInstanceData(){return[this._defaultRenderInstanceData,...this._highlightRenderInstanceDatas.values()]}get _allRenderInstanceDataExceptHighlightShadow(){const e=[this._defaultRenderInstanceData];for(const t of this._highlightRenderInstanceDatas)t[0]!==T&&e.push(t[1]);return e}hasHighlight(e){return this._highlightRenderInstanceDatas.has(e)}get _enableLevelSelection(){return this.symbol.levels.length>1}get levels(){return this._levels}get baseBoundingBox(){return this._levels[this._levels.length-1].boundingBox}get baseBoundingSphere(){return this._levels[this._levels.length-1].boundingSphere}get baseMaterial(){return this._levels[this._levels.length-1].components[0].material}get slicePlaneEnabled(){return this._slicePlane}set slicePlaneEnabled(e){this._slicePlane=e}get layerViewUid(){return this.metadata.layerViewUid}get instanceData(){return this._instanceData}get hasEmissions(){return this._levels.some(e=>e.components.some(e=>e.material.hasEmissions))}get usedMemory(){return this._allRenderInstanceData.reduce((e,t)=>t.reduce((e,t)=>e+t.usedMemory,e),this._levels.reduce((e,t)=>e+t.components.reduce((e,t)=>e+t.usedMemory,0),0))}get renderStats(){const e=this._instanceData.size,t=[];return this._levels.forEach((e,s)=>{const r=this._allRenderInstanceData[0][s].size+this._allRenderInstanceData[1][s].size,n=e.triangleCount;t.push({renderedInstances:r,renderedTriangles:r*n,trianglesPerInstance:n})}),{totalInstances:e,renderedInstances:t.reduce((e,t)=>e+t.renderedInstances,0),renderedTriangles:t.reduce((e,t)=>e+t.renderedTriangles,0),levels:t}}_createRenderInstanceDataArray(){const{rctx:e}=this._context.renderContext;return this.symbol.levels.map(t=>new w(e,this._instanceBufferLayout))}async initializeRenderContext(e,s){this._context=e,this._defaultRenderInstanceData=this._createRenderInstanceDataArray();const r=await Promise.allSettled(this.symbol.levels.map(t=>x.create(e,t,s))),n=r.map(e=>"fulfilled"===e.status?e.value:null).filter(t);if(i(s)||n.length!==r.length){n.forEach(e=>e.destroy()),o(s);for(const e of r)if("rejected"===e.status)throw e.reason}this._levels=n,this._levelSelector=B(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach(e=>e.destroy()),this._defaultRenderInstanceData.forEach(e=>e.destroy()),this._highlightRenderInstanceDatas.forEach(e=>e.forEach(e=>e.destroy()))}_hasTransparentLevels(){return this._levels.some(e=>e.components.some(e=>{const t=e.material.produces.get(4);return t?.(0)}))}hasHighlights(){return r(this._highlightRenderInstanceDatas,e=>e.some(e=>e.size>0))}_produces(e){return(8!==e||this.hasHighlights())&&(5!==e||this.hasHighlight(T))}prepareRender(e){if(!g.LOD_INSTANCE_RENDERER_DISABLE_UPDATES){if(this._enableLevelSelection){const t=e.bind.contentCamera.equals(this._camera);this._camera.copyFrom(e.bind.contentCamera),t||this._requestUpdateCycle()}this._needFullCycle&&(this.runTask(A),this._needFullCycle=!1)}}acquireTechniques(e){if(!this.baseMaterial.visible||!this.baseMaterial.isVisibleForOutput(e.output))return null;const t=this._getInstanceDatas(e);if(!t)return null;const s=new Array,r=this.levels;return t.forEach(t=>r.forEach(({components:r},n)=>r.forEach(r=>s.push(this._beginComponent(e,t[n],r))))),s}render(e,t){const s=this._getInstanceDatas(e);if(!s||null==t)return;let r=0;const n=this.levels;s.forEach(s=>n.forEach(({components:n},a)=>n.forEach(n=>this._renderComponent(e,t[r++],s[a],n,a)))),e.rctx.unbindBuffer(34962),e.rctx.bindVAO(null)}_getInstanceDatas(e){const{output:t,bind:s}=e,r=8===t,n=5===t,a=6!==t;if(!r&&!n)return a?this._allRenderInstanceData:this._allRenderInstanceDataExceptHighlightShadow;const{_highlightRenderInstanceDatas:i}=this;if(a){if(r){const e=s.highlight?.name;if(!e)return null;const t=i.get(e);return t?[t]:null}const e=i.get(T);return n?e?[e]:null:Array.from(i.values())}return null}intersect(e,t,s,r){if(!this.baseMaterial.visible||null==this._octree)return;const n=f();d(n,r,s);const a=n=>{this._instanceData.getCombinedModelTransform(n,N),e.transform.set(N),m(W,s,e.transform.inverse),m(k,r,e.transform.inverse);const a=this._instanceData.getState(n),i=this._instanceData.getLodLevel(n),o=this._levels.length;C(!!(18&a),"invalid instance state"),C(i>=0&&i<o,"invaid lod level"),this._levels[i].intersect(e,t,W,k,n,this.metadata,o)};this.baseMaterial.parameters.verticalOffset?this._octree.forEach(a):this._octree.forEachAlongRay(s,n,a)}notifyShaderTransformationChanged(){this._invalidateOctree(),this._requestUpdateCycle()}get _octree(){if(null==this._octreeCached){const e=this._instanceData,t=e.view?.state;if(!t)return null;this._octreeCached=new R(e,this.baseBoundingSphere);for(let s=0;s<e.capacity;++s)18&t.get(s)&&this._octreeCached.addInstance(s)}return this._octreeCached}_invalidateOctree(){this._octreeCached=a(this._octreeCached)}queryDepthRange(e){if(null==this._octree)return new I;const t=e.viewForward,s=this._octree.findClosest(t,1,e.frustum),r=this._octree.findClosest(t,-1,e.frustum);if(null==s||null==r)return new I;const n=e.eye,a=this._instanceData.view;a.boundingSphere.getVec(s,z),d(z,z,n);const i=u(z,t)-z[3];a.boundingSphere.getVec(r,z),d(z,z,n);const o=u(z,t)+z[3];return new I(i,o)}_requestUpdateCycle(e=!1){this._updateCyclesWithStaticCamera=-1,this._cycleStartIndex=this._instanceIndex,e&&(this._needFullCycle=!0,this._context.requestRender())}_startUpdateCycle(){this._updateCyclesWithStaticCamera++,this._allRenderInstanceData.forEach(e=>e.forEach(e=>e.startUpdateCycle()))}get readyToRun(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}runTask(e){const{_enableLevelSelection:t,_camera:r,_levelSelector:a}=this;this._allRenderInstanceData.forEach(e=>e.forEach(e=>e.beginUpdate()));const i=this._instanceData,o=i.view;let l=i.size;const c=i.capacity;let h=this._instanceIndex;const d=Math.ceil(c/500),{_highlightRenderInstanceDatas:u}=this;for(let m=0;m<l&&!e.done;++m){h===this._cycleStartIndex&&this._startUpdateCycle();const m=o.state.get(h);let f=0;if(!(1&m)){h=h+1===c?0:h+1,l++;continue}const p=o.lodLevel.get(h);if(2&m&&this._defaultRenderInstanceData[p].freeTail(),16&m){const e=i.geHighlightOptionsPrev(h);if(e){const t=u.get(e);if(!t)throw new s("internal:lod-renderer","Internal error in lodRenderer");t[p].freeTail(),t.every(e=>e.isEmpty)&&(t.forEach(e=>e.destroy()),u.delete(e))}}if(32&m)i.freeInstance(h);else if(4&m){let e=0;if(t&&(o.modelOrigin.getVec(h,V),e=a.selectLevel(V,i.getCombinedMedianScaleFactor(h),r)),f=-83&m,e>=0)if(8&m){const t=i.getHighlightName(h);if(t){const r=()=>{const e=this._createRenderInstanceDataArray();return e.forEach(e=>e.beginUpdate()),e},a=n(u,t,r);if(e>=a.length)throw new s("internal:lod-renderer",`LodRenderer internal error - missing lodLevel ${e}`);H(a[e],o,h)}f|=16}else H(this._defaultRenderInstanceData[e],o,h),f|=2;o.state.set(h,f),o.lodLevel.set(h,e)}else f=-83&m,o.state.set(h,f);if(null!=this._octreeCached){const e=!!(18&m),t=!!(18&f);!e&&t?this._octreeCached.addInstance(h):e&&!t?this._octreeCached.removeInstance(h):e&&t&&64&m&&(this._octreeCached.removeInstance(h),this._octreeCached.addInstance(h))}h=h+1===c?0:h+1,h%d===0&&e.madeProgress()}this._instanceIndex=h,this._allRenderInstanceData.forEach(e=>e.forEach(e=>e.endUpdate())),this._context.requestRender()}_beginComponent(e,t,s){if(0===t.size)return null;const r=s.glMaterials.load(e.rctx,e.bind.slot,e.output);return r?.beginSlot(e.bind)}_renderComponent(e,t,s,r,n){if(!t)return;const{bind:a,rctx:i}=e;i.runAppleAmdDriverHelper();const o=i.bindTechnique(t,a,r.material.parameters,Y),l=this._glInstanceBufferLayout;o.assertCompatibleVertexAttributeLocations(r.vao,q(l)),i.bindVAO(r.vao),g.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&0===e.output&&(o.setUniform4fv("externalColor",G[Math.min(n,G.length-1)]),o.setUniform1i("symbolColorMixMode",L.replace));const c=s.capacity,h=s.headIndex,d=s.tailIndex,u=s.firstIndex,m=(e,n)=>{M(i,o.locations,s.buffer,e),i.drawArraysInstanced(t.primitiveType,0,r.numVertices,n-e)};r.material.transparent&&null!=u?h>d?(C(u>=d&&u<=h,"invalid firstIndex"),m(u,h),m(d,u)):h<d&&(u<=h?(C(u>=0&&u<=h,"invalid firstIndex"),m(u,h),m(d,c),m(0,u)):(C(u>=d&&u<=c,"invalid firstIndex"),m(u,c),m(0,h),m(d,u))):h>d?m(d,h):h<d&&(m(0,h),m(d,c))}};function H(e,t,s){const r=e.allocateHead();P(t,s,e.view,r)}function P(e,t,s,r){j(e.modelOrigin,t,s.modelOriginHi,s.modelOriginLo,r),s.model.copyFrom(r,e.model,t),s.modelNormal.copyFrom(r,e.modelNormal,t),e.color&&s.color&&s.color.copyFrom(r,e.color,t),e.olidColor&&s.olidColor&&s.olidColor.copyFrom(r,e.olidColor,t),e.featureAttribute&&s.featureAttribute&&s.featureAttribute.copyFrom(r,e.featureAttribute,t)}e([l({constructOnly:!0})],F.prototype,"symbol",void 0),e([l({constructOnly:!0})],F.prototype,"metadata",void 0),e([l({constructOnly:!0})],F.prototype,"shaderTransformation",void 0),e([l()],F.prototype,"_instanceData",void 0),e([l()],F.prototype,"_cycleStartIndex",void 0),e([l({readOnly:!0})],F.prototype,"_enableLevelSelection",null),e([l()],F.prototype,"_updateCyclesWithStaticCamera",void 0),e([l({readOnly:!0})],F.prototype,"readyToRun",null),F=e([c("esri.views.3d.webgl-engine.lib.lodRendering.LodRenderer")],F);const V=f(),z=p(),N=h(),W=f(),k=f(),G=[_(1,0,1,1),_(0,0,1,1),_(0,1,0,1),_(1,1,0,1),_(1,0,0,1)],Y=new U;export{F as LodRenderer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{reallocShrinkThreshold as t,reallocGrowthFactor as i,reallocShrinkFactor as e}from"../../../../../core/arrayUtils.js";import{BufferViewVec4f as s,BufferViewVec4u8 as a}from"../../../../../geometry/support/buffer/BufferView.js";import{newLayout as n}from"../../../support/buffer/InterleavedLayout.js";import{assert as r}from"../Util.js";import h from"./BackedBufferObject.js";import{addOptionalLayoutFields as d,initialCapacity as _}from"./InstanceData.js";class c{constructor(t){this.model=t.instanceModel,this.modelNormal=t.instanceModelNormal,this.modelOriginHi=t.instanceModelOriginHi,this.modelOriginLo=t.instanceModelOriginLo,this.featureAttribute=t.getField("instanceFeatureAttribute",s),this.color=t.getField("instanceColor",a),this.olidColor=t.getField("instanceOlidColor",a)}}class o{constructor(t,i){this._rctx=t,this._layout=i,this._headIndex=0,this._tailIndex=0,this._firstIndex=null,this._captureFirstIndex=!0,this._updating=!1,this._prevHeadIndex=0,this._resized=!1,this._capacity=1}destroy(){this._buffer&&this._buffer.destroy()}get buffer(){return this._buffer.buffer}get view(){return this._view}get capacity(){return this._capacity}get size(){const t=this._headIndex,i=this._tailIndex;return t>=i?t-i:t+this._capacity-i}get isEmpty(){return this._headIndex===this._tailIndex}get isFull(){return this._tailIndex===(this._headIndex+1)%this._capacity}get headIndex(){return this._headIndex}get tailIndex(){return this._tailIndex}get firstIndex(){return this._firstIndex}get usedMemory(){return this._buffer?.usedMemory??0}reset(){this._headIndex=0,this._tailIndex=0,this._firstIndex=null}startUpdateCycle(){this._captureFirstIndex=!0}beginUpdate(){r(!this._updating,"already updating"),this._updating=!0,this._prevHeadIndex=this._headIndex}endUpdate(){r(this._updating,"not updating"),this.size<t*this.capacity&&this._shrink(),this._resized?(this._buffer.transferAll(),this._resized=!1):this._transferRange(this._prevHeadIndex,this._headIndex),this._updating=!1}allocateHead(){r(this._updating,"not updating"),this.isFull&&this._grow();const t=this.headIndex;return this._captureFirstIndex&&(this._firstIndex=t,this._captureFirstIndex=!1),this._incrementHead(),r(this._headIndex!==this._tailIndex,"invalid pointers"),t}freeTail(){r(this._updating,"not updating"),r(this.size>0,"invalid size");const t=this._tailIndex===this._firstIndex;this._incrementTail(),t&&(this._firstIndex=this._tailIndex)}_grow(){const t=Math.max(_,Math.floor(this._capacity*i));this._resize(t)}_shrink(){const t=Math.max(_,Math.floor(this._capacity*e));this._resize(t)}_resize(t){if(r(this._updating,"not updating"),t===this._capacity)return;const i=new h(this._rctx,this._layout.stride,t);if(this._buffer){this._firstIndex&&(this._firstIndex=(this._firstIndex+this._capacity-this._tailIndex)%this._capacity);const t=this.size,e=this._compactInstances(i);r(e===t,"invalid compaction"),this._buffer.destroy(),this._tailIndex=0,this._headIndex=e,this._prevHeadIndex=0}this._resized=!0,this._capacity=t,this._buffer=i,this._view=new c(this._layout.createView(this._buffer.array))}_compactInstances(t){const i=this._headIndex,e=this._tailIndex;return e<i?(this._buffer.copyRange(e,i,t),i-e):e>i?(this._buffer.copyRange(e,this._capacity,t),i>0&&this._buffer.copyRange(0,i,t,this._capacity-e),i+(this._capacity-e)):0}_incrementHead(t=1){this._headIndex=(this._headIndex+t)%this._capacity}_incrementTail(t=1){this._tailIndex=(this._tailIndex+t)%this._capacity}_transferRange(t,i){t<i?this._buffer.transferRange(t,i):t>i&&(i>0&&this._buffer.transferRange(0,i),this._buffer.transferRange(t,this._capacity))}}const f=n().vec3f("instanceModelOriginHi").vec3f("instanceModelOriginLo").mat3f("instanceModel").mat3f("instanceModelNormal");function u(t){return d(f.clone(),t)}export{o as RenderInstanceData,c as RenderInstanceDataView,u as getRenderInstanceDataLayout};
5
+ import{reallocShrinkThreshold as t,reallocGrowthFactor as i,reallocShrinkFactor as e}from"../../../../../core/arrayUtils.js";import{BufferViewVec4f as s,BufferViewVec4u8 as a}from"../../../../../geometry/support/buffer/BufferView.js";import{newLayout as n}from"../../../support/buffer/InterleavedLayout.js";import{assert as r}from"../Util.js";import{BackedBufferObject as h}from"./BackedBufferObject.js";import{addOptionalLayoutFields as d,initialCapacity as _}from"./InstanceData.js";class c{constructor(t){this.model=t.instanceModel,this.modelNormal=t.instanceModelNormal,this.modelOriginHi=t.instanceModelOriginHi,this.modelOriginLo=t.instanceModelOriginLo,this.featureAttribute=t.getField("instanceFeatureAttribute",s),this.color=t.getField("instanceColor",a),this.olidColor=t.getField("instanceOlidColor",a)}}class o{constructor(t,i){this._rctx=t,this._layout=i,this._headIndex=0,this._tailIndex=0,this._firstIndex=null,this._captureFirstIndex=!0,this._updating=!1,this._prevHeadIndex=0,this._resized=!1,this._capacity=1}destroy(){this._buffer&&this._buffer.destroy()}get buffer(){return this._buffer.buffer}get view(){return this._view}get capacity(){return this._capacity}get size(){const t=this._headIndex,i=this._tailIndex;return t>=i?t-i:t+this._capacity-i}get isEmpty(){return this._headIndex===this._tailIndex}get isFull(){return this._tailIndex===(this._headIndex+1)%this._capacity}get headIndex(){return this._headIndex}get tailIndex(){return this._tailIndex}get firstIndex(){return this._firstIndex}get usedMemory(){return this._buffer?.usedMemory??0}reset(){this._headIndex=0,this._tailIndex=0,this._firstIndex=null}startUpdateCycle(){this._captureFirstIndex=!0}beginUpdate(){r(!this._updating,"already updating"),this._updating=!0,this._prevHeadIndex=this._headIndex}endUpdate(){r(this._updating,"not updating"),this.size<t*this.capacity&&this._shrink(),this._resized?(this._buffer.transferAll(),this._resized=!1):this._transferRange(this._prevHeadIndex,this._headIndex),this._updating=!1}allocateHead(){r(this._updating,"not updating"),this.isFull&&this._grow();const t=this.headIndex;return this._captureFirstIndex&&(this._firstIndex=t,this._captureFirstIndex=!1),this._incrementHead(),r(this._headIndex!==this._tailIndex,"invalid pointers"),t}freeTail(){r(this._updating,"not updating"),r(this.size>0,"invalid size");const t=this._tailIndex===this._firstIndex;this._incrementTail(),t&&(this._firstIndex=this._tailIndex)}_grow(){const t=Math.max(_,Math.floor(this._capacity*i));this._resize(t)}_shrink(){const t=Math.max(_,Math.floor(this._capacity*e));this._resize(t)}_resize(t){if(r(this._updating,"not updating"),t===this._capacity)return;const i=new h(this._rctx,this._layout,t);if(this._buffer){this._firstIndex&&(this._firstIndex=(this._firstIndex+this._capacity-this._tailIndex)%this._capacity);const t=this.size,e=this._compactInstances(i);r(e===t,"invalid compaction"),this._buffer.destroy(),this._tailIndex=0,this._headIndex=e,this._prevHeadIndex=0}this._resized=!0,this._capacity=t,this._buffer=i,this._view=new c(this._layout.createView(this._buffer.array))}_compactInstances(t){const i=this._headIndex,e=this._tailIndex;return e<i?(this._buffer.copyRange(e,i,t),i-e):e>i?(this._buffer.copyRange(e,this._capacity,t),i>0&&this._buffer.copyRange(0,i,t,this._capacity-e),i+(this._capacity-e)):0}_incrementHead(t=1){this._headIndex=(this._headIndex+t)%this._capacity}_incrementTail(t=1){this._tailIndex=(this._tailIndex+t)%this._capacity}_transferRange(t,i){t<i?this._buffer.transferRange(t,i):t>i&&(i>0&&this._buffer.transferRange(0,i),this._buffer.transferRange(t,this._capacity))}}const f=n().vec3f("instanceModelOriginHi").vec3f("instanceModelOriginLo").mat3f("instanceModel").mat3f("instanceModelNormal");function u(t){return d(f.clone(),t)}export{o as RenderInstanceData,c as RenderInstanceDataView,u as getRenderInstanceDataLayout};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{removeUnordered as r,filterInPlace as o}from"../../../../../core/arrayUtils.js";import{nextHighestPowerOfTwo as s}from"../../../../../core/mathUtils.js";import{NestedMap as n}from"../../../../../core/NestedMap.js";import i from"../../../../../core/PooledArray.js";import{property as a}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import{subclass as l}from"../../../../../core/accessorSupport/decorators/subclass.js";import{copy as u,invert as f,transpose as c}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as h}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{glLayout as d}from"../../../support/buffer/glUtil.js";import{assert as m}from"../../lib/Util.js";import{BufferRange as g,mergeAdjacentRanges as p}from"./BufferRange.js";import{Instance as y}from"./Instance.js";import{PerBufferData as b,hasVao as _}from"./PerBufferData.js";import{PerOriginData as v}from"./PerOriginData.js";let w=class extends t{constructor(e){super(e),this._vaoCache=null,this._bufferWriter=null,this._useMetalWorkaround=!1,this._hasOccludees=!1}destroy(){this.uninitializeRenderContext()}initializeRenderContext(e){this._useMetalWorkaround=e.renderContext.rctx.isAssumedMetalDriver,this._bufferWriter=this.material.createBufferWriter(),this._vaoCache=e.renderContext.rctx.getVaoCache(d(this._bufferWriter.layout))}uninitializeRenderContext(){this._useMetalWorkaround=!1,this._bufferWriter=null,this._vaoCache=null}get hasOccludees(){return this._hasOccludees}modify(e,t){this._applyUpdates(e,t),this._applyAddsAndRemoves(e),this._updateDrawCommands()}get canCompact(){for(const e of this.dataByOrigin.values())if(e.buffers.some(e=>e.holes.length>1))return!0;return!1}compact(e){if(!this.canCompact)return!1;let t=!1;for(const r of this.dataByOrigin.values()){const o=new Array;for(let t=0;t<r.buffers.length&&!e.done;){const s=r.buffers[t];s.holes.length<=1?++t:(s.instances.forEach(({geometry:e})=>o.push(e)),this._vaoCache.deleteVao(s.vao),r.buffers[t]=r.buffers[r.buffers.length-1],--r.buffers.length,e.madeProgress())}if(o.length>0){for(r.buffers.forEach(e=>this._applyAdds(e,o));o.length>0;)r.buffers.push(this._applyAndRebuild(new b,o,null));t=!0}}return t}updateHighlights(e){this.highlightOrderMap=e,this.dataByOrigin.forEach(t=>t.buffers.forEach(t=>t.updateHighlights(e)))}_applyUpdates(e,t){const o=this._bufferWriter;if(null==o)return void e.clearUpdates();const s=o.layout.stride/4;for(const n of e.updates){if(t.done)return;const{renderGeometry:i,updateType:a}=n;r(e.pending.updates,n),t.madeProgress();const l=this.dataByOrigin.get(i.localOrigin.id),u=l?.findBuffer(i.id);if(null==u)return;const f=u.instances.get(i.id);if(6&a){const e=k(o.elementCount(f.geometry.geometry.attributes)*s),t=o.layout.createView(e.buffer);this._writeGeometry(i,t,0),u.vao.buffer()?.buffer.setSubData(e,f.from*s,0,f.numElements*s)}25&a&&(u.drawCommandsDirty=!0)}}_computeDeltas(e,t){const r=new n;for(const o of e){const e=o.localOrigin;if(null==e)continue;let t=r.get(e.id,null);null==t&&(t=new C(e.vec3),r.set(e.id,null,t)),t.changes.push(o)}for(const o of t){const e=o.localOrigin;if(null==e)continue;const t=this.dataByOrigin.get(e.id),s=t?.findBuffer(o.id);if(null==s)continue;let n=r.get(e.id,s);null==n&&(n=new C(e.vec3),r.set(e.id,s,n)),n.changes.push(o)}return r}_applyAddsAndRemoves(e){const{_bufferWriter:t,dataByOrigin:o,_vaoCache:s}=this;if(null==t||null==s)return void e.clearAddsAndRemoves();const n=t.layout.stride/4,i=this._computeDeltas(e.adds,e.removes);i.forEach((e,a)=>{const l=e.get(null),u=l?.changes??[];i.delete(a,null);let f=o.get(a);if(e.forEach((e,l)=>{if(i.delete(a,l),null==l&&m(!1,"No VAO for removed geometries"),l.instances.size===e.changes.length)return s.deleteVao(l.vao),r(f.buffers,l),void(0===f.buffers.length&&0===u.length&&o.delete(a));const c=l.numElements,h=l.vao.getByteLength("geometry")/4,d=u.reduce((e,r)=>e+t.elementCount(r.geometry.attributes),0),g=e.changes.reduce((e,r)=>e+t.elementCount(r.geometry.attributes),0),p=Math.min((c+d-g)*n,R),y=p>h;p>E&&p<h/2?(e.changes.forEach(({id:e})=>l.deleteInstance(e)),l.instances.forEach(({geometry:e})=>u.push(e)),this._vaoCache.deleteVao(l.vao),r(f.buffers,l)):y?this._applyAndRebuild(l,u,e):this._applyRemoves(l,e)}),u.length>0)for(null==f&&(f=new v(l.origin),o.set(a,f)),f.buffers.forEach(e=>this._applyAdds(e,u));u.length>0;)f.buffers.push(this._applyAndRebuild(new b,u,null))}),e.clearAddsAndRemoves()}_updateDrawCommands(){this._hasOccludees=!1,this.dataByOrigin.forEach(e=>{e.buffers.forEach(e=>{e.updateIfDrawCommandsDirty(this.highlightOrderMap,this._bufferWriter.layout.stride),this._hasOccludees||=e.hasOccludees})})}_applyAndRebuild(e,t,r){if(r)for(const d of r.changes)e.deleteInstance(d.id);const o=this._bufferWriter,s=o.layout.stride,n=s/4,i=Math.floor(R/n);let a=e.numElements;for(;t.length>0;){const r=t.pop(),s=o.elementCount(r.geometry.attributes);if(a+s>i&&a>0){t.push(r);break}a+=s;const n=new y(r,0,0,this.highlightOrderMap);m(null==e.instances.get(r.id)),e.addInstance(r.id,n)}const l=a*n,u=k(l),f=o.layout.createView(u.buffer);let c=0;e.resetInstanceSummary(),e.instances.forEach((t,r)=>{this._writeGeometry(t.geometry,f,c);const s=c;c+=o.elementCount(t.geometry.geometry.attributes),e.updateInstance(r,s,c),e.updateDrawState(t)}),this._vaoCache.deleteVao(e.vao),e.vao=this._vaoCache.newVao(V(l)),e.vao.buffer()?.buffer.setSubData(u,0,0,c*n),e.holes.clear();const h=e.holes.pushNew();return h.from=c,h.to=Math.floor(e.vao.getByteLength("geometry")/s),e.updateDrawCommands(this.highlightOrderMap,s),e}_applyRemoves(e,t){if(0===t.changes.length||null==this._bufferWriter)return;let r=1/0,o=-1/0;for(const i of t.changes){const t=i.id,s=e.instances.get(t);if(!s)continue;e.deleteInstance(t),this._useMetalWorkaround&&(r=Math.min(r,s.from),o=Math.max(o,s.to));const n=W.back();if(n){if(n.to===s.from){n.to=s.to;continue}if(n.from===s.to){n.from=s.from;continue}}const a=W.pushNew();a.from=s.from,a.to=s.to}p(W);const s=this._bufferWriter.layout.stride/4,n=e.vao.buffer()?.buffer;if(this._useMetalWorkaround){const t=(o-r)*s,i=k(t),a=this._bufferWriter.layout.createView(i.buffer);i.fill(0,0,t),e.instances.forEach(e=>{if(!(e.from>=r&&e.to<=o))return;const t=e.from-r;this._writeGeometry(e.geometry,a,t)}),n?.setSubData(i,r*s,0,t)}else{const e=W.reduce((e,t)=>Math.max(e,t.numElements),0)*s,t=k(e);t.fill(0,0,e),W.forAll(e=>n?.setSubData(t,e.from*s,0,e.numElements*s))}e.holes.pushArray(W.data,W.length),W.forAll((e,t)=>W.data[t]=null),W.clear(),e.drawCommandsDirty=!0}_applyAdds(e,t){if(0===t.length||null==this._bufferWriter)return;if(!_(e))return void this._applyAndRebuild(e,t,null);const r=this._bufferWriter,s=r.layout.stride/4,n=e.numElements,i=t.reduce((e,t)=>e+r.elementCount(t.geometry.attributes),0),a=Math.min((n+i)*s,R),l=4*a;if(e.vao.getByteLength("geometry")<V(R-E)&&l>e.vao.getByteLength("geometry"))return void this._applyAndRebuild(e,t,null);p(e.holes);const u=new Array;let f=1/0,c=-1/0;for(const o of t){const t=r.elementCount(o.geometry.attributes),s=A(e.holes,t);u.push(s),this._useMetalWorkaround&&null!=s&&(f=Math.min(s,f),c=Math.max(s+t,c))}const h=e.vao.buffer()?.buffer;let d=0,g=0,b=0;const v=this._useMetalWorkaround?k((c-f)*s):k(a),w=r.layout.createView(v.buffer);if(t.forEach((t,o)=>{const n=u[o];if(null==n)return;const i=r.elementCount(t.geometry.attributes);if(!this._useMetalWorkaround){if(!(b===n)){const e=b-g;e>0&&h?.setSubData(v,g*s,0,e*s),g=n,d=0}this._writeGeometry(t,w,d),d+=i,b=n+i}const a=new y(t,n,n+i,this.highlightOrderMap);m(null==e.instances.get(t.id)),e.addInstance(t.id,a),e.drawCommandsDirty=!0}),this._useMetalWorkaround){const t=(c-f)*s;v.fill(0,0,t),e.instances.forEach(e=>{if(!(e.from>=f&&e.to<=c))return;const t=e.from-f;this._writeGeometry(e.geometry,w,t)}),g=f,b=c}const C=b-g;C>0&&h?.setSubData(v,g*s,0,C*s),o(t,(e,t)=>null==u[t])}_writeGeometry(e,t,r){null!=this._bufferWriter&&(u(M,e.transformation),M[12]-=e.localOrigin.vec3[0],M[13]-=e.localOrigin.vec3[1],M[14]-=e.localOrigin.vec3[2],f(O,M),c(O,O),this._bufferWriter.write(M,O,e.geometry.attributes,e.geometry.olidColor,t,r))}static prune(){x=new Float32Array(E)}};e([a({constructOnly:!0})],w.prototype,"dataByOrigin",void 0),e([a({constructOnly:!0})],w.prototype,"material",void 0),e([a()],w.prototype,"highlightOrderMap",void 0),w=e([l("esri.views.3d.webgl-engine.materials.renderers.MergedBuffer")],w);class C{constructor(e){this.origin=e,this.changes=new Array}}function A(e,t){const r=e.find(e=>e.numElements>=t);if(null==r)return null;const o=r.from;return r.from+=t,r.from>=r.to&&e.removeUnordered(r),o}const M=h(),O=h(),W=new i({allocator:e=>e||new g,deallocator:null}),E=65536,D=4*E,B=1024,j=16777216,R=j/4;let x=new Float32Array(E);function k(e){return x.length<e&&(x=new Float32Array(e)),x}function V(e){const t=4*e;return t<=B?B:t<D?s(t):Math.max(Math.min(Math.ceil(1.5*t/D)*D,j),t)}export{w as MergedBuffer,V as sizeForVao};
5
+ import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{removeUnordered as r,filterInPlace as o}from"../../../../../core/arrayUtils.js";import{nextHighestPowerOfTwo as s}from"../../../../../core/mathUtils.js";import{NestedMap as n}from"../../../../../core/NestedMap.js";import i from"../../../../../core/PooledArray.js";import{property as a}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import{subclass as l}from"../../../../../core/accessorSupport/decorators/subclass.js";import{copy as u,invert as f,transpose as c}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as h}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{glLayout as d}from"../../../support/buffer/glUtil.js";import{assert as m}from"../../lib/Util.js";import{BufferRange as g,mergeAdjacentRanges as p}from"./BufferRange.js";import{Instance as y}from"./Instance.js";import{PerBufferData as b,hasVao as _}from"./PerBufferData.js";import{PerOriginData as v}from"./PerOriginData.js";let w=class extends t{constructor(e){super(e),this._vaoCache=null,this._bufferWriter=null,this._useMetalWorkaround=!1,this._hasOccludees=!1}destroy(){this.uninitializeRenderContext()}initializeRenderContext(e){this._useMetalWorkaround=e.renderContext.rctx.isAssumedMetalDriver,this._bufferWriter=this.material.createBufferWriter(),this._vaoCache=e.renderContext.rctx.getVaoCache(d(this._bufferWriter.layout))}uninitializeRenderContext(){this._useMetalWorkaround=!1,this._bufferWriter=null,this._vaoCache=null}get hasOccludees(){return this._hasOccludees}modify(e,t){this._applyUpdates(e,t),this._applyAddsAndRemoves(e),this._updateDrawCommands()}get canCompact(){for(const e of this.dataByOrigin.values())if(e.buffers.some(e=>e.holes.length>1))return!0;return!1}compact(e){if(!this.canCompact)return!1;let t=!1;for(const r of this.dataByOrigin.values()){const o=new Array;for(let t=0;t<r.buffers.length&&!e.done;){const s=r.buffers[t];s.holes.length<=1?++t:(s.instances.forEach(({geometry:e})=>o.push(e)),this._vaoCache.deleteVao(s.vao),r.buffers[t]=r.buffers[r.buffers.length-1],--r.buffers.length,e.madeProgress())}if(o.length>0){for(r.buffers.forEach(e=>this._applyAdds(e,o));o.length>0;)r.buffers.push(this._applyAndRebuild(new b,o,null));t=!0}}return t}updateHighlights(e){this.highlightOrderMap=e,this.dataByOrigin.forEach(t=>t.buffers.forEach(t=>t.updateHighlights(e)))}_applyUpdates(e,t){const o=this._bufferWriter;if(null==o)return void e.clearUpdates();const s=o.layout.stride/4;for(const n of e.updates){if(t.done)return;const{renderGeometry:i,updateType:a}=n;r(e.pending.updates,n),t.madeProgress();const l=this.dataByOrigin.get(i.localOrigin.id),u=l?.findBuffer(i.id);if(null==u)return;const f=u.instances.get(i.id);if(6&a){const e=k(o.elementCount(f.geometry.geometry.attributes)*s),t=o.layout.createView(e.buffer);this._writeGeometry(i,t,0),u.vao.buffer()?.setSubData(e,f.from*s,0,f.numElements*s)}25&a&&(u.drawCommandsDirty=!0)}}_computeDeltas(e,t){const r=new n;for(const o of e){const e=o.localOrigin;if(null==e)continue;let t=r.get(e.id,null);null==t&&(t=new C(e.vec3),r.set(e.id,null,t)),t.changes.push(o)}for(const o of t){const e=o.localOrigin;if(null==e)continue;const t=this.dataByOrigin.get(e.id),s=t?.findBuffer(o.id);if(null==s)continue;let n=r.get(e.id,s);null==n&&(n=new C(e.vec3),r.set(e.id,s,n)),n.changes.push(o)}return r}_applyAddsAndRemoves(e){const{_bufferWriter:t,dataByOrigin:o,_vaoCache:s}=this;if(null==t||null==s)return void e.clearAddsAndRemoves();const n=t.layout.stride/4,i=this._computeDeltas(e.adds,e.removes);i.forEach((e,a)=>{const l=e.get(null),u=l?.changes??[];i.delete(a,null);let f=o.get(a);if(e.forEach((e,l)=>{if(i.delete(a,l),null==l&&m(!1,"No VAO for removed geometries"),l.instances.size===e.changes.length)return s.deleteVao(l.vao),r(f.buffers,l),void(0===f.buffers.length&&0===u.length&&o.delete(a));const c=l.numElements,h=l.vao.getByteLength("geometry")/4,d=u.reduce((e,r)=>e+t.elementCount(r.geometry.attributes),0),g=e.changes.reduce((e,r)=>e+t.elementCount(r.geometry.attributes),0),p=Math.min((c+d-g)*n,R),y=p>h;p>E&&p<h/2?(e.changes.forEach(({id:e})=>l.deleteInstance(e)),l.instances.forEach(({geometry:e})=>u.push(e)),this._vaoCache.deleteVao(l.vao),r(f.buffers,l)):y?this._applyAndRebuild(l,u,e):this._applyRemoves(l,e)}),u.length>0)for(null==f&&(f=new v(l.origin),o.set(a,f)),f.buffers.forEach(e=>this._applyAdds(e,u));u.length>0;)f.buffers.push(this._applyAndRebuild(new b,u,null))}),e.clearAddsAndRemoves()}_updateDrawCommands(){this._hasOccludees=!1,this.dataByOrigin.forEach(e=>{e.buffers.forEach(e=>{e.updateIfDrawCommandsDirty(this.highlightOrderMap,this._bufferWriter.layout.stride),this._hasOccludees||=e.hasOccludees})})}_applyAndRebuild(e,t,r){if(r)for(const d of r.changes)e.deleteInstance(d.id);const o=this._bufferWriter,s=o.layout.stride,n=s/4,i=Math.floor(R/n);let a=e.numElements;for(;t.length>0;){const r=t.pop(),s=o.elementCount(r.geometry.attributes);if(a+s>i&&a>0){t.push(r);break}a+=s;const n=new y(r,0,0,this.highlightOrderMap);m(null==e.instances.get(r.id)),e.addInstance(r.id,n)}const l=a*n,u=k(l),f=o.layout.createView(u.buffer);let c=0;e.resetInstanceSummary(),e.instances.forEach((t,r)=>{this._writeGeometry(t.geometry,f,c);const s=c;c+=o.elementCount(t.geometry.geometry.attributes),e.updateInstance(r,s,c),e.updateDrawState(t)}),this._vaoCache.deleteVao(e.vao),e.vao=this._vaoCache.newVao(V(l)),e.vao.buffer()?.setSubData(u,0,0,c*n),e.holes.clear();const h=e.holes.pushNew();return h.from=c,h.to=Math.floor(e.vao.getByteLength("geometry")/s),e.updateDrawCommands(this.highlightOrderMap,s),e}_applyRemoves(e,t){if(0===t.changes.length||null==this._bufferWriter)return;let r=1/0,o=-1/0;for(const i of t.changes){const t=i.id,s=e.instances.get(t);if(!s)continue;e.deleteInstance(t),this._useMetalWorkaround&&(r=Math.min(r,s.from),o=Math.max(o,s.to));const n=W.back();if(n){if(n.to===s.from){n.to=s.to;continue}if(n.from===s.to){n.from=s.from;continue}}const a=W.pushNew();a.from=s.from,a.to=s.to}p(W);const s=this._bufferWriter.layout.stride/4,n=e.vao.buffer();if(this._useMetalWorkaround){const t=(o-r)*s,i=k(t),a=this._bufferWriter.layout.createView(i.buffer);i.fill(0,0,t),e.instances.forEach(e=>{if(!(e.from>=r&&e.to<=o))return;const t=e.from-r;this._writeGeometry(e.geometry,a,t)}),n?.setSubData(i,r*s,0,t)}else{const e=W.reduce((e,t)=>Math.max(e,t.numElements),0)*s,t=k(e);t.fill(0,0,e),W.forAll(e=>n?.setSubData(t,e.from*s,0,e.numElements*s))}e.holes.pushArray(W.data,W.length),W.forAll((e,t)=>W.data[t]=null),W.clear(),e.drawCommandsDirty=!0}_applyAdds(e,t){if(0===t.length||null==this._bufferWriter)return;if(!_(e))return void this._applyAndRebuild(e,t,null);const r=this._bufferWriter,s=r.layout.stride/4,n=e.numElements,i=t.reduce((e,t)=>e+r.elementCount(t.geometry.attributes),0),a=Math.min((n+i)*s,R),l=4*a;if(e.vao.getByteLength("geometry")<V(R-E)&&l>e.vao.getByteLength("geometry"))return void this._applyAndRebuild(e,t,null);p(e.holes);const u=new Array;let f=1/0,c=-1/0;for(const o of t){const t=r.elementCount(o.geometry.attributes),s=A(e.holes,t);u.push(s),this._useMetalWorkaround&&null!=s&&(f=Math.min(s,f),c=Math.max(s+t,c))}const h=e.vao.buffer();let d=0,g=0,b=0;const v=this._useMetalWorkaround?k((c-f)*s):k(a),w=r.layout.createView(v.buffer);if(t.forEach((t,o)=>{const n=u[o];if(null==n)return;const i=r.elementCount(t.geometry.attributes);if(!this._useMetalWorkaround){if(!(b===n)){const e=b-g;e>0&&h?.setSubData(v,g*s,0,e*s),g=n,d=0}this._writeGeometry(t,w,d),d+=i,b=n+i}const a=new y(t,n,n+i,this.highlightOrderMap);m(null==e.instances.get(t.id)),e.addInstance(t.id,a),e.drawCommandsDirty=!0}),this._useMetalWorkaround){const t=(c-f)*s;v.fill(0,0,t),e.instances.forEach(e=>{if(!(e.from>=f&&e.to<=c))return;const t=e.from-f;this._writeGeometry(e.geometry,w,t)}),g=f,b=c}const C=b-g;C>0&&h?.setSubData(v,g*s,0,C*s),o(t,(e,t)=>null==u[t])}_writeGeometry(e,t,r){null!=this._bufferWriter&&(u(M,e.transformation),M[12]-=e.localOrigin.vec3[0],M[13]-=e.localOrigin.vec3[1],M[14]-=e.localOrigin.vec3[2],f(O,M),c(O,O),this._bufferWriter.write(M,O,e.geometry.attributes,e.geometry.olidColor,t,r))}static prune(){x=new Float32Array(E)}};e([a({constructOnly:!0})],w.prototype,"dataByOrigin",void 0),e([a({constructOnly:!0})],w.prototype,"material",void 0),e([a()],w.prototype,"highlightOrderMap",void 0),w=e([l("esri.views.3d.webgl-engine.materials.renderers.MergedBuffer")],w);class C{constructor(e){this.origin=e,this.changes=new Array}}function A(e,t){const r=e.find(e=>e.numElements>=t);if(null==r)return null;const o=r.from;return r.from+=t,r.from>=r.to&&e.removeUnordered(r),o}const M=h(),O=h(),W=new i({allocator:e=>e||new g,deallocator:null}),E=65536,D=4*E,B=1024,j=16777216,R=j/4;let x=new Float32Array(E);function k(e){return x.length<e&&(x=new Float32Array(e)),x}function V(e){const t=4*e;return t<=B?B:t<D?s(t):Math.max(Math.min(Math.ceil(1.5*t/D)*D,j),t)}export{w as MergedBuffer,V as sizeForVao};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{MemCachePool as e}from"../../../../../core/MemCachePool.js";import{VertexArrayObject as t}from"../../lib/VertexArrayObject.js";import{BufferObject as r}from"../../../../webgl/BufferObject.js";import{VertexBuffer as o}from"../../../../webgl/VertexBuffer.js";class c{constructor(t,r){this._rctx=t,this._layout=r,this._cache=new e(t.newCache,"VAOCache")}dispose(){this._cache.destroy()}newVao(e){const c=e.toString();let s=this._cache.pop(c);return s||(s=new t(this._rctx,new o(this._layout,r.createVertex(this._rctx,35044))),s.buffer()?.buffer.setSize(e),s)}deleteVao(e){if(null==e)return;const t=e.getByteLength("geometry").toString();this._cache.put(t,e)}}export{c as VaoCache};
5
+ import{MemCachePool as t}from"../../../../../core/MemCachePool.js";import{VertexArrayObject as e}from"../../lib/VertexArrayObject.js";import{VertexBuffer as r}from"../../../../webgl/VertexBuffer.js";class o{constructor(e,r){this._rctx=e,this._layout=r,this._cache=new t(e.newCache,"VAOCache")}dispose(){this._cache.destroy()}newVao(t){const o=t.toString();let c=this._cache.pop(o);return c||(c=new e(this._rctx,new r(this._rctx,this._layout)),c.buffer()?.setSize(t),c)}deleteVao(t){if(null==t)return;const e=t.getByteLength("geometry").toString();this._cache.put(e,t)}}export{o as VaoCache};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../Color.js";import i from"../Viewpoint.js";import s from"../core/Accessor.js";import{EventedMixin as r}from"../core/Evented.js";import{destroyMaybe as o}from"../core/maybe.js";import{EsriPromiseMixin as a}from"../core/Promise.js";import{watch as n,initial as l,whenOnce as p,syncAndInitial as m}from"../core/reactiveUtils.js";import{property as h}from"../core/accessorSupport/decorators/property.js";import{cast as d}from"../core/accessorSupport/decorators/cast.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as c}from"../core/accessorSupport/decorators/subclass.js";import{ensureClass as g}from"../core/accessorSupport/ensureType.js";import f from"../geometry/Extent.js";import u from"../geometry/Point.js";import y from"../geometry/SpatialReference.js";import{load as j,execute as w}from"../geometry/operators/projectOperator.js";import b from"../layers/support/ExtentAndRotationGeoreference.js";import{MediaElementView as v}from"../layers/support/MediaElementView.js";import M from"../layers/support/TileInfo.js";import _ from"../layers/support/VideoElement.js";import{DOMContainer as S}from"./DOMContainer.js";import{Viewport2DBaseMixin as V}from"./Viewport2DBaseMixin.js";import{Viewport2DMixin as C}from"./Viewport2DMixin.js";import x from"./2d/AnimationManager.js";import P from"./2d/MapViewConstraints.js";import"../core/Error.js";import"../core/scheduling.js";import"../core/Logger.js";import"../core/mathUtils.js";import"../config.js";import"../core/floatRGBA.js";import"../geometry/Geometry.js";import"../geometry/Multipoint.js";import"../geometry/Polygon.js";import"../geometry/Polyline.js";import"../symbols/Font.js";import"../core/ObjectPool.js";import"../geometry/support/spatialReferenceUtils.js";import"../symbols/cim/effects/EffectAddControlPoints.js";import"../symbols/cim/effects/EffectArrow.js";import"../symbols/cim/effects/EffectBuffer.js";import"../symbols/cim/effects/EffectControlMeasureLine.js";import"../symbols/cim/effects/EffectCut.js";import"../symbols/cim/effects/EffectDashes.js";import"../symbols/cim/effects/EffectDonut.js";import"../symbols/cim/effects/EffectEnclosingPolygon.js";import"../symbols/cim/effects/EffectJog.js";import"../symbols/cim/effects/EffectMove.js";import"../symbols/cim/effects/EffectOffset.js";import"../symbols/cim/effects/EffectRadial.js";import"../symbols/cim/effects/EffectReverse.js";import"../symbols/cim/effects/EffectRotate.js";import"../symbols/cim/effects/EffectScale.js";import"../symbols/cim/effects/EffectSuppress.js";import"../symbols/cim/effects/EffectTaperedPolygon.js";import"../symbols/cim/effects/EffectWave.js";import"../symbols/cim/placements/PlacementAlongLineSameSize.js";import"../symbols/cim/placements/PlacementAtExtremities.js";import"../symbols/cim/placements/PlacementAtRatioPositions.js";import"../symbols/cim/placements/PlacementInsidePolygon.js";import"../symbols/cim/placements/PlacementOnLine.js";import"../symbols/cim/placements/PlacementOnVertices.js";import"../symbols/cim/placements/PlacementPolygonCenter.js";import"../symbols/cim/constants.js";import"../core/libs/gl-matrix-2/factories/vec2f32.js";import"../symbols/support/defaults.js";import"../symbols/cim/OverrideHelper.js";import{Container as E}from"./2d/engine/Container.js";import"../core/libs/gl-matrix-2/factories/vec4f32.js";import"./webgl/enums.js";import"./2d/engine/webgl/shaders/BackgroundPrograms.js";import"./webgl/Program.js";import"./webgl/BufferObject.js";import"./webgl/checkWebGLError.js";import"./webgl/VertexAttributeLayouts.js";import"./2d/engine/webgl/AFeatureTile.js";import"./2d/engine/webgl/DisplayEntity.js";import"./2d/engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js";import"./2d/engine/webgl/cpuMapped/MappedMesh.js";import"./2d/engine/webgl/number.js";import"./2d/engine/webgl/shaders/TileInfoPrograms.js";import"./webgl/Texture.js";import"./2d/engine/webgl/shaders/BitBlitPrograms.js";import"../request.js";import"../core/urlUtils.js";import"../core/pbf.js";import"./2d/engine/webgl/shaders/StencilPrograms.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/BlendShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/OpacityShader.js";import"./2d/engine/webgl/shaders/HighlightPrograms.js";import"./webgl/FramebufferObject.js";import"./2d/engine/webgl/meshing/SimpleMesh.js";import"./webgl/Renderbuffer.js";import"./2d/engine/webgl/PooledUint32Array.js";import"./2d/engine/webgl/Profiler.js";import"./2d/engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import"./2d/engine/webgl/shaderGraph/techniques/animated/attributes.js";import"./2d/engine/webgl/mesh/templates/templateUtils.js";import"./2d/engine/webgl/shaderGraph/techniques/line/LineMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/ComplexFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/FillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/GradientFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/OutlineFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/PatternFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapMeshWriter.js";import"../geometry/support/aaBoundingBox.js";import"./2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/line/GradientStrokeMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/line/TexturedLineMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js";import"../core/sql/UnknownTimeZone.js";import"luxon";import"../intl/locale.js";import"../layers/support/fieldUtils.js";import"../time/constants.js";import"./2d/engine/webgl/animations/instructions.js";import"./2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartMeshWriter.js";import"./webgl/renderState.js";import"./3d/webgl-engine/core/shaderModules/glsl.js";import"./webgl/testSVGPremultipliedAlpha.js";import{ManagedCanvas as G}from"./2d/engine/ManagedCanvas.js";import"./2d/engine/transitions/FadeTransition.js";import"./2d/engine/webgl/meshing/definitions.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/VideoScreenShader.js";import"./2d/LabelManager.js";import"./2d/layers/graphics/GraphicsView2D.js";import"../chunks/earcut.js";import"../core/libs/gl-matrix-2/factories/vec3f32.js";import"../geometry/support/normalizeUtilsCommon.js";import"../geometry/support/Ellipsoid.js";import"../kernel.js";import"./2d/layers/support/util.js";import D from"./2d/navigation/MapViewNavigation.js";import"../core/asyncUtils.js";import"../core/support/UpdatingHandles.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js";import"../core/unitUtils.js";import"../geometry/ellipsoidUtils.js";import"../chunks/pe.js";import"../geometry/projection/projectors.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/GridShader.js";import"../geometry/support/geodesicConstants.js";import{ViewStateManager as R}from"./2d/ViewStateManager.js";import q from"./2d/engine/webgl/Overlay.js";import z from"./2d/engine/webgl/OverlayContainer.js";import O from"./navigation/Navigation.js";import T from"./ui/DefaultUI.js";import W from"./ui/video/DefaultUIVideo.js";const k=new t("#000");let A;async function U(){const[,{ParentStage:e}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);A=e}const F=.01,H=["feature","geojson","csv","stream","ogc-feature","catalog","wfs","parquet","graphics","group"];let L=class extends s{};L=e([c("esri.views.VideoView.Base")],L);let B=class extends(C(V(S(r(a(L)))))){constructor(e){super(e),this._isValid=!1,this._prevZoomEnabled=!1,this._prevRotationEnabled=!1,this.stage=null,this.childStage=null,this._operationalDataView=null,this.operationalDataVisible=!1,this.layer=null,this.map=null,this.navigation=new O,this.ready=!1,this.spatialReference=new y({wkid:0}),this.stateManager=new R({constraints:new P({view:this,minScale:1,maxScale:F})}),this.type="2d",this.ui=new W,this.view2dType="video",this.addHandles([n(()=>this.preconditionsReady,e=>e?this._startup():this._teardown()),n(()=>this.layer,()=>this.addResolvingPromise(p(()=>this.ready)),l),n(()=>this.videoSize,([e,t])=>{this._extent&&e&&t&&(this._extent.xmax=e,this._extent.ymax=t)}),n(()=>this.size,e=>{this._operationalDataView&&this._operationalDataView.stateManager.resize(e[0],e[1])}),n(()=>[this.layer?.frameEffect,this._effectsContainer],()=>{this._effectsContainer&&(this._effectsContainer.effect=this.layer?.frameEffect??null)},m)])}initialize(){this._prevZoomEnabled="zoom"===this.navigation.actionMap.mouseWheel&&this.ui.components.includes("zoom"),this._prevRotationEnabled="rotate"===this.navigation.actionMap.dragSecondary&&this.ui.components.includes("compass"),this.addHandles([n(()=>[this.operationalDataVisible,this.childStage],()=>{this.childStage&&(this.childStage.videoScreenRenderer.visible=this.operationalDataVisible),this.operationalDataVisible&&(this.scale=1,this.rotation=0),this.navigation&&(this._prevZoomEnabled&&(this.navigation.actionMap.mouseWheel=this.operationalDataVisible?"none":"zoom",this.navigation.actionMap.dragPrimary=this.operationalDataVisible?"none":"pan",this.ui.components&&(this.ui.components=this.operationalDataVisible?this.ui.components.filter(e=>"zoom"!==e):[...new Set([...this.ui.components,"zoom"])])),this._prevRotationEnabled&&(this.navigation.actionMap.dragSecondary=this.operationalDataVisible?"none":"rotate",this.ui.components&&(this.ui.components=this.operationalDataVisible?this.ui.components.filter(e=>"compass"!==e):[...new Set([...this.ui.components,"compass"])])))},m)]),this.addResolvingPromise(U().then(()=>(this._isValid=!0,p(()=>this.ready))))}destroy(){this._teardown(),this.removeAllHandles(),this._set("preconditionsReady",!1),this.frameTask=o(this.frameTask),this.goToManager.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get constraintsInfo(){return{lods:null,spatialReference:this.spatialReference}}get preconditionsReady(){return!(!this._isValid||0===this.width||0===this.height||0===this.videoSize[0]||0===this.videoSize[1])}get rendering(){return this.stage?.renderRequested??!1}get scale(){return this.stateManager?.scale??0}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get videoSize(){if(!this.layer?.videoWidth||!this.layer?.videoHeight)return[0,0];const[e,t]=this.size,i=(this.layer?.videoWidth||0)/(this.layer?.videoHeight||0),s=t*i,r=e/i;return e/t>=1?i>=1?s<=e?[s,t]:[e,r]:r<=t?[e,r]:[s,t]:i>=1?r<=t?[e,r]:[s,t]:s<=e?[s,t]:[e,r]}async hitTest(e,t){return this._operationalDataView&&this._operationalDataView.ready?this._operationalDataView.hitTest(e,t):{screenPoint:e,results:[]}}_startup(){if(!this.layer)return;const e=this._getViewpoint();this.stateManager.startup(e,this.size,e.targetGeometry.spatialReference);const t={renderingOptions:this.renderingOptions,backgroundColor:k,groundControlPoints:()=>this.layer?.groundControlPoints,getSize:()=>this.videoSize},i=new A(this.surface,t,new G(this.surface));this.stage=i,this._prepareStage(this.stage),this.childStage=i.childStage,this._prepareChildStage(this.childStage);const s=new x({view:this});this._set("animationManager",s);const r=new D({view:this,animationManager:s});this._set("mapViewNavigation",r),this._updateConstraints(),this.frameTask.start(),this._set("ready",!0)}_teardown(){this.stage.destroy(),this.stage=null,this._videoElementView=null,this._overlayContainer.removeAllChildren(),this._overlayContainer=null,this.removeHandles("video-view"),this._set("ready",!1),this.stateManager.teardown(),this.frameTask.stop(),this.stationaryManager.clear()}_getViewpoint(){return new i({targetGeometry:new u({x:this.videoSize[0]/2,y:this.videoSize[1]/2,spatialReference:this.spatialReference}),scale:1})}_prepareStage(e){this.addHandles([n(()=>this.stationary,t=>e.stationary=t,m),n(()=>this.state.id,()=>e.state=this.state,m),n(()=>this.renderingOptions,t=>e.renderingOptions=t,m)],"video-view"),this._extent=new f({xmin:0,ymin:0,xmax:this.videoSize[0],ymax:this.videoSize[1],spatialReference:{wkid:0}}),this._videoElementView=new v({element:new _({video:this.layer?.videoElement,georeference:new b({extent:this._extent}),autoplay:!1}),spatialReference:this.spatialReference});const t=new q(this._videoElementView);this._overlayContainer=new z,this._overlayContainer.addChild(t),this._effectsContainer=new E,this._effectsContainer.addChild(this._overlayContainer),this.stage.addChild(this._effectsContainer);const i=document.createElement("div");i.classList.add("esri-video-poster"),this.container?.classList.add("esri-video-view"),this.container?.appendChild(i)}_prepareChildStage(e){this.addHandles([n(()=>this.map,async t=>{if(!t)return;const{default:i}=await import("./video/VideoOperationalDataView.js");this._operationalDataView=new i({stage:e,layerViewFilter:e=>new Set(H).has(e.type),width:this.size[0],height:this.size[1],map:t}),p(()=>this._operationalDataView?.ready).then(()=>{e.videoScreenRenderer.visible=this.operationalDataVisible})},m),n(()=>this.layer?.groundControlPoints,async()=>{if(!this.layer?.groundControlPoints||!e.state)return;const t=this.layer.groundControlPoints,i=t?.length;if(!i)return;await j();const s=new Array(i),r=e.state.spatialReference;for(let e=0;e<i;e++){const{lat:i,lon:o}=t[e];s[e]=w(new u(o,i),r)}let o=1/0,a=1/0,n=-1/0,l=-1/0;for(const e of s)o=Math.min(o,e.x),a=Math.min(a,e.y),n=Math.max(n,e.x),l=Math.max(l,e.y);const p=f.fromJSON({xmin:o,ymin:a,xmax:n,ymax:l,spatialReference:r});await(this._operationalDataView?.goTo(p,{animate:!1}).catch(()=>{}))},m)])}_updateConstraints(){this._updateZoomConstraints(),this._updatePanConstraints()}_updateZoomConstraints(){const e=this.videoSize,t=Math.max(e[0]/this.size[0],e[1]/this.size[1]),i=[];for(let r=t;r>F;r/=2)i.push(r);i.push(F);const{lods:s}=M.create({scales:i});this.constraints.set({lods:s,minScale:t})}_updatePanConstraints(){const e=e=>{if(!e.targetGeometry)return e;const[t,i]=this.videoSize,s=t*e.scale/2,r=i*e.scale/2,o=e.targetGeometry.clone();return o.x=Math.max(s,Math.min(t-s,o.x)),o.y=Math.max(r,Math.min(i-r,o.y)),e.targetGeometry=o,e};this.constraints.customConstraints.add({constrain:e,applyPanConstraint:e})}};e([h()],B.prototype,"_overlayContainer",void 0),e([h()],B.prototype,"_isValid",void 0),e([h()],B.prototype,"_effectsContainer",void 0),e([h()],B.prototype,"constraintsInfo",null),e([h()],B.prototype,"operationalDataVisible",void 0),e([h()],B.prototype,"layer",void 0),e([h()],B.prototype,"map",void 0),e([h({type:O,nonNullable:!0})],B.prototype,"navigation",void 0),e([h({readOnly:!0})],B.prototype,"preconditionsReady",null),e([h({readOnly:!0})],B.prototype,"ready",void 0),e([h({readOnly:!0})],B.prototype,"rendering",null),e([h()],B.prototype,"scale",null),e([h()],B.prototype,"spatialReference",void 0),e([h()],B.prototype,"stateManager",void 0),e([h()],B.prototype,"type",void 0),e([h(),d(e=>e instanceof T?e:g(W,e))],B.prototype,"ui",void 0),e([h({readOnly:!0})],B.prototype,"videoSize",null),e([h({readOnly:!0})],B.prototype,"view2dType",void 0),B=e([c("esri.views.VideoView")],B);const I=B;export{I as default};
5
+ import{__decorate as e}from"tslib";import t from"../Color.js";import i from"../Viewpoint.js";import s from"../core/Accessor.js";import{EventedMixin as r}from"../core/Evented.js";import{destroyMaybe as o}from"../core/maybe.js";import{EsriPromiseMixin as a}from"../core/Promise.js";import{watch as n,initial as l,whenOnce as p,syncAndInitial as m}from"../core/reactiveUtils.js";import{property as h}from"../core/accessorSupport/decorators/property.js";import{cast as d}from"../core/accessorSupport/decorators/cast.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as c}from"../core/accessorSupport/decorators/subclass.js";import{ensureClass as g}from"../core/accessorSupport/ensureType.js";import f from"../geometry/Extent.js";import u from"../geometry/Point.js";import y from"../geometry/SpatialReference.js";import{load as j,execute as w}from"../geometry/operators/projectOperator.js";import b from"../layers/support/ExtentAndRotationGeoreference.js";import{MediaElementView as v}from"../layers/support/MediaElementView.js";import M from"../layers/support/TileInfo.js";import _ from"../layers/support/VideoElement.js";import{DOMContainer as S}from"./DOMContainer.js";import{Viewport2DBaseMixin as V}from"./Viewport2DBaseMixin.js";import{Viewport2DMixin as C}from"./Viewport2DMixin.js";import x from"./2d/AnimationManager.js";import P from"./2d/MapViewConstraints.js";import"../core/Error.js";import"../core/scheduling.js";import"../core/Logger.js";import"../core/mathUtils.js";import"../config.js";import"../core/floatRGBA.js";import"../geometry/Geometry.js";import"../geometry/Multipoint.js";import"../geometry/Polygon.js";import"../geometry/Polyline.js";import"../symbols/Font.js";import"../core/ObjectPool.js";import"../geometry/support/spatialReferenceUtils.js";import"../symbols/cim/effects/EffectAddControlPoints.js";import"../symbols/cim/effects/EffectArrow.js";import"../symbols/cim/effects/EffectBuffer.js";import"../symbols/cim/effects/EffectControlMeasureLine.js";import"../symbols/cim/effects/EffectCut.js";import"../symbols/cim/effects/EffectDashes.js";import"../symbols/cim/effects/EffectDonut.js";import"../symbols/cim/effects/EffectEnclosingPolygon.js";import"../symbols/cim/effects/EffectJog.js";import"../symbols/cim/effects/EffectMove.js";import"../symbols/cim/effects/EffectOffset.js";import"../symbols/cim/effects/EffectRadial.js";import"../symbols/cim/effects/EffectReverse.js";import"../symbols/cim/effects/EffectRotate.js";import"../symbols/cim/effects/EffectScale.js";import"../symbols/cim/effects/EffectSuppress.js";import"../symbols/cim/effects/EffectTaperedPolygon.js";import"../symbols/cim/effects/EffectWave.js";import"../symbols/cim/placements/PlacementAlongLineSameSize.js";import"../symbols/cim/placements/PlacementAtExtremities.js";import"../symbols/cim/placements/PlacementAtRatioPositions.js";import"../symbols/cim/placements/PlacementInsidePolygon.js";import"../symbols/cim/placements/PlacementOnLine.js";import"../symbols/cim/placements/PlacementOnVertices.js";import"../symbols/cim/placements/PlacementPolygonCenter.js";import"../symbols/cim/constants.js";import"../core/libs/gl-matrix-2/factories/vec2f32.js";import"../symbols/support/defaults.js";import"../symbols/cim/OverrideHelper.js";import{Container as E}from"./2d/engine/Container.js";import"../core/libs/gl-matrix-2/factories/vec4f32.js";import"./webgl/enums.js";import"./2d/engine/webgl/shaders/BackgroundPrograms.js";import"./webgl/Program.js";import"./webgl/checkWebGLError.js";import"./webgl/VertexAttributeLayouts.js";import"./webgl/BufferObject.js";import"./2d/engine/webgl/AFeatureTile.js";import"./2d/engine/webgl/DisplayEntity.js";import"./2d/engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js";import"./2d/engine/webgl/cpuMapped/MappedMesh.js";import"./2d/engine/webgl/number.js";import"./2d/engine/webgl/shaders/TileInfoPrograms.js";import"./webgl/Texture.js";import"./2d/engine/webgl/shaders/BitBlitPrograms.js";import"../request.js";import"../core/urlUtils.js";import"../core/pbf.js";import"./2d/engine/webgl/shaders/StencilPrograms.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/BlendShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/OpacityShader.js";import"./2d/engine/webgl/shaders/HighlightPrograms.js";import"./webgl/FramebufferObject.js";import"./2d/engine/webgl/meshing/SimpleMesh.js";import"./webgl/Renderbuffer.js";import"./2d/engine/webgl/PooledUint32Array.js";import"./2d/engine/webgl/Profiler.js";import"./2d/engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import"./2d/engine/webgl/shaderGraph/techniques/animated/attributes.js";import"./2d/engine/webgl/mesh/templates/templateUtils.js";import"./2d/engine/webgl/shaderGraph/techniques/line/LineMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/ComplexFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/FillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/GradientFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/OutlineFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/PatternFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapMeshWriter.js";import"../geometry/support/aaBoundingBox.js";import"./2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/line/GradientStrokeMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/line/TexturedLineMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js";import"../core/sql/UnknownTimeZone.js";import"luxon";import"../intl/locale.js";import"../layers/support/fieldUtils.js";import"../time/constants.js";import"./2d/engine/webgl/animations/instructions.js";import"./2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartMeshWriter.js";import"./webgl/renderState.js";import"./3d/webgl-engine/core/shaderModules/glsl.js";import"./webgl/testSVGPremultipliedAlpha.js";import{ManagedCanvas as G}from"./2d/engine/ManagedCanvas.js";import"./2d/engine/transitions/FadeTransition.js";import"./2d/engine/webgl/meshing/definitions.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/VideoScreenShader.js";import"./2d/LabelManager.js";import"./2d/layers/graphics/GraphicsView2D.js";import"../chunks/earcut.js";import"../core/libs/gl-matrix-2/factories/vec3f32.js";import"../geometry/support/normalizeUtilsCommon.js";import"../geometry/support/Ellipsoid.js";import"../kernel.js";import"./2d/layers/support/util.js";import D from"./2d/navigation/MapViewNavigation.js";import"../core/asyncUtils.js";import"../core/support/UpdatingHandles.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js";import"../core/unitUtils.js";import"../geometry/ellipsoidUtils.js";import"../chunks/pe.js";import"../geometry/projection/projectors.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/GridShader.js";import"../geometry/support/geodesicConstants.js";import{ViewStateManager as R}from"./2d/ViewStateManager.js";import q from"./2d/engine/webgl/Overlay.js";import z from"./2d/engine/webgl/OverlayContainer.js";import O from"./navigation/Navigation.js";import T from"./ui/DefaultUI.js";import W from"./ui/video/DefaultUIVideo.js";const k=new t("#000");let A;async function U(){const[,{ParentStage:e}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);A=e}const F=.01,H=["feature","geojson","csv","stream","ogc-feature","catalog","wfs","parquet","graphics","group"];let L=class extends s{};L=e([c("esri.views.VideoView.Base")],L);let B=class extends(C(V(S(r(a(L)))))){constructor(e){super(e),this._isValid=!1,this._prevZoomEnabled=!1,this._prevRotationEnabled=!1,this.stage=null,this.childStage=null,this._operationalDataView=null,this.operationalDataVisible=!1,this.layer=null,this.map=null,this.navigation=new O,this.ready=!1,this.spatialReference=new y({wkid:0}),this.stateManager=new R({constraints:new P({view:this,minScale:1,maxScale:F})}),this.type="2d",this.ui=new W,this.view2dType="video",this.addHandles([n(()=>this.preconditionsReady,e=>e?this._startup():this._teardown()),n(()=>this.layer,()=>this.addResolvingPromise(p(()=>this.ready)),l),n(()=>this.videoSize,([e,t])=>{this._extent&&e&&t&&(this._extent.xmax=e,this._extent.ymax=t)}),n(()=>this.size,e=>{this._operationalDataView&&this._operationalDataView.stateManager.resize(e[0],e[1])}),n(()=>[this.layer?.frameEffect,this._effectsContainer],()=>{this._effectsContainer&&(this._effectsContainer.effect=this.layer?.frameEffect??null)},m)])}initialize(){this._prevZoomEnabled="zoom"===this.navigation.actionMap.mouseWheel&&this.ui.components.includes("zoom"),this._prevRotationEnabled="rotate"===this.navigation.actionMap.dragSecondary&&this.ui.components.includes("compass"),this.addHandles([n(()=>[this.operationalDataVisible,this.childStage],()=>{this.childStage&&(this.childStage.videoScreenRenderer.visible=this.operationalDataVisible),this.operationalDataVisible&&(this.scale=1,this.rotation=0),this.navigation&&(this._prevZoomEnabled&&(this.navigation.actionMap.mouseWheel=this.operationalDataVisible?"none":"zoom",this.navigation.actionMap.dragPrimary=this.operationalDataVisible?"none":"pan",this.ui.components&&(this.ui.components=this.operationalDataVisible?this.ui.components.filter(e=>"zoom"!==e):[...new Set([...this.ui.components,"zoom"])])),this._prevRotationEnabled&&(this.navigation.actionMap.dragSecondary=this.operationalDataVisible?"none":"rotate",this.ui.components&&(this.ui.components=this.operationalDataVisible?this.ui.components.filter(e=>"compass"!==e):[...new Set([...this.ui.components,"compass"])])))},m)]),this.addResolvingPromise(U().then(()=>(this._isValid=!0,p(()=>this.ready))))}destroy(){this._teardown(),this.removeAllHandles(),this._set("preconditionsReady",!1),this.frameTask=o(this.frameTask),this.goToManager.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get constraintsInfo(){return{lods:null,spatialReference:this.spatialReference}}get preconditionsReady(){return!(!this._isValid||0===this.width||0===this.height||0===this.videoSize[0]||0===this.videoSize[1])}get rendering(){return this.stage?.renderRequested??!1}get scale(){return this.stateManager?.scale??0}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get videoSize(){if(!this.layer?.videoWidth||!this.layer?.videoHeight)return[0,0];const[e,t]=this.size,i=(this.layer?.videoWidth||0)/(this.layer?.videoHeight||0),s=t*i,r=e/i;return e/t>=1?i>=1?s<=e?[s,t]:[e,r]:r<=t?[e,r]:[s,t]:i>=1?r<=t?[e,r]:[s,t]:s<=e?[s,t]:[e,r]}async hitTest(e,t){return this._operationalDataView&&this._operationalDataView.ready?this._operationalDataView.hitTest(e,t):{screenPoint:e,results:[]}}_startup(){if(!this.layer)return;const e=this._getViewpoint();this.stateManager.startup(e,this.size,e.targetGeometry.spatialReference);const t={renderingOptions:this.renderingOptions,backgroundColor:k,groundControlPoints:()=>this.layer?.groundControlPoints,getSize:()=>this.videoSize},i=new A(this.surface,t,new G(this.surface));this.stage=i,this._prepareStage(this.stage),this.childStage=i.childStage,this._prepareChildStage(this.childStage);const s=new x({view:this});this._set("animationManager",s);const r=new D({view:this,animationManager:s});this._set("mapViewNavigation",r),this._updateConstraints(),this.frameTask.start(),this._set("ready",!0)}_teardown(){this.stage.destroy(),this.stage=null,this._videoElementView=null,this._overlayContainer.removeAllChildren(),this._overlayContainer=null,this.removeHandles("video-view"),this._set("ready",!1),this.stateManager.teardown(),this.frameTask.stop(),this.stationaryManager.clear()}_getViewpoint(){return new i({targetGeometry:new u({x:this.videoSize[0]/2,y:this.videoSize[1]/2,spatialReference:this.spatialReference}),scale:1})}_prepareStage(e){this.addHandles([n(()=>this.stationary,t=>e.stationary=t,m),n(()=>this.state.id,()=>e.state=this.state,m),n(()=>this.renderingOptions,t=>e.renderingOptions=t,m)],"video-view"),this._extent=new f({xmin:0,ymin:0,xmax:this.videoSize[0],ymax:this.videoSize[1],spatialReference:{wkid:0}}),this._videoElementView=new v({element:new _({video:this.layer?.videoElement,georeference:new b({extent:this._extent}),autoplay:!1}),spatialReference:this.spatialReference});const t=new q(this._videoElementView);this._overlayContainer=new z,this._overlayContainer.addChild(t),this._effectsContainer=new E,this._effectsContainer.addChild(this._overlayContainer),this.stage.addChild(this._effectsContainer);const i=document.createElement("div");i.classList.add("esri-video-poster"),this.container?.classList.add("esri-video-view"),this.container?.appendChild(i)}_prepareChildStage(e){this.addHandles([n(()=>this.map,async t=>{if(!t)return;const{default:i}=await import("./video/VideoOperationalDataView.js");this._operationalDataView=new i({stage:e,layerViewFilter:e=>new Set(H).has(e.type),width:this.size[0],height:this.size[1],map:t}),p(()=>this._operationalDataView?.ready).then(()=>{e.videoScreenRenderer.visible=this.operationalDataVisible})},m),n(()=>this.layer?.groundControlPoints,async()=>{if(!this.layer?.groundControlPoints||!e.state)return;const t=this.layer.groundControlPoints,i=t?.length;if(!i)return;await j();const s=new Array(i),r=e.state.spatialReference;for(let e=0;e<i;e++){const{lat:i,lon:o}=t[e];s[e]=w(new u(o,i),r)}let o=1/0,a=1/0,n=-1/0,l=-1/0;for(const e of s)o=Math.min(o,e.x),a=Math.min(a,e.y),n=Math.max(n,e.x),l=Math.max(l,e.y);const p=f.fromJSON({xmin:o,ymin:a,xmax:n,ymax:l,spatialReference:r});await(this._operationalDataView?.goTo(p,{animate:!1}).catch(()=>{}))},m)])}_updateConstraints(){this._updateZoomConstraints(),this._updatePanConstraints()}_updateZoomConstraints(){const e=this.videoSize,t=Math.max(e[0]/this.size[0],e[1]/this.size[1]),i=[];for(let r=t;r>F;r/=2)i.push(r);i.push(F);const{lods:s}=M.create({scales:i});this.constraints.set({lods:s,minScale:t})}_updatePanConstraints(){const e=e=>{if(!e.targetGeometry)return e;const[t,i]=this.videoSize,s=t*e.scale/2,r=i*e.scale/2,o=e.targetGeometry.clone();return o.x=Math.max(s,Math.min(t-s,o.x)),o.y=Math.max(r,Math.min(i-r,o.y)),e.targetGeometry=o,e};this.constraints.customConstraints.add({constrain:e,applyPanConstraint:e})}};e([h()],B.prototype,"_overlayContainer",void 0),e([h()],B.prototype,"_isValid",void 0),e([h()],B.prototype,"_effectsContainer",void 0),e([h()],B.prototype,"constraintsInfo",null),e([h()],B.prototype,"operationalDataVisible",void 0),e([h()],B.prototype,"layer",void 0),e([h()],B.prototype,"map",void 0),e([h({type:O,nonNullable:!0})],B.prototype,"navigation",void 0),e([h({readOnly:!0})],B.prototype,"preconditionsReady",null),e([h({readOnly:!0})],B.prototype,"ready",void 0),e([h({readOnly:!0})],B.prototype,"rendering",null),e([h()],B.prototype,"scale",null),e([h()],B.prototype,"spatialReference",void 0),e([h()],B.prototype,"stateManager",void 0),e([h()],B.prototype,"type",void 0),e([h(),d(e=>e instanceof T?e:g(W,e))],B.prototype,"ui",void 0),e([h({readOnly:!0})],B.prototype,"videoSize",null),e([h({readOnly:!0})],B.prototype,"view2dType",void 0),B=e([c("esri.views.VideoView")],B);const I=B;export{I as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import o from"../../Color.js";import s from"../../Graphic.js";import t from"../../core/Accessor.js";import l from"../../core/Collection.js";import{lerp as r}from"../../core/mathUtils.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import n from"../../symbols/PointSymbol3D.js";import m from"../../symbols/SimpleFillSymbol.js";import h from"../../symbols/TextSymbol.js";import p from"../../symbols/TextSymbol3DLayer.js";import c from"../../symbols/callouts/LineCallout3D.js";import y from"../../symbols/callouts/LineCallout3DBorder.js";import b from"../../symbols/support/Symbol3DVerticalOffset.js";const u=[[0,179,255],[117,62,128],[0,104,255],[215,189,166],[32,0,193],[98,162,206],[102,112,129],[52,125,0],[142,118,246],[138,83,0],[92,122,255],[122,55,83],[0,142,255],[81,40,179],[0,200,244],[13,24,127],[0,170,147],[19,58,241],[22,44,35]];let d=class extends t{constructor(e){super(e),this.updating=!1,this.enablePolygons=!0,this.enableLabels=!0,this._polygons=new Map,this._labels=new Map,this._symbols=u.map(e=>new m({color:[e[0],e[1],e[2],.6],outline:{color:"black",width:1}})),this._enabled=!0}initialize(){this.update()}destroy(){this._enabled=!1,this.clear()}get enabled(){return this._enabled}set enabled(e){this._enabled!==e&&(this._enabled=e,this.update())}update(){if(!this._enabled)return void this.clear();const e=e=>{if(null!=e.label)return e.label;let o=e.lij.toString();return null!=e.loadPriority&&(o+=` (${e.loadPriority})`),e.measures&&(o+=`[${e.measures.lodLevel}]`),o},t=this.getTiles(),i=new Array,a=new Set((this._labels.size,this._labels.keys()));t.forEach((m,u)=>{const d=m.lij.toString();a.delete(d);const g=m.measures?.lodLevel??m.level,f=m.geometry;if(this.enablePolygons&&!this._polygons.has(d)){const e=m.polygonSymbol??this._symbols[g%this._symbols.length],o=new s({geometry:f,symbol:e});this._polygons.set(d,o),i.push(o)}if(this.enableLabels){const a=e(m),g=u/(t.length-1),w=r(0,200,g),_=r(20,6,g)/.75,j=null!=m.loadPriority&&m.loadPriority>=t.length,v=new o([w,j?0:w,j?0:w]),S="3d"===this.view.type?()=>new n({verticalOffset:new b({screenLength:40/.75}),callout:new c({color:new o("white"),border:new y({color:new o("black")})}),symbolLayers:new l([new p({text:a,halo:{color:"white",size:1/.75},material:{color:v},size:_})])}):()=>new h({text:a,haloColor:"white",haloSize:1/.75,color:v,size:_}),L=this._labels.get(d);if(L){const e=S();null!=L.symbol&&JSON.stringify(e)===JSON.stringify(L.symbol)||(L.symbol=e)}else{const e=new s({geometry:f.extent.center,symbol:S()});this._labels.set(d,e),i.push(e)}}});const m=new Array;a.forEach(e=>{const o=this._polygons.get(e);null!=o&&(m.push(o),this._polygons.delete(e));const s=this._labels.get(e);null!=s&&(m.push(s),this._labels.delete(e))}),this.view.graphics.removeMany(m),this.view.graphics.addMany(i)}clear(){this.view.graphics.removeMany(Array.from(this._polygons.values())),this.view.graphics.removeMany(Array.from(this._labels.values())),this._polygons.clear(),this._labels.clear()}};e([i({constructOnly:!0})],d.prototype,"view",void 0),e([i({readOnly:!0})],d.prototype,"updating",void 0),e([i()],d.prototype,"enabled",null),d=e([a("esri.views.support.TileTreeDebugger")],d);export{d as TileTreeDebugger};
5
+ import{__decorate as e}from"tslib";import o from"../../Color.js";import s from"../../Graphic.js";import t from"../../core/Accessor.js";import l from"../../core/Collection.js";import{lerp as r}from"../../core/mathUtils.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";import a from"../../symbols/PointSymbol3D.js";import m from"../../symbols/SimpleFillSymbol.js";import h from"../../symbols/TextSymbol.js";import p from"../../symbols/TextSymbol3DLayer.js";import c from"../../symbols/callouts/LineCallout3D.js";import y from"../../symbols/callouts/LineCallout3DBorder.js";import b from"../../symbols/support/Symbol3DVerticalOffset.js";const u=[[0,179,255],[117,62,128],[0,104,255],[215,189,166],[32,0,193],[98,162,206],[102,112,129],[52,125,0],[142,118,246],[138,83,0],[92,122,255],[122,55,83],[0,142,255],[81,40,179],[0,200,244],[13,24,127],[0,170,147],[19,58,241],[22,44,35]];let d=class extends t{constructor(e){super(e),this.updating=!1,this.enablePolygons=!0,this.enableLabels=!0,this._polygons=new Map,this._labels=new Map,this._symbols=u.map(e=>new m({color:[e[0],e[1],e[2],.6],outline:{color:"black",width:1}})),this._enabled=!0}initialize(){this.update()}destroy(){this._enabled=!1,this.clear()}get enabled(){return this._enabled}set enabled(e){this._enabled!==e&&(this._enabled=e,this.update())}update(){if(!this._enabled)return void this.clear();const e=e=>{if(null!=e.label)return e.label;let o=e.lij.toString();return null!=e.loadPriority&&(o+=` (${e.loadPriority})`),e.measures&&(o+=`[${e.measures.lodLevel}]`),o},t=this.getTiles(),i=new Array,n=new Set(this._labels.size>0?this._labels.keys():this._polygons.keys());t.forEach((m,u)=>{const d=m.lij.toString();n.delete(d);const g=m.measures?.lodLevel??m.level,f=m.geometry;if(this.enablePolygons&&!this._polygons.has(d)){const e=m.polygonSymbol??this._symbols[g%this._symbols.length],o=new s({geometry:f,symbol:e});this._polygons.set(d,o),i.push(o)}if(this.enableLabels){const n=e(m),g=u/(t.length-1),w=r(0,200,g),_=r(20,6,g)/.75,j=null!=m.loadPriority&&m.loadPriority>=t.length,v=new o([w,j?0:w,j?0:w]),S="3d"===this.view.type?()=>new a({verticalOffset:new b({screenLength:40/.75}),callout:new c({color:new o("white"),border:new y({color:new o("black")})}),symbolLayers:new l([new p({text:n,halo:{color:"white",size:1/.75},material:{color:v},size:_})])}):()=>new h({text:n,haloColor:"white",haloSize:1/.75,color:v,size:_}),L=this._labels.get(d);if(L){const e=S();null!=L.symbol&&JSON.stringify(e)===JSON.stringify(L.symbol)||(L.symbol=e)}else{const e=new s({geometry:f.extent.center,symbol:S()});this._labels.set(d,e),i.push(e)}}});const m=new Array;n.forEach(e=>{const o=this._polygons.get(e);null!=o&&(m.push(o),this._polygons.delete(e));const s=this._labels.get(e);null!=s&&(m.push(s),this._labels.delete(e))}),this.view.graphics.removeMany(m),this.view.graphics.addMany(i)}clear(){this.view.graphics.removeMany(Array.from(this._polygons.values())),this.view.graphics.removeMany(Array.from(this._labels.values())),this._polygons.clear(),this._labels.clear()}};e([i({constructOnly:!0})],d.prototype,"view",void 0),e([i({readOnly:!0})],d.prototype,"updating",void 0),e([i()],d.prototype,"enabled",null),d=e([n("esri.views.support.TileTreeDebugger")],d);export{d as TileTreeDebugger};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{isArrayLike as t}from"../../core/arrayUtils.js";import has from"../../core/has.js";import e from"../../core/Logger.js";import{isUint8Array as s,isUint16Array as i,isUint32Array as r}from"../../core/typedArrayUtil.js";import{checkWebGLError as n}from"./checkWebGLError.js";import{ResourceType as a,DataType as u}from"./enums.js";const f=()=>e.getLogger("esri.views.webgl.BufferObject"),h=null,c=!!has("esri-tests-disable-gpu-memory-measurements");class o{static createIndex(t,e,s){return new o(t,34963,e,s)}static createVertex(t,e,s){return new o(t,34962,e,s)}static createUniform(t,e,s){return new o(t,35345,e,s)}static createPixelPack(t,e=35041,s){const i=new o(t,35051,e);return s&&i.setSize(s),i}static createPixelUnpack(t,e=35040,s){return new o(t,35052,e,s)}static createTransformFeedback(t,e=35044,s){const i=new o(t,35982,e);return i.setSize(s),i}constructor(t,e,s,i){this._context=t,this.bufferType=e,this.usage=s,this._glName=null,this._size=-1,this._indexType=void 0,t.instanceCounter.increment(a.BufferObject,this),this._glName=this._context.gl.createBuffer(),n(this._context.gl),i&&this.setData(i)}get glName(){return this._glName}get size(){return this._size}get indexType(){return this._indexType}get sizeBytes(){if(34963===this.bufferType){if(this._indexType===u.UNSIGNED_INT)return 4*this._size;if(this._indexType===u.UNSIGNED_SHORT)return 2*this._size}return this._size}get usedMemory(){return c?0:this.sizeBytes}get _isVAOAware(){return 34963===this.bufferType||34962===this.bufferType}dispose(){if(this._context?.gl){if(this._glName){this._context.gl.deleteBuffer(this._glName),this._glName=null}this._context.instanceCounter.decrement(a.BufferObject,this),this._context=null}else this._glName&&f().warn("Leaked WebGL buffer object")}setSize(t,e=null){if(34963===this.bufferType&&null!=e)switch(this._indexType=e,e){case u.UNSIGNED_SHORT:t*=2;break;case u.UNSIGNED_INT:t*=4}this._setBufferData(t)}setData(t){if(!t)return;let e=t.byteLength;34963===this.bufferType&&(s(t)?this._indexType=u.UNSIGNED_BYTE:i(t)?(e/=2,this._indexType=u.UNSIGNED_SHORT):r(t)&&(e/=4,this._indexType=u.UNSIGNED_INT)),this._setBufferData(e,t)}_setBufferData(t,e=null){this._size=t;const s=this._context.getBoundVAO();this._isVAOAware&&this._context.bindVAO(null),this._context.bindBuffer(this);const i=this._context.gl;null!=e?i.bufferData(this.bufferType,e,this.usage):i.bufferData(this.bufferType,t,this.usage),n(i),this._isVAOAware&&this._context.bindVAO(s)}setSubData(t,e,s,i){if(!t)return;const r=this._context.getBoundVAO();this._isVAOAware&&this._context.bindVAO(null),this._context.bindBuffer(this);const{gl:a}=this._context;a.bufferSubData(this.bufferType,e*t.BYTES_PER_ELEMENT,t,s,i-s),n(a),this._isVAOAware&&this._context.bindVAO(r)}getSubData(t,e=0,s,i){if(s<0||i<0)return;const r=_(t)?t.BYTES_PER_ELEMENT:1;if(r*((s??0)+(i??0))>t.byteLength)return;e+r*(i??0)>this.usedMemory&&f().warn("Potential problem getting subdata: requested data exceeds buffer size!");const n=this._context.gl;35982===this.bufferType?(this._context.bindBuffer(this,35982),n.getBufferSubData(35982,e,t,s,i),this._context.unbindBuffer(35982)):(this._context.bindBuffer(this,36662),n.getBufferSubData(36662,e,t,s,i),this._context.unbindBuffer(36662))}async getSubDataAsync(t,e=0,s,i){await this._context.clientWaitAsync(),this.getSubData(t,e,s,i)}}function _(e){return t(e)}export{o as BufferObject,h as tracer};
5
+ import{isArrayLike as t}from"../../core/arrayUtils.js";import has from"../../core/has.js";import e from"../../core/Logger.js";import{isUint8Array as s,isUint16Array as i,isUint32Array as r}from"../../core/typedArrayUtil.js";import{checkWebGLError as n}from"./checkWebGLError.js";import{ResourceType as u,DataType as a}from"./enums.js";const f=()=>e.getLogger("esri.views.webgl.BufferObject"),h=null,c=!!has("esri-tests-disable-gpu-memory-measurements");class o{static createIndex(t,e,s){return new o(t,34963,e,s)}static createUniform(t,e,s){return new o(t,35345,e,s)}static createPixelPack(t,e=35041,s){const i=new o(t,35051,e);return s&&i.setSize(s),i}static createPixelUnpack(t,e=35040,s){return new o(t,35052,e,s)}static createTransformFeedback(t,e=35044,s){const i=new o(t,35982,e);return i.setSize(s),i}constructor(t,e,s,i){this._context=t,this.bufferType=e,this.usage=s,this._glName=null,this._size=-1,this._indexType=void 0,t.instanceCounter.increment(u.BufferObject,this),this._glName=this._context.gl.createBuffer(),n(this._context.gl),i&&this.setData(i)}get glName(){return this._glName}get size(){return this._size}get indexType(){return this._indexType}get sizeBytes(){if(34963===this.bufferType){if(this._indexType===a.UNSIGNED_INT)return 4*this._size;if(this._indexType===a.UNSIGNED_SHORT)return 2*this._size}return this._size}get usedMemory(){return c?0:this.sizeBytes}get _isVAOAware(){return 34963===this.bufferType||34962===this.bufferType}dispose(){if(this._context?.gl){if(this._glName){this._context.gl.deleteBuffer(this._glName),this._glName=null}this._context.instanceCounter.decrement(u.BufferObject,this),this._context=null}else this._glName&&f().warn("Leaked WebGL buffer object")}setSize(t,e=null){if(34963===this.bufferType&&null!=e)switch(this._indexType=e,e){case a.UNSIGNED_SHORT:t*=2;break;case a.UNSIGNED_INT:t*=4}this._setBufferData(t)}setData(t){if(!t)return;let e=t.byteLength;34963===this.bufferType&&(s(t)?this._indexType=a.UNSIGNED_BYTE:i(t)?(e/=2,this._indexType=a.UNSIGNED_SHORT):r(t)&&(e/=4,this._indexType=a.UNSIGNED_INT)),this._setBufferData(e,t)}_setBufferData(t,e=null){this._size=t;const s=this._context.getBoundVAO();this._isVAOAware&&this._context.bindVAO(null),this._context.bindBuffer(this);const i=this._context.gl;null!=e?i.bufferData(this.bufferType,e,this.usage):i.bufferData(this.bufferType,t,this.usage),n(i),this._isVAOAware&&this._context.bindVAO(s)}setSubData(t,e,s,i){if(!t)return;const r=this._context.getBoundVAO();this._isVAOAware&&this._context.bindVAO(null),this._context.bindBuffer(this);const{gl:u}=this._context;u.bufferSubData(this.bufferType,e*t.BYTES_PER_ELEMENT,t,s,i-s),n(u),this._isVAOAware&&this._context.bindVAO(r)}getSubData(t,e=0,s,i){if(s<0||i<0)return;const r=_(t)?t.BYTES_PER_ELEMENT:1;if(r*((s??0)+(i??0))>t.byteLength)return;e+r*(i??0)>this.usedMemory&&f().warn("Potential problem getting subdata: requested data exceeds buffer size!");const n=this._context.gl;35982===this.bufferType?(this._context.bindBuffer(this,35982),n.getBufferSubData(35982,e,t,s,i),this._context.unbindBuffer(35982)):(this._context.bindBuffer(this,36662),n.getBufferSubData(36662,e,t,s,i),this._context.unbindBuffer(36662))}async getSubDataAsync(t,e=0,s,i){await this._context.clientWaitAsync(),this.getSubData(t,e,s,i)}}function _(e){return t(e)}export{o as BufferObject,h as tracer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import"../../core/has.js";import{webglDebugEnabled as e,getErrorMessage as s}from"./checkWebGLError.js";import{CompressedTextureFormat as c,SizedPixelFormat as a,SizedDepthStencilFormat as r,SizedDepthFormat as t}from"./enums.js";function R(c,a,r,t,R=0){const _=c.gl;c.bindBuffer(r);for(const n of t){const r=a.get(n.name);if(null==r){console.warn(`There is no location for vertex attribute '${n.name}' defined.`);continue}const t=R*n.stride;if(n.count<=4)_.vertexAttribPointer(r,n.count,n.type,n.normalized,n.stride,n.offset+t),_.enableVertexAttribArray(r),n.divisor>0&&_.vertexAttribDivisor(r,n.divisor);else if(9===n.count)for(let e=0;e<3;e++)_.vertexAttribPointer(r+e,3,n.type,n.normalized,n.stride,n.offset+12*e+t),_.enableVertexAttribArray(r+e),n.divisor>0&&_.vertexAttribDivisor(r+e,n.divisor);else if(16===n.count)for(let e=0;e<4;e++)_.vertexAttribPointer(r+e,4,n.type,n.normalized,n.stride,n.offset+16*e+t),_.enableVertexAttribArray(r+e),n.divisor>0&&_.vertexAttribDivisor(r+e,n.divisor);else console.error("Unsupported vertex attribute element count: "+n.count);if(e()){const e=s(c.gl);e&&console.error(`Unable to bind vertex attribute "${n.name}" with baseInstanceOffset ${t}:`,e,n)}}}function _(e){switch(e){case 6406:case 6409:case 6403:case 36244:case a.R8:case a.R8I:case a.R8UI:case a.R8_SNORM:case 36168:return 1;case 6410:case 33319:case 33320:case a.RGBA4:case a.R16F:case a.R16I:case a.R16UI:case a.RG8:case a.RG8I:case a.RG8UI:case a.RG8_SNORM:case a.RGB565:case a.RGB5_A1:case t.DEPTH_COMPONENT16:return 2;case 6407:case 36248:case a.RGB8:case a.RGB8I:case a.RGB8UI:case a.RGB8_SNORM:case a.SRGB8:case t.DEPTH_COMPONENT24:return 3;case 6408:case 36249:case a.RGBA8:case a.R32F:case a.R11F_G11F_B10F:case a.RG16F:case a.R32I:case a.R32UI:case a.RG16I:case a.RG16UI:case a.RGBA8I:case a.RGBA8UI:case a.RGBA8_SNORM:case a.SRGB8_ALPHA8:case a.RGB9_E5:case a.RGB10_A2UI:case a.RGB10_A2:case t.DEPTH_COMPONENT32F:case r.DEPTH24_STENCIL8:return 4;case r.DEPTH32F_STENCIL8:return 5;case a.RGB16F:case a.RGB16I:case a.RGB16UI:return 6;case a.RG32F:case a.RG32I:case a.RG32UI:case a.RGBA16F:case a.RGBA16I:case a.RGBA16UI:return 8;case a.RGB32F:case a.RGB32I:case a.RGB32UI:return 12;case a.RGBA32F:case a.RGBA32I:case a.RGBA32UI:return 16;case c.COMPRESSED_RGB_S3TC_DXT1_EXT:case c.COMPRESSED_RGBA_S3TC_DXT1_EXT:return.5;case c.COMPRESSED_RGBA_S3TC_DXT3_EXT:case c.COMPRESSED_RGBA_S3TC_DXT5_EXT:return 1;case c.COMPRESSED_R11_EAC:case c.COMPRESSED_SIGNED_R11_EAC:case c.COMPRESSED_RGB8_ETC2:case c.COMPRESSED_SRGB8_ETC2:case c.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:case c.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:return.5;case c.COMPRESSED_RG11_EAC:case c.COMPRESSED_SIGNED_RG11_EAC:case c.COMPRESSED_RGBA8_ETC2_EAC:case c.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:return 1}return 0}export{R as bindVertexBufferLayout,_ as getBytesPerElementFormat};
5
+ import"../../core/has.js";import{webglDebugEnabled as e,getErrorMessage as s}from"./checkWebGLError.js";import{CompressedTextureFormat as c,SizedPixelFormat as a,SizedDepthStencilFormat as r,SizedDepthFormat as t}from"./enums.js";function R(c,a,r,t=0){const R=c.gl;c.bindBuffer(r);for(const _ of r.layout){const r=a.get(_.name);if(null==r){console.warn(`There is no location for vertex attribute '${_.name}' defined.`);continue}const n=t*_.stride;if(_.count<=4)R.vertexAttribPointer(r,_.count,_.type,_.normalized,_.stride,_.offset+n),R.enableVertexAttribArray(r),_.divisor>0&&R.vertexAttribDivisor(r,_.divisor);else if(9===_.count)for(let e=0;e<3;e++)R.vertexAttribPointer(r+e,3,_.type,_.normalized,_.stride,_.offset+12*e+n),R.enableVertexAttribArray(r+e),_.divisor>0&&R.vertexAttribDivisor(r+e,_.divisor);else if(16===_.count)for(let e=0;e<4;e++)R.vertexAttribPointer(r+e,4,_.type,_.normalized,_.stride,_.offset+16*e+n),R.enableVertexAttribArray(r+e),_.divisor>0&&R.vertexAttribDivisor(r+e,_.divisor);else console.error("Unsupported vertex attribute element count: "+_.count);if(e()){const e=s(c.gl);e&&console.error(`Unable to bind vertex attribute "${_.name}" with baseInstanceOffset ${n}:`,e,_)}}}function _(e){switch(e){case 6406:case 6409:case 6403:case 36244:case a.R8:case a.R8I:case a.R8UI:case a.R8_SNORM:case 36168:return 1;case 6410:case 33319:case 33320:case a.RGBA4:case a.R16F:case a.R16I:case a.R16UI:case a.RG8:case a.RG8I:case a.RG8UI:case a.RG8_SNORM:case a.RGB565:case a.RGB5_A1:case t.DEPTH_COMPONENT16:return 2;case 6407:case 36248:case a.RGB8:case a.RGB8I:case a.RGB8UI:case a.RGB8_SNORM:case a.SRGB8:case t.DEPTH_COMPONENT24:return 3;case 6408:case 36249:case a.RGBA8:case a.R32F:case a.R11F_G11F_B10F:case a.RG16F:case a.R32I:case a.R32UI:case a.RG16I:case a.RG16UI:case a.RGBA8I:case a.RGBA8UI:case a.RGBA8_SNORM:case a.SRGB8_ALPHA8:case a.RGB9_E5:case a.RGB10_A2UI:case a.RGB10_A2:case t.DEPTH_COMPONENT32F:case r.DEPTH24_STENCIL8:return 4;case r.DEPTH32F_STENCIL8:return 5;case a.RGB16F:case a.RGB16I:case a.RGB16UI:return 6;case a.RG32F:case a.RG32I:case a.RG32UI:case a.RGBA16F:case a.RGBA16I:case a.RGBA16UI:return 8;case a.RGB32F:case a.RGB32I:case a.RGB32UI:return 12;case a.RGBA32F:case a.RGBA32I:case a.RGBA32UI:return 16;case c.COMPRESSED_RGB_S3TC_DXT1_EXT:case c.COMPRESSED_RGBA_S3TC_DXT1_EXT:return.5;case c.COMPRESSED_RGBA_S3TC_DXT3_EXT:case c.COMPRESSED_RGBA_S3TC_DXT5_EXT:return 1;case c.COMPRESSED_R11_EAC:case c.COMPRESSED_SIGNED_R11_EAC:case c.COMPRESSED_RGB8_ETC2:case c.COMPRESSED_SRGB8_ETC2:case c.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:case c.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:return.5;case c.COMPRESSED_RG11_EAC:case c.COMPRESSED_SIGNED_RG11_EAC:case c.COMPRESSED_RGBA8_ETC2_EAC:case c.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:return 1}return 0}export{R as bindVertexBufferLayout,_ as getBytesPerElementFormat};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{toConst as e}from"../../core/compilerUtils.js";import t from"../../core/Logger.js";import{disposeMaybe as r}from"../../core/maybe.js";import{baseTypedArrayMemory as s}from"../../core/memoryEstimations.js";import{ResourceType as i}from"./enums.js";import{bindVertexBufferLayout as n}from"./Util.js";import{fromBuffers as o}from"./VertexAttributeLocations.js";const f=()=>t.getLogger("esri.views.webgl.VertexArrayObject");let u=class{constructor(t,r,s){this._context=t,this._indexBuffer=s,this._buffers=r instanceof Map?r:new Map([["geometry",r]]),this.locations=e(o(this._buffers))}get glName(){return this._glName}get context(){return this._context}get buffers(){return e(this._buffers)}buffer(e="geometry"){return this.buffers.get(e)}get indexBuffer(){return this._indexBuffer}getByteLength(e){return this.buffer(e)?.buffer?.sizeBytes??0}vertexCount(e){const t=this.buffer(e);return t?t.buffer.sizeBytes/t.layout[0].stride:0}get usedMemory(){return Array.from(this._buffers.values()).reduce((e,{buffer:t})=>e+t.usedMemory,this._indexBuffer?.usedMemory??0+(this._buffers.size+(this._indexBuffer?1:0))*s)}get cachedMemory(){return this.usedMemory}dispose(){this._context?(this._context.getBoundVAO()===this&&this._context.bindVAO(null),this._buffers.forEach(({buffer:e})=>e.dispose()),this._buffers.clear(),this._indexBuffer=r(this._indexBuffer),this.disposeVAOOnly()):(this._glName||this._buffers.size>0)&&f().warn("Leaked WebGL VAO")}disposeVAOOnly(){this._glName&&(this._context.gl.deleteVertexArray(this._glName),this._glName=null,this._context.instanceCounter.decrement(i.VertexArrayObject,this)),this._context=null}bind(e=this.locations){const t=this._context.gl;this._glName?t.bindVertexArray(this._glName):(this._context.instanceCounter.increment(i.VertexArrayObject,this),this._glName=t.createVertexArray(),t.bindVertexArray(this._glName),this._bindLayout(e))}_bindLayout(e){const{_buffers:t,_indexBuffer:r}=this;if(t||f().error("Vertex buffer dictionary is empty!"),t.forEach(({buffer:t,layout:r})=>n(this._context,e,t,r)),null!=r){const e=this._context.gl;this._context.gl.bindBuffer(e.ELEMENT_ARRAY_BUFFER,r.glName)}}unbind(){this._context.gl.bindVertexArray(null)}};export{u as VertexArrayObject};
5
+ import{toConst as e}from"../../core/compilerUtils.js";import t from"../../core/Logger.js";import{disposeMaybe as r}from"../../core/maybe.js";import{baseTypedArrayMemory as s}from"../../core/memoryEstimations.js";import{ResourceType as i}from"./enums.js";import{bindVertexBufferLayout as n}from"./Util.js";import{fromBuffers as o}from"./VertexAttributeLocations.js";const f=()=>t.getLogger("esri.views.webgl.VertexArrayObject");let u=class{constructor(t,r,s){this._context=t,this._indexBuffer=s,this._buffers=r instanceof Map?r:new Map([["geometry",r]]),this.locations=e(o(this._buffers))}get glName(){return this._glName}get context(){return this._context}get buffers(){return e(this._buffers)}buffer(e="geometry"){return this.buffers.get(e)}get indexBuffer(){return this._indexBuffer}getByteLength(e){return this.buffer(e)?.sizeBytes??0}vertexCount(e){const t=this.buffer(e);return t?t.sizeBytes/t.layout[0].stride:0}get usedMemory(){return Array.from(this._buffers.values()).reduce((e,t)=>e+t.usedMemory,this._indexBuffer?.usedMemory??0+(this._buffers.size+(this._indexBuffer?1:0))*s)}get cachedMemory(){return this.usedMemory}dispose(){this._context?(this._context.getBoundVAO()===this&&this._context.bindVAO(null),this._buffers.forEach(e=>e.dispose()),this._buffers.clear(),this._indexBuffer=r(this._indexBuffer),this.disposeVAOOnly()):(this._glName||this._buffers.size>0)&&f().warn("Leaked WebGL VAO")}disposeVAOOnly(){this._glName&&(this._context.gl.deleteVertexArray(this._glName),this._glName=null,this._context.instanceCounter.decrement(i.VertexArrayObject,this)),this._context=null}bind(e=this.locations){const t=this._context.gl;this._glName?t.bindVertexArray(this._glName):(this._context.instanceCounter.increment(i.VertexArrayObject,this),this._glName=t.createVertexArray(),t.bindVertexArray(this._glName),this._bindLayout(e))}_bindLayout(e){const{_buffers:t,_indexBuffer:r}=this;if(t||f().error("Vertex buffer dictionary is empty!"),t.forEach(t=>n(this._context,e,t)),null!=r){const e=this._context.gl;this._context.gl.bindBuffer(e.ELEMENT_ARRAY_BUFFER,r.glName)}}unbind(){this._context.gl.bindVertexArray(null)}};export{u as VertexArrayObject};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- class t{constructor(t,s){this.layout=t,this.buffer=s}}export{t as VertexBuffer};
5
+ import{BufferObject as t}from"./BufferObject.js";class r extends t{constructor(t,r,s,e=35044){super(t,34962,e,s),this.layout=r}}export{r as VertexBuffer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{BufferObject as r}from"./BufferObject.js";import{PixelType as e,SizedPixelFormat as t,PrimitiveType as o}from"./enums.js";import{FramebufferObject as i}from"./FramebufferObject.js";import{makePipelineState as n,destinationTimesOneMinusSourceAlpha as s}from"./renderState.js";import{TextureDescriptor as a}from"./TextureDescriptor.js";import{VertexArrayObject as p}from"./VertexArrayObject.js";import{Pos2usLocations as c,Pos2us as f}from"./VertexAttributeLayouts.js";import{VertexBuffer as m}from"./VertexBuffer.js";import{WebGLDriverTestModule as l}from"./WebGLDriverTestModule.js";class u extends l{constructor(r){if(super(),this._rctx=r,!r.gl)return;if(!(r.capabilities.colorBufferFloat?.textureFloat&&r.capabilities.colorBufferFloat?.floatBlend))return;const e="\n precision highp float;\n attribute vec2 position;\n\n void main() {\n gl_Position = vec4(position * 2.0 - 1.0, 0.0, 1.0);\n }\n ",t="\n precision highp float;\n\n void main() {\n gl_FragColor = vec4(0.5, 0.5, 0.5, 0.5);\n }\n ";this._program=r.programCache.acquire(e,t,c)}_test(c){const l=this._rctx,u=new a(1);u.wrapMode=33071,u.dataType=e.FLOAT,u.internalFormat=t.RGBA32F,u.samplingMode=9728;const b=new i(l,u),d=r.createVertex(l,35044,new Uint16Array([0,0,1,0,0,1,1,1])),g=new p(l,new m(f,d));l.gl.getError(),l.useProgram(c);const j=l.getBoundFramebufferObject(),{x:w,y:x,width:A,height:h}=l.getViewport();l.bindFramebuffer(b),l.setViewport(0,0,1,1),l.bindVAO(g),l.drawArrays(o.TRIANGLE_STRIP,0,4);const F=n({blending:s});l.setPipelineState(F),l.drawArrays(o.TRIANGLE_STRIP,0,4);const _=l.gl.getError();return l.setViewport(w,x,A,h),l.bindFramebuffer(j),g.dispose(),b.dispose(),_!==l.gl.INVALID_OPERATION||(console.warn("Device claims support for WebGL extension EXT_float_blend but does not support it. Using fall back."),!1)}}export{u as FloatBufferBlend};
5
+ import{PixelType as r,SizedPixelFormat as e,PrimitiveType as t}from"./enums.js";import{FramebufferObject as o}from"./FramebufferObject.js";import{makePipelineState as i,destinationTimesOneMinusSourceAlpha as n}from"./renderState.js";import{TextureDescriptor as s}from"./TextureDescriptor.js";import{VertexArrayObject as a}from"./VertexArrayObject.js";import{Pos2usLocations as p,Pos2us as c}from"./VertexAttributeLayouts.js";import{VertexBuffer as f}from"./VertexBuffer.js";import{WebGLDriverTestModule as l}from"./WebGLDriverTestModule.js";class m extends l{constructor(r){if(super(),this._rctx=r,!r.gl)return;if(!(r.capabilities.colorBufferFloat?.textureFloat&&r.capabilities.colorBufferFloat?.floatBlend))return;const e="\n precision highp float;\n attribute vec2 position;\n\n void main() {\n gl_Position = vec4(position * 2.0 - 1.0, 0.0, 1.0);\n }\n ",t="\n precision highp float;\n\n void main() {\n gl_FragColor = vec4(0.5, 0.5, 0.5, 0.5);\n }\n ";this._program=r.programCache.acquire(e,t,p)}_test(p){const l=this._rctx,m=new s(1);m.wrapMode=33071,m.dataType=r.FLOAT,m.internalFormat=e.RGBA32F,m.samplingMode=9728;const u=new o(l,m),b=new f(l,c,new Uint16Array([0,0,1,0,0,1,1,1])),d=new a(l,b);l.gl.getError(),l.useProgram(p);const g=l.getBoundFramebufferObject(),{x:w,y:A,width:j,height:x}=l.getViewport();l.bindFramebuffer(u),l.setViewport(0,0,1,1),l.bindVAO(d),l.drawArrays(t.TRIANGLE_STRIP,0,4);const h=i({blending:n});l.setPipelineState(h),l.drawArrays(t.TRIANGLE_STRIP,0,4);const F=l.gl.getError();return l.setViewport(w,A,j,x),l.bindFramebuffer(g),d.dispose(),u.dispose(),F!==l.gl.INVALID_OPERATION||(console.warn("Device claims support for WebGL extension EXT_float_blend but does not support it. Using fall back."),!1)}}export{m as FloatBufferBlend};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{BufferObject as e}from"./BufferObject.js";import{PrimitiveType as r,PixelType as t}from"./enums.js";import{FramebufferObject as i}from"./FramebufferObject.js";import{Texture as o}from"./Texture.js";import{TextureDescriptor as n}from"./TextureDescriptor.js";import{VertexArrayObject as s}from"./VertexArrayObject.js";import{Pos2usLocations as a,Pos2us as m}from"./VertexAttributeLayouts.js";import{VertexBuffer as p}from"./VertexBuffer.js";import{WebGLDriverTestModule as u}from"./WebGLDriverTestModule.js";class c extends u{constructor(e){super(),this._rctx=e;const r="\n precision highp float;\n\n attribute vec2 position;\n varying vec2 v_uv;\n\n void main() {\n v_uv = position;\n gl_Position = vec4(position * 2.0 - 1.0, 0.0, 1.0);\n }\n ",t="\n precision highp float;\n\n varying vec2 v_uv;\n\n uniform sampler2D u_texture;\n\n void main() {\n gl_FragColor = texture2D(u_texture, v_uv);\n }\n ";this._program=e.programCache.acquire(r,t,a)}dispose(){super.dispose()}_test(a){const u=this._rctx;if(!u.gl)return a.dispose(),!0;const c=new n(1);c.wrapMode=33071,c.samplingMode=9728;const f=new i(u,c),g=e.createVertex(u,35044,new Uint16Array([0,0,1,0,0,1,1,1])),l=new s(u,new p(m,g)),v=new n;v.samplingMode=9729,v.wrapMode=33071;const w=new o(u,v,d);u.useProgram(a),u.bindTexture(w,0),a.setUniform1i("u_texture",0);const x=u.getBoundFramebufferObject(),{x:h,y:b,width:_,height:j}=u.getViewport();u.bindFramebuffer(f),u.setViewport(0,0,1,1),u.setClearColor(0,0,0,0),u.setBlendingEnabled(!1),u.clear(16384),u.bindVAO(l),u.drawArrays(r.TRIANGLE_STRIP,0,4);const y=new Uint8Array(4);return f.readPixels(0,0,1,1,6408,t.UNSIGNED_BYTE,y),l.dispose(),f.dispose(),w.dispose(),u.setViewport(h,b,_,j),u.bindFramebuffer(x),255!==y[0]}}const d=new Image;d.src="data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg width='5' height='5' version='1.1' viewBox='0 0 5 5' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='5' height='5' fill='%23f00' fill-opacity='.5'/%3E%3C/svg%3E%0A",d.width=5,d.height=5,d.decode();export{c as SVGPremultipliedAlpha};
5
+ import{PrimitiveType as e,PixelType as r}from"./enums.js";import{FramebufferObject as t}from"./FramebufferObject.js";import{Texture as i}from"./Texture.js";import{TextureDescriptor as o}from"./TextureDescriptor.js";import{VertexArrayObject as n}from"./VertexArrayObject.js";import{Pos2usLocations as s,Pos2us as a}from"./VertexAttributeLayouts.js";import{VertexBuffer as p}from"./VertexBuffer.js";import{WebGLDriverTestModule as m}from"./WebGLDriverTestModule.js";class u extends m{constructor(e){super(),this._rctx=e;const r="\n precision highp float;\n\n attribute vec2 position;\n varying vec2 v_uv;\n\n void main() {\n v_uv = position;\n gl_Position = vec4(position * 2.0 - 1.0, 0.0, 1.0);\n }\n ",t="\n precision highp float;\n\n varying vec2 v_uv;\n\n uniform sampler2D u_texture;\n\n void main() {\n gl_FragColor = texture2D(u_texture, v_uv);\n }\n ";this._program=e.programCache.acquire(r,t,s)}dispose(){super.dispose()}_test(s){const m=this._rctx;if(!m.gl)return s.dispose(),!0;const u=new o(1);u.wrapMode=33071,u.samplingMode=9728;const d=new t(m,u),g=new p(m,a,new Uint16Array([0,0,1,0,0,1,1,1])),f=new n(m,g),l=new o;l.samplingMode=9729,l.wrapMode=33071;const v=new i(m,l,c);m.useProgram(s),m.bindTexture(v,0),s.setUniform1i("u_texture",0);const w=m.getBoundFramebufferObject(),{x,y:h,width:b,height:_}=m.getViewport();m.bindFramebuffer(d),m.setViewport(0,0,1,1),m.setClearColor(0,0,0,0),m.setBlendingEnabled(!1),m.clear(16384),m.bindVAO(f),m.drawArrays(e.TRIANGLE_STRIP,0,4);const j=new Uint8Array(4);return d.readPixels(0,0,1,1,6408,r.UNSIGNED_BYTE,j),f.dispose(),d.dispose(),v.dispose(),m.setViewport(x,h,b,_),m.bindFramebuffer(w),255!==j[0]}}const c=new Image;c.src="data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg width='5' height='5' version='1.1' viewBox='0 0 5 5' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='5' height='5' fill='%23f00' fill-opacity='.5'/%3E%3C/svg%3E%0A",c.width=5,c.height=5,c.decode();export{u as SVGPremultipliedAlpha};
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[6811],{9192:(e,t,r)=>{r.r(t),r.d(t,{OperatorProject:()=>s.O}),r(55537);var s=r(39117)}}]);