@arcgis/core 4.33.0-next.20250207 → 4.33.0-next.20250209

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 (87) hide show
  1. package/applications/Components/styleUtils.js +1 -1
  2. package/applications/Components/webStyleSymbolUtils.js +1 -1
  3. package/arcade/treeAnalysis.js +1 -1
  4. package/assets/esri/core/workers/RemoteClient.js +1 -1
  5. package/assets/esri/core/workers/chunks/{5b20ee64248f2d5c937f.js → 08980b1ad3d5d67c6390.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{b1f5344e57ee679a7e81.js → 140d0c4285c6978103ea.js} +7 -7
  7. package/assets/esri/core/workers/chunks/{2a7f5d09cdc0333fa4bd.js → 2611adb4f328f95ee508.js} +1 -1
  8. package/assets/esri/core/workers/chunks/2def7db73a776e759dae.js +1 -0
  9. package/assets/esri/core/workers/chunks/{32f5f00aab55ef16dcf1.js → 5b85f9da022742f602e2.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{bab541feca7ab4d3f993.js → 6ea02ff25f051c08e6c3.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{8e334fa440ae542e2e34.js → 7e49ddb5a2182f2c9ca6.js} +1 -1
  12. package/assets/esri/core/workers/chunks/b97673755cd2cc5164e8.js +1 -0
  13. package/assets/esri/core/workers/chunks/bb9ab85a135d211637f6.js +1 -0
  14. package/assets/esri/core/workers/chunks/c26ffbff1115e76bcb0f.js +1 -0
  15. package/assets/esri/core/workers/chunks/c38c154062cd838dd144.js +1 -0
  16. package/assets/esri/core/workers/chunks/{4decfae8bc5e80878bdd.js → de4384b5833a60e88e31.js} +1 -1
  17. package/assets/esri/core/workers/chunks/e37e5d2e233d7f6ccd52.js +314 -0
  18. package/assets/esri/core/workers/chunks/e93dea6b112ce8e2779b.js +1 -0
  19. package/assets/esri/core/workers/chunks/edb580ce96da6fd66503.js +1 -0
  20. package/chunks/ImageMaterial.glsl.js +4 -4
  21. package/geometry/Mesh.js +1 -1
  22. package/geometry/support/Indices.js +1 -1
  23. package/geometry/support/meshUtils/deduplicate.js +1 -1
  24. package/geometry/support/meshVertexSpaceUtils.js +1 -1
  25. package/geometry/support/triangulationUtils.js +1 -1
  26. package/interfaces.d.ts +3 -28
  27. package/package.json +1 -1
  28. package/support/arcadeUtils.js +1 -1
  29. package/support/revision.js +1 -1
  30. package/symbols/WebStyleSymbol.js +1 -1
  31. package/symbols/support/previewSymbol3D.js +1 -1
  32. package/symbols/support/previewWebStyleSymbol.js +1 -1
  33. package/symbols/support/styleUtils.js +1 -1
  34. package/symbols/support/symbolUtils.js +1 -1
  35. package/symbols/support/utils.js +1 -1
  36. package/symbols/support/webStyleAcceptedFormats.js +5 -0
  37. package/symbols/support/webStyleSymbolUtils.js +1 -1
  38. package/views/3d/glTF/internal/resourceUtils.js +1 -1
  39. package/views/3d/layers/MediaLayerView3D.js +1 -1
  40. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  41. package/views/3d/layers/graphics/Graphics3DWebStyleSymbol.js +1 -1
  42. package/views/3d/layers/graphics/Labeler.js +1 -1
  43. package/views/3d/layers/graphics/pipeline/Feature3DPipeline.js +1 -1
  44. package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +1 -1
  45. package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorkerHandle.js +1 -1
  46. package/views/3d/layers/graphics/pipeline/PipelineCommand.js +1 -1
  47. package/views/3d/layers/graphics/pipeline/featureData/FeatureData.js +1 -1
  48. package/views/3d/layers/graphics/pipeline/featureData/processingUtils.js +1 -1
  49. package/views/3d/layers/graphics/pipeline/rendering/DirectRenderer.js +1 -1
  50. package/views/3d/layers/graphics/pipeline/rendering/FeaturePipelineRenderManager.js +1 -1
  51. package/views/3d/layers/graphics/pipeline/rendering/LodRenderer.js +1 -1
  52. package/views/3d/layers/graphics/pipeline/rendering/RenderCommandContext.js +1 -1
  53. package/views/3d/layers/graphics/pipeline/rendering/RenderCommandEncoder.js +1 -1
  54. package/views/3d/layers/graphics/pipeline/rendering/RenderGeometryBufferWriter.js +1 -1
  55. package/views/3d/layers/graphics/pipeline/symbolization/TestObjectSymbol.js +1 -1
  56. package/views/3d/layers/graphics/pipeline/symbolization/TestSymbol.js +1 -1
  57. package/views/3d/layers/graphics/pipeline/symbolization/UniqueValueFeatureRenderer.js +1 -1
  58. package/views/3d/layers/graphics/pipeline/symbolization/primitiveObjectUtils.js +1 -1
  59. package/views/3d/layers/graphics/pipeline/utils.js +5 -0
  60. package/views/3d/layers/graphics/webStyleUtils.js +1 -1
  61. package/views/3d/layers/graphics/wosrLoader.js +1 -1
  62. package/views/3d/webgl-engine/lib/GLTextureMaterial.js +1 -1
  63. package/views/3d/webgl-engine/lib/Texture.js +1 -1
  64. package/views/3d/webgl-engine/lib/TextureRepository.js +1 -1
  65. package/views/3d/webgl-engine/materials/DefaultBufferWriter.js +1 -1
  66. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  67. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  68. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  69. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  70. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  71. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  72. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  73. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  74. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  75. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  76. package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
  77. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  78. package/views/3d/webgl-engine/shaders/ImageMaterial.glsl.js +1 -1
  79. package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
  80. package/assets/esri/core/workers/chunks/1100d9d114287b6443e2.js +0 -1
  81. package/assets/esri/core/workers/chunks/459af0c3d62c3ed11c19.js +0 -1
  82. package/assets/esri/core/workers/chunks/6ec108bd955e064256b5.js +0 -1
  83. package/assets/esri/core/workers/chunks/7b11bf5799ecb3640b48.js +0 -314
  84. package/assets/esri/core/workers/chunks/81efe1f47fd41b7a5cc1.js +0 -1
  85. package/assets/esri/core/workers/chunks/92871ebb339a7b6ff29c.js +0 -1
  86. package/assets/esri/core/workers/chunks/b3f9d7a676076a7557f5.js +0 -1
  87. package/assets/esri/core/workers/chunks/fe817283bbcbca8fb296.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.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../../chunks/tslib.es6.js";import{nullUid as r}from"../../../../../../core/uid.js";import{property as t}from"../../../../../../core/accessorSupport/decorators/property.js";import"../../../../../../core/has.js";import"../../../../../../core/Logger.js";import"../../../../../../core/RandomLCG.js";import{subclass as i}from"../../../../../../core/accessorSupport/decorators/subclass.js";import{glLayout as s}from"../../../../support/buffer/glUtil.js";import{ShaderOutput as o}from"../../../../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as n}from"../../../../webgl-engine/effects/RenderPlugin.js";import{GLMaterials as a}from"../../../../webgl-engine/lib/GLMaterials.js";import{IntersectorType as l}from"../../../../webgl-engine/lib/IntersectorInterfaces.js";import{BoundingVolume as m}from"../../../../webgl-engine/lib/Object3D.js";import{RenderSlot as c}from"../../../../webgl-engine/lib/RenderSlot.js";import{DrawParameters as d}from"../../../../webgl-engine/materials/DrawParameters.js";import{HUDMaterial as u}from"../../../../webgl-engine/materials/HUDMaterial.js";let h=class extends n{constructor(e){super(e),this._glMaterials=null,this._produces=new Map,this._renderGeometries=new Map,this._vaoCache=null,this._drawParameters=new d,this._bufferWriter=null,this.slicePlaneEnabled=!1,this.isGround=!1,this.type=e.material instanceof u?l.HUD:l.OBJECT,this.layerUid=e.layerUid}get produces(){return this._produces}get numFeatures(){const e=6;let r=0;return this._renderGeometries.forEach((t=>r+=t.numElements/e)),r}get usedMemory(){let e=0;return this._renderGeometries.forEach((r=>{e+=r.vao.usedMemory})),e}intersect(e,t,i,s,o,n){const{material:a,_bufferWriter:l,layerUid:c}=this,d=this._renderGeometries;if(0!==d.size&&null!=l.intersect)for(const[u,h]of d){const{buffer:t,localOrigin:o,objectIds:n}=h;if(null==n)return;l.intersect(t.data,a.parameters,o,e,i,s,((t,i,s,o,l,d)=>{const u=n[s];e.handleObjectIntersection({object:{id:r,graphicUid:u,layerUid:c,boundingVolumeWorldSpace:new m,geometries:[{material:a}]},geometryId:0,primIndex:s},t,i,o,null,l,d)}))}}initialize(){this._bufferWriter=this.material.createBufferWriter(),this.material.produces.forEach(((e,r)=>{this._produces.set(r,(r=>r!==o.Highlight&&r!==o.ShadowHighlight&&e(r)))}))}destroy(){this._glMaterials.dispose();const e=this._renderGeometries.keys();for(const r of e)this.removeRenderGeometry(r)}acquireTechniques(e){const r=this.material;if(!r.shouldRender(e))return null;const{output:t,bind:i}=e,s=r.produces.get(i.slot);if(!s?.(t))return null;if(t===o.Highlight||t===o.ShadowHighlight)return null;const n=this._glMaterials.load(e.rctx,i.slot,t);return n?.beginSlot(i)}render(e,r){const t=this._renderGeometries;if(0===t.size)return;const{bind:i}=e,s=i.slot===c.OCCLUDER_MATERIAL||i.slot===c.TRANSPARENT_OCCLUDER_MATERIAL?i.slot:null,o=e.rctx;o.runAppleAmdDriverHelper(),o.bindTechnique(r,i,this.material.parameters);const n=r.program;for(const[a,l]of t)this._drawParameters.origin=l.localOrigin,n.bindDraw(i,this.material.parameters,this._drawParameters),r.ensureAttributeLocations(l.vao),o.bindVAO(l.vao),o.setPipelineState(r.getPipeline(!1,s)),o.drawArrays(r.primitiveType,0,l.numElements)}initializeRenderContext(e,r){this._glMaterials=new a(this.material,e.materials),this._vaoCache=e.renderContext.rctx.getVaoCache(this.material.vertexAttributeLocations,s(this._bufferWriter.vertexBufferLayout))}uninitializeRenderContext(){}addRenderGeometry(e,r,t,i){this.removeRenderGeometry(e);const s=this._vaoCache.newVao(t.data.byteLength);s.vertexBuffers.get("geometry").setSubData(new Uint8Array(t.data),0,0,t.data.byteLength);const o={buffer:t,localOrigin:i,vao:s,numElements:t.elementCount,objectIds:r};return this._renderGeometries.set(e,o),o}removeRenderGeometry(e){const r=this._renderGeometries.get(e);null!=r&&(this._vaoCache.deleteVao(r.vao),this._renderGeometries.delete(e))}hasHighlightOptions(e){return!1}};e([t({constructOnly:!0})],h.prototype,"material",void 0),h=e([i("esri.views.3d.layers.graphics.pipeline.rendering.DirectRenderer")],h);export{h as DirectRenderer};
5
+ import{_ as e}from"../../../../../../chunks/tslib.es6.js";import{nullUid as t}from"../../../../../../core/uid.js";import{property as r}from"../../../../../../core/accessorSupport/decorators/property.js";import"../../../../../../core/has.js";import"../../../../../../core/Logger.js";import"../../../../../../core/RandomLCG.js";import{subclass as i}from"../../../../../../core/accessorSupport/decorators/subclass.js";import{glLayout as s}from"../../../../support/buffer/glUtil.js";import{ShaderOutput as n}from"../../../../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as o}from"../../../../webgl-engine/effects/RenderPlugin.js";import{GLMaterials as a}from"../../../../webgl-engine/lib/GLMaterials.js";import{IntersectorType as l}from"../../../../webgl-engine/lib/IntersectorInterfaces.js";import{BoundingVolume as c}from"../../../../webgl-engine/lib/Object3D.js";import{RenderSlot as u}from"../../../../webgl-engine/lib/RenderSlot.js";import{DrawParameters as m}from"../../../../webgl-engine/materials/DrawParameters.js";import{HUDMaterial as d}from"../../../../webgl-engine/materials/HUDMaterial.js";let h=class extends o{constructor(e){super(e),this._glMaterials=null,this._produces=new Map,this._renderGeometries=new Map,this._vaoCache=null,this._drawParameters=new m,this._bufferWriter=null,this.slicePlaneEnabled=!1,this.isGround=!1,this.type=e.material instanceof d?l.HUD:l.OBJECT,this.layerUid=e.layerUid}get produces(){return this._produces}get numFeatures(){const e=6;let t=0;return this._renderGeometries.forEach((r=>t+=r.numElements/e)),t}get usedMemory(){let e=0;return this._renderGeometries.forEach((t=>{e+=t.vao.usedMemory})),e}intersect(e,r,i,s,n,o){const{material:a,_bufferWriter:l,layerUid:u}=this,m=this._renderGeometries;if(0!==m.size&&null!=l.intersect)for(const[d,h]of m){const{buffer:r,localOrigin:n,items:o}=h;l.intersect(r.data,a.parameters,n,e,i,s,((r,i,s,n,l,m)=>{const d=o.objectIds[s];o.visibilities[s]&&e.handleObjectIntersection({object:{id:t,graphicUid:d,layerUid:u,boundingVolumeWorldSpace:new c,geometries:[{material:a}]},geometryId:0,primIndex:s},r,i,n,null,l,m)}))}}initialize(){this._bufferWriter=this.material.createBufferWriter(),this.material.produces.forEach(((e,t)=>{this._produces.set(t,(t=>t!==n.Highlight&&t!==n.ShadowHighlight&&e(t)))}))}destroy(){this._glMaterials.dispose();const e=this._renderGeometries.keys();for(const t of e)this.removeRenderGeometry(t)}acquireTechniques(e){const t=this.material;if(!t.shouldRender(e))return null;const{output:r,bind:i}=e,s=t.produces.get(i.slot);if(!s?.(r))return null;if(r===n.Highlight||r===n.ShadowHighlight)return null;const o=this._glMaterials.load(e.rctx,i.slot,r);return o?.beginSlot(i)}render(e,t){const r=this._renderGeometries;if(0===r.size)return;const{bind:i}=e,s=i.slot===u.OCCLUDER_MATERIAL||i.slot===u.TRANSPARENT_OCCLUDER_MATERIAL?i.slot:null,n=e.rctx;n.runAppleAmdDriverHelper(),n.bindTechnique(t,i,this.material.parameters);const o=t.program;for(const[a,l]of r){const{vao:e,localOrigin:r,drawCalls:a}=l;this._drawParameters.origin=r,o.bindDraw(i,this.material.parameters,this._drawParameters),t.ensureAttributeLocations(e),n.bindVAO(e),n.setPipelineState(t.getPipeline(!1,s));for(const i of a)n.drawArrays(t.primitiveType,i.start,i.count)}}initializeRenderContext(e,t){this._glMaterials=new a(this.material,e.materials),this._vaoCache=e.renderContext.rctx.getVaoCache(this.material.vertexAttributeLocations,s(this._bufferWriter.vertexBufferLayout))}uninitializeRenderContext(){}addRenderGeometry(e,t,r,i){this.removeRenderGeometry(e);const{data:s,elementCount:n}=t,o=this._vaoCache.newVao(s.byteLength);o.vertexBuffers.get("geometry").setSubData(new Uint8Array(s),0,0,s.byteLength);const a={localOrigin:i,numElements:n,buffer:t,items:r,vao:o,drawCalls:this._produceDrawCalls(r)};return this._renderGeometries.set(e,a),a}updateRenderGeometryVisibility(e,t){const r=this._renderGeometries.get(e);if(null==r)return;const{items:i}=r;if(i.visibilities.length!==t.length)throw new Error("Unexpected mismatch between old and new visibiltiy flag buffer length.");i.visibilities=t,r.drawCalls=this._produceDrawCalls(i)}removeRenderGeometry(e){const t=this._renderGeometries.get(e);null!=t&&(this._vaoCache.deleteVao(t.vao),this._renderGeometries.delete(e))}hasHighlightOptions(e){return!1}_produceDrawCalls(e){const{visibilities:t,ranges:r}=e,i=[];if(p(r)){if(0===r.numItems)return[];const e=r.numVertices;let s=null;for(let n=0;n<r.numItems;++n){t[n]?null==s?(s={start:n*e,count:e},i.push(s)):s.count+=e:s=null}}else{const e=r.counts,s=e.length;if(0===s)return[];let n=null,o=0;for(let r=0;r<s;++r){const s=t[r],a=e[r];s?null==n?(n={start:o,count:a},i.push(n)):n.count+=a:n=null,o+=a}}return i}};function p(e){return"numItems"in e}e([r({constructOnly:!0})],h.prototype,"material",void 0),h=e([i("esri.views.3d.layers.graphics.pipeline.rendering.DirectRenderer")],h);export{h as DirectRenderer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../../chunks/tslib.es6.js";import r from"../../../../../../core/Accessor.js";import{makeHandle as t}from"../../../../../../core/handleUtils.js";import{releaseMaybe as s}from"../../../../../../core/maybe.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 o}from"../../../../../../core/accessorSupport/decorators/subclass.js";import{ONES as a}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as n}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ViewingMode as d}from"../../../../../ViewingMode.js";import{namedAnchorToHUDMaterialAnchorPos as c}from"../../placementUtils.js";import{DirectRenderer as l}from"./DirectRenderer.js";import{LodRenderer as m}from"./LodRenderer.js";import{defaultBoundingBox as u,createTexture as h,requiresHalfTexelOffset as p}from"../../../../support/engineContent/sdfPrimitives.js";import{CullFaceOptions as f}from"../../../../webgl-engine/lib/basicInterfaces.js";import{DefaultMaterial as w}from"../../../../webgl-engine/materials/DefaultMaterial.js";import{HUDMaterial as y}from"../../../../webgl-engine/materials/HUDMaterial.js";import{schematicMRRFactors as g}from"../../../../webgl-engine/materials/pbrUtils.js";let _=class extends r{constructor(e){super(),this.view=null,this.layerUid=null,this._renderGeometries=new Map,this._materials=new Map,this._directRenderers=new Map,this._lodRenderers=new Map,this.totalFeatures=0,this.view=e.view,this.layerUid=e.layerUid}initialize(){}destroy(){this.removeAllHandles(),this._lodRenderers.forEach((e=>e.destroy()))}async executeRenderCommands(e){for(const r of e)switch(r.id){case"create-material":await this._createMaterial(r);break;case"create-direct-renderer":await this._createDirectRenderer(r);break;case"add-direct-renderer-geometry":await this._addDirectRendererGeometry(r),this._updateFeatureCount();break;case"remove-direct-renderer-geometry":await this._removeDirectRendererGeometry(r),this._updateFeatureCount();break;case"create-lod-renderer":await this._createLodRenderer(r);break;case"add-lod-instances":await this._addLodInstances(r),this._updateFeatureCount();break;case"remove-lod-instances":await this._removeLodInstances(r),this._updateFeatureCount()}}_updateFeatureCount(){let e=0;for(const r of this._directRenderers.values())e+=r.numFeatures;for(const r of this._lodRenderers.values())e+=r.numFeatures;this._set("totalFeatures",e)}get usedMemory(){let e=0;for(const r of this._directRenderers.values())e+=r.usedMemory;for(const r of this._lodRenderers.values())e+=r.usedMemory;return e}async _createMaterial(e){const{view:r}=this,{sharedSymbolResources:i}=r;if(null==i)throw new Error("No shared symbol resources found!");const{textures:o}=i,a=r.state.viewingMode===d.Global;let n=null;switch(e.type){case"default":n=v(i,{physicalBasedRenderingEnabled:!0,slicePlaneEnabled:!1,castShadows:!0,isPrimitive:!0,screenSizePerspectiveEnabled:!0,doublePrecisionRequiresObfuscation:r._stage.renderView.renderingContext.driverTest.doublePrecisionRequiresObfuscation.result},a);break;case"hud":{const[e,r]=R(o,a);this.addHandles([t((()=>s(r)))]),n=e}break;default:throw new Error(`unable to create unknown material type ${e.type}`)}this._materials.set(e.materialId,n)}_getMaterial(e){return this._materials.get(e)}async _createDirectRenderer(e){const r=e.materialId,t=this._getMaterial(r);if(null==t)throw new Error(`material not found ${r}`);const{view:s}=this,i=new l({material:t,layerUid:this.layerUid});this._directRenderers.set(r,i),s._stage.addRenderPlugin(i),s._stage.renderView.renderer.updateHasFlags()}async _addDirectRendererGeometry(e){const r=e.renderGeometryId,t=e.objectIds,s=e.materialId;await this._removeDirectRendererGeometry({renderGeometryId:r});const i=this._directRenderers.get(s);if(null==i)return void console.error("no renderer assigned to provided material");const o=i.addRenderGeometry(r,t,e.renderGeometryBuffer,e.localOrigin);this._renderGeometries.set(r,{renderGeometry:o,materialId:s}),this.view._stage.renderView.requestRender()}async _removeDirectRendererGeometry(e){const r=e.renderGeometryId,t=this._renderGeometries.get(r);if(null==t)return;const s=t.materialId,i=this._directRenderers.get(s);null!=i?i.removeRenderGeometry(e.renderGeometryId):console.error("no renderer assigned to provided material")}async _createLodRenderer(e){const r=new m({view:this.view,layerUid:this.layerUid}),t=new AbortController,s=e=>this._getMaterial(e);await r.doLoad(e.lodRenderGeometry,s,t.signal),this._lodRenderers.set(e.lodRendererId,r)}async _addLodInstances(e){const r=this._lodRenderers.get(e.lodRendererId);if(null==r)throw new Error("no lod renderer assigned to provided lod renderer Id");r.addInstances(e.data)}async _removeLodInstances(e){const r=this._lodRenderers.get(e.lodRendererId);if(null==r)throw new Error("no lod renderer assigned to provided lod renderer Id");r.removeInstances(e.featureIds)}};function R(e,r){const t={anchorPosition:c.center,occlusionTest:!0,hasSlicePlane:!1,color:[1,0,0,1],outlineColor:[0,0,0,1],outlineSize:1,distanceFieldBoundingBox:u},s=null;if(null!=e){const r=e.fromData("circle-icon",(()=>h("circle")));t.textureId=r.texture.id,t.textureIsSignedDistanceField=!0,t.sampleSignedDistanceFieldTexelCenter=p("circle")}return[new y(t,r),s]}function v(e,r,t){const s={usePBR:r.physicalBasedRenderingEnabled,isSchematic:!0,mrrFactors:g,ambient:a,diffuse:a,hasSlicePlane:r.slicePlaneEnabled,castShadows:r.castShadows,offsetTransparentBackfaces:!r.isPrimitive};return b(s),r.screenSizePerspectiveEnabled&&(s.screenSizePerspective=e.screenSizePerspectiveSettings),s.externalColor=n,s.isInstanced=!0,new w(s,{spherical:t,doublePrecisionRequiresObfuscation:!0})}function b(e){const r=e.opacity??1,t=r<1;return e.transparent=t,e.opacity=r,e.cullFace=t?f.None:f.Back,e}e([i({readOnly:!0})],_.prototype,"totalFeatures",void 0),_=e([o("esri.views.3d.layers.graphics.pipeline.rendering.FeaturePipelineRenderManager")],_);export{_ as FeaturePipelineRenderManager,v as createDefaultMaterial,R as createHudMaterial};
5
+ import{_ as e}from"../../../../../../chunks/tslib.es6.js";import r from"../../../../../../core/Accessor.js";import"../../../../../../core/has.js";import{makeHandle as t}from"../../../../../../core/handleUtils.js";import{releaseMaybe as s}from"../../../../../../core/maybe.js";import{createAbortError as i}from"../../../../../../core/promiseUtils.js";import{property as o}from"../../../../../../core/accessorSupport/decorators/property.js";import"../../../../../../core/Logger.js";import"../../../../../../core/RandomLCG.js";import{subclass as n}from"../../../../../../core/accessorSupport/decorators/subclass.js";import{ONES as a}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as d}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ViewingMode as l}from"../../../../../ViewingMode.js";import{namedAnchorToHUDMaterialAnchorPos as c}from"../../placementUtils.js";import{DirectRenderer as m}from"./DirectRenderer.js";import{LodRenderer as u}from"./LodRenderer.js";import{defaultBoundingBox as h,createTexture as p,requiresHalfTexelOffset as f}from"../../../../support/engineContent/sdfPrimitives.js";import{CullFaceOptions as y}from"../../../../webgl-engine/lib/basicInterfaces.js";import{DefaultMaterial as g}from"../../../../webgl-engine/materials/DefaultMaterial.js";import{HUDMaterial as w}from"../../../../webgl-engine/materials/HUDMaterial.js";import{schematicMRRFactors as R}from"../../../../webgl-engine/materials/pbrUtils.js";let v=class extends r{constructor(e){super(),this.view=null,this.layerUid=null,this._materials=new Map,this._directRenderers=new Map,this._lodRenderers=new Map,this.totalFeatures=0,this.view=e.view,this.layerUid=e.layerUid}initialize(){}destroy(){this.removeAllHandles(),this._lodRenderers.forEach((e=>e.destroy()))}async createMaterial(e,r){const{view:i}=this,{sharedSymbolResources:o}=i;if(null==o)throw new Error("No shared symbol resources found!");const{textures:n}=o,a=i.state.viewingMode===l.Global;let d=null;switch(r){case"default":d=_(o,{physicalBasedRenderingEnabled:!0,slicePlaneEnabled:!1,castShadows:!0,isPrimitive:!0,screenSizePerspectiveEnabled:!0,doublePrecisionRequiresObfuscation:i._stage.renderView.renderingContext.driverTest.doublePrecisionRequiresObfuscation.result},a);break;case"hud":{const[e,r]=b(n,a);this.addHandles([t((()=>s(r)))]),d=e}break;default:throw new Error(`unable to create unknown material type ${r}`)}this._materials.set(e,d)}async createDirectRenderer(e){if(this._directRenderers.has(e))return;const r=this._materials.get(e);if(null==r)throw new Error(`material not found ${e}`);const{view:t}=this,s=new m({material:r,layerUid:this.layerUid});this._directRenderers.set(e,s),t._stage.addRenderPlugin(s),t._stage.renderView.renderer.updateHasFlags()}async createLoDRenderer(e,r,t){const s=new u({view:this.view,layerUid:this.layerUid}),o=e=>this._materials.get(e);if(await s.doLoad(r,o,t),t?.aborted)throw s.destroy(),i();this._lodRenderers.set(e,s)}async executeRenderCommands(e){for(const r of e)switch(r.id){case"add-direct-renderer-geometry":this._addDirectRendererGeometry(r);break;case"update-direct-renderer-visibility":this._updateDirectRendererVisibility(r);break;case"remove-direct-renderer-geometry":this._removeDirectRendererGeometry(r);break;case"add-lod-instances":this._addLodInstances(r);break;case"remove-lod-instances":this._removeLodInstances(r)}e.length>0&&this._updateFeatureCount()}_updateFeatureCount(){let e=0;for(const r of this._directRenderers.values())e+=r.numFeatures;for(const r of this._lodRenderers.values())e+=r.numFeatures;this._set("totalFeatures",e)}get usedMemory(){let e=0;for(const r of this._directRenderers.values())e+=r.usedMemory;for(const r of this._lodRenderers.values())e+=r.usedMemory;return e}_addDirectRendererGeometry({renderGeometryId:e,materialId:r,renderGeometryBuffer:t,renderGeometryBufferItems:s,localOrigin:i}){const o=this._directRenderers.get(r);null!=o?(o.addRenderGeometry(e,t,s,i),this.view._stage.renderView.requestRender()):console.error("no renderer assigned to provided material")}_updateDirectRendererVisibility(e){const{materialId:r,renderGeometryId:t,visibility:s}=e,i=this._directRenderers.get(r);null!=i?(i.updateRenderGeometryVisibility(t,s),this.view._stage.renderView.requestRender()):console.error("no renderer assigned to provided material")}_removeDirectRendererGeometry({renderGeometryId:e,materialId:r}){const t=this._directRenderers.get(r);null!=t?t.removeRenderGeometry(e):console.error("no renderer assigned to provided material")}_addLodInstances({lodRendererId:e,renderGeometryId:r,data:t}){const s=this._lodRenderers.get(e);if(null==s)throw new Error("no lod renderer assigned to provided lod renderer Id");s.addInstances(r,t)}_removeLodInstances({lodRendererId:e,renderGeometryId:r}){const t=this._lodRenderers.get(e);if(null==t)throw new Error("no lod renderer assigned to provided lod renderer Id");t.removeInstances(r)}};function b(e,r){const t={anchorPosition:c.center,occlusionTest:!0,hasSlicePlane:!1,color:[1,0,0,1],outlineColor:[0,0,0,1],outlineSize:1,distanceFieldBoundingBox:h},s=null;if(null!=e){const r=e.fromData("circle-icon",(()=>p("circle")));t.textureId=r.texture.id,t.textureIsSignedDistanceField=!0,t.sampleSignedDistanceFieldTexelCenter=f("circle")}return[new w(t,r),s]}function _(e,r,t){const s={usePBR:r.physicalBasedRenderingEnabled,isSchematic:!0,mrrFactors:R,ambient:a,diffuse:a,hasSlicePlane:r.slicePlaneEnabled,castShadows:r.castShadows,offsetTransparentBackfaces:!r.isPrimitive};return I(s),r.screenSizePerspectiveEnabled&&(s.screenSizePerspective=e.screenSizePerspectiveSettings),s.externalColor=d,s.isInstanced=!0,new g(s,{spherical:t,doublePrecisionRequiresObfuscation:!0})}function I(e){const r=e.opacity??1,t=r<1;return e.transparent=t,e.opacity=r,e.cullFace=t?y.None:y.Back,e}e([o({readOnly:!0})],v.prototype,"totalFeatures",void 0),v=e([n("esri.views.3d.layers.graphics.pipeline.rendering.FeaturePipelineRenderManager")],v);export{v as FeaturePipelineRenderManager,_ as createDefaultMaterial,b as createHudMaterial};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../../chunks/tslib.es6.js";import has from"../../../../../../core/has.js";import{throwIfAborted as r}from"../../../../../../core/promiseUtils.js";import"../../../../../../core/Logger.js";import"../../../../../../core/RandomLCG.js";import"../../../../../../core/Error.js";import{subclass as s}from"../../../../../../core/accessorSupport/decorators/subclass.js";import{VertexAttribute as t}from"../../../../webgl-engine/lib/VertexAttribute.js";import{LodRenderer as n}from"../../../../webgl-engine/lib/lodRendering/LodRenderer.js";import{LodComponentRenderGeometry as o,LodComponentResources as i,LodLevelResources as a,LodResources as d}from"../../../../webgl-engine/lib/lodRendering/LodResources.js";let l=class{constructor(e){this._optionalFields=new Array,this._featureIdToInstanceIndex=new Map,this._instanceIndexToFeatureId=new Map,this._disposeResourceHandles=new Array,this._lodRendererResources=null,this.layerUid=e.layerUid,this.view=e.view,this.sharedResources=this.view.sharedSymbolResources,this.scheduler=this.view.resourceController.scheduler}get numFeatures(){return this._featureIdToInstanceIndex.size}get usedMemory(){const e=this._lodRendererResources?.lodRenderer,r=e?.symbol;return(r?.computeUsedMemory()??0)+16*this._featureIdToInstanceIndex.size}destroy(){this._disposeResourceHandles.forEach((e=>e()))}async doLoad(e,s,n){has("enable-feature:objectAndLayerId-rendering")&&this._optionalFields.push(t.OBJECTANDLAYERIDCOLOR);const o=c((e=>s(e)),e),i=this.view._stage,a=o.getMaterials();i.addMany(a),this._addDisposeResource((()=>i.removeMany(a)));const d=o.getTextures();i.addMany(d),this._addDisposeResource((()=>{d.forEach((e=>e.unload())),i.removeMany(d)})),await Promise.all(d.map((e=>this.view._stage.schedule((()=>e.load(i.renderView.renderingContext)),n)))),r(n);const l=await this._createLodRenderer(o,n);this._lodRendererResources={lodRenderer:l,materials:a,textures:d}}addInstances(e){const r=this._lodRendererResources;if(null==r)return;const{featureIds:s,localTransforms:t,globalTransforms:n}=e,o=r.lodRenderer;if(null==o)return;const i=o.instanceData,a=s.length;for(let d=0;d<a;++d){const e=s[d],r=i.addInstance(),o=i.view,a=16*d;o.localTransform.copyFromTypedBuffer(r,t,a),o.globalTransform.copyFromTypedBuffer(r,n,a),i.updateModelTransform(r),i.setVisible(r,!0),this._featureIdToInstanceIndex.set(e,r),this._instanceIndexToFeatureId.set(r,e)}}removeInstances(e){const r=this._lodRendererResources;if(null==r)return;const s=r.lodRenderer.instanceData,t=this._featureIdToInstanceIndex,n=e.length;for(let o=0;o<n;++o){const r=e[o],n=t.get(r);null!=n&&(s.removeInstance(n),t.delete(r),this._instanceIndexToFeatureId.delete(n))}}_addDisposeResource(e){this._disposeResourceHandles.push(e)}async _createLodRenderer(e,r){const s=this.view._stage,t={layerUid:this.layerUid,graphicUid:e=>this._instanceIndexToFeatureId.get(e)??-1,notifyGraphicGeometryChanged:e=>1,notifyGraphicVisibilityChanged:e=>1},o=new n({symbol:e,optionalFields:this._optionalFields,metadata:t,shaderTransformation:null},this.scheduler);return o.slicePlaneEnabled=!1,this._addDisposeResource((()=>{s.removeRenderPlugin(o),o.destroy()})),await s.addRenderPlugin(o,r),o}};function c(e,r){const s=r.levels.map((r=>{const s=r.components.map((r=>{const s=e(r.materialId);if(!u(s))throw new Error("LodRenderer only supports DefaultMaterial");const t=new o(s,r.renderGeometryBuffer.data,r.renderGeometryBuffer.elementCount,r.boundingInfo);return new i(t)}));return new a(s,r.minScreenSpaceRadius)}));return new d(s)}function u(e){return null!=e&&"materialType"in e&&"default"===e.materialType}l=e([s("esri.views.3d.layers.graphics.pipeline.rendering.LodRenderer")],l);export{l as LodRenderer,u as isDefaultMaterial};
5
+ import{_ as e}from"../../../../../../chunks/tslib.es6.js";import has from"../../../../../../core/has.js";import{throwIfAborted as r}from"../../../../../../core/promiseUtils.js";import"../../../../../../core/Logger.js";import"../../../../../../core/RandomLCG.js";import"../../../../../../core/Error.js";import{subclass as s}from"../../../../../../core/accessorSupport/decorators/subclass.js";import{VertexAttribute as n}from"../../../../webgl-engine/lib/VertexAttribute.js";import{LodRenderer as t}from"../../../../webgl-engine/lib/lodRendering/LodRenderer.js";import{LodComponentRenderGeometry as o,LodComponentResources as i,LodLevelResources as a,LodResources as d}from"../../../../webgl-engine/lib/lodRendering/LodResources.js";let l=class{constructor(e){this._optionalFields=new Array,this._instanceGroupToIndices=new Map,this._instanceIndexToFeatureId=new Map,this._disposeResourceHandles=new Array,this._lodRendererResources=null,this._numFeatures=0,this.layerUid=e.layerUid,this.view=e.view,this.sharedResources=this.view.sharedSymbolResources,this.scheduler=this.view.resourceController.scheduler}get numFeatures(){return this._numFeatures}get usedMemory(){const e=this._lodRendererResources?.lodRenderer,r=e?.symbol;return(r?.computeUsedMemory()??0)+16*this._instanceIndexToFeatureId.size}destroy(){this._disposeResourceHandles.forEach((e=>e()))}async doLoad(e,s,t){has("enable-feature:objectAndLayerId-rendering")&&this._optionalFields.push(n.OBJECTANDLAYERIDCOLOR);const o=c((e=>s(e)),e),i=this.view._stage,a=o.getMaterials();i.addMany(a),this._addDisposeResource((()=>i.removeMany(a)));const d=o.getTextures();i.addMany(d),this._addDisposeResource((()=>{d.forEach((e=>e.unload())),i.removeMany(d)})),await Promise.all(d.map((e=>this.view._stage.schedule((()=>e.load(i.renderView.renderingContext)),t)))),r(t);const l=await this._createLodRenderer(o,t);this._lodRendererResources={lodRenderer:l,materials:a,textures:d}}addInstances(e,r){const s=this._lodRendererResources;if(null==s)return;const{featureIds:n,localTransforms:t,globalTransforms:o}=r,i=s.lodRenderer;if(null==i)return;const a=new Array,d=i.instanceData,l=n.length,c=this._instanceIndexToFeatureId;for(let u=0;u<l;++u){const e=n[u],r=d.addInstance(),s=d.view,i=16*u;s.localTransform.copyFromTypedBuffer(r,t,i),s.globalTransform.copyFromTypedBuffer(r,o,i),d.updateModelTransform(r),d.setVisible(r,!0),a.push(r),c.set(r,e)}this._instanceGroupToIndices.set(e,a),this._numFeatures+=l}removeInstances(e){const r=this._instanceGroupToIndices.get(e);if(null==r)return;const s=this._lodRendererResources;if(null==s)return;const n=s.lodRenderer.instanceData,t=this._instanceIndexToFeatureId;for(const o of r)n.removeInstance(o),t.delete(o);this._numFeatures-=r.length,this._instanceGroupToIndices.delete(e)}_addDisposeResource(e){this._disposeResourceHandles.push(e)}async _createLodRenderer(e,r){const s=this.view._stage,n={layerUid:this.layerUid,graphicUid:e=>this._instanceIndexToFeatureId.get(e)??-1,notifyGraphicGeometryChanged:e=>1,notifyGraphicVisibilityChanged:e=>1},o=new t({symbol:e,optionalFields:this._optionalFields,metadata:n,shaderTransformation:null},this.scheduler);return o.slicePlaneEnabled=!1,this._addDisposeResource((()=>{s.removeRenderPlugin(o),o.destroy()})),await s.addRenderPlugin(o,r),o}};function c(e,r){const s=r.levels.map((r=>{const s=r.components.map((r=>{const s=e(r.materialId);if(!u(s))throw new Error("LodRenderer only supports DefaultMaterial");const n=new o(s,r.renderGeometryBuffer.data,r.renderGeometryBuffer.elementCount,r.boundingInfo);return new i(n)}));return new a(s,r.minScreenSpaceRadius)}));return new d(s)}function u(e){return null!=e&&"materialType"in e&&"default"===e.materialType}l=e([s("esri.views.3d.layers.graphics.pipeline.rendering.LodRenderer")],l);export{l as LodRenderer,u as isDefaultMaterial};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{ViewingMode as e}from"../../../../../ViewingMode.js";import{RenderCommandEncoder as r}from"./RenderCommandEncoder.js";class t{constructor(r){this._idCounter=0,this._bufferWriters=new Map,this._dispatchRenderCommandsCallback=async()=>{},this.globalViewingMode=!1,this.globalViewingMode=r.viewingMode===e.Global,this._dispatchRenderCommandsCallback=r.dispatchRenderCommandsCallback}generateUID(){return this._idCounter++,this._idCounter}generateId(e=""){return`${e}${this.generateUID()}`}createEncoder(){return new r(this)}async dispatchRenderCommands(e,r){0!==e.length&&await this._dispatchRenderCommandsCallback(e,r)}registerRenderGeometryBufferWriter(e,r){this._bufferWriters.set(e,r)}getRenderGeometryBufferWriter(e){return this._bufferWriters.get(e)}}export{t as RenderCommandContext};
5
+ import{getContinuousIndexArray as e}from"../../../../../../geometry/support/Indices.js";import{ViewingMode as r}from"../../../../../ViewingMode.js";import{generateId as t}from"../utils.js";import{createHudMaterial as i}from"./FeaturePipelineRenderManager.js";import{RenderCommandEncoder as n}from"./RenderCommandEncoder.js";import{RenderGeometryBufferWriter as a}from"./RenderGeometryBufferWriter.js";import{BoundingInfo as o}from"../../../../webgl-engine/lib/BoundingInfo.js";import{VertexAttribute as s}from"../../../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as d}from"../../../../webgl-engine/materials/DefaultMaterial.js";class l{constructor(e,t,i,n,a){this._createClientMaterial=t,this._createClientDirectRenderer=i,this._createClientLodRenderer=n,this._dispatchRenderCommands=a,this._bufferWriters=new Map,this.globalViewingMode=e===r.Global}createEncoder(){return new n(this)}async dispatchRenderCommands(e,r){0!==e.length&&await this._dispatchRenderCommands(e,r)}async createMaterial(e){const r=t("material");let n;switch(e){case"default":n=new d({},{spherical:this.globalViewingMode,doublePrecisionRequiresObfuscation:!0});break;case"hud":n=i(null,this.globalViewingMode)[0]}const o=new a(n);return this.registerRenderGeometryBufferWriter(r,o),await this._createClientMaterial(r,e),r}async createDirectRenderer(e){return await this._createClientDirectRenderer(e),e}async createLodRenderer(r){const i=t("lod-renderer"),n=new Set,a={levels:r.levels.map((r=>({components:r.components.map((r=>{const t=r.attributes.get(s.POSITION);if(!t||0===t.indices.length)throw new Error("positions attribute expected");const i=3,a=e(t.indices.length/i),d=new o(a,i,t),l=this.getRenderGeometryBufferWriter(r.materialId);if(null==l)throw new Error("writer not found");const{renderGeometryBuffer:c}=l.createBuffer(r,null);n.add(c.data);return{materialId:r.materialId,renderGeometryBuffer:c,boundingInfo:{bbMax:d.bbMax,bbMin:d.bbMin}}})),minScreenSpaceRadius:r.minScreenSpaceRadius})))};return await this._createClientLodRenderer(i,a,Array.from(n)),i}registerRenderGeometryBufferWriter(e,r){this._bufferWriters.set(e,r)}getRenderGeometryBufferWriter(e){return this._bufferWriters.get(e)}}export{l as RenderCommandContext};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{getContinuousIndexArray as e}from"../../../../../../geometry/support/Indices.js";import{createHudMaterial as r}from"./FeaturePipelineRenderManager.js";import{RenderGeometryBufferWriter as t}from"./RenderGeometryBufferWriter.js";import{BoundingInfo as n}from"../../../../webgl-engine/lib/BoundingInfo.js";import{VertexAttribute as s}from"../../../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as a}from"../../../../webgl-engine/materials/DefaultMaterial.js";class o{constructor(e){this._context=e,this._commands=[],this._transferables=new Set}createMaterial(e){const n=this._context,s=n.generateId("material");switch(e){case"default":{const e=new a({},{spherical:this._context.globalViewingMode,doublePrecisionRequiresObfuscation:!0}),r=new t(e);n.registerRenderGeometryBufferWriter(s,r)}break;case"hud":{const e=r(null,this._context.globalViewingMode)[0],a=new t(e);n.registerRenderGeometryBufferWriter(s,a)}}return this._commands.push({id:"create-material",type:e,materialId:s}),s}createDirectRenderer(e){const r=this._context.generateId("material-renderer");return this._commands.push({id:"create-direct-renderer",materialRendererId:r,materialId:e}),r}addDirectRendererGeometry(e,r,t){const n=r.materialId,s=this._context.getRenderGeometryBufferWriter(n);if(null==s)throw new Error(`no bufferwriter found for material ${n}`);const a=s.createBuffer(r,t);this._transferables.add(a.data),null!=r.objectIds&&this._transferables.add(r.objectIds.buffer),this._commands.push({id:"add-direct-renderer-geometry",renderGeometryId:e,materialId:n,localOrigin:t,renderGeometryBuffer:a,objectIds:r.objectIds})}removeDirectRendererGeometry(e){this._commands.push({id:"remove-direct-renderer-geometry",renderGeometryId:e})}createLodRenderer(r){const t=this._context.generateId("lod-renderer"),a={levels:r.levels.map((r=>({components:r.components.map((r=>{const t=r.attributes.get(s.POSITION);if(!t||0===t.indices.length)throw new Error("positions attribute expected");const a=3,o=e(t.indices.length/a),d=new n(o,a,t),i=this._context.getRenderGeometryBufferWriter(r.materialId);if(null==i)throw new Error("writer not found");const c=i.createBuffer(r,null);this._transferables.add(c.data);return{materialId:r.materialId,renderGeometryBuffer:c,boundingInfo:{bbMax:d.bbMax,bbMin:d.bbMin}}})),minScreenSpaceRadius:r.minScreenSpaceRadius})))};return this._commands.push({id:"create-lod-renderer",lodRendererId:t,lodRenderGeometry:a}),t}addLodInstances(e,r){this._commands.push({id:"add-lod-instances",lodRendererId:e,data:r}),this._transferables.add(r.featureIds.buffer),this._transferables.add(r.globalTransforms.buffer),this._transferables.add(r.localTransforms.buffer)}removeLodInstances(e,r){this._commands.push({id:"remove-lod-instances",lodRendererId:e,featureIds:r}),this._transferables.add(r.buffer)}append(e){if(e._context!==this._context)throw new Error("Cannot append encoders from different contexts");const{_commands:r,_transferables:t}=this;for(const n of e._commands)r.push(n);for(const n of e._transferables)t.add(n)}async dispatch(){const e=this._commands,r=Array.from(this._transferables);this._clearCommandBuffer(),await this._context.dispatchRenderCommands(e,r)}_clearCommandBuffer(){this._commands=[],this._transferables.clear()}}export{o as RenderCommandEncoder,s as VertexAttribute};
5
+ class e{constructor(e){this._context=e,this._commands=[],this._transferables=new Set}addDirectRendererGeometry(e,r,t){const{materialId:s,objectIds:d,visibilities:n}=r,a=this._context.getRenderGeometryBufferWriter(s);if(null==a)throw new Error(`no bufferwriter found for material ${s}`);const{renderGeometryBuffer:i,renderGeometryBufferItems:o}=a.createBuffer(r,t);if(this._transferables.add(i.data),this._transferables.add(d.buffer),this._transferables.add(n.buffer),n.length!==o.numItems||d.length!==o.numItems)throw new Error("Unexpected mismatch between number of RenderGeometryBufferItems and provided objectIds/visibility flags.");this._commands.push({id:"add-direct-renderer-geometry",materialId:s,renderGeometryId:e,renderGeometryBuffer:i,renderGeometryBufferItems:{objectIds:d,visibilities:n,ranges:{numVertices:o.numVerticesPerItem,numItems:o.numItems}},localOrigin:t})}updateDirectRendererGeometryVisibility(e,r,t){this._commands.push({id:"update-direct-renderer-visibility",materialId:e,renderGeometryId:r,visibility:t})}removeDirectRendererGeometry(e,r){this._commands.push({id:"remove-direct-renderer-geometry",materialId:e,renderGeometryId:r})}addLodInstances(e,r,t){this._commands.push({id:"add-lod-instances",lodRendererId:e,renderGeometryId:r,data:t}),this._transferables.add(t.featureIds.buffer),this._transferables.add(t.globalTransforms.buffer),this._transferables.add(t.localTransforms.buffer)}removeLodInstances(e,r){this._commands.push({id:"remove-lod-instances",lodRendererId:e,renderGeometryId:r})}append(e){if(e._context!==this._context)throw new Error("Cannot append encoders from different contexts");const{_commands:r,_transferables:t}=this;for(const s of e._commands)r.push(s);for(const s of e._transferables)t.add(s)}async dispatch(){const e=this._commands,r=Array.from(this._transferables);this._clearCommandBuffer(),await this._context.dispatchRenderCommands(e,r)}_clearCommandBuffer(){this._commands=[],this._transferables.clear()}}export{e as RenderCommandEncoder};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{copy as r,invert as e,transpose as t}from"../../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as o}from"../../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";class n{constructor(r){this._bufferWriter=null,this._bufferWriter=r.createBufferWriter()}createBuffer(o,n){const s=this._bufferWriter;let l=null;if(o.transformation&&n)r(f,o.transformation),f[12]-=n[0],f[13]-=n[1],f[14]-=n[2],l=f;else{if(n)throw new Error("not implemented");o.transformation&&(l=o.transformation)}let u=null;l&&(e(a,f),t(a,a),u=a);const m=o.attributes,c=s.elementCount(m),b=s.vertexBufferLayout.stride/4;c>Math.floor(i/b)&&console.warn("geometry with very large number of elements encountered");const h=s.vertexBufferLayout.createBuffer(c),d=0;return s.write(l,u,m,o.objectAndLayerIdColor,h,d),{data:h.buffer,elementCount:c}}}const f=o(),a=o(),i=16777216/4;export{n as RenderGeometryBufferWriter};
5
+ import{copy as r,invert as e,transpose as t}from"../../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as o}from"../../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";class f{constructor(r){this._bufferWriter=null,this._bufferWriter=r.createBufferWriter()}createBuffer(o,f){const s=this._bufferWriter;let m=null;if(o.transformation&&f)r(n,o.transformation),n[12]-=f[0],n[13]-=f[1],n[14]-=f[2],m=n;else{if(f)throw new Error("not implemented");o.transformation&&(m=o.transformation)}let u=null;m&&(e(i,n),t(i,i),u=i);const l=o.attributes,c=s.elementCount(l),d=s.vertexBufferLayout.stride/4;c>Math.floor(a/d)&&console.warn("geometry with very large number of elements encountered");const b=s.vertexBufferLayout.createBuffer(c),w=0,h=s.write(m,u,l,o.objectAndLayerIdColor,b,w);if(null==h)throw new Error("Bufferwriter.write does not provide item information.");return{renderGeometryBuffer:{data:b.buffer,elementCount:c},renderGeometryBufferItems:h}}}const n=o(),i=o(),a=16777216/4;export{f as RenderGeometryBufferWriter};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{identity as t,scale as e}from"../../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromArray as o,create as i}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{computeTranslationToOriginAndRotation as n}from"../../../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{create as s,size as a}from"../../../../../../geometry/support/aaBoundingBox.js";import{objectSymbolLayerPrimitiveBoundingBox as l,objectSymbolLayerSizeWithResourceSize as d}from"../../../../../../symbols/support/symbolLayerUtils3D.js";import{computeObjectScale as c}from"../../graphicUtils.js";import{readMapCoordinates as m,readObjectIds as h}from"../featureData/processingUtils.js";import{createPrimitiveGeometry as p}from"./primitiveObjectUtils.js";class f{constructor(t){this._context=t,this.lodRendererId=null,this._loaded=!1,this._loadingPromise=null,this._primitive="cone"}get loaded(){return this._loaded}load(){return null==this._loadingPromise&&(this._loadingPromise=this._load()),this._loadingPromise}async _load(){const t=this._context.renderCommandContext.createEncoder(),e=t.createMaterial("default"),r=p(this._primitive,e);this.lodRendererId=t.createLodRenderer(r),await t.dispatch(),this._loaded=!0}async createAddCommand(t){const e=this._context.renderCommandContext.createEncoder();if(null==this.lodRendererId)throw new Error("expected lod renderer id to not be null");const{featureCount:r}=t;if(0===r)return e;const i=!0,n=s(l(this._primitive)),c=o(a(n)),p=o(d(c,{isPrimitive:i,width:100,depth:null,height:null})),f=new Float64Array(16*r),u=new Float64Array(16*r),g=m(t,this._context);for(let o=0;o<r;++o){const t=o,e=g[3*o+0],r=g[3*o+1],i=g[3*o+2],n=this._computeGlobalTransform(e,r,i,this._context.viewSpatialReference,x),s=this._computeLocalTransform(p,c,_);this._writeMatrixToTypedBuffer(f,t,s),this._writeMatrixToTypedBuffer(u,t,n)}const y=h(t,this._context),T={featureIds:new Uint32Array(y),localTransforms:f,globalTransforms:u};return e.addLodInstances(this.lodRendererId,T),e}async createRemoveCommand(t){const e=this._context.renderCommandContext.createEncoder();if(null==this.lodRendererId)return e;const r=h(t,this._context);return e.removeLodInstances(this.lodRendererId,r),e}_writeMatrixToTypedBuffer(t,e,r){let o=16*e;for(let i=0;i<16;i++)t[o++]=r[i]}_computeGlobalTransform(t,e,r,o,i){return u[0]=t,u[1]=e,u[2]=r,n(o,u,i,this._context.renderSpatialReference),i}_computeLocalTransform(e,r,o){return t(o),this._applyObjectScale(e,r,o),o}_applyObjectScale(t,r,o){const i=c(t,t,r,this._context.renderCoordsHelper.unitInMeters);1===i[0]&&1===i[1]&&1===i[2]||e(o,o,i)}}const u=i(),_=r(),x=r();export{f as TestObjectSymbol};
5
+ import{identity as e,scale as t}from"../../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromArray as o,create as i}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{computeTranslationToOriginAndRotation as n}from"../../../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{create as s,size as a}from"../../../../../../geometry/support/aaBoundingBox.js";import{objectSymbolLayerPrimitiveBoundingBox as l,objectSymbolLayerSizeWithResourceSize as d}from"../../../../../../symbols/support/symbolLayerUtils3D.js";import{computeObjectScale as c}from"../../graphicUtils.js";import{readMapCoordinates as m,readObjectIds as p}from"../featureData/processingUtils.js";import{createPrimitiveGeometry as h}from"./primitiveObjectUtils.js";class f{constructor(e){this._context=e,this.lodRendererId=null,this._loaded=!1,this._loadingPromise=null,this._primitive="cone"}get loaded(){return this._loaded}load(){return null==this._loadingPromise&&(this._loadingPromise=this._load()),this._loadingPromise}async _load(){const e=this._context.renderCommandContext,t=await e.createMaterial("default"),r=h(this._primitive,t);this.lodRendererId=await e.createLodRenderer(r),this._loaded=!0}async createAddCommand(e){const t=this._context.renderCommandContext.createEncoder();if(null==this.lodRendererId)throw new Error("expected lod renderer id to not be null");const{featureCount:r}=e;if(0===r)return t;const i=!0,n=s(l(this._primitive)),c=o(a(n)),h=o(d(c,{isPrimitive:i,width:100,depth:null,height:null})),f=new Float64Array(16*r),u=new Float64Array(16*r),g=m(e);for(let o=0;o<r;++o){const e=o,t=g[3*o+0],r=g[3*o+1],i=g[3*o+2],n=this._computeGlobalTransform(t,r,i,this._context.viewSpatialReference,x),s=this._computeLocalTransform(h,c,_);this._writeMatrixToTypedBuffer(f,e,s),this._writeMatrixToTypedBuffer(u,e,n)}const y=p(e),T={featureIds:new Uint32Array(y),localTransforms:f,globalTransforms:u};return t.addLodInstances(this.lodRendererId,e.id,T),t}async createRemoveCommand(e){const t=this._context.renderCommandContext.createEncoder();return null==this.lodRendererId||t.removeLodInstances(this.lodRendererId,e),t}_writeMatrixToTypedBuffer(e,t,r){let o=16*t;for(let i=0;i<16;i++)e[o++]=r[i]}_computeGlobalTransform(e,t,r,o,i){return u[0]=e,u[1]=t,u[2]=r,n(o,u,i,this._context.renderSpatialReference),i}_computeLocalTransform(t,r,o){return e(o),this._applyObjectScale(t,r,o),o}_applyObjectScale(e,r,o){const i=c(e,e,r,this._context.renderCoordsHelper.unitInMeters);1===i[0]&&1===i[1]&&1===i[2]||t(o,o,i)}}const u=i(),_=r(),x=r();export{f as TestObjectSymbol};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{create as e}from"../../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{readObjectIds as t,computeRenderCoordinates as r,computeTileCenterRenderCoordinates as o}from"../featureData/processingUtils.js";import{inputAttributesToAttributesMap as n}from"./symbolizationUtils.js";import{Attribute as a}from"../../../../webgl-engine/lib/Attribute.js";import{VertexAttribute as i}from"../../../../webgl-engine/lib/VertexAttribute.js";class s{constructor(e){this._context=e,this.materialId=null,this._loaded=!1,this._loadingPromise=null}get loaded(){return this._loaded}load(){return null==this._loadingPromise&&(this._loadingPromise=this._load()),this._loadingPromise}async _load(){const e=this._context.renderCommandContext.createEncoder();this.materialId=e.createMaterial("hud"),e.createDirectRenderer(this.materialId),await e.dispatch(),this._loaded=!0}async createAddCommand(s){if(null==this.materialId)throw new Error("expected material not to be null");const d=this._context,l=d.renderCommandContext.createEncoder(),{featureCount:m,id:c}=s;if(0===m)return l;const h=t(s),w=r(s,d),u=o(s,d),A=new Float64Array([0,0,1]),y=new Float64Array([255,255,255,255]),f=new Float64Array([24,24]),C=new Float64Array([0,0,0,1]),I=new Float64Array([0,0]),_=new Float64Array([0]),b=new Uint32Array(m);for(let e=0;e<m;++e)b[e]=e;const g=new Uint32Array(m);for(let e=0;e<m;++e)g[e]=0;const x=new a(w,b,3,!0),p=new a(A,g,3,!0),E=new a(I,g,2,!0),F=new a(y,g,4,!0),O=new a(_,g,1,!0),R=new a(f,g,2,!0),j=new a(C,g,4,!0),D=[[i.POSITION,x],[i.NORMAL,p],[i.UV0,E],[i.COLOR,F],[i.ROTATION,O],[i.SIZE,R],[i.CENTEROFFSETANDDISTANCE,j]],N={attributes:n(D),objectAndLayerIdColor:void 0,transformation:e(),materialId:this.materialId,objectIds:h};return l.addDirectRendererGeometry(c,N,u),l}async createRemoveCommand(e){const t=this._context.renderCommandContext.createEncoder();return t.removeDirectRendererGeometry(e.id),t}}export{s as TestSymbol};
5
+ import{create as e}from"../../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{readObjectIds as t,computeRenderCoordinates as r,computeTileCenterRenderCoordinates as o}from"../featureData/processingUtils.js";import{inputAttributesToAttributesMap as a}from"./symbolizationUtils.js";import{Attribute as n}from"../../../../webgl-engine/lib/Attribute.js";import{VertexAttribute as i}from"../../../../webgl-engine/lib/VertexAttribute.js";class l{constructor(e){this._context=e,this.materialId=null,this._loaded=!1,this._loadingPromise=null}get loaded(){return this._loaded}load(){return null==this._loadingPromise&&(this._loadingPromise=this._load()),this._loadingPromise}async _load(){const e=this._context.renderCommandContext;this.materialId=await e.createMaterial("hud"),await e.createDirectRenderer(this.materialId),this._loaded=!0}async createAddCommand(l){if(null==this.materialId)throw new Error("expected material not to be null");const s=this._context,d=s.renderCommandContext.createEncoder(),{featureCount:m,id:c}=l;if(0===m)return d;const w=t(l),h=r(l,s),u=o(l,s),A=new Float64Array([0,0,1]),y=new Float64Array([255,255,255,255]),f=new Float64Array([24,24]),I=new Float64Array([0,0,0,1]),b=new Float64Array([0,0]),C=new Float64Array([0]),_=new Uint32Array(m);for(let e=0;e<m;++e)_[e]=e;const g=new Uint32Array(m);for(let e=0;e<m;++e)g[e]=0;const x=new n(h,_,3,!0),p=new n(A,g,3,!0),E=new n(b,g,2,!0),F=new n(y,g,4,!0),O=new n(C,g,1,!0),R=new n(f,g,2,!0),j=new n(I,g,4,!0),D=[[i.POSITION,x],[i.NORMAL,p],[i.UV0,E],[i.COLOR,F],[i.ROTATION,O],[i.SIZE,R],[i.CENTEROFFSETANDDISTANCE,j]],N={attributes:a(D),objectAndLayerIdColor:void 0,transformation:e(),materialId:this.materialId,objectIds:w,visibilities:new Uint8Array(m).fill(1)};return d.addDirectRendererGeometry(c,N,u),d}async createRemoveCommand(e){const{materialId:t,_context:r}=this,o=r.renderCommandContext.createEncoder();return null==t||o.removeDirectRendererGeometry(t,e),o}}export{l as TestSymbol};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{PipelineCommand as t}from"../PipelineCommand.js";import{readObjectIds as e}from"../featureData/processingUtils.js";import{TestObjectSymbol as n}from"./TestObjectSymbol.js";import{TestSymbol as o}from"./TestSymbol.js";class r{constructor(t){this._symbols=new Array,this._featureDataPartitioning=new Map,this._context=t}async load(){this._symbols[0]=new o(this._context),this._symbols[1]=new n(this._context)}async createAddCommand(e){const n=this._partition(e),o=await Promise.all(n.map((async({index:t,features:e})=>{const n=await this._provisionSymbol(t);return await(n?.createAddCommand(e))}))),r=this._context.renderCommandContext.createEncoder();for(const t of o)null!=t&&r.append(t);return new t(r,[()=>{this._featureDataPartitioning.set(e,n)}])}async createRemoveCommand(e){const{_featureDataPartitioning:n}=this,o=n.get(e),r=this._context.renderCommandContext.createEncoder();if(null==o)return new t(this._context.renderCommandContext.createEncoder(),[]);const a=await Promise.all(o.map((async({index:t,features:e})=>{const n=this._getLoadedSymbol(t);return await(n?.createRemoveCommand(e))})));for(const t of a)null!=t&&r.append(t);return new t(r,[()=>{n.delete(e)}])}async _provisionSymbol(t){if(null==t)return null;const e=this._symbols[t];return e?(e.loaded||await e.load(),e):null}_getLoadedSymbol(t){if(null==t)return null;const e=this._symbols[t];return null!=e&&e.loaded?e:null}_partition(t){const n=e(t,this._context);if(null==n)throw new Error("unable to fetch objectIds");const{featureCount:o}=t,r=[[],[]];for(let e=0;e<o;++e){r[n[e]%2].push(e)}return r.map(((e,n)=>new a(n,t.subset(new Uint32Array(e))))).filter((t=>t.features.featureCount>0))}}class a{constructor(t,e){this.index=t,this.features=e}}export{r as UniqueValueFeatureRenderer};
5
+ import{PipelineCommand as t}from"../PipelineCommand.js";import{readObjectIds as e}from"../featureData/processingUtils.js";import{TestObjectSymbol as n}from"./TestObjectSymbol.js";import{TestSymbol as o}from"./TestSymbol.js";class r{constructor(t){this._symbols=new Array,this._featureDataPartitioning=new Map,this._context=t}async load(){this._symbols[0]=new o(this._context),this._symbols[1]=new n(this._context)}async createAddCommand(e){const n=this._partition(e),o=await Promise.all(n.map((async({index:t,features:e})=>{const n=await this._provisionSymbol(t);return await(n?.createAddCommand(e))}))),r=this._context.renderCommandContext.createEncoder();for(const t of o)null!=t&&r.append(t);return new t(r,[()=>{this._featureDataPartitioning.set(e.id,n)}])}async createRemoveCommand(e){const{_featureDataPartitioning:n}=this,o=n.get(e),r=this._context.renderCommandContext.createEncoder();if(null==o)return new t(this._context.renderCommandContext.createEncoder(),[]);const a=await Promise.all(o.map((async({index:t,features:e})=>{const n=this._getLoadedSymbol(t);return await(n?.createRemoveCommand(e.id))})));for(const t of a)null!=t&&r.append(t);return new t(r,[()=>{n.delete(e)}])}async _provisionSymbol(t){if(null==t)return null;const e=this._symbols[t];return e?(e.loaded||await e.load(),e):null}_getLoadedSymbol(t){if(null==t)return null;const e=this._symbols[t];return null!=e&&e.loaded?e:null}_partition(t){const n=e(t);if(null==n)throw new Error("unable to fetch objectIds");const{featureCount:o}=t,r=[[],[]];for(let e=0;e<o;++e){r[n[e]%2].push(e)}return r.map(((e,n)=>new a(n,t.subset(new Uint32Array(e))))).filter((t=>t.features.featureCount>0))}}class a{constructor(t,e){this.index=t,this.features=e}}export{r as UniqueValueFeatureRenderer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../../../core/has.js";import{inputAttributesToAttributesMap as e}from"./symbolizationUtils.js";import{cloneAttributeData as t}from"../../../../webgl-engine/lib/AttributeArray.js";import{createConeGeometryData as n}from"../../../../webgl-engine/lib/GeometryUtil.js";import{VertexAttribute as i}from"../../../../webgl-engine/lib/VertexAttribute.js";function r(t,i){const r=(t,n,r=!1)=>({levels:t.map((t=>{const o=e(n(t.tesselation));r&&a(o);return{components:[{attributes:o,objectAndLayerIdColor:void 0,transformation:null,materialId:i}],minScreenSpaceRadius:t.minScreenSpaceRadius}}))});switch(t){case"cone":return r(s,(e=>n(1,.5,e,!1)),!0);case"sphere":case"cube":case"inverted-cone":case"cylinder":case"tetrahedron":case"diamond":throw new Error("not implemented");default:return}}function a(e){const t=e,n=t.get(i.POSITION).data,r=t.get(i.NORMAL).data;if(r){const t=o(e,i.NORMAL).data;for(let e=0;e<r.length;e+=3){const n=r[e+1];t[e+1]=-r[e+2],t[e+2]=n}}if(n){const t=o(e,i.POSITION).data;for(let e=0;e<n.length;e+=3){const i=n[e+1];t[e+1]=-n[e+2],t[e+2]=i}}}function o(e,n){let i=e.get(n);return i&&!i.exclusive&&(i={...i,exclusive:!0,data:t(i.data)},e.set(n,i)),i}const s=[{tesselation:6,minScreenSpaceRadius:0},{tesselation:18,minScreenSpaceRadius:7},{tesselation:64,minScreenSpaceRadius:65}];export{r as createPrimitiveGeometry};
5
+ import"../../../../../../core/has.js";import{inputAttributesToAttributesMap as e}from"./symbolizationUtils.js";import{cloneAttributeData as t}from"../../../../webgl-engine/lib/AttributeArray.js";import{createConeGeometryData as n}from"../../../../webgl-engine/lib/GeometryUtil.js";import{VertexAttribute as i}from"../../../../webgl-engine/lib/VertexAttribute.js";function r(t,i){const r=(t,n,r=!1)=>({levels:t.map((t=>{const s=e(n(t.tesselation));r&&a(s);return{components:[{attributes:s,objectAndLayerIdColor:void 0,transformation:null,materialId:i,visibilities:new Uint8Array([1]),objectIds:new Uint32Array([-1])}],minScreenSpaceRadius:t.minScreenSpaceRadius}}))});switch(t){case"cone":return r(o,(e=>n(1,.5,e,!1)),!0);case"sphere":case"cube":case"inverted-cone":case"cylinder":case"tetrahedron":case"diamond":throw new Error("not implemented");default:return}}function a(e){const t=e,n=t.get(i.POSITION).data,r=t.get(i.NORMAL).data;if(r){const t=s(e,i.NORMAL).data;for(let e=0;e<r.length;e+=3){const n=r[e+1];t[e+1]=-r[e+2],t[e+2]=n}}if(n){const t=s(e,i.POSITION).data;for(let e=0;e<n.length;e+=3){const i=n[e+1];t[e+1]=-n[e+2],t[e+2]=i}}}function s(e,n){let i=e.get(n);return i&&!i.exclusive&&(i={...i,exclusive:!0,data:t(i.data)},e.set(n,i)),i}const o=[{tesselation:6,minScreenSpaceRadius:0},{tesselation:18,minScreenSpaceRadius:7},{tesselation:64,minScreenSpaceRadius:65}];export{r as createPrimitiveGeometry};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
+ */
5
+ import{generateUID as r}from"../../../../../core/uid.js";function o(o=""){return`${o}${r()}`}export{o as generateId};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import l from"../../../../core/Error.js";import{fetchStyle as t,symbolUrlFromStyleItem as s}from"../../../../symbols/support/styleUtils.js";import{getStyleItemFromStyle as e,fetchSymbolFromStyle as n}from"../../../../symbols/support/webStyleSymbolUtils.js";async function r(r){if(null==r||null==r.styleName&&null==r.styleUrl)return null;const o=r.name;if(null==o)throw new l("symbolstyleutils:style-symbol-reference-name-missing","Missing name in style symbol reference");const u={portal:r.portal},i=await t(r,u).catch((()=>null));if(null===i)return null;const m=e(o,i.data);if(m&&!m.formatInfos?.some((l=>"gltf_basisu"===l.type)))return null;const a=await n(i,o,u,"webRef",((l,t)=>s(l,t,["gltf_basisu","gltf"]))).catch((()=>null));if(null===a||"point-3d"!==a.type)return null;const y=a.symbolLayers.items[0];return"object"===y.type?y.resource:null}export{r as getResourceUrlFromSymbolStyle};
5
+ import l from"../../../../core/Error.js";import{fetchStyle as t,symbolUrlFromStyleItem as e}from"../../../../symbols/support/styleUtils.js";import{getStyleItemFromStyle as s,fetchSymbolFromStyle as n}from"../../../../symbols/support/webStyleSymbolUtils.js";async function r(r){if(null==r||null==r.styleName&&null==r.styleUrl)return null;const o=r.name;if(null==o)throw new l("symbolstyleutils:style-symbol-reference-name-missing","Missing name in style symbol reference");const u={portal:r.portal},i=await t(r,u).catch((()=>null));if(null===i)return null;const m=s(o,i.data);if(m&&!m.formatInfos?.some((l=>"gltf_basisu"===l.type)))return null;const a=await n(i,o,u,e,{acceptedFormats:["web-gltf-basisu","web-gltf","web"]}).catch((()=>null));if(null===a||"point-3d"!==a.type)return null;const y=a.symbolLayers.items[0];return"object"===y.type?y.resource:null}export{r as getResourceUrlFromSymbolStyle};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../request.js";import{result as t}from"../../../../core/asyncUtils.js";import r from"../../../../core/Error.js";import n from"../../../../core/Logger.js";import{estimateNestedObjectMemory as s}from"../../../../core/memoryEstimations.js";import{NestedMap as a}from"../../../../core/NestedMap.js";import{throwIfAbortError as o}from"../../../../core/promiseUtils.js";import{Version as i}from"../../../../core/Version.js";import{fromArray as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as u,expandWithVec3 as c}from"../../../../geometry/support/aaBoundingBox.js";import{getContinuousIndexArray as m}from"../../../../geometry/support/Indices.js";import{requestImage as p}from"../../../../support/requestImageUtils.js";import{Attribute as f}from"../../webgl-engine/lib/Attribute.js";import{CullFaceOptions as d,AlphaDiscardMode as g}from"../../webgl-engine/lib/basicInterfaces.js";import{Geometry as y}from"../../webgl-engine/lib/Geometry.js";import{Texture as w}from"../../webgl-engine/lib/Texture.js";import{VertexAttribute as b}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as h}from"../../webgl-engine/materials/DefaultMaterial.js";import{TextureWrapMode as x}from"../../../webgl/enums.js";const v=()=>n.getLogger("esri.views.3d.layers.graphics.objectResourceUtils");class A{constructor(e,t,r){this.resource=e,this.textures=t,this.cachedMemory=r}}async function j(e,t){const r=await I(e,t),n=await O(r.textureDefinitions??{},t);let a=0;for(const s in n)if(n.hasOwnProperty(s)){const e=n[s];a+=e?.image?e.image.width*e.image.height*4:0}return new A(r,n,a+s(r))}async function I(r,n){const s=n?.streamDataRequester;if(s)return P(r,s,n);const a=await t(e(r,n));if(!0===a.ok)return a.value.data;o(a.error),M(a.error)}async function P(e,r,n){const s=await t(r.request(e,"json",n));if(!0===s.ok)return s.value;o(s.error),M(s.error.details.url)}function M(e){throw new r("",`Request for object resource failed: ${e}`)}function T(e){const t=e.params,r=t.topology;let n=!0;switch(t.vertexAttributes||(v().warn("Geometry must specify vertex attributes"),n=!1),t.topology){case"PerAttributeArray":break;case"Indexed":case null:case void 0:{const e=t.faces;if(e){if(t.vertexAttributes)for(const r in t.vertexAttributes){const t=e[r];t?.values?(null!=t.valueType&&"UInt32"!==t.valueType&&(v().warn(`Unsupported indexed geometry indices type '${t.valueType}', only UInt32 is currently supported`),n=!1),null!=t.valuesPerElement&&1!==t.valuesPerElement&&(v().warn(`Unsupported indexed geometry values per element '${t.valuesPerElement}', only 1 is currently supported`),n=!1)):(v().warn(`Indexed geometry does not specify face indices for '${r}' attribute`),n=!1)}}else v().warn("Indexed geometries must specify faces"),n=!1;break}default:v().warn(`Unsupported topology '${r}'`),n=!1}e.params.material||(v().warn("Geometry requires material"),n=!1);const s=e.params.vertexAttributes;for(const a in s){s[a].values||(v().warn("Geometries with externally defined attributes are not yet supported"),n=!1)}return n}function U(e,t){const r=new Array,n=new Array,s=new Array,o=new a,u=e.resource,c=i.parse(u.version||"1.0","wosr");R.validate(c);const p=u.model.name,g=u.model.geometries,x=u.materialDefinitions??{},v=e.textures;let A=0;const j=new Map;for(let a=0;a<g.length;a++){const e=g[a];if(!T(e))continue;const i=q(e),u=e.params.vertexAttributes,c=[],p=t=>{if("PerAttributeArray"===e.params.topology)return null;const r=e.params.faces;for(const e in r)if(e===t)return r[e].values;return null},I=u[b.POSITION],P=I.values.length/I.valuesPerElement;for(const t in u){const e=u[t],r=e.values,n=p(t)??m(P);c.push([t,new f(r,n,e.valuesPerElement,!0)])}const M=i.texture,U=v&&v[M];if(U&&!j.has(M)){const{image:e,parameters:t}=U,r=new w(e,t);n.push(r),j.set(M,r)}const E=j.get(M),O=E?E.id:void 0,R=i.material;let B=o.get(R,M);if(null==B){const e=x[R.slice(R.lastIndexOf("/")+1)].params;1===e.transparency&&(e.transparency=0);const r=U&&U.alphaChannelUsage,n=e.transparency>0||"transparency"===r||"maskAndTransparency"===r,s=U?k(U.alphaChannelUsage):void 0,a={ambient:l(e.diffuse),diffuse:l(e.diffuse),opacity:1-(e.transparency||0),transparent:n,textureAlphaMode:s,textureAlphaCutoff:.33,textureId:O,initTextureTransparent:!0,doubleSided:!0,cullFace:d.None,colorMixMode:e.externalColorMixMode||"tint",textureAlphaPremultiplied:U?.parameters.preMultiplyAlpha??!1};t?.materialParameters&&Object.assign(a,t.materialParameters),B=new h(a,t),o.set(R,M,B)}s.push(B);const C=new y(B,c);A+=c.find((e=>e[0]===b.POSITION))?.[1]?.indices.length??0,r.push(C)}return{engineResources:[{name:p,stageResources:{textures:n,materials:s,geometries:r},pivotOffset:u.model.pivotOffset,numberOfVertices:A,lodThreshold:null}],referenceBoundingBox:E(r)}}function E(e){const t=u();return e.forEach((e=>{const r=e.boundingInfo;null!=r&&(c(t,r.bbMin),c(t,r.bbMax))})),t}async function O(e,t){const r=new Array;for(const a in e){const n=e[a],s=n.images[0].data;if(!s){v().warn("Externally referenced texture data is not yet supported");continue}const o=n.encoding+";base64,"+s,i="/textureDefinitions/"+a,l="rgba"===n.channels?n.alphaChannelUsage||"transparency":"none",u={noUnpackFlip:!0,wrap:{s:x.REPEAT,t:x.REPEAT},preMultiplyAlpha:k(l)!==g.Opaque},c=t?.disableTextures?Promise.resolve(null):p(o,t);r.push(c.then((e=>({refId:i,image:e,parameters:u,alphaChannelUsage:l}))))}const n=await Promise.all(r),s={};for(const a of n)s[a.refId]=a;return s}function k(e){switch(e){case"mask":return g.Mask;case"maskAndTransparency":return g.MaskBlend;case"none":return g.Opaque;default:return g.Blend}}function q(e){const t=e.params;return{id:1,material:t.material,texture:t.texture,region:t.texture}}const R=new i(1,2,"wosr");export{A as LoaderResultWOSR,O as createTextureResources,j as load,U as processLoadResult};
5
+ import e from"../../../../request.js";import{result as t}from"../../../../core/asyncUtils.js";import r from"../../../../core/Error.js";import n from"../../../../core/Logger.js";import{estimateNestedObjectMemory as s}from"../../../../core/memoryEstimations.js";import{NestedMap as o}from"../../../../core/NestedMap.js";import{throwIfAbortError as a}from"../../../../core/promiseUtils.js";import{Version as i}from"../../../../core/Version.js";import{fromArray as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as u,expandWithVec3 as c}from"../../../../geometry/support/aaBoundingBox.js";import{getContinuousIndexArray as m}from"../../../../geometry/support/Indices.js";import{requestImage as p}from"../../../../support/requestImageUtils.js";import{Attribute as f}from"../../webgl-engine/lib/Attribute.js";import{CullFaceOptions as d,AlphaDiscardMode as g}from"../../webgl-engine/lib/basicInterfaces.js";import{Geometry as y}from"../../webgl-engine/lib/Geometry.js";import{Texture as w}from"../../webgl-engine/lib/Texture.js";import{VertexAttribute as b}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as h}from"../../webgl-engine/materials/DefaultMaterial.js";import{TextureWrapMode as x}from"../../../webgl/enums.js";const v=()=>n.getLogger("esri.views.3d.layers.graphics.objectResourceUtils");class A{constructor(e,t,r){this.resource=e,this.textures=t,this.cachedMemory=r}}async function j(e,t){const r=await I(e,t),n=await T(r.textureDefinitions??{},t);let o=0;for(const s in n)if(n.hasOwnProperty(s)){const e=n[s];o+=e?.image?e.image.width*e.image.height*4:0}return new A(r,n,o+s(r))}async function I(r,n){const s=n?.streamDataRequester;if(s)return P(r,s,n);const o=await t(e(r,n));if(!0===o.ok)return o.value.data;a(o.error),M(o.error)}async function P(e,r,n){const s=await t(r.request(e,"json",n));if(!0===s.ok)return s.value;a(s.error),M(s.error.details.url)}function M(e){throw new r("",`Request for object resource failed: ${e}`)}function U(e){const t=e.params,r=t.topology;let n=!0;switch(t.vertexAttributes||(v().warn("Geometry must specify vertex attributes"),n=!1),t.topology){case"PerAttributeArray":break;case"Indexed":case null:case void 0:{const e=t.faces;if(e){if(t.vertexAttributes)for(const r in t.vertexAttributes){const t=e[r];t?.values?(null!=t.valueType&&"UInt32"!==t.valueType&&(v().warn(`Unsupported indexed geometry indices type '${t.valueType}', only UInt32 is currently supported`),n=!1),null!=t.valuesPerElement&&1!==t.valuesPerElement&&(v().warn(`Unsupported indexed geometry values per element '${t.valuesPerElement}', only 1 is currently supported`),n=!1)):(v().warn(`Indexed geometry does not specify face indices for '${r}' attribute`),n=!1)}}else v().warn("Indexed geometries must specify faces"),n=!1;break}default:v().warn(`Unsupported topology '${r}'`),n=!1}e.params.material||(v().warn("Geometry requires material"),n=!1);const s=e.params.vertexAttributes;for(const o in s){s[o].values||(v().warn("Geometries with externally defined attributes are not yet supported"),n=!1)}return n}function E(e,t){const r=new Array,n=new Array,s=new Array,a=new o,u=e.resource,c=i.parse(u.version||"1.0","wosr");R.validate(c);const p=u.model.name,g=u.model.geometries,x=u.materialDefinitions??{},v=e.textures;let A=0;const j=new Map;for(let o=0;o<g.length;o++){const e=g[o];if(!U(e))continue;const i=q(e),u=e.params.vertexAttributes,c=[],p=t=>{if("PerAttributeArray"===e.params.topology)return null;const r=e.params.faces;for(const e in r)if(e===t)return r[e].values;return null},I=u[b.POSITION],P=I.values.length/I.valuesPerElement;for(const t in u){const e=u[t],r=e.values,n=p(t)??m(P);c.push([t,new f(r,n,e.valuesPerElement,!0)])}const M=i.texture,E=v&&v[M];if(E&&!j.has(M)){const{image:e,parameters:t}=E,r=new w(e,t);n.push(r),j.set(M,r)}const O=j.get(M),T=O?O.id:void 0,R=i.material;let B=a.get(R,M);if(null==B){const e=x[R.slice(R.lastIndexOf("/")+1)].params;1===e.transparency&&(e.transparency=0);const r=E&&E.alphaChannelUsage,n=e.transparency>0||"transparency"===r||"maskAndTransparency"===r,s=E?k(E.alphaChannelUsage):void 0,o={ambient:l(e.diffuse),diffuse:l(e.diffuse),opacity:1-(e.transparency||0),transparent:n,textureAlphaMode:s,textureAlphaCutoff:.33,textureId:T,doubleSided:!0,cullFace:d.None,colorMixMode:e.externalColorMixMode||"tint",textureAlphaPremultiplied:E?.parameters.preMultiplyAlpha??!1};t?.materialParameters&&Object.assign(o,t.materialParameters),B=new h(o,t),a.set(R,M,B)}s.push(B);const C=new y(B,c);A+=c.find((e=>e[0]===b.POSITION))?.[1]?.indices.length??0,r.push(C)}return{engineResources:[{name:p,stageResources:{textures:n,materials:s,geometries:r},pivotOffset:u.model.pivotOffset,numberOfVertices:A,lodThreshold:null}],referenceBoundingBox:O(r)}}function O(e){const t=u();return e.forEach((e=>{const r=e.boundingInfo;null!=r&&(c(t,r.bbMin),c(t,r.bbMax))})),t}async function T(e,t){const r=new Array;for(const o in e){const n=e[o],s=n.images[0].data;if(!s){v().warn("Externally referenced texture data is not yet supported");continue}const a=n.encoding+";base64,"+s,i="/textureDefinitions/"+o,l="rgba"===n.channels?n.alphaChannelUsage||"transparency":"none",u={noUnpackFlip:!0,wrap:{s:x.REPEAT,t:x.REPEAT},preMultiplyAlpha:k(l)!==g.Opaque},c=t?.disableTextures?Promise.resolve(null):p(a,t);r.push(c.then((e=>({refId:i,image:e,parameters:u,alphaChannelUsage:l}))))}const n=await Promise.all(r),s={};for(const o of n)s[o.refId]=o;return s}function k(e){switch(e){case"mask":return g.Mask;case"maskAndTransparency":return g.MaskBlend;case"none":return g.Opaque;default:return g.Blend}}function q(e){const t=e.params;return{id:1,material:t.material,texture:t.texture,region:t.texture}}const R=new i(1,2,"wosr");export{A as LoaderResultWOSR,T as createTextureResources,j as load,E as processLoadResult};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{releaseMaybe as t}from"../../../../core/maybe.js";import{isPromiseLike as e}from"../../../../core/promiseUtils.js";import{ResourceState as s}from"./basicInterfaces.js";import i from"./GLMaterial.js";import{NoParameters as r}from"../../../webgl/NoParameters.js";class u extends i{constructor(t){super(t),this._numLoading=0,this._disposed=!1,this._textures=t.textures,this._textureId=t.textureId,this._acquire(t.textureId,(t=>this._texture=t)),this._acquire(t.normalTextureId,(t=>this._textureNormal=t)),this._acquire(t.emissiveTextureId,(t=>this._textureEmissive=t)),this._acquire(t.occlusionTextureId,(t=>this._textureOcclusion=t)),this._acquire(t.metallicRoughnessTextureId,(t=>this._textureMetallicRoughness=t))}dispose(){super.dispose(),this._texture=t(this._texture),this._textureNormal=t(this._textureNormal),this._textureEmissive=t(this._textureEmissive),this._textureOcclusion=t(this._textureOcclusion),this._textureMetallicRoughness=t(this._textureMetallicRoughness),this._disposed=!0}ensureResources(t){return 0===this._numLoading?s.LOADED:s.LOADING}get textureBindParameters(){return new h(null!=this._texture?this._texture.glTexture:null,null!=this._textureNormal?this._textureNormal.glTexture:null,null!=this._textureEmissive?this._textureEmissive.glTexture:null,null!=this._textureOcclusion?this._textureOcclusion.glTexture:null,null!=this._textureMetallicRoughness?this._textureMetallicRoughness.glTexture:null)}updateTexture(e){null!=this._texture&&e===this._texture.id||(this._texture=t(this._texture),this._textureId=e,this._acquire(this._textureId,(t=>this._texture=t)))}_acquire(s,i){if(null==s)return void i(null);const r=this._textures.acquire(s);if(e(r))return++this._numLoading,void r.then((e=>{if(this._disposed)return t(e),void i(null);i(e)})).finally((()=>--this._numLoading));i(r)}}class l extends r{constructor(t=null){super(),this.textureEmissive=t}}class h extends l{constructor(t=null,e=null,s=null,i=null,r=null,u,l){super(s),this.texture=t,this.textureNormal=e,this.textureOcclusion=i,this.textureMetallicRoughness=r,this.scale=u,this.normalTextureTransformMatrix=l}}export{l as GLEmissiveTexturePassParameters,u as GLTextureMaterial,h as GLTextureMaterialBindParameters};
5
+ import{releaseMaybe as t}from"../../../../core/maybe.js";import{isPromiseLike as e}from"../../../../core/promiseUtils.js";import{ResourceState as s}from"./basicInterfaces.js";import i from"./GLMaterial.js";import{NoParameters as u}from"../../../webgl/NoParameters.js";class r extends i{constructor(t){super(t),this._numLoading=0,this._disposed=!1,this._textures=t.textures,this.updateTexture(t.textureId),this._acquire(t.normalTextureId,(t=>this._textureNormal=t)),this._acquire(t.emissiveTextureId,(t=>this._textureEmissive=t)),this._acquire(t.occlusionTextureId,(t=>this._textureOcclusion=t)),this._acquire(t.metallicRoughnessTextureId,(t=>this._textureMetallicRoughness=t))}dispose(){super.dispose(),this._texture=t(this._texture),this._textureNormal=t(this._textureNormal),this._textureEmissive=t(this._textureEmissive),this._textureOcclusion=t(this._textureOcclusion),this._textureMetallicRoughness=t(this._textureMetallicRoughness),this._disposed=!0}ensureResources(t){return 0===this._numLoading?s.LOADED:s.LOADING}get textureBindParameters(){return new n(null!=this._texture?this._texture.glTexture:null,null!=this._textureNormal?this._textureNormal.glTexture:null,null!=this._textureEmissive?this._textureEmissive.glTexture:null,null!=this._textureOcclusion?this._textureOcclusion.glTexture:null,null!=this._textureMetallicRoughness?this._textureMetallicRoughness.glTexture:null)}updateTexture(e){null!=this._texture&&e===this._texture.id||(this._texture=t(this._texture),this._textureId=e,this._acquire(this._textureId,(t=>this._texture=t)))}_acquire(s,i){if(null==s)return void i(null);const u=this._textures.acquire(s);if(e(u))return++this._numLoading,void u.then((e=>{if(this._disposed)return t(e),void i(null);i(e)})).finally((()=>--this._numLoading));i(u)}}class l extends u{constructor(t=null){super(),this.textureEmissive=t}}class n extends l{constructor(t=null,e=null,s=null,i=null,u=null,r,l){super(s),this.texture=t,this.textureNormal=e,this.textureOcclusion=i,this.textureMetallicRoughness=u,this.scale=r,this.normalTextureTransformMatrix=l}}export{l as GLEmissiveTexturePassParameters,r as GLTextureMaterial,n as GLTextureMaterialBindParameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../core/has.js";import e from"../../../../core/Error.js";import t from"../../../../core/Evented.js";import{disposeMaybe as r,removeMaybe as s}from"../../../../core/maybe.js";import{throwIfAborted as a,onAbort as i,createAbortError as o}from"../../../../core/promiseUtils.js";import{isUint8Array as n,isArrayBuffer as l}from"../../../../core/typedArrayUtil.js";import{isBlobProtocol as m,isDataProtocol as h}from"../../../../core/urlUtils.js";import{requestImage as _}from"../../../../support/requestImageUtils.js";import{loadImageAsync as p}from"../../../../support/requestUtils.js";import{TextureEncodingMimeType as d}from"./basicInterfaces.js";import{createTextureKTX2 as c,createTextureBasis as u,estimateMemoryKTX2 as g,estimateMemoryBasis as A}from"./BasisUtil.js";import{ContentObject as E}from"./ContentObject.js";import{ContentObjectType as T}from"./ContentObjectType.js";import{createDDSTexture as f}from"./DDSUtil.js";import{downsampleImage as D,ensureImageMaxSize as x}from"./textureUtils.js";import{assert as y}from"./Util.js";import{TextureWrapMode as I,TextureSamplingMode as U,PixelFormat as F}from"../../../webgl/enums.js";import{Texture as w}from"../../../webgl/Texture.js";import{TextureDescriptor as C}from"../../../webgl/TextureDescriptor.js";class N extends E{get parameters(){return this._parameters}constructor(e,r){super(),this._data=e,this.type=T.Texture,this._glTexture=null,this._loadingPromise=null,this._loadingController=null,this.events=new t,this._parameters={...M,...r},this._startPreload(e)}dispose(){this.unload(),this._data=this.frameUpdate=void 0}_startPreload(e){null!=e&&(e instanceof HTMLVideoElement?(this.frameUpdate=t=>this._frameUpdate(e,t),this._startPreloadVideoElement(e)):e instanceof HTMLImageElement&&this._startPreloadImageElement(e))}_startPreloadVideoElement(e){if(!(m(e.src)||"auto"===e.preload&&e.crossOrigin)){e.preload="auto",e.crossOrigin="anonymous";const t=!e.paused;if(e.src=e.src,t&&e.autoplay){const t=()=>{e.removeEventListener("canplay",t),e.play()};e.addEventListener("canplay",t)}}}_startPreloadImageElement(e){h(e.src)||m(e.src)||e.crossOrigin||(e.crossOrigin="anonymous",e.src=e.src)}_createDescriptor(e){const t=new C;return t.wrapMode=this._parameters.wrap??I.REPEAT,t.flipped=!this._parameters.noUnpackFlip,t.samplingMode=this._parameters.mipmap?U.LINEAR_MIPMAP_LINEAR:U.LINEAR,t.hasMipmap=!!this._parameters.mipmap,t.preMultiplyAlpha=!!this._parameters.preMultiplyAlpha,t.maxAnisotropy=this._parameters.maxAnisotropy??(this._parameters.mipmap?e.parameters.maxMaxAnisotropy:1),t}get glTexture(){return this._glTexture}get memoryEstimate(){return this._glTexture?.usedMemory||H(this._data,this._parameters)}load(e){if(this._glTexture)return this._glTexture;if(this._loadingPromise)return this._loadingPromise;const t=this._data;return null==t?(this._glTexture=new w(e,this._createDescriptor(e),null),this._glTexture):(this._parameters.reloadable||(this._data=void 0),"string"==typeof t?this._loadFromURL(e,t):t instanceof Image?this._loadFromImageElement(e,t):t instanceof HTMLVideoElement?this._loadFromVideoElement(e,t):t instanceof ImageData||t instanceof HTMLCanvasElement?this._loadFromImage(e,t):n(t)&&this._parameters.encoding===d.DDS_ENCODING?this._loadFromDDSData(e,t):l(t)&&this._parameters.encoding===d.DDS_ENCODING?this._loadFromDDSData(e,new Uint8Array(t)):(l(t)||n(t))&&this._parameters.encoding===d.KTX2_ENCODING?this._loadFromKTX2(e,t):(l(t)||n(t))&&this._parameters.encoding===d.BASIS_ENCODING?this._loadFromBasis(e,t):n(t)?this._loadFromPixelData(e,t):l(t)?this._loadFromPixelData(e,new Uint8Array(t)):null)}_frameUpdate(e,t){return null==this._glTexture||e.readyState<V.HAVE_CURRENT_DATA||t===e.currentTime?t:(this._glTexture.setData(e),this._glTexture.descriptor.hasMipmap&&this._glTexture.generateMipmap(),this._parameters.updateCallback&&this._parameters.updateCallback(),e.currentTime)}_loadFromDDSData(e,t){return this._glTexture=f(e,this._createDescriptor(e),t),this._glTexture}_loadFromKTX2(e,t){return this._loadAsync((()=>c(e,this._createDescriptor(e),t).then((e=>(this._glTexture=e,e)))))}_loadFromBasis(e,t){return this._loadAsync((()=>u(e,this._createDescriptor(e),t).then((e=>(this._glTexture=e,e)))))}_loadFromPixelData(e,t){y(this._parameters.width>0&&this._parameters.height>0);const r=this._createDescriptor(e);return r.pixelFormat=1===this._parameters.components?F.LUMINANCE:3===this._parameters.components?F.RGB:F.RGBA,r.width=this._parameters.width??0,r.height=this._parameters.height??0,this._glTexture=new w(e,r,t),this._glTexture}_loadFromURL(e,t){return this._loadAsync((async r=>{const s=await _(t,{signal:r});return a(r),this._loadFromImage(e,s)}))}_loadFromImageElement(e,t){return t.complete?this._loadFromImage(e,t):this._loadAsync((async r=>{const s=await p(t,t.src,!1,r);return a(r),this._loadFromImage(e,s)}))}_loadFromVideoElement(e,t){return t.readyState>=V.HAVE_CURRENT_DATA?this._loadFromImage(e,t):this._loadFromVideoElementAsync(e,t)}_loadFromVideoElementAsync(t,r){return this._loadAsync((a=>new Promise(((n,l)=>{const m=()=>{r.removeEventListener("loadeddata",h),r.removeEventListener("error",_),s(p)},h=()=>{r.readyState>=V.HAVE_CURRENT_DATA&&(m(),n(this._loadFromImage(t,r)))},_=t=>{m(),l(t||new e("Failed to load video"))};r.addEventListener("loadeddata",h),r.addEventListener("error",_);const p=i(a,(()=>_(o())))}))))}_loadFromImage(e,t){let r=t;if(!(r instanceof HTMLVideoElement)){const{maxTextureSize:t}=e.parameters;r=this._parameters.downsampleUncompressed?D(r,t):x(r,t)}const s=R(r);this._parameters.width=s.width,this._parameters.height=s.height;const a=this._createDescriptor(e);return a.pixelFormat=3===this._parameters.components?F.RGB:F.RGBA,a.width=s.width,a.height=s.height,a.shouldCompress=this._parameters.shouldCompress,this._glTexture=new w(e,a,r),this._glTexture}_loadAsync(e){const t=new AbortController;this._loadingController=t;const r=e(t.signal);this._loadingPromise=r;const s=()=>{this._loadingController===t&&(this._loadingController=null),this._loadingPromise===r&&(this._loadingPromise=null)};return r.then(s,s),r}unload(){if(this._glTexture=r(this._glTexture),null!=this._loadingController){const e=this._loadingController;this._loadingController=null,this._loadingPromise=null,e.abort()}this.events.emit("unloaded")}}function H(e,t){if(null==e)return 0;if(l(e)||n(e))return t.encoding===d.KTX2_ENCODING?g(e,!!t.mipmap):t.encoding===d.BASIS_ENCODING?A(e,!!t.mipmap):e.byteLength;const{width:r,height:s}=e instanceof Image||e instanceof ImageData||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement?R(e):t;return(t.mipmap?4/3:1)*r*s*(t.components||4)||0}function R(e){return e instanceof HTMLVideoElement?{width:e.videoWidth,height:e.videoHeight}:e}var V;!function(e){e[e.HAVE_NOTHING=0]="HAVE_NOTHING",e[e.HAVE_METADATA=1]="HAVE_METADATA",e[e.HAVE_CURRENT_DATA=2]="HAVE_CURRENT_DATA",e[e.HAVE_FUTURE_DATA=3]="HAVE_FUTURE_DATA",e[e.HAVE_ENOUGH_DATA=4]="HAVE_ENOUGH_DATA"}(V||(V={}));const M={wrap:{s:I.REPEAT,t:I.REPEAT},mipmap:!0,noUnpackFlip:!1,preMultiplyAlpha:!1,downsampleUncompressed:!1,shouldCompress:!1};export{N as Texture};
5
+ import"../../../../core/has.js";import e from"../../../../core/Error.js";import t from"../../../../core/Evented.js";import{disposeMaybe as r,removeMaybe as s}from"../../../../core/maybe.js";import{throwIfAborted as a,onAbort as i,createAbortError as o}from"../../../../core/promiseUtils.js";import{isUint8Array as n,isArrayBuffer as l}from"../../../../core/typedArrayUtil.js";import{isBlobProtocol as m,isDataProtocol as h}from"../../../../core/urlUtils.js";import{requestImage as _}from"../../../../support/requestImageUtils.js";import{loadImageAsync as p}from"../../../../support/requestUtils.js";import{TextureEncodingMimeType as d}from"./basicInterfaces.js";import{createTextureKTX2 as c,createTextureBasis as u,estimateMemoryKTX2 as g,estimateMemoryBasis as A}from"./BasisUtil.js";import{ContentObject as E}from"./ContentObject.js";import{ContentObjectType as T}from"./ContentObjectType.js";import{createDDSTexture as f}from"./DDSUtil.js";import{downsampleImage as D,ensureImageMaxSize as x}from"./textureUtils.js";import{assert as y}from"./Util.js";import{TextureWrapMode as I,TextureSamplingMode as U,PixelFormat as F}from"../../../webgl/enums.js";import{Texture as w}from"../../../webgl/Texture.js";import{TextureDescriptor as C}from"../../../webgl/TextureDescriptor.js";class N extends E{constructor(e,r){super(),this._data=e,this.type=T.Texture,this.events=new t,this._glTexture=null,this._loadingPromise=null,this._loadingController=null,this._parameters={...M,...r},this._startPreload(e)}dispose(){this.unload(),this._data=this.frameUpdate=void 0}_startPreload(e){null!=e&&(e instanceof HTMLVideoElement?(this.frameUpdate=t=>this._frameUpdate(e,t),this._startPreloadVideoElement(e)):e instanceof HTMLImageElement&&this._startPreloadImageElement(e))}_startPreloadVideoElement(e){if(!(m(e.src)||"auto"===e.preload&&e.crossOrigin)){e.preload="auto",e.crossOrigin="anonymous";const t=!e.paused;if(e.src=e.src,t&&e.autoplay){const t=()=>{e.removeEventListener("canplay",t),e.play()};e.addEventListener("canplay",t)}}}_startPreloadImageElement(e){h(e.src)||m(e.src)||e.crossOrigin||(e.crossOrigin="anonymous",e.src=e.src)}_createDescriptor(e){const t=new C;return t.wrapMode=this._parameters.wrap??I.REPEAT,t.flipped=!this._parameters.noUnpackFlip,t.samplingMode=this._parameters.mipmap?U.LINEAR_MIPMAP_LINEAR:U.LINEAR,t.hasMipmap=!!this._parameters.mipmap,t.preMultiplyAlpha=!!this._parameters.preMultiplyAlpha,t.maxAnisotropy=this._parameters.maxAnisotropy??(this._parameters.mipmap?e.parameters.maxMaxAnisotropy:1),t}get glTexture(){return this._glTexture}get memoryEstimate(){return this._glTexture?.usedMemory||H(this._data,this._parameters)}load(e){if(this._glTexture)return this._glTexture;if(this._loadingPromise)return this._loadingPromise;const t=this._data;return null==t?(this._glTexture=new w(e,this._createDescriptor(e),null),this._glTexture):(this._parameters.reloadable||(this._data=void 0),"string"==typeof t?this._loadFromURL(e,t):t instanceof Image?this._loadFromImageElement(e,t):t instanceof HTMLVideoElement?this._loadFromVideoElement(e,t):t instanceof ImageData||t instanceof HTMLCanvasElement?this._loadFromImage(e,t):n(t)&&this._parameters.encoding===d.DDS_ENCODING?this._loadFromDDSData(e,t):l(t)&&this._parameters.encoding===d.DDS_ENCODING?this._loadFromDDSData(e,new Uint8Array(t)):(l(t)||n(t))&&this._parameters.encoding===d.KTX2_ENCODING?this._loadFromKTX2(e,t):(l(t)||n(t))&&this._parameters.encoding===d.BASIS_ENCODING?this._loadFromBasis(e,t):n(t)?this._loadFromPixelData(e,t):l(t)?this._loadFromPixelData(e,new Uint8Array(t)):null)}_frameUpdate(e,t){return null==this._glTexture||e.readyState<V.HAVE_CURRENT_DATA||t===e.currentTime?t:(this._glTexture.setData(e),this._glTexture.descriptor.hasMipmap&&this._glTexture.generateMipmap(),this._parameters.updateCallback&&this._parameters.updateCallback(),e.currentTime)}_loadFromDDSData(e,t){return this._glTexture=f(e,this._createDescriptor(e),t),this._glTexture}_loadFromKTX2(e,t){return this._loadAsync((()=>c(e,this._createDescriptor(e),t).then((e=>(this._glTexture=e,e)))))}_loadFromBasis(e,t){return this._loadAsync((()=>u(e,this._createDescriptor(e),t).then((e=>(this._glTexture=e,e)))))}_loadFromPixelData(e,t){y(this._parameters.width>0&&this._parameters.height>0);const r=this._createDescriptor(e);return r.pixelFormat=1===this._parameters.components?F.LUMINANCE:3===this._parameters.components?F.RGB:F.RGBA,r.width=this._parameters.width??0,r.height=this._parameters.height??0,this._glTexture=new w(e,r,t),this._glTexture}_loadFromURL(e,t){return this._loadAsync((async r=>{const s=await _(t,{signal:r});return a(r),this._loadFromImage(e,s)}))}_loadFromImageElement(e,t){return t.complete?this._loadFromImage(e,t):this._loadAsync((async r=>{const s=await p(t,t.src,!1,r);return a(r),this._loadFromImage(e,s)}))}_loadFromVideoElement(e,t){return t.readyState>=V.HAVE_CURRENT_DATA?this._loadFromImage(e,t):this._loadFromVideoElementAsync(e,t)}_loadFromVideoElementAsync(t,r){return this._loadAsync((a=>new Promise(((n,l)=>{const m=()=>{r.removeEventListener("loadeddata",h),r.removeEventListener("error",_),s(p)},h=()=>{r.readyState>=V.HAVE_CURRENT_DATA&&(m(),n(this._loadFromImage(t,r)))},_=t=>{m(),l(t||new e("Failed to load video"))};r.addEventListener("loadeddata",h),r.addEventListener("error",_);const p=i(a,(()=>_(o())))}))))}_loadFromImage(e,t){let r=t;if(!(r instanceof HTMLVideoElement)){const{maxTextureSize:t}=e.parameters;r=this._parameters.downsampleUncompressed?D(r,t):x(r,t)}const s=R(r);this._parameters.width=s.width,this._parameters.height=s.height;const a=this._createDescriptor(e);return a.pixelFormat=3===this._parameters.components?F.RGB:F.RGBA,a.width=s.width,a.height=s.height,a.shouldCompress=this._parameters.shouldCompress,this._glTexture=new w(e,a,r),this._glTexture}_loadAsync(e){const t=new AbortController;this._loadingController=t;const r=e(t.signal);this._loadingPromise=r;const s=()=>{this._loadingController===t&&(this._loadingController=null),this._loadingPromise===r&&(this._loadingPromise=null)};return r.then(s,s),r}unload(){if(this._glTexture=r(this._glTexture),null!=this._loadingController){const e=this._loadingController;this._loadingController=null,this._loadingPromise=null,e.abort()}this.events.emit("unloaded")}get parameters(){return this._parameters}}function H(e,t){if(null==e)return 0;if(l(e)||n(e))return t.encoding===d.KTX2_ENCODING?g(e,!!t.mipmap):t.encoding===d.BASIS_ENCODING?A(e,!!t.mipmap):e.byteLength;const{width:r,height:s}=e instanceof Image||e instanceof ImageData||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement?R(e):t;return(t.mipmap?4/3:1)*r*s*(t.components||4)||0}function R(e){return e instanceof HTMLVideoElement?{width:e.videoWidth,height:e.videoHeight}:e}var V;!function(e){e[e.HAVE_NOTHING=0]="HAVE_NOTHING",e[e.HAVE_METADATA=1]="HAVE_METADATA",e[e.HAVE_CURRENT_DATA=2]="HAVE_CURRENT_DATA",e[e.HAVE_FUTURE_DATA=3]="HAVE_FUTURE_DATA",e[e.HAVE_ENOUGH_DATA=4]="HAVE_ENOUGH_DATA"}(V||(V={}));const M={wrap:{s:I.REPEAT,t:I.REPEAT},mipmap:!0,noUnpackFlip:!1,preMultiplyAlpha:!1,downsampleUncompressed:!1,shouldCompress:!1};export{N as Texture};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import r from"../../../../core/Evented.js";import s from"../../../../core/Logger.js";import{isPromiseLike as o,isAbortError as i}from"../../../../core/promiseUtils.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as u}from"../../../../core/accessorSupport/decorators/subclass.js";import{RenderRequestType as a}from"./basicInterfaces.js";import{ContentObjectType as h}from"./ContentObjectType.js";import{isFrameUpdateTexture as c}from"./ITexture.js";import{TextureTechnique as l}from"./TextureTechnique.js";import{TextureTechniqueConfiguration as p}from"./TextureTechniqueConfiguration.js";import{TaskPriority as d}from"../../../support/Scheduler.js";let m=class extends t{constructor(e,t,s){super({}),this._stage=e,this._techniques=t,this._rctx=s,this._textures=new Map,this._loadingCount=0,this._frameUpdates=new Map,this.events=new r,this._frameTask=e.view.resourceController.scheduler.registerTask(d.TEXTURE_UNLOAD)}normalizeCtorArgs(){return{}}destroy(){this._frameTask.remove(),this._stage.forEachOfType(h.Texture,(e=>e.unload()))}get updating(){return this._loadingCount>0||this._frameTask.updating}get textureTechnique(){return null==this._textureTechnique&&(this._textureTechnique=this._techniques.get(l,new p)),this._textureTechnique}acquire(e){const t=this._textures.get(e);return t?(t.ref(),t.loadingPromise??t):this._createNewRef(e)}update(){let e=!1;this._frameUpdates.forEach((t=>{const r=t.texture.frameUpdate(t.previousToken);r>=0&&r!==t.previousToken&&(t.previousToken=r,e=!0)})),e&&this.events.emit("changed",a.BACKGROUND)}_createNewRef(e){const t=this._stage.getObject(e);if(null==t)return null;const r=t.events.on("unloaded",(()=>{r.remove(),this._onTextureUnloaded(e)})),n=new _(e,(()=>{this._frameTask.schedule((()=>{n.isUnreferenced&&t.unload()}))}));return this._textures.set(e,n),n.ref(),t.glTexture?(this._updateGLTexture(n,t.glTexture),c(t)&&this._frameUpdates.set(e,{texture:t,previousToken:-1}),n):(this._loadingCount++,n.loadingPromise=this._stage.schedule((()=>{const r=t.load(this._rctx),u=r=>(this._loadingCount--,n.loadingPromise=null,this._updateGLTexture(n,r),c(t)&&this._frameUpdates.set(e,{texture:t,previousToken:-1}),n),a=e=>(this._loadingCount--,n.loadingPromise=null,i(e)||s.getLogger(this).error(e),null);return o(r)?r.then(u,a):u(r)})),n.loadingPromise)}_updateGLTexture(e,t){e.glTexture=t,this.events.emit("changed",a.UPDATE)}_onTextureUnloaded(e){this._textures.delete(e),this._frameUpdates.delete(e)}};e([n()],m.prototype,"_loadingCount",void 0),e([n()],m.prototype,"_frameTask",void 0),e([n()],m.prototype,"updating",null),m=e([u("esri.views.3d.webgl-engine.lib.TextureRepository")],m);class _{constructor(e,t){this.id=e,this._release=t,this._refCount=0}get isUnreferenced(){return 0===this._refCount}ref(){++this._refCount}release(){--this._refCount,this._refCount>0||(0!==this._refCount?(s.getLogger("esri.views.3d.webgl-engine.lib.TextureRepository.RefCountedTextureImpl").error("Cannot dereference texture that has no references!"),this._refCount=0):this._release())}}export{m as TextureRepository};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import r from"../../../../core/Evented.js";import s from"../../../../core/Logger.js";import{isPromiseLike as o,isAbortError as i}from"../../../../core/promiseUtils.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{RenderRequestType as u}from"./basicInterfaces.js";import{ContentObjectType as d}from"./ContentObjectType.js";import{isFrameUpdateTexture as l}from"./ITexture.js";import{TaskPriority as p}from"../../../support/Scheduler.js";let h=class extends t{constructor(e){super({}),this._stage=e,this._textures=new Map,this._loadingCount=0,this._frameUpdates=new Map,this.events=new r,this._frameTask=e.view.resourceController.scheduler.registerTask(p.TEXTURE_UNLOAD)}normalizeCtorArgs(){return{}}destroy(){this._frameTask.remove(),this._stage.forEachOfType(d.Texture,(e=>e.unload()))}get updating(){return this._loadingCount>0||this._frameTask.updating}acquire(e){const t=this._textures.get(e);return t?(t.ref(),t.loadingPromise??t):this._createNewRef(e)}update(){let e=!1;this._frameUpdates.forEach((t=>{const r=t.texture.frameUpdate(t.previousToken);r>=0&&r!==t.previousToken&&(t.previousToken=r,e=!0)})),e&&this.events.emit("changed",u.BACKGROUND)}_createNewRef(e){const t=this._stage.getObject(e);if(null==t)return null;const r=t.events.on("unloaded",(()=>{r.remove(),this._onTextureUnloaded(e)})),n=new c(e,(()=>{this._frameTask.schedule((()=>{n.isUnreferenced&&t.unload()}))}));return this._textures.set(e,n),n.ref(),t.glTexture?(this._updateGLTexture(n,t.glTexture),l(t)&&this._frameUpdates.set(e,{texture:t,previousToken:-1}),n):(this._loadingCount++,n.loadingPromise=this._stage.schedule((()=>{const r=t.load(this._stage.renderView.renderingContext),a=r=>(this._loadingCount--,n.loadingPromise=null,this._updateGLTexture(n,r),l(t)&&this._frameUpdates.set(e,{texture:t,previousToken:-1}),n),u=e=>(this._loadingCount--,n.loadingPromise=null,i(e)||s.getLogger(this).error(e),null);return o(r)?r.then(a,u):a(r)})),n.loadingPromise)}_updateGLTexture(e,t){e.glTexture=t,this.events.emit("changed",u.UPDATE)}_onTextureUnloaded(e){this._textures.delete(e),this._frameUpdates.delete(e)}};e([n()],h.prototype,"_loadingCount",void 0),e([n()],h.prototype,"_frameTask",void 0),e([n()],h.prototype,"updating",null),h=e([a("esri.views.3d.webgl-engine.lib.TextureRepository")],h);class c{constructor(e,t){this.id=e,this._release=t,this._refCount=0}get isUnreferenced(){return 0===this._refCount}ref(){++this._refCount}release(){--this._refCount,this._refCount>0||(0!==this._refCount?(s.getLogger("esri.views.3d.webgl-engine.lib.TextureRepository.RefCountedTextureImpl").error("Cannot dereference texture that has no references!"),this._refCount=0):this._release())}}export{h as TextureRepository};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{a as e}from"../../../../chunks/vec32.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{BufferViewVec3f as r}from"../../../../geometry/support/buffer/BufferView.js";import{intersectRenderGeometryTriangles as o}from"../lib/RayIntersections.js";import{VertexAttribute as i}from"../lib/VertexAttribute.js";import{writeDefaultAttributes as s}from"./internal/bufferWriterUtils.js";class f{constructor(e){this.vertexBufferLayout=e}elementCount(e){return e.get(i.POSITION).indices.length}write(e,t,r,o,i,f){s(r,o,this.vertexBufferLayout,e,t,i,f)}intersect(t,s,f,n,c,m,l){const a=this.vertexBufferLayout.createView(t).getField(i.POSITION,r);if(null==a)return;const p=e(u,m,c),y=0,b=a.count/3,d=n.options.normalRequired,j=(e,t,r)=>{l(e,r,t,!1)};o(c,p,y,b,a.typedBuffer,a.typedBufferStride,d,j)}}const u=t();export{f as DefaultBufferWriter};
5
+ import{a as e}from"../../../../chunks/vec32.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{BufferViewVec3f as r}from"../../../../geometry/support/buffer/BufferView.js";import{intersectRenderGeometryTriangles as o}from"../lib/RayIntersections.js";import{VertexAttribute as i}from"../lib/VertexAttribute.js";import{writeDefaultAttributes as s}from"./internal/bufferWriterUtils.js";class f{constructor(e){this.vertexBufferLayout=e}elementCount(e){return e.get(i.POSITION).indices.length}write(e,t,r,o,i,f){return s(r,o,this.vertexBufferLayout,e,t,i,f)}intersect(t,s,f,n,c,m,l){const a=this.vertexBufferLayout.createView(t).getField(i.POSITION,r);if(null==a)return;const p=e(u,m,c),y=0,b=a.count/3,d=n.options.normalRequired,j=(e,t,r)=>{l(e,r,t,!1)};o(c,p,y,b,a.typedBuffer,a.typedBufferStride,d,j)}}const u=t();export{f as DefaultBufferWriter};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{p as e,i as r,c as t,n as i,d as s,l as a,h as o,f as n,q as c}from"../../../../chunks/vec32.js";import{ZEROS as l,create as u,fromValues as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ViewingMode as f}from"../../../ViewingMode.js";import{newLayout as m}from"../../support/buffer/InterleavedLayout.js";import{is3DGeometryOutputMRT as p,isShadowRelatedOutput as d,is3DGeometryOutput as g,ShaderOutput as T,isColorOrColorEmission as x}from"../core/shaderLibrary/ShaderOutput.js";import{NormalType as _}from"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{EmissionSource as v}from"../core/shaderLibrary/output/Emissions.glsl.js";import{NormalsDoubleSidedMode as b}from"../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as S}from"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{olidEnabled as O}from"../effects/geometry/olidUtils.js";import{CullFaceOptions as M}from"../lib/basicInterfaces.js";import{GLTextureMaterial as w}from"../lib/GLTextureMaterial.js";import{Material as R}from"../lib/Material.js";import{OITPolygonOffsetLimit as C}from"../lib/OrderIndependentTransparency.js";import{intersectTriangleGeometry as y}from"../lib/RayIntersections.js";import{RenderSlot as A}from"../lib/RenderSlot.js";import{VertexAttribute as I}from"../lib/VertexAttribute.js";import{getVerticalOffsetObject3D as P}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as j}from"./DefaultBufferWriter.js";import{verticalOffsetAtDistance as D}from"./internal/MaterialUtil.js";import{DefaultMaterialTechnique as L,DefaultMaterialPassParameters as N}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as E}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as V}from"../shaders/RealisticTreeTechnique.js";import{alphaCutoff as B}from"../../../../webscene/support/AlphaCutoff.js";class z extends R{constructor(e,r){super(e,U),this.materialType="default",this.supportsEdges=!0,this.produces=new Map([[A.OPAQUE_MATERIAL,e=>(p(e)||d(e))&&!this.parameters.transparent],[A.TRANSPARENT_MATERIAL,e=>(p(e)||d(e))&&this.parameters.transparent&&this.parameters.writeDepth],[A.TRANSPARENT_MATERIAL_WITHOUT_DEPTH,e=>(g(e)||d(e))&&this.parameters.transparent&&!this.parameters.writeDepth]]),this._vertexBufferLayout=k(this.parameters),this._configuration=new E(r.spherical,r.doublePrecisionRequiresObfuscation)}isVisibleForOutput(e){return e!==T.Shadow&&e!==T.ShadowExcludeHighlight&&e!==T.ShadowHighlight||this.parameters.castShadows}get visible(){const e=this.parameters;if(e.layerOpacity<B)return!1;const{hasInstancedColor:r,hasVertexColors:t,hasSymbolColors:i,vvColor:s}=e,a=r||s||i,o="replace"===e.colorMixMode,n=e.opacity>=B;if(t&&a)return o||n;const c=e.externalColor&&e.externalColor[3]>=B;return t?o?c:n:a?o||n:o?c:n}get hasEmissions(){return!!this.parameters.emissiveTextureId||!e(this.parameters.emissiveFactor,l)}getConfiguration(e,r){const t=this.parameters,{treeRendering:i,doubleSided:s,doubleSidedType:a}=t;return this._configuration.output=e,this._configuration.hasNormalTexture=!i&&!!t.normalTextureId,this._configuration.hasColorTexture=!!t.textureId,this._configuration.hasVertexTangents=!i&&t.hasVertexTangents,this._configuration.instanced=t.isInstanced,this._configuration.instancedDoublePrecision=t.instancedDoublePrecision,this._configuration.vvSize=!!t.vvSize,this._configuration.hasVerticalOffset=null!=t.verticalOffset,this._configuration.hasScreenSizePerspective=null!=t.screenSizePerspective,this._configuration.hasSlicePlane=t.hasSlicePlane,this._configuration.alphaDiscardMode=t.textureAlphaMode,this._configuration.normalType=i?_.Attribute:t.normalType,this._configuration.transparent=t.transparent,this._configuration.writeDepth=t.writeDepth,null!=t.customDepthTest&&(this._configuration.customDepthTest=t.customDepthTest),this._configuration.hasOccludees=r.hasOccludees,this._configuration.cullFace=t.hasSlicePlane?M.None:t.cullFace,this._configuration.cullAboveTerrain=r.cullAboveTerrain,this._configuration.hasModelTransformation=!i&&null!=t.modelTransformation,this._configuration.hasVertexColors=t.hasVertexColors,this._configuration.hasSymbolColors=t.hasSymbolColors,this._configuration.doubleSidedMode=i?b.WindingOrder:s&&"normal"===a?b.View:s&&"winding-order"===a?b.WindingOrder:b.None,this._configuration.instancedColor=t.hasInstancedColor,x(e)?(this._configuration.terrainDepthTest=r.terrainDepthTest,this._configuration.receiveShadows=t.receiveShadows,this._configuration.receiveAmbientOcclusion=t.receiveAmbientOcclusion&&null!=r.ssao):(this._configuration.terrainDepthTest=!1,this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1),this._configuration.vvColor=!!t.vvColor,this._configuration.textureAlphaPremultiplied=!!t.textureAlphaPremultiplied,this._configuration.pbrMode=t.usePBR?t.isSchematic?S.Schematic:S.Normal:S.Disabled,this._configuration.hasMetallicRoughnessTexture=!i&&!!t.metallicRoughnessTextureId,this._configuration.emissionSource=i?v.None:null!=t.emissiveTextureId?v.Texture:t.usePBR?v.Value:v.None,this._configuration.hasOcclusionTexture=!i&&!!t.occlusionTextureId,this._configuration.offsetBackfaces=!(!t.transparent||!t.offsetTransparentBackfaces),this._configuration.oitPass=r.oitPass,this._configuration.enableOffset=r.camera.relativeElevation<C,this._configuration.snowCover=W(r),this._configuration.hasColorTextureTransform=!!t.colorTextureTransformMatrix,this._configuration.hasNormalTextureTransform=!!t.normalTextureTransformMatrix,this._configuration.hasEmissionTextureTransform=!!t.emissiveTextureTransformMatrix,this._configuration.hasOcclusionTextureTransform=!!t.occlusionTextureTransformMatrix,this._configuration.hasMetallicRoughnessTextureTransform=!!t.metallicRoughnessTextureTransformMatrix,this._configuration}intersect(e,l,u,h,m,p){if(null!=this.parameters.verticalOffset){const e=u.camera;r(Q,l[12],l[13],l[14]);let p=null;switch(u.viewingMode){case f.Global:p=i(Y,Q);break;case f.Local:p=t(Y,H)}let d=0;const g=s(K,Q,e.eye),T=a(g),x=o(g,g,1/T);let _=null;this.parameters.screenSizePerspective&&(_=n(p,x)),d+=D(e,T,this.parameters.verticalOffset,_??0,this.parameters.screenSizePerspective),o(p,p,d),c(J,p,u.transform.inverseRotation),h=s(F,h,J),m=s(G,m,J)}y(e,u,h,m,P(u.verticalOffset),p)}createGLMaterial(e){return new q(e)}createBufferWriter(){return new j(this._vertexBufferLayout)}}class q extends w{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){this._material.setParameters({receiveShadows:e.shadowMap.enabled});const t=this._material.parameters;this.updateTexture(t.textureId);const i=e.camera.viewInverseTransposeMatrix;return r(t.origin,i[3],i[7],i[11]),this._material.setParameters(this.textureBindParameters),this.getTechnique(t.treeRendering?V:L,e)}}class U extends N{constructor(){super(...arguments),this.initTextureTransparent=!1,this.treeRendering=!1,this.hasVertexTangents=!1}}function W(e){return null!=e.weather&&e.weatherVisible&&"snowy"===e.weather.type&&"enabled"===e.weather.snowCover}function k(e){const r=m().vec3f(I.POSITION);e.normalType===_.Compressed?r.vec2i16(I.NORMALCOMPRESSED,{glNormalized:!0}):r.vec3f(I.NORMAL),e.hasVertexTangents&&r.vec4f(I.TANGENT);return(e.textureId||e.normalTextureId||e.metallicRoughnessTextureId||e.emissiveTextureId||e.occlusionTextureId)&&r.vec2f(I.UV0),e.hasVertexColors&&r.vec4u8(I.COLOR),e.hasSymbolColors&&r.vec4u8(I.SYMBOLCOLOR),O()&&r.vec4u8(I.OBJECTANDLAYERIDCOLOR),r}const F=u(),G=u(),H=h(0,0,1),Y=u(),J=u(),Q=u(),K=u();export{q as DefaultGLMaterial,z as DefaultMaterial,U as DefaultMaterialParameters};
5
+ import{p as e,i as r,c as t,n as i,d as s,l as o,h as a,f as n,q as c}from"../../../../chunks/vec32.js";import{ZEROS as l,create as u,fromValues as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ViewingMode as f}from"../../../ViewingMode.js";import{newLayout as m}from"../../support/buffer/InterleavedLayout.js";import{is3DGeometryOutputMRT as p,isShadowRelatedOutput as d,is3DGeometryOutput as g,ShaderOutput as T,isColorOrColorEmission as x}from"../core/shaderLibrary/ShaderOutput.js";import{NormalType as _}from"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{EmissionSource as v}from"../core/shaderLibrary/output/Emissions.glsl.js";import{NormalsDoubleSidedMode as b}from"../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as S}from"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{olidEnabled as O}from"../effects/geometry/olidUtils.js";import{CullFaceOptions as M}from"../lib/basicInterfaces.js";import{GLTextureMaterial as w}from"../lib/GLTextureMaterial.js";import{Material as R}from"../lib/Material.js";import{OITPolygonOffsetLimit as C}from"../lib/OrderIndependentTransparency.js";import{intersectTriangleGeometry as y}from"../lib/RayIntersections.js";import{RenderSlot as A}from"../lib/RenderSlot.js";import{VertexAttribute as I}from"../lib/VertexAttribute.js";import{getVerticalOffsetObject3D as P}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as j}from"./DefaultBufferWriter.js";import{verticalOffsetAtDistance as D}from"./internal/MaterialUtil.js";import{DefaultMaterialTechnique as L,DefaultMaterialPassParameters as N}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as E}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as V}from"../shaders/RealisticTreeTechnique.js";import{alphaCutoff as B}from"../../../../webscene/support/AlphaCutoff.js";class z extends R{constructor(e,r){super(e,U),this.materialType="default",this.supportsEdges=!0,this.produces=new Map([[A.OPAQUE_MATERIAL,e=>(p(e)||d(e))&&!this.parameters.transparent],[A.TRANSPARENT_MATERIAL,e=>(p(e)||d(e))&&this.parameters.transparent&&this.parameters.writeDepth],[A.TRANSPARENT_MATERIAL_WITHOUT_DEPTH,e=>(g(e)||d(e))&&this.parameters.transparent&&!this.parameters.writeDepth]]),this._vertexBufferLayout=k(this.parameters),this._configuration=new E(r.spherical,r.doublePrecisionRequiresObfuscation)}isVisibleForOutput(e){return e!==T.Shadow&&e!==T.ShadowExcludeHighlight&&e!==T.ShadowHighlight||this.parameters.castShadows}get visible(){const e=this.parameters;if(e.layerOpacity<B)return!1;const{hasInstancedColor:r,hasVertexColors:t,hasSymbolColors:i,vvColor:s}=e,o=r||s||i,a="replace"===e.colorMixMode,n=e.opacity>=B;if(t&&o)return a||n;const c=e.externalColor&&e.externalColor[3]>=B;return t?a?c:n:o?a||n:a?c:n}get hasEmissions(){return!!this.parameters.emissiveTextureId||!e(this.parameters.emissiveFactor,l)}getConfiguration(e,r){const t=this.parameters,{treeRendering:i,doubleSided:s,doubleSidedType:o}=t;return this._configuration.output=e,this._configuration.hasNormalTexture=!i&&!!t.normalTextureId,this._configuration.hasColorTexture=!!t.textureId,this._configuration.hasVertexTangents=!i&&t.hasVertexTangents,this._configuration.instanced=t.isInstanced,this._configuration.instancedDoublePrecision=t.instancedDoublePrecision,this._configuration.vvSize=!!t.vvSize,this._configuration.hasVerticalOffset=null!=t.verticalOffset,this._configuration.hasScreenSizePerspective=null!=t.screenSizePerspective,this._configuration.hasSlicePlane=t.hasSlicePlane,this._configuration.alphaDiscardMode=t.textureAlphaMode,this._configuration.normalType=i?_.Attribute:t.normalType,this._configuration.transparent=t.transparent,this._configuration.writeDepth=t.writeDepth,null!=t.customDepthTest&&(this._configuration.customDepthTest=t.customDepthTest),this._configuration.hasOccludees=r.hasOccludees,this._configuration.cullFace=t.hasSlicePlane?M.None:t.cullFace,this._configuration.cullAboveTerrain=r.cullAboveTerrain,this._configuration.hasModelTransformation=!i&&null!=t.modelTransformation,this._configuration.hasVertexColors=t.hasVertexColors,this._configuration.hasSymbolColors=t.hasSymbolColors,this._configuration.doubleSidedMode=i?b.WindingOrder:s&&"normal"===o?b.View:s&&"winding-order"===o?b.WindingOrder:b.None,this._configuration.instancedColor=t.hasInstancedColor,x(e)?(this._configuration.terrainDepthTest=r.terrainDepthTest,this._configuration.receiveShadows=t.receiveShadows,this._configuration.receiveAmbientOcclusion=t.receiveAmbientOcclusion&&null!=r.ssao):(this._configuration.terrainDepthTest=!1,this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1),this._configuration.vvColor=!!t.vvColor,this._configuration.textureAlphaPremultiplied=!!t.textureAlphaPremultiplied,this._configuration.pbrMode=t.usePBR?t.isSchematic?S.Schematic:S.Normal:S.Disabled,this._configuration.hasMetallicRoughnessTexture=!i&&!!t.metallicRoughnessTextureId,this._configuration.emissionSource=i?v.None:null!=t.emissiveTextureId?v.Texture:t.usePBR?v.Value:v.None,this._configuration.hasOcclusionTexture=!i&&!!t.occlusionTextureId,this._configuration.offsetBackfaces=!(!t.transparent||!t.offsetTransparentBackfaces),this._configuration.oitPass=r.oitPass,this._configuration.enableOffset=r.camera.relativeElevation<C,this._configuration.snowCover=W(r),this._configuration.hasColorTextureTransform=!!t.colorTextureTransformMatrix,this._configuration.hasNormalTextureTransform=!!t.normalTextureTransformMatrix,this._configuration.hasEmissionTextureTransform=!!t.emissiveTextureTransformMatrix,this._configuration.hasOcclusionTextureTransform=!!t.occlusionTextureTransformMatrix,this._configuration.hasMetallicRoughnessTextureTransform=!!t.metallicRoughnessTextureTransformMatrix,this._configuration}intersect(e,l,u,h,m,p){if(null!=this.parameters.verticalOffset){const e=u.camera;r(Q,l[12],l[13],l[14]);let p=null;switch(u.viewingMode){case f.Global:p=i(Y,Q);break;case f.Local:p=t(Y,H)}let d=0;const g=s(K,Q,e.eye),T=o(g),x=a(g,g,1/T);let _=null;this.parameters.screenSizePerspective&&(_=n(p,x)),d+=D(e,T,this.parameters.verticalOffset,_??0,this.parameters.screenSizePerspective),a(p,p,d),c(J,p,u.transform.inverseRotation),h=s(F,h,J),m=s(G,m,J)}y(e,u,h,m,P(u.verticalOffset),p)}createGLMaterial(e){return new q(e)}createBufferWriter(){return new j(this._vertexBufferLayout)}}class q extends w{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){this._material.setParameters({receiveShadows:e.shadowMap.enabled});const t=this._material.parameters;this.updateTexture(t.textureId);const i=e.camera.viewInverseTransposeMatrix;return r(t.origin,i[3],i[7],i[11]),this._material.setParameters(this.textureBindParameters),this.getTechnique(t.treeRendering?V:L,e)}}class U extends N{constructor(){super(...arguments),this.treeRendering=!1,this.hasVertexTangents=!1}}function W(e){return null!=e.weather&&e.weatherVisible&&"snowy"===e.weather.type&&"enabled"===e.weather.snowCover}function k(e){const r=m().vec3f(I.POSITION);e.normalType===_.Compressed?r.vec2i16(I.NORMALCOMPRESSED,{glNormalized:!0}):r.vec3f(I.NORMAL),e.hasVertexTangents&&r.vec4f(I.TANGENT);return(e.textureId||e.normalTextureId||e.metallicRoughnessTextureId||e.emissiveTextureId||e.occlusionTextureId)&&r.vec2f(I.UV0),e.hasVertexColors&&r.vec4u8(I.COLOR),e.hasSymbolColors&&r.vec4u8(I.SYMBOLCOLOR),O()&&r.vec4u8(I.OBJECTANDLAYERIDCOLOR),r}const F=u(),G=u(),H=h(0,0,1),Y=u(),J=u(),Q=u(),K=u();export{q as DefaultGLMaterial,z as DefaultMaterial,U as DefaultMaterialParameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{clamp as e,deg2rad as t}from"../../../../core/mathUtils.js";import{fromMat4 as i}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as n,rotate as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as l,fromValues as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{i as f,t as u,n as p,d as h,h as m,c as d,l as g,j as O,g as T,q as S,f as A}from"../../../../chunks/vec32.js";import{create as b,fromValues as E}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromArray as v,create as R,freeze as I}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMat4 as x}from"../../../../core/libs/gl-matrix-2/types/mat4.js";import{create as F}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec4u8 as _,BufferViewVec3f as C,BufferViewFloat as P,BufferViewVec2f as D,BufferViewVec4f as y}from"../../../../geometry/support/buffer/BufferView.js";import{evaluateModelTransformScale as N}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as L}from"../../support/debugFlags.js";import{newLayout as j}from"../../support/buffer/InterleavedLayout.js";import{isColorEmissionHighlightOrOID as M,isColorOrColorEmission as U}from"../core/shaderLibrary/ShaderOutput.js";import{HUDVerticalPixelOffset as z}from"../core/shaderLibrary/hud/HUD.glsl.js";import{olidEnabled as w}from"../effects/geometry/olidUtils.js";import{GLTextureMaterial as B,GLTextureMaterialBindParameters as V}from"../lib/GLTextureMaterial.js";import{Material as q,RenderOccludedFlag as X}from"../lib/Material.js";import{RenderSlot as G}from"../lib/RenderSlot.js";import{applyScaleFactor as H,applyPrecomputedScaleFactor as W,precomputeScaleFactor as Y}from"../lib/screenSizePerspectiveUtils.js";import{assert as Z}from"../lib/Util.js";import{VertexAttribute as k}from"../lib/VertexAttribute.js";import{ScaleInfo as J}from"./ScaleInfo.js";import{writePosition as K,writeNormal as Q,writeColor as $,writeBufferFloat as ee,writeBufferVec4 as te,writeBufferVec4Zeros as ie,writeObjectAndLayerIdColor as se}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as re}from"./internal/MaterialUtil.js";import{c as ae}from"../../../../chunks/HUDMaterial.glsl.js";import{HUDMaterialTechnique as ne}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as oe}from"../shaders/HUDMaterialTechniqueConfiguration.js";import{alphaCutoff as le}from"../../../../webscene/support/AlphaCutoff.js";class ce extends q{constructor(e,t){super(e,Me),this.produces=new Map([[G.HUD_MATERIAL,e=>M(e)&&!this.parameters.drawAsLabel],[G.LABEL_MATERIAL,e=>M(e)&&this.parameters.drawAsLabel],[G.OCCLUSION_PIXELS,()=>this.parameters.occlusionTest],[G.DRAPED_MATERIAL,e=>this.parameters.draped&&M(e)]]),this._visible=!0,this._configuration=new oe(t)}getConfiguration(e,t){return this._configuration.output=e,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVerticalOffset=!!this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,this._configuration.hasPolygonOffset=this.parameters.polygonOffset,this._configuration.draped=this.parameters.draped,this._configuration.occlusionTestEnabled=this.parameters.occlusionTest,this._configuration.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,this._configuration.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,this._configuration.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,this._configuration.hasRotation=this.parameters.hasRotation,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.occlusionPass=t.slot===G.OCCLUSION_PIXELS,this._configuration.occludedFragmentFade=this.parameters.occludedFragmentFade,this._configuration.horizonCullingEnabled=this.parameters.horizonCullingEnabled,this._configuration.isFocused=this.parameters.isFocused,this._configuration.depthTestEnabled=this.parameters.depthEnabled||t.slot===G.OCCLUSION_PIXELS,U(e)&&(this._configuration.debugDrawLabelBorder=!!L.LABELS_SHOW_BORDER),this._configuration.oitPass=t.oitPass,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration}intersect(e,t,s,a,n,o){const{options:{selectionMode:l,hud:c,excludeLabels:T},point:S,camera:A}=s,{parameters:E}=this;if(!l||!c||T&&E.isLabel||!e.visible||!S)return;const R=e.attributes.get(k.FEATUREATTRIBUTE),I=null==R?null:v(R.data,Ce),{scaleX:x,scaleY:F}=Be(I,E,A.pixelRatio);i(ve,t),e.attributes.has(k.FEATUREATTRIBUTE)&&he(ve);const _=e.attributes.get(k.POSITION),C=e.attributes.get(k.SIZE),P=e.attributes.get(k.NORMAL),D=e.attributes.get(k.ROTATION),y=e.attributes.get(k.CENTEROFFSETANDDISTANCE);Z(_.size>=3);const N=ae(E),L="screen"===this.parameters.centerOffsetUnits;for(let i=0;i<_.data.length/_.size;i++){const e=i*_.size;f(ge,_.data[e],_.data[e+1],_.data[e+2]),u(ge,ge,t),u(ge,ge,A.viewMatrix);const a=i*y.size;if(f(Fe,y.data[a],y.data[a+1],y.data[a+2]),!L&&(ge[0]+=Fe[0],ge[1]+=Fe[1],0!==Fe[2])){const e=Fe[2];p(Fe,ge),h(ge,ge,m(Fe,Fe,e))}const n=i*P.size;if(f(Oe,P.data[n],P.data[n+1],P.data[n+2]),pe(Oe,ve,A,Pe),Ve(this.parameters,ge,Pe,A,de),A.applyProjection(ge,Te),Te[0]>-1){L&&(Fe[0]||Fe[1])&&(Te[0]+=Fe[0]*A.pixelRatio,0!==Fe[1]&&(Te[1]+=H(Fe[1],de.factorAlignment)*A.pixelRatio),A.unapplyProjection(Te,ge)),Te[0]+=this.parameters.screenOffset[0]*A.pixelRatio,Te[1]+=this.parameters.screenOffset[1]*A.pixelRatio,Te[0]=Math.floor(Te[0]),Te[1]=Math.floor(Te[1]);const e=i*C.size;Ne[0]=C.data[e],Ne[1]=C.data[e+1],W(Ne,de.factor,Ne);const t=De*A.pixelRatio;let a=0;if(E.textureIsSignedDistanceField){a=Math.min(E.outlineSize,.5*Ne[0])*A.pixelRatio/2}Ne[0]*=x,Ne[1]*=F;const n=i*D.size,l=E.rotation+D.data[n];if(me(S,Te[0],Te[1],Ne,t,a,l,E,N)){const e=s.ray;if(u(Ae,ge,r(Ie,A.viewMatrix)),Te[0]=S[0],Te[1]=S[1],A.unprojectFromRenderScreen(Te,ge)){const t=b();d(t,e.direction);const i=1/g(t);m(t,t,i);o(O(e.origin,ge)*i,t,-1,!0,1,Ae)}}}}}intersectDraped(e,t,i,s,r,a){const n=e.attributes.get(k.POSITION),o=e.attributes.get(k.SIZE),l=e.attributes.get(k.ROTATION),c=this.parameters,f=ae(c),u=e.attributes.get(k.FEATUREATTRIBUTE),p=null==u?null:v(u.data,Ce),{scaleX:h,scaleY:m}=Be(p,c,e.screenToWorldRatio),d=ye*e.screenToWorldRatio;for(let g=0;g<n.data.length/n.size;g++){const t=g*n.size,i=n.data[t],u=n.data[t+1],p=g*o.size;Ne[0]=o.data[p],Ne[1]=o.data[p+1];let O=0;if(c.textureIsSignedDistanceField){O=Math.min(c.outlineSize,.5*Ne[0])*e.screenToWorldRatio/2}Ne[0]*=h,Ne[1]*=m;const T=g*l.size,S=c.rotation+l.data[T];me(s,i,u,Ne,d,O,S,c,f)&&r(a.dist,a.normal,-1,!1)}}createBufferWriter(){return new we}applyShaderOffsetsView(e,t,i,s,r,a,n){const o=pe(t,i,r,Pe);return this._applyVerticalGroundOffsetView(e,o,r,n),Ve(this.parameters,n,o,r,a),this._applyPolygonOffsetView(n,o,s[3],r,n),this._applyCenterOffsetView(n,s,n),n}applyShaderOffsetsNDC(e,t,i,s,r){return this._applyCenterOffsetNDC(e,t,i,s),null!=r&&d(r,s),this._applyPolygonOffsetNDC(s,t,i,s),s}_applyPolygonOffsetView(t,i,s,r,a){const n=r.aboveGround?1:-1;let o=Math.sign(s);0===o&&(o=n);const l=n*o;if(this.parameters.shaderPolygonOffset<=0)return d(a,t);const c=e(Math.abs(i.cosAngle),.01,1),f=1-Math.sqrt(1-c*c)/c/r.viewport[2];return m(a,t,l>0?f:1/f),a}_applyVerticalGroundOffsetView(e,t,i,s){const r=g(e),a=i.aboveGround?1:-1,n=i.computeRenderPixelSizeAtDist(r)*z,o=m(ge,t.normal,a*n);return T(s,e,o),s}_applyCenterOffsetView(e,t,i){const s="screen"!==this.parameters.centerOffsetUnits;return i!==e&&d(i,e),s&&(i[0]+=t[0],i[1]+=t[1],t[2]&&(p(Oe,i),T(i,i,m(Oe,Oe,t[2])))),i}_applyCenterOffsetNDC(e,t,i,s){const r="screen"!==this.parameters.centerOffsetUnits;return s!==e&&d(s,e),r||(s[0]+=t[0]/i.fullWidth*2,s[1]+=t[1]/i.fullHeight*2),s}_applyPolygonOffsetNDC(e,t,i,s){const r=this.parameters.shaderPolygonOffset;if(e!==s&&d(s,e),r){const e=i.aboveGround?1:-1,a=e*Math.sign(t[3]);s[2]-=(a||e)*r}return s}set visible(e){this._visible=e}get visible(){const{color:e,outlineSize:t,outlineColor:i}=this.parameters,s=e[3]>=le||t>=le&&i[3]>=le;return this._visible&&s}createGLMaterial(e){return new fe(e)}calculateRelativeScreenBounds(e,t,i=F()){return ue(this.parameters,e,t,i),i[2]=i[0]+e[0],i[3]=i[1]+e[1],i}}class fe extends B{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.getTechnique(ne,e)}}function ue(e,t,i,s){s[0]=e.anchorPosition[0]*-t[0]+e.screenOffset[0]*i,s[1]=e.anchorPosition[1]*-t[1]+e.screenOffset[1]*i}function pe(e,t,s,r){return x(t)&&(t=i(Re,t)),S(r.normal,e,t),u(r.normal,r.normal,s.viewInverseTransposeMatrix),r.cosAngle=A(Se,je),r}function he(e){const t=e[0],i=e[1],s=e[2],r=e[3],a=e[4],n=e[5],o=e[6],l=e[7],c=e[8],f=1/Math.sqrt(t*t+i*i+s*s),u=1/Math.sqrt(r*r+a*a+n*n),p=1/Math.sqrt(o*o+l*l+c*c);return e[0]=t*f,e[1]=i*f,e[2]=s*f,e[3]=r*u,e[4]=a*u,e[5]=n*u,e[6]=o*p,e[7]=l*p,e[8]=c*p,e}function me(e,i,s,r,a,l,c,f,u){let p=i-a-r[0]*u[0],h=p+r[0]+2*a,m=s-a-r[1]*u[1],d=m+r[1]+2*a;const g=f.distanceFieldBoundingBox;return f.textureIsSignedDistanceField&&null!=g&&(p+=r[0]*g[0],m+=r[1]*g[1],h-=r[0]*(1-g[2]),d-=r[1]*(1-g[3]),p-=l,h+=l,m-=l,d+=l),n(Ee,i,s),o(be,e,Ee,t(c)),be[0]>p&&be[0]<h&&be[1]>m&&be[1]<d}const de=new J,ge=b(),Oe=b(),Te=R(),Se=b(),Ae=b(),be=l(),Ee=l(),ve=s(),Re=s(),Ie=a(),xe=R(),Fe=b(),_e=b(),Ce=R(),Pe={normal:Se,cosAngle:0},De=1,ye=2,Ne=c(0,0),Le=6,je=E(0,0,1);class Me extends V{constructor(){super(...arguments),this.renderOccluded=X.Occlude,this.isDecoration=!1,this.color=I(1,1,1,1),this.polygonOffset=!1,this.anchorPosition=c(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=I(1,1,1,1),this.outlineSize=0,this.distanceFieldBoundingBox=R(),this.rotation=0,this.hasRotation=!1,this.vvSizeEnabled=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.vvSymbolAnchor=null,this.vvSymbolRotationMatrix=null,this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.occlusionTest=!0,this.occludedFragmentFade=!1,this.horizonCullingEnabled=!1,this.centerOffsetUnits="world",this.drawAsLabel=!1,this.depthEnabled=!0,this.isFocused=!0,this.focusEffect="none",this.draped=!1,this.isLabel=!1}}const Ue=j().vec3f(k.POSITION).vec3f(k.NORMAL).vec2f(k.UV0).vec4u8(k.COLOR).vec2f(k.SIZE).f32(k.ROTATION).vec4f(k.CENTEROFFSETANDDISTANCE).vec4f(k.FEATUREATTRIBUTE),ze=Ue.clone().vec4u8(k.OBJECTANDLAYERIDCOLOR);class we{constructor(){this.vertexBufferLayout=w()?ze:Ue}elementCount(e){return e.get(k.POSITION).indices.length*Le}write(e,t,i,s,r,a){K(i.get(k.POSITION),e,r.position,a,Le),Q(i.get(k.NORMAL),t,r.normal,a,Le);const n=i.get(k.UV0)?.data;let o=0,l=0,c=1,f=1;n&&n.length>=4&&(o=n[0],l=n[1],c=n[2],f=n[3]),c=Math.min(1.99999,c+1),f=Math.min(1.99999,f+1);let u=i.get(k.POSITION).indices.length,p=a;const h=r.uv0;for(let O=0;O<u;++O)h.set(p,0,o),h.set(p,1,l),p++,h.set(p,0,c),h.set(p,1,l),p++,h.set(p,0,c),h.set(p,1,f),p++,h.set(p,0,c),h.set(p,1,f),p++,h.set(p,0,o),h.set(p,1,f),p++,h.set(p,0,o),h.set(p,1,l),p++;$(i.get(k.COLOR),4,r.color,a,Le);const{data:m,indices:d}=i.get(k.SIZE);u=d.length;const g=r.size;p=a;for(let O=0;O<u;++O){const e=m[2*d[O]],t=m[2*d[O]+1];for(let i=0;i<Le;++i)g.set(p,0,e),g.set(p,1,t),p++}if(ee(i.get(k.ROTATION),r.rotation,a,Le),i.get(k.CENTEROFFSETANDDISTANCE)?te(i.get(k.CENTEROFFSETANDDISTANCE),r.centerOffsetAndDistance,a,Le):ie(r.centerOffsetAndDistance,a,u*Le),i.get(k.FEATUREATTRIBUTE)?te(i.get(k.FEATUREATTRIBUTE),r.featureAttribute,a,Le):ie(r.featureAttribute,a,u*Le),null!=s){const e=i.get(k.POSITION)?.indices;if(e){const t=e.length,i=r.getField(k.OBJECTANDLAYERIDCOLOR,_);se(s,i,t,a,Le)}}}intersect(e,t,i,s,a,n,o){const{options:{selectionMode:l,hud:c,excludeLabels:S},point:A,camera:E}=s;if(!l||!c||S&&t.isLabel||!A)return;const v=this.vertexBufferLayout.createView(e),R=v.getField(k.POSITION,C),I=v.getField(k.NORMAL,C),x=v.getField(k.ROTATION,P),F=v.getField(k.SIZE,D),_=v.getField(k.FEATUREATTRIBUTE,y),N=v.getField(k.CENTEROFFSETANDDISTANCE,y),L="screen"===t.centerOffsetUnits,j=ae(t);if(null==R||null==I||null==x||null==F||null==N)return;const M=null==_?null:_.getVec(0,Ce),{scaleX:U,scaleY:z}=Be(M,t,E.pixelRatio),w=R.count/Le;for(let C=0;C<w;C++){const e=C*Le;if(R.getVec(e,ge),null!=i&&T(ge,ge,i),u(ge,ge,E.viewMatrix),N.getVec(e,xe),f(Fe,xe[0],xe[1],xe[2]),!L&&(ge[0]+=Fe[0],ge[1]+=Fe[1],0!==Fe[2])){const e=Fe[2];p(Fe,ge),h(ge,ge,m(Fe,Fe,e))}if(I.getVec(e,Oe),pe(Oe,ve,E,Pe),Ve(t,ge,Pe,E,de),E.applyProjection(ge,Te),Te[0]>-1){L&&(Fe[0]||Fe[1])&&(Te[0]+=Fe[0]*E.pixelRatio,0!==Fe[1]&&(Te[1]+=H(Fe[1],de.factorAlignment)*E.pixelRatio),E.unapplyProjection(Te,ge)),Te[0]+=t.screenOffset[0]*E.pixelRatio,Te[1]+=t.screenOffset[1]*E.pixelRatio,Te[0]=Math.floor(Te[0]),Te[1]=Math.floor(Te[1]),F.getVec(e,Ne),W(Ne,de.factor,Ne);const i=De*E.pixelRatio;let a=0;if(t.textureIsSignedDistanceField){a=Math.min(t.outlineSize,.5*Ne[0])*E.pixelRatio/2}Ne[0]*=U,Ne[1]*=z;const n=x.get(e),l=t.rotation+n;if(me(A,Te[0],Te[1],Ne,i,a,l,t,j)){const e=s.ray;if(u(Ae,ge,r(Ie,E.viewMatrix)),Te[0]=A[0],Te[1]=A[1],E.unprojectFromRenderScreen(Te,ge)){const t=b();d(t,e.direction);const i=1/g(t);m(t,t,i);o(O(e.origin,ge)*i,t,C,!0,1,Ae)}}}}}}function Be(e,t,i){return null==e||null==t.vvSize?{scaleX:i,scaleY:i}:(N(_e,t,e),{scaleX:_e[0]*i,scaleY:_e[1]*i})}function Ve(e,t,i,s,r){if(!e.verticalOffset?.screenLength){if(e.screenSizePerspective||e.screenSizePerspectiveAlignment){qe(e,r,g(t),i.cosAngle)}else r.factor.scale=1,r.factorAlignment.scale=1;return t}const a=g(t),n=e.screenSizePerspectiveAlignment??e.screenSizePerspective,o=re(s,a,e.verticalOffset,i.cosAngle,n);return qe(e,r,a,i.cosAngle),m(i.normal,i.normal,o),T(t,t,i.normal)}function qe(e,t,i,s){null!=e.screenSizePerspective?Y(s,i,e.screenSizePerspective,t.factor):(t.factor.scale=1,t.factor.factor=0,t.factor.minScaleFactor=0),null!=e.screenSizePerspectiveAlignment?Y(s,i,e.screenSizePerspectiveAlignment,t.factorAlignment):(t.factorAlignment.factor=t.factor.factor,t.factorAlignment.scale=t.factor.scale,t.factorAlignment.minScaleFactor=t.factor.minScaleFactor)}export{ce as HUDMaterial,Me as Parameters};
5
+ import{clamp as e,deg2rad as t}from"../../../../core/mathUtils.js";import{fromMat4 as i}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as n,rotate as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as l,fromValues as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{i as f,t as u,n as p,d as h,h as m,c as d,l as g,j as O,g as T,q as S,f as A}from"../../../../chunks/vec32.js";import{create as b,fromValues as E}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromArray as v,create as R,freeze as I}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMat4 as x}from"../../../../core/libs/gl-matrix-2/types/mat4.js";import{create as F}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec4u8 as P,BufferViewVec3f as _,BufferViewFloat as C,BufferViewVec2f as D,BufferViewVec4f as y}from"../../../../geometry/support/buffer/BufferView.js";import{evaluateModelTransformScale as N}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as L}from"../../support/debugFlags.js";import{newLayout as j}from"../../support/buffer/InterleavedLayout.js";import{isColorEmissionHighlightOrOID as M,isColorOrColorEmission as U}from"../core/shaderLibrary/ShaderOutput.js";import{HUDVerticalPixelOffset as z}from"../core/shaderLibrary/hud/HUD.glsl.js";import{olidEnabled as w}from"../effects/geometry/olidUtils.js";import{GLTextureMaterial as B,GLTextureMaterialBindParameters as V}from"../lib/GLTextureMaterial.js";import{Material as q,RenderOccludedFlag as X}from"../lib/Material.js";import{RenderSlot as G}from"../lib/RenderSlot.js";import{applyScaleFactor as H,applyPrecomputedScaleFactor as W,precomputeScaleFactor as Y}from"../lib/screenSizePerspectiveUtils.js";import{assert as Z}from"../lib/Util.js";import{VertexAttribute as k}from"../lib/VertexAttribute.js";import{ScaleInfo as J}from"./ScaleInfo.js";import{writePosition as K,writeNormal as Q,writeColor as $,writeBufferFloat as ee,writeBufferVec4 as te,writeBufferVec4Zeros as ie,writeObjectAndLayerIdColor as se}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as re}from"./internal/MaterialUtil.js";import{c as ae}from"../../../../chunks/HUDMaterial.glsl.js";import{HUDMaterialTechnique as ne}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as oe}from"../shaders/HUDMaterialTechniqueConfiguration.js";import{alphaCutoff as le}from"../../../../webscene/support/AlphaCutoff.js";class ce extends q{constructor(e,t){super(e,Me),this.produces=new Map([[G.HUD_MATERIAL,e=>M(e)&&!this.parameters.drawAsLabel],[G.LABEL_MATERIAL,e=>M(e)&&this.parameters.drawAsLabel],[G.OCCLUSION_PIXELS,()=>this.parameters.occlusionTest],[G.DRAPED_MATERIAL,e=>this.parameters.draped&&M(e)]]),this._visible=!0,this._configuration=new oe(t)}getConfiguration(e,t){return this._configuration.output=e,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVerticalOffset=!!this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,this._configuration.hasPolygonOffset=this.parameters.polygonOffset,this._configuration.draped=this.parameters.draped,this._configuration.occlusionTestEnabled=this.parameters.occlusionTest,this._configuration.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,this._configuration.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,this._configuration.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,this._configuration.hasRotation=this.parameters.hasRotation,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.occlusionPass=t.slot===G.OCCLUSION_PIXELS,this._configuration.occludedFragmentFade=this.parameters.occludedFragmentFade,this._configuration.horizonCullingEnabled=this.parameters.horizonCullingEnabled,this._configuration.isFocused=this.parameters.isFocused,this._configuration.depthTestEnabled=this.parameters.depthEnabled||t.slot===G.OCCLUSION_PIXELS,U(e)&&(this._configuration.debugDrawLabelBorder=!!L.LABELS_SHOW_BORDER),this._configuration.oitPass=t.oitPass,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration}intersect(e,t,s,a,n,o){const{options:{selectionMode:l,hud:c,excludeLabels:T},point:S,camera:A}=s,{parameters:E}=this;if(!l||!c||T&&E.isLabel||!e.visible||!S)return;const R=e.attributes.get(k.FEATUREATTRIBUTE),I=null==R?null:v(R.data,_e),{scaleX:x,scaleY:F}=Be(I,E,A.pixelRatio);i(ve,t),e.attributes.has(k.FEATUREATTRIBUTE)&&he(ve);const P=e.attributes.get(k.POSITION),_=e.attributes.get(k.SIZE),C=e.attributes.get(k.NORMAL),D=e.attributes.get(k.ROTATION),y=e.attributes.get(k.CENTEROFFSETANDDISTANCE);Z(P.size>=3);const N=ae(E),L="screen"===this.parameters.centerOffsetUnits;for(let i=0;i<P.data.length/P.size;i++){const e=i*P.size;f(ge,P.data[e],P.data[e+1],P.data[e+2]),u(ge,ge,t),u(ge,ge,A.viewMatrix);const a=i*y.size;if(f(Fe,y.data[a],y.data[a+1],y.data[a+2]),!L&&(ge[0]+=Fe[0],ge[1]+=Fe[1],0!==Fe[2])){const e=Fe[2];p(Fe,ge),h(ge,ge,m(Fe,Fe,e))}const n=i*C.size;if(f(Oe,C.data[n],C.data[n+1],C.data[n+2]),pe(Oe,ve,A,Ce),Ve(this.parameters,ge,Ce,A,de),A.applyProjection(ge,Te),Te[0]>-1){L&&(Fe[0]||Fe[1])&&(Te[0]+=Fe[0]*A.pixelRatio,0!==Fe[1]&&(Te[1]+=H(Fe[1],de.factorAlignment)*A.pixelRatio),A.unapplyProjection(Te,ge)),Te[0]+=this.parameters.screenOffset[0]*A.pixelRatio,Te[1]+=this.parameters.screenOffset[1]*A.pixelRatio,Te[0]=Math.floor(Te[0]),Te[1]=Math.floor(Te[1]);const e=i*_.size;Ne[0]=_.data[e],Ne[1]=_.data[e+1],W(Ne,de.factor,Ne);const t=De*A.pixelRatio;let a=0;if(E.textureIsSignedDistanceField){a=Math.min(E.outlineSize,.5*Ne[0])*A.pixelRatio/2}Ne[0]*=x,Ne[1]*=F;const n=i*D.size,l=E.rotation+D.data[n];if(me(S,Te[0],Te[1],Ne,t,a,l,E,N)){const e=s.ray;if(u(Ae,ge,r(Ie,A.viewMatrix)),Te[0]=S[0],Te[1]=S[1],A.unprojectFromRenderScreen(Te,ge)){const t=b();d(t,e.direction);const i=1/g(t);m(t,t,i);o(O(e.origin,ge)*i,t,-1,!0,1,Ae)}}}}}intersectDraped(e,t,i,s,r,a){const n=e.attributes.get(k.POSITION),o=e.attributes.get(k.SIZE),l=e.attributes.get(k.ROTATION),c=this.parameters,f=ae(c),u=e.attributes.get(k.FEATUREATTRIBUTE),p=null==u?null:v(u.data,_e),{scaleX:h,scaleY:m}=Be(p,c,e.screenToWorldRatio),d=ye*e.screenToWorldRatio;for(let g=0;g<n.data.length/n.size;g++){const t=g*n.size,i=n.data[t],u=n.data[t+1],p=g*o.size;Ne[0]=o.data[p],Ne[1]=o.data[p+1];let O=0;if(c.textureIsSignedDistanceField){O=Math.min(c.outlineSize,.5*Ne[0])*e.screenToWorldRatio/2}Ne[0]*=h,Ne[1]*=m;const T=g*l.size,S=c.rotation+l.data[T];me(s,i,u,Ne,d,O,S,c,f)&&r(a.dist,a.normal,-1,!1)}}createBufferWriter(){return new we}applyShaderOffsetsView(e,t,i,s,r,a,n){const o=pe(t,i,r,Ce);return this._applyVerticalGroundOffsetView(e,o,r,n),Ve(this.parameters,n,o,r,a),this._applyPolygonOffsetView(n,o,s[3],r,n),this._applyCenterOffsetView(n,s,n),n}applyShaderOffsetsNDC(e,t,i,s,r){return this._applyCenterOffsetNDC(e,t,i,s),null!=r&&d(r,s),this._applyPolygonOffsetNDC(s,t,i,s),s}_applyPolygonOffsetView(t,i,s,r,a){const n=r.aboveGround?1:-1;let o=Math.sign(s);0===o&&(o=n);const l=n*o;if(this.parameters.shaderPolygonOffset<=0)return d(a,t);const c=e(Math.abs(i.cosAngle),.01,1),f=1-Math.sqrt(1-c*c)/c/r.viewport[2];return m(a,t,l>0?f:1/f),a}_applyVerticalGroundOffsetView(e,t,i,s){const r=g(e),a=i.aboveGround?1:-1,n=i.computeRenderPixelSizeAtDist(r)*z,o=m(ge,t.normal,a*n);return T(s,e,o),s}_applyCenterOffsetView(e,t,i){const s="screen"!==this.parameters.centerOffsetUnits;return i!==e&&d(i,e),s&&(i[0]+=t[0],i[1]+=t[1],t[2]&&(p(Oe,i),T(i,i,m(Oe,Oe,t[2])))),i}_applyCenterOffsetNDC(e,t,i,s){const r="screen"!==this.parameters.centerOffsetUnits;return s!==e&&d(s,e),r||(s[0]+=t[0]/i.fullWidth*2,s[1]+=t[1]/i.fullHeight*2),s}_applyPolygonOffsetNDC(e,t,i,s){const r=this.parameters.shaderPolygonOffset;if(e!==s&&d(s,e),r){const e=i.aboveGround?1:-1,a=e*Math.sign(t[3]);s[2]-=(a||e)*r}return s}set visible(e){this._visible=e}get visible(){const{color:e,outlineSize:t,outlineColor:i}=this.parameters,s=e[3]>=le||t>=le&&i[3]>=le;return this._visible&&s}createGLMaterial(e){return new fe(e)}calculateRelativeScreenBounds(e,t,i=F()){return ue(this.parameters,e,t,i),i[2]=i[0]+e[0],i[3]=i[1]+e[1],i}}class fe extends B{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.getTechnique(ne,e)}}function ue(e,t,i,s){s[0]=e.anchorPosition[0]*-t[0]+e.screenOffset[0]*i,s[1]=e.anchorPosition[1]*-t[1]+e.screenOffset[1]*i}function pe(e,t,s,r){return x(t)&&(t=i(Re,t)),S(r.normal,e,t),u(r.normal,r.normal,s.viewInverseTransposeMatrix),r.cosAngle=A(Se,je),r}function he(e){const t=e[0],i=e[1],s=e[2],r=e[3],a=e[4],n=e[5],o=e[6],l=e[7],c=e[8],f=1/Math.sqrt(t*t+i*i+s*s),u=1/Math.sqrt(r*r+a*a+n*n),p=1/Math.sqrt(o*o+l*l+c*c);return e[0]=t*f,e[1]=i*f,e[2]=s*f,e[3]=r*u,e[4]=a*u,e[5]=n*u,e[6]=o*p,e[7]=l*p,e[8]=c*p,e}function me(e,i,s,r,a,l,c,f,u){let p=i-a-r[0]*u[0],h=p+r[0]+2*a,m=s-a-r[1]*u[1],d=m+r[1]+2*a;const g=f.distanceFieldBoundingBox;return f.textureIsSignedDistanceField&&null!=g&&(p+=r[0]*g[0],m+=r[1]*g[1],h-=r[0]*(1-g[2]),d-=r[1]*(1-g[3]),p-=l,h+=l,m-=l,d+=l),n(Ee,i,s),o(be,e,Ee,t(c)),be[0]>p&&be[0]<h&&be[1]>m&&be[1]<d}const de=new J,ge=b(),Oe=b(),Te=R(),Se=b(),Ae=b(),be=l(),Ee=l(),ve=s(),Re=s(),Ie=a(),xe=R(),Fe=b(),Pe=b(),_e=R(),Ce={normal:Se,cosAngle:0},De=1,ye=2,Ne=c(0,0),Le=6,je=E(0,0,1);class Me extends V{constructor(){super(...arguments),this.renderOccluded=X.Occlude,this.isDecoration=!1,this.color=I(1,1,1,1),this.polygonOffset=!1,this.anchorPosition=c(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=I(1,1,1,1),this.outlineSize=0,this.distanceFieldBoundingBox=R(),this.rotation=0,this.hasRotation=!1,this.vvSizeEnabled=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.vvSymbolAnchor=null,this.vvSymbolRotationMatrix=null,this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.occlusionTest=!0,this.occludedFragmentFade=!1,this.horizonCullingEnabled=!1,this.centerOffsetUnits="world",this.drawAsLabel=!1,this.depthEnabled=!0,this.isFocused=!0,this.focusEffect="none",this.draped=!1,this.isLabel=!1}}const Ue=j().vec3f(k.POSITION).vec3f(k.NORMAL).vec2f(k.UV0).vec4u8(k.COLOR).vec2f(k.SIZE).f32(k.ROTATION).vec4f(k.CENTEROFFSETANDDISTANCE).vec4f(k.FEATUREATTRIBUTE),ze=Ue.clone().vec4u8(k.OBJECTANDLAYERIDCOLOR);class we{constructor(){this.vertexBufferLayout=w()?ze:Ue}elementCount(e){return e.get(k.POSITION).indices.length*Le}write(e,t,i,s,r,a){K(i.get(k.POSITION),e,r.position,a,Le),Q(i.get(k.NORMAL),t,r.normal,a,Le);const n=i.get(k.UV0)?.data;let o=0,l=0,c=1,f=1;n&&n.length>=4&&(o=n[0],l=n[1],c=n[2],f=n[3]),c=Math.min(1.99999,c+1),f=Math.min(1.99999,f+1);let u=i.get(k.POSITION).indices.length,p=a;const h=r.uv0;for(let O=0;O<u;++O)h.set(p,0,o),h.set(p,1,l),p++,h.set(p,0,c),h.set(p,1,l),p++,h.set(p,0,c),h.set(p,1,f),p++,h.set(p,0,c),h.set(p,1,f),p++,h.set(p,0,o),h.set(p,1,f),p++,h.set(p,0,o),h.set(p,1,l),p++;$(i.get(k.COLOR),4,r.color,a,Le);const{data:m,indices:d}=i.get(k.SIZE);u=d.length;const g=r.size;p=a;for(let O=0;O<u;++O){const e=m[2*d[O]],t=m[2*d[O]+1];for(let i=0;i<Le;++i)g.set(p,0,e),g.set(p,1,t),p++}if(ee(i.get(k.ROTATION),r.rotation,a,Le),i.get(k.CENTEROFFSETANDDISTANCE)?te(i.get(k.CENTEROFFSETANDDISTANCE),r.centerOffsetAndDistance,a,Le):ie(r.centerOffsetAndDistance,a,u*Le),i.get(k.FEATUREATTRIBUTE)?te(i.get(k.FEATUREATTRIBUTE),r.featureAttribute,a,Le):ie(r.featureAttribute,a,u*Le),null!=s){const e=i.get(k.POSITION)?.indices;if(e){const t=e.length,i=r.getField(k.OBJECTANDLAYERIDCOLOR,P);se(s,i,t,a,Le)}}return{numVerticesPerItem:Le,numItems:u}}intersect(e,t,i,s,a,n,o){const{options:{selectionMode:l,hud:c,excludeLabels:S},point:A,camera:E}=s;if(!l||!c||S&&t.isLabel||!A)return;const v=this.vertexBufferLayout.createView(e),R=v.getField(k.POSITION,_),I=v.getField(k.NORMAL,_),x=v.getField(k.ROTATION,C),F=v.getField(k.SIZE,D),P=v.getField(k.FEATUREATTRIBUTE,y),N=v.getField(k.CENTEROFFSETANDDISTANCE,y),L="screen"===t.centerOffsetUnits,j=ae(t);if(null==R||null==I||null==x||null==F||null==N)return;const M=null==P?null:P.getVec(0,_e),{scaleX:U,scaleY:z}=Be(M,t,E.pixelRatio),w=R.count/Le;for(let _=0;_<w;_++){const e=_*Le;if(R.getVec(e,ge),null!=i&&T(ge,ge,i),u(ge,ge,E.viewMatrix),N.getVec(e,xe),f(Fe,xe[0],xe[1],xe[2]),!L&&(ge[0]+=Fe[0],ge[1]+=Fe[1],0!==Fe[2])){const e=Fe[2];p(Fe,ge),h(ge,ge,m(Fe,Fe,e))}if(I.getVec(e,Oe),pe(Oe,ve,E,Ce),Ve(t,ge,Ce,E,de),E.applyProjection(ge,Te),Te[0]>-1){L&&(Fe[0]||Fe[1])&&(Te[0]+=Fe[0]*E.pixelRatio,0!==Fe[1]&&(Te[1]+=H(Fe[1],de.factorAlignment)*E.pixelRatio),E.unapplyProjection(Te,ge)),Te[0]+=t.screenOffset[0]*E.pixelRatio,Te[1]+=t.screenOffset[1]*E.pixelRatio,Te[0]=Math.floor(Te[0]),Te[1]=Math.floor(Te[1]),F.getVec(e,Ne),W(Ne,de.factor,Ne);const i=De*E.pixelRatio;let a=0;if(t.textureIsSignedDistanceField){a=Math.min(t.outlineSize,.5*Ne[0])*E.pixelRatio/2}Ne[0]*=U,Ne[1]*=z;const n=x.get(e),l=t.rotation+n;if(me(A,Te[0],Te[1],Ne,i,a,l,t,j)){const e=s.ray;if(u(Ae,ge,r(Ie,E.viewMatrix)),Te[0]=A[0],Te[1]=A[1],E.unprojectFromRenderScreen(Te,ge)){const t=b();d(t,e.direction);const i=1/g(t);m(t,t,i);o(O(e.origin,ge)*i,t,_,!0,1,Ae)}}}}}}function Be(e,t,i){return null==e||null==t.vvSize?{scaleX:i,scaleY:i}:(N(Pe,t,e),{scaleX:Pe[0]*i,scaleY:Pe[1]*i})}function Ve(e,t,i,s,r){if(!e.verticalOffset?.screenLength){if(e.screenSizePerspective||e.screenSizePerspectiveAlignment){qe(e,r,g(t),i.cosAngle)}else r.factor.scale=1,r.factorAlignment.scale=1;return t}const a=g(t),n=e.screenSizePerspectiveAlignment??e.screenSizePerspective,o=re(s,a,e.verticalOffset,i.cosAngle,n);return qe(e,r,a,i.cosAngle),m(i.normal,i.normal,o),T(t,t,i.normal)}function qe(e,t,i,s){null!=e.screenSizePerspective?Y(s,i,e.screenSizePerspective,t.factor):(t.factor.scale=1,t.factor.factor=0,t.factor.minScaleFactor=0),null!=e.screenSizePerspectiveAlignment?Y(s,i,e.screenSizePerspectiveAlignment,t.factorAlignment):(t.factorAlignment.factor=t.factor.factor,t.factorAlignment.scale=t.factor.scale,t.factorAlignment.minScaleFactor=t.factor.minScaleFactor)}export{ce as HUDMaterial,Me as Parameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{set as t,squaredDistance as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{newLayout as s}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as i}from"../core/shaderLibrary/ShaderOutput.js";import o from"../lib/GLMaterial.js";import{Material as a}from"../lib/Material.js";import{RenderSlot as n}from"../lib/RenderSlot.js";import{VertexAttribute as u}from"../lib/VertexAttribute.js";import{writePosition as l,writeBufferFloat as c}from"./internal/bufferWriterUtils.js";import{HeatmapDensityPassParameters as f,HeatmapDensityTechnique as m}from"../shaders/HeatmapDensityTechnique.js";import{HeatmapDensityTechniqueConfiguration as p}from"../shaders/HeatmapDensityTechniqueConfiguration.js";const h=2;class T extends f{constructor(){super(...arguments),this.isAttributeDriven=!1,this.usesHalfFloats=!1}}class g extends a{constructor(t){super(t,T),this.produces=new Map([[n.DRAPED_MATERIAL,t=>t===i.Color]]),this._configuration=new p}getConfiguration(){return this._configuration.isAttributeDriven=this.parameters.isAttributeDriven,this._configuration.usesHalfFloat=this.parameters.usesHalfFloats,this._configuration}get visible(){return!0}createGLMaterial(t){return new d(t)}intersect(){}intersectDraped(r,s,i,o,a,n){const l=r.attributes.get(u.POSITION),{parameters:c}=this,{searchRadius:f}=c,{screenToWorldRatio:m}=r,p=f*m+h*m,T=p*p,g=l.data.length/l.size;for(let u=0;u<g;u++){const r=u*l.size,s=t(j,l.data[r],l.data[r+1]);e(s,o)<T&&a(n.dist,n.normal,-1,!1)}}createBufferWriter(){return new b(this.parameters.isAttributeDriven?I:A)}}class d extends o{beginSlot(t){return this.getTechnique(m,t)}}class b{constructor(t){this.vertexBufferLayout=t}elementCount(t){return t.get(u.POSITION).indices.length*v}write(t,e,r,s,i,o){l(r.get(u.POSITION),t,i.position,o,v);const a=r.get(u.POSITION).indices.length,n=i.uv0;let f=o;for(let u=0;u<a;++u)n.setValues(f++,-1,-1),n.setValues(f++,1,-1),n.setValues(f++,1,1),n.setValues(f++,1,1),n.setValues(f++,-1,1),n.setValues(f++,-1,-1);const m=u.FEATUREATTRIBUTE in i?i.featureAttribute:null;m&&c(r.get(u.FEATUREATTRIBUTE),m,o,v)}}const A=s().vec3f(u.POSITION).vec2f(u.UV0),I=A.clone().f32(u.FEATUREATTRIBUTE),v=6,j=r();export{g as HeatmapDensityMaterial,T as Parameters};
5
+ import{set as t,squaredDistance as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{newLayout as s}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as i}from"../core/shaderLibrary/ShaderOutput.js";import o from"../lib/GLMaterial.js";import{Material as a}from"../lib/Material.js";import{RenderSlot as n}from"../lib/RenderSlot.js";import{VertexAttribute as u}from"../lib/VertexAttribute.js";import{writePosition as l,writeBufferFloat as c}from"./internal/bufferWriterUtils.js";import{HeatmapDensityPassParameters as f,HeatmapDensityTechnique as m}from"../shaders/HeatmapDensityTechnique.js";import{HeatmapDensityTechniqueConfiguration as p}from"../shaders/HeatmapDensityTechniqueConfiguration.js";const h=2;class T extends f{constructor(){super(...arguments),this.isAttributeDriven=!1,this.usesHalfFloats=!1}}class g extends a{constructor(t){super(t,T),this.produces=new Map([[n.DRAPED_MATERIAL,t=>t===i.Color]]),this._configuration=new p}getConfiguration(){return this._configuration.isAttributeDriven=this.parameters.isAttributeDriven,this._configuration.usesHalfFloat=this.parameters.usesHalfFloats,this._configuration}get visible(){return!0}createGLMaterial(t){return new d(t)}intersect(){}intersectDraped(r,s,i,o,a,n){const l=r.attributes.get(u.POSITION),{parameters:c}=this,{searchRadius:f}=c,{screenToWorldRatio:m}=r,p=f*m+h*m,T=p*p,g=l.data.length/l.size;for(let u=0;u<g;u++){const r=u*l.size,s=t(j,l.data[r],l.data[r+1]);e(s,o)<T&&a(n.dist,n.normal,-1,!1)}}createBufferWriter(){return new b(this.parameters.isAttributeDriven?I:A)}}class d extends o{beginSlot(t){return this.getTechnique(m,t)}}class b{constructor(t){this.vertexBufferLayout=t}elementCount(t){return t.get(u.POSITION).indices.length*v}write(t,e,r,s,i,o){l(r.get(u.POSITION),t,i.position,o,v);const a=r.get(u.POSITION).indices.length,n=i.uv0;let f=o;for(let u=0;u<a;++u)n.setValues(f++,-1,-1),n.setValues(f++,1,-1),n.setValues(f++,1,1),n.setValues(f++,1,1),n.setValues(f++,-1,1),n.setValues(f++,-1,-1);const m=u.FEATUREATTRIBUTE in i?i.featureAttribute:null;return m?(c(r.get(u.FEATUREATTRIBUTE),m,o,v),null):null}}const A=s().vec3f(u.POSITION).vec2f(u.UV0),I=A.clone().f32(u.FEATUREATTRIBUTE),v=6,j=r();export{g as HeatmapDensityMaterial,T as Parameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{BufferViewFloat as e}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOID as t,isColor as r}from"../core/shaderLibrary/ShaderOutput.js";import{CullFaceOptions as i}from"../lib/basicInterfaces.js";import{GLTextureMaterial as s}from"../lib/GLTextureMaterial.js";import{MaterialParameters as a}from"../lib/Material.js";import{OITPolygonOffsetLimit as o}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as n}from"../lib/RenderSlot.js";import{assert as u}from"../lib/Util.js";import{VertexAttribute as l}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as p}from"./DefaultBufferWriter.js";import{PositionUVLayout as c}from"./DefaultLayouts.js";import{TriangleMaterial as h}from"./TriangleMaterial.js";import{writeBufferFloat as f,writeDefaultAttribute as m}from"./internal/bufferWriterUtils.js";import{vertexAttributeLocations as T,ImageMaterialTechnique as g}from"../shaders/ImageMaterialTechnique.js";import{ImageMaterialTechniqueConfiguration as d}from"../shaders/ImageMaterialTechniqueConfiguration.js";class I extends h{constructor(e){super(e,b),this._configuration=new d,this.vertexAttributeLocations=T,this.supportsEdges=!0,this.produces=new Map([[n.OPAQUE_MATERIAL,e=>t(e)],[n.TRANSPARENT_MATERIAL,e=>r(e)&&this.parameters.writeDepth],[n.TRANSPARENT_MATERIAL_WITHOUT_DEPTH,e=>r(e)&&!this.parameters.writeDepth],[n.DRAPED_MATERIAL,e=>r(e)||t(e)]])}getConfiguration(e,t){return this._configuration.output=e,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=t.hasOccludees,this._configuration.oitPass=t.oitPass,this._configuration.enableOffset=t.camera.relativeElevation<o,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.perspectiveInterpolation=this.parameters.perspectiveInterpolation,this._configuration}get visible(){return!0}createGLMaterial(e){return new _(e)}createBufferWriter(){const e=c.clone();return this.parameters.perspectiveInterpolation&&e.f32(l.PERSPECTIVEDIVIDE),new E(e)}}class _ extends s{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.getTechnique(g,e)}}class E extends p{write(t,r,i,s,a,o){for(const n of this.vertexBufferLayout.fields.keys()){const s=i.get(n);if(s)if(n===l.PERSPECTIVEDIVIDE){u(1===s.size);const t=a.getField(n,e);t&&f(s,t,o)}else m(n,s,t,r,a,o)}}}class b extends a{constructor(){super(...arguments),this.writeDepth=!0,this.hasSlicePlane=!1,this.cullFace=i.None,this.opacity=1,this.textureId=null,this.initTextureTransparent=!0,this.perspectiveInterpolation=!1}}export{I as ImageMaterial,b as Parameters};
5
+ import{BufferViewFloat as e}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOID as t,isColor as r}from"../core/shaderLibrary/ShaderOutput.js";import{CullFaceOptions as i}from"../lib/basicInterfaces.js";import{GLTextureMaterial as s}from"../lib/GLTextureMaterial.js";import{MaterialParameters as a}from"../lib/Material.js";import{OITPolygonOffsetLimit as o}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as n}from"../lib/RenderSlot.js";import{assert as u}from"../lib/Util.js";import{VertexAttribute as l}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as c}from"./DefaultBufferWriter.js";import{PositionUVLayout as p}from"./DefaultLayouts.js";import{TriangleMaterial as h}from"./TriangleMaterial.js";import{writeBufferFloat as f,writeDefaultAttribute as m}from"./internal/bufferWriterUtils.js";import{vertexAttributeLocations as g,ImageMaterialTechnique as T}from"../shaders/ImageMaterialTechnique.js";import{ImageMaterialTechniqueConfiguration as d}from"../shaders/ImageMaterialTechniqueConfiguration.js";class I extends h{constructor(e){super(e,b),this._configuration=new d,this.vertexAttributeLocations=g,this.supportsEdges=!0,this.produces=new Map([[n.OPAQUE_MATERIAL,e=>t(e)],[n.TRANSPARENT_MATERIAL,e=>r(e)&&this.parameters.writeDepth],[n.TRANSPARENT_MATERIAL_WITHOUT_DEPTH,e=>r(e)&&!this.parameters.writeDepth],[n.DRAPED_MATERIAL,e=>r(e)||t(e)]])}getConfiguration(e,t){return this._configuration.output=e,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=t.hasOccludees,this._configuration.oitPass=t.oitPass,this._configuration.enableOffset=t.camera.relativeElevation<o,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.perspectiveInterpolation=this.parameters.perspectiveInterpolation,this._configuration}get visible(){return!0}createGLMaterial(e){return new _(e)}createBufferWriter(){const e=p.clone();return this.parameters.perspectiveInterpolation&&e.f32(l.PERSPECTIVEDIVIDE),new E(e)}}class _ extends s{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.getTechnique(T,e)}}class E extends c{write(t,r,i,s,a,o){for(const n of this.vertexBufferLayout.fields.keys()){const s=i.get(n);if(s)if(n===l.PERSPECTIVEDIVIDE){u(1===s.size);const t=a.getField(n,e);t&&f(s,t,o)}else m(n,s,t,r,a,o)}return null}}class b extends a{constructor(e){super(),this.textureId=e,this.writeDepth=!0,this.hasSlicePlane=!1,this.cullFace=i.None,this.opacity=1,this.perspectiveInterpolation=!1}}export{I as ImageMaterial,b as Parameters};