@arcgis/core 4.28.0-next.20230920 → 4.28.0-next.20230921

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 (146) hide show
  1. package/WebScene.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/1cbaba30f55f00f7498b.js +1 -0
  4. package/assets/esri/core/workers/chunks/21a9c8aa2a9e9990df41.js +1 -0
  5. package/assets/esri/core/workers/chunks/24629402c647ef6b5f6b.js +1 -0
  6. package/assets/esri/core/workers/chunks/{b428fcb53ecc82b49e66.js → 332689bf60d246485993.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{b558a402e2ce2616cf37.js → 3ca759f72d3bb29e9ea9.js} +22 -22
  8. package/assets/esri/core/workers/chunks/4339ce8aaf87fabb80cc.js +1 -0
  9. package/assets/esri/core/workers/chunks/4369a6c1e0a82ab4db6a.js +1 -0
  10. package/assets/esri/core/workers/chunks/43ba2bacd0f7d19915f7.js +1 -0
  11. package/assets/esri/core/workers/chunks/44b8e75593b7df1843e1.js +1 -0
  12. package/assets/esri/core/workers/chunks/53097659f31750c03a6d.js +1 -0
  13. package/assets/esri/core/workers/chunks/{7c72d5368bb2d7484b9b.js → 580039dd491854ca325c.js} +1 -1
  14. package/assets/esri/core/workers/chunks/59c00d6fba0fd1c03d01.js +1 -0
  15. package/assets/esri/core/workers/chunks/5edb99b58549cd66b394.js +1 -0
  16. package/assets/esri/core/workers/chunks/6203ddf6caad3d356327.js +1 -0
  17. package/assets/esri/core/workers/chunks/652749dc847fcb887234.js +1 -0
  18. package/assets/esri/core/workers/chunks/74d3ecb1a06d9f81e2c5.js +1 -0
  19. package/assets/esri/core/workers/chunks/7ea33aa455c5143affb1.js +1 -0
  20. package/assets/esri/core/workers/chunks/90771b0de3e520a1df9a.js +1 -0
  21. package/assets/esri/core/workers/chunks/a277c980ba8704939688.js +1 -0
  22. package/assets/esri/core/workers/chunks/bbc0dcd316c5598bc9ad.js +1 -0
  23. package/assets/esri/core/workers/chunks/bc1dc6383e60e7e61d50.js +1 -0
  24. package/assets/esri/core/workers/chunks/c4bb67150ccd01ea6014.js +1 -0
  25. package/assets/esri/core/workers/chunks/{aa021bc97b4a18a749dd.js → cad260881653567bc8f9.js} +1 -1
  26. package/assets/esri/core/workers/chunks/cec607d0138351a4952e.js +1 -0
  27. package/assets/esri/core/workers/chunks/{f147269d85adfb4588ed.js → d9061beaa43065316062.js} +1 -1
  28. package/assets/esri/core/workers/chunks/e55f7fc7eff0074ce0fc.js +1 -0
  29. package/assets/esri/core/workers/chunks/{9c40e7ed387071544f8c.js → ed1fbc1bc8d50453e2f5.js} +1 -1
  30. package/assets/esri/core/workers/chunks/eef27d305023034084a4.js +1 -0
  31. package/assets/esri/images/portal/onlinemedialayer16.png +0 -0
  32. package/chunks/LaserlinePath.glsl.js +5 -1
  33. package/core/sql.js +1 -1
  34. package/interfaces.d.ts +1 -17
  35. package/layers/graphics/sources/WFSSourceWorker.js +1 -1
  36. package/layers/mixins/SceneService.js +1 -1
  37. package/layers/save/utils.js +1 -1
  38. package/layers/support/editableLayers.js +1 -1
  39. package/package.json +1 -1
  40. package/portal/PortalItem.js +1 -1
  41. package/rest/geometryService/cut.js +1 -1
  42. package/rest/query/operations/query.js +1 -1
  43. package/rest/versionManagement/deleteVersion.js +1 -1
  44. package/rest/versionManagement/gdbVersion/alterVersion.js +1 -1
  45. package/rest/versionManagement/gdbVersion/post.js +1 -1
  46. package/rest/versionManagement/gdbVersion/reconcile.js +1 -1
  47. package/rest/versionManagement/gdbVersion/serverVersionUtils.js +5 -0
  48. package/support/revision.js +1 -1
  49. package/views/2d/engine/Stage.js +1 -1
  50. package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
  51. package/views/3d/analysis/Dimension/lengthDimensionConstraintUtils.js +1 -1
  52. package/views/3d/analysis/Slice/RotateManipulator.js +1 -1
  53. package/views/3d/environment/LocalAtmosphere.js +1 -1
  54. package/views/3d/interactive/manipulatorUtils.js +1 -1
  55. package/views/3d/interactive/visualElements/MeasurementAreaVisualElement.js +1 -1
  56. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  57. package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
  58. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  59. package/views/3d/layers/MediaLayerView3D.js +1 -1
  60. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  61. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  62. package/views/3d/layers/graphics/ElevationAligners.js +1 -1
  63. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  64. package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
  65. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  66. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  67. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  68. package/views/3d/layers/graphics/polygonUtils.js +1 -1
  69. package/views/3d/layers/graphics/wosrLoader.js +1 -1
  70. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  71. package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
  72. package/views/3d/layers/support/overlayImageUtils.js +1 -1
  73. package/views/3d/layers/support/patternUtils.js +1 -1
  74. package/views/3d/support/dito.js +1 -1
  75. package/views/3d/support/engineContent/line.js +1 -1
  76. package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
  77. package/views/3d/support/pointsOfInterest/Focus.js +1 -1
  78. package/views/3d/terrain/TerrainRenderer.js +1 -1
  79. package/views/3d/webgl-engine/collections/Component/ComponentIntersectionData.js +1 -1
  80. package/views/3d/webgl-engine/collections/Component/IntersectionGeometry.js +1 -1
  81. package/views/3d/webgl-engine/core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js +6 -6
  82. package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
  83. package/views/3d/webgl-engine/lib/Attribute.js +1 -1
  84. package/views/3d/webgl-engine/lib/BoundingInfo.js +1 -1
  85. package/views/3d/webgl-engine/lib/Camera.js +1 -1
  86. package/views/3d/webgl-engine/lib/Geometry.js +1 -1
  87. package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
  88. package/views/3d/webgl-engine/lib/GridLocalOriginFactory.js +1 -1
  89. package/views/3d/webgl-engine/lib/PathGeometryData.js +1 -1
  90. package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
  91. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  92. package/views/3d/webgl-engine/lib/geometryDataUtils.js +1 -1
  93. package/views/3d/webgl-engine/lib/lodRendering/LodResources.js +1 -1
  94. package/views/3d/webgl-engine/materials/DefaultBufferWriter.js +1 -1
  95. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  96. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  97. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  98. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  99. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  100. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  101. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  102. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  103. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  104. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  105. package/views/3d/webgl-engine/materials/internal/MaterialUtil.js +1 -1
  106. package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
  107. package/views/draw/DrawGraphicTool.js +1 -1
  108. package/views/interactive/keybindings.js +1 -1
  109. package/views/interactive/tooltip/SketchTooltipInfo.js +1 -1
  110. package/views/interactive/tooltip/TooltipEditableField.js +1 -1
  111. package/views/interactive/tooltip/content/Fields.js +5 -0
  112. package/views/interactive/tooltip/content/TooltipContentDrawPoint.js +1 -1
  113. package/views/interactive/tooltip/content/TooltipContentDrawPolygon.js +1 -1
  114. package/views/interactive/tooltip/content/TooltipContentDrawPolyline.js +1 -1
  115. package/webdoc/saveAPIKeyUtils.js +5 -0
  116. package/webdoc/webdocSaveUtils.js +1 -1
  117. package/widgets/BasemapGallery.js +1 -1
  118. package/widgets/BasemapLayerList.js +1 -1
  119. package/widgets/Expand.js +1 -1
  120. package/widgets/Feature/FeatureRelationship.js +1 -1
  121. package/widgets/Fullscreen.js +1 -1
  122. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  123. package/widgets/Swipe.js +1 -1
  124. package/widgets/support/globalCss.js +1 -1
  125. package/assets/esri/core/workers/chunks/034accc7cab6c88a3b31.js +0 -1
  126. package/assets/esri/core/workers/chunks/084a85e2e31b4d5fa924.js +0 -1
  127. package/assets/esri/core/workers/chunks/1a449168d30a688e6128.js +0 -1
  128. package/assets/esri/core/workers/chunks/21f0fafafcd754f5fb88.js +0 -1
  129. package/assets/esri/core/workers/chunks/273167b2dd46e58b8739.js +0 -1
  130. package/assets/esri/core/workers/chunks/2bf58296a6ea4eee960b.js +0 -1
  131. package/assets/esri/core/workers/chunks/3c2c64832fb498bbaa83.js +0 -1
  132. package/assets/esri/core/workers/chunks/4b3a5cc435435c81e6a5.js +0 -1
  133. package/assets/esri/core/workers/chunks/56afd89d08c874f620a1.js +0 -1
  134. package/assets/esri/core/workers/chunks/6108d72faf48a592c8ba.js +0 -1
  135. package/assets/esri/core/workers/chunks/74ddc14e4b576ddbb582.js +0 -1
  136. package/assets/esri/core/workers/chunks/7f680cf24dd97d61bcd2.js +0 -1
  137. package/assets/esri/core/workers/chunks/9b54b5bdb6367c36f6e9.js +0 -1
  138. package/assets/esri/core/workers/chunks/a838dc6653ec29503053.js +0 -1
  139. package/assets/esri/core/workers/chunks/b10a91cae610aba62bf8.js +0 -1
  140. package/assets/esri/core/workers/chunks/b8eb842ea98a9734e161.js +0 -1
  141. package/assets/esri/core/workers/chunks/bbb63392485ed57703e0.js +0 -1
  142. package/assets/esri/core/workers/chunks/bdf13091bd0e1ab0db7e.js +0 -1
  143. package/assets/esri/core/workers/chunks/c88869d2a647c22dc3e6.js +0 -1
  144. package/assets/esri/core/workers/chunks/e54ae2a4281dd58e0707.js +0 -1
  145. package/assets/esri/core/workers/chunks/e5fcfd41f0ec12dcb7f2.js +0 -1
  146. package/assets/esri/core/workers/chunks/f07a0ea10428adecea1a.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.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../core/Accessor.js";import{equals as r,binaryIndexOf as s}from"../../../../../core/arrayUtils.js";import n from"../../../../../core/Logger.js";import{clamp as o}from"../../../../../core/mathUtils.js";import{disposeMaybe as i,destroyMaybe as a}from"../../../../../core/maybe.js";import{property as c}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/has.js";import{subclass as l}from"../../../../../core/accessorSupport/decorators/subclass.js";import{f as d,t as u,d as h}from"../../../../../chunks/mat3.js";import{a as m}from"../../../../../chunks/mat3f64.js";import{a as g}from"../../../../../chunks/mat4f64.js";import{s as p,c as f,u as _,j as b}from"../../../../../chunks/vec3.js";import{c as y}from"../../../../../chunks/vec3f64.js";import{UpdatingHandles as O}from"../../../../../core/support/UpdatingHandles.js";import{g as j,a as w}from"../../../../../chunks/sphere.js";import{c as E}from"../../../../../chunks/vec33.js";import{ViewingMode as v}from"../../../../ViewingMode.js";import{encodeElevationOffset as R}from"../../collections/Component/Material/shader/ComponentData.glsl.js";import{TwoVectorPosition as x}from"../../core/util/TwoVectorPosition.js";import{GridLocalOriginFactory as T}from"../GridLocalOriginFactory.js";import{applyToModelMatrix as C}from"../localOriginHelper.js";import{LocalOriginManager as M}from"../LocalOriginManager.js";import{Object3D as P}from"../Object3D.js";import{VertexArrayObject as S}from"../VertexArrayObject.js";import{VertexAttribute as D}from"../VertexAttribute.js";import{VertexLayout as A,EdgeInputBufferLayout as U,EdgeShaderAttributeLocations as B,glVertexLayout as k}from"./bufferLayouts.js";import{RegularEdgeBufferWriter as I,SilhouetteEdgeBufferWriter as L}from"./edgeBufferWriters.js";import{EdgeType as H}from"./edgePreprocessing.js";import{EdgeRenderer as V,lineWidthFractionFactor as N,extensionLengthOffset as G}from"./EdgeRenderer.js";import{EdgePassParameters as q}from"./EdgeShaderParameters.js";import{EdgeWorkerHandle as z}from"./EdgeWorkerHandle.js";import{Transparency as W}from"./interfaces.js";import{generateStrokesTexture as K}from"./strokes.js";import{determineRendererType as F,determineEdgeTransparency as Q,determineObjectTransparency as J,fillComponenBufferIndices as X}from"./util.js";import{BufferManager as Y}from"../TextureBackedBuffer/BufferManager.js";import{EdgeSilhouette as Z}from"../../shaders/sources/edgeRenderer/EdgeUtil.glsl.js";import{BufferObject as $}from"../../../../webgl/BufferObject.js";import{Usage as ee}from"../../../../webgl/enums.js";let te=class extends t{constructor(e){super(e),this._updatingHandles=new O,this._perObjectData=new Map,this._perObjectDataEvictionCache=new Set,this._renderers=new Map,this._gpuMemoryUsage=0,this._workerAbort=new AbortController,this._tmpModelPosition=y(),this._localOrigins=new M(new T(e.renderSR))}initialize(){this._worker=new z(this.schedule),this._componentColorManager=new Y(this.rctx,3);const e=A.createBuffer(4);for(let t=0;t<4;t++)e.sideness.set(t,0,0===t||3===t?0:1),e.sideness.set(t,1,0===t||1===t?0:1);this._verticesBufferObject=$.createVertex(this.rctx,ee.STATIC_DRAW,e.buffer)}destroy(){this.destroyed||(this._perObjectData.forEach((e=>this._discardObjectEntry(e))),this._perObjectData.clear(),this._strokesTexture=i(this._strokesTexture),this._componentColorManager=a(this._componentColorManager),this._workerAbort.abort(),this._worker.destroy(),this._verticesBufferObject=i(this._verticesBufferObject),this._renderers.clear(),this._updatingHandles.destroy(),this._set("schedule",fe))}get updating(){return this._updatingHandles.updating}get usedMemory(){return this._gpuMemoryUsage}shouldRender(){return this._renderers.size>0}async addComponentObject(e,t,r,s,n,o,i,a){if(this.hasObject(e))return this.getObjectMemoryUsage(e);let c;const l=new ne(new Promise((e=>c=e)),r.center,r.radius);this._perObjectData.set(e,l);const d=await this._updatingHandles.addPromise(this._addComponentGeometry(t,l,s,n,o,i,a));return this.setNeedsRender(),c(),d}async addOrUpdateObject3D(e,t,r,s){if(this.destroyed)return void n.getLogger(this).warn("Attempt to add an object to a destroyed instance");const o=this._perObjectData.get(e);let i;o?.renderables.length>0&&this._perObjectDataEvictionCache.add(o);const a=e.boundingVolumeWorldSpace.bounds,c=new ne(new Promise((e=>i=e)),j(a),w(a));this._perObjectData.set(e,c);const l=new Array;if(r.mergeGeometries&&e.geometries.length>1&&se(e))l.push(this._addObjectMergedGeometries(e,c,t,r,s));else for(let n=0;n<e.geometries.length;n++){const o=e.geometries[n];o.material.supportsEdges&&l.push(this._addGeometry(e,c,o,t[0],r,s))}await this._updatingHandles.addPromise(Promise.all(l)),this._perObjectDataEvictionCache.delete(c),this._discardObjectEntry(o),this.setNeedsRender(),i()}_discardObjectEntry(e){e&&(e.renderables.length&&(e.renderables.forEach((e=>this._removeRenderable(e))),this.setNeedsRender()),e.loaded=null)}hasObject(e){return this._perObjectData.has(e)}async updateAllComponentOpacities(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));if(null==r)return;const s=t instanceof Array?e=>t[e]:()=>t;r.renderables.forEach((e=>{const t=e.components.meta.length;for(let r=0;r<t;r++){const t=s(r),n=e.components.meta[r],o=n.index;n.material.opacity=t,e.components.buffer.textureBuffer.setDataElement(o,1,3,255*t)}this._updateTransparency(e)})),this.setNeedsRender()}async getObjectMemoryUsage(e){const t=await this._getObjectEntry(e);return null!=t?t.renderables.reduce(((e,t)=>e+t.statistics.gpuMemoryUsage),0):0}async updateAllComponentMaterials(e,t,r,s){const n=e instanceof P,o=!!r.hasSlicePlane,i=F(t),a=V.getKey(i,o,n),c=await this._updatingHandles.addPromise(this._getObjectEntry(e));null!=c&&(c.renderables.forEach((e=>{if(a!==e.rendererKey){const t=this._renderers.get(e.rendererKey),r=this._acquireRenderer(i,o,n);t.removeRenderable(e),--t.refCount,e.rendererKey=a,r.addRenderable(e)}for(let r=0;r<t.length;r++)e.components.meta[r].material=t[r];s&&this._updateComponentBuffer(e.components),this._updateTransparency(e)})),this.setNeedsRender())}async updateAllVerticalOffsets(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));null!=r&&(r.renderables.forEach((e=>{const r=e.components.meta;for(let s=0;s<r.length;s++)e.components.meta[s].verticalOffset=t?.[s]??0;this._updateComponentBuffer(e.components)})),this.setNeedsRender())}async updateObjectVisibility(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));null!=r&&(r.renderables.forEach((e=>e.visible=t)),this.setNeedsRender())}removeObject(e){const t=this._perObjectData.get(e);t&&(this._perObjectData.delete(e),this._discardObjectEntry(t))}async _getObjectEntry(e){const t=this._perObjectData.get(e);if(!t)throw new Error("no object");return await t.loaded,null==t.loaded?null:t}render(e,t){if(null==this._componentColorManager)return;this._localOrigins.updateViewMatrices(e.camera.viewMatrix);const r=e.camera.viewInverseTransposeMatrix,s=y(),n=new x;let o=0,i=0;if(this._renderers.forEach((r=>{if(0===r.refCount)this._renderers.delete(r.key),r.dispose();else{let s=!0,n=!0;r.forEachRenderable((t=>{t.visible&&(o+=t.statistics.averageEdgeLength,i++,s&&t.regular&&(r.updateTechnique(e,!1),s=!1),n&&t.silhouette&&(r.updateTechnique(e,!0),n=!1))}),t)}})),this._componentColorManager.garbageCollect(),this._componentColorManager.updateTextures(),0===i)return;const a=new q(40*o/i,t);p(s,r[3],r[7],r[11]),n.set(s),f(a.transformWorldFromViewTH,n.high),f(a.transformWorldFromViewTL,n.low),d(a.transformViewFromCameraRelativeRS,e.camera.viewMatrix),u(pe,a.transformViewFromCameraRelativeRS),h(a.transformNormalViewFromGlobal,pe),a.transformProjFromView=e.camera.projectionMatrix,this._updateObjectCameraDistances(e),this._renderers.forEach((t=>{this._renderRegularEdges(t,e,a),this._renderSilhouetteEdges(t,e,a)}))}_updateTransparency(e){const t=Q(e.components.meta),r=J(e.components.meta);t===e.edgeTransparency&&r===e.objectTransparency||(e.edgeTransparency=t,e.objectTransparency=r,this._renderers.get(e.rendererKey).setRenderablesDirty())}_computeModelTransformWithLocalOrigin(e,t,r){e.getCombinedShaderTransformation(t,r);const s=null!=t.localOrigin?this._localOrigins.register(t.localOrigin):this._localOrigins.acquire(p(this._tmpModelPosition,r[12],r[13],r[14]));return t.localOrigin=s.origin,C(s.origin.vec3,r),s}_updateComponentBuffer(e){const{meta:t,buffer:r}=e,s=new Uint8Array(4);for(let n=0;n<t.length;n++){const e=t[n].material,i=t[n].index,a=o(Math.round(e.size*N),0,255),c=o(e.extensionLength,-G,255-G)+G,l="solid"===e.type?H.SOLID:H.SKETCH,d=255*e.opacity,u=e.color,h=255*u[0],m=255*u[1],g=255*u[2],p=255*u[3];r.textureBuffer.setData(i,0,h,m,g,p),r.textureBuffer.setData(i,1,a,c,l,d),R(t[n].verticalOffset,s),r.textureBuffer.setData(i,2,s[0],s[1],s[2],s[3])}}_createComponentBuffers(e){if(null==this._componentColorManager)return null;const t=new Array,r=this._componentColorManager.getBuffer(e.length);for(let n=0;n<e.length;n++){const s=e[n],o=r.acquireIndex();t.push({index:o,verticalOffset:0,material:s})}const s=new oe(r,t);return this._updateComponentBuffer(s),s}_extractEdges(e,t,r,s,n,o=n.length){return this._worker.process({data:t,indices:n,indicesLength:o,writerSettings:e,skipDeduplicate:r},this._workerAbort.signal,s)}_createRenderable(e,t,r,s,n){const o=t=>null!=this._verticesBufferObject?new ie(new S(this.rctx,B,{vertices:k,instances:t===Z.REGULAR?I.glLayout:L.glLayout},{vertices:this._verticesBufferObject,instances:$.createVertex(this.rctx,ee.STATIC_DRAW,t===Z.REGULAR?e.regular.instancesData.buffer:e.silhouette.instancesData.buffer)}),t===Z.REGULAR?e.regular.lodInfo:e.silhouette.lodInfo):null,i=e.regular.lodInfo.lengths.length>0?o(Z.REGULAR):null,a=e.silhouette.lodInfo.lengths.length>0?o(Z.SILHOUETTE):null,c=(i?.vao.memoryUsage??0)+(a?.vao.memoryUsage??0);return new ce(i,a,{gpuMemoryUsage:c,externalMemoryUsage:n,averageEdgeLength:e.averageEdgeLength},r,Q(t.meta),J(t.meta),t,s)}async _addGeometry(e,t,r,s,n,o){const i=r.vertexAttributes.get(D.POSITION),a=r.indices.get(D.POSITION),c=g(),l=this._computeModelTransformWithLocalOrigin(e,r,c),d=new ge(i,a,c,l);return this._addPositionData(t,d,r.edgeIndicesLength,s,n,o)}async _addPositionData(e,t,r,s,n,o=!1){if(null==e.loaded)return;const i=this._createComponentBuffers([s]);if(null==i||r<=0)return;const a=this._acquireRenderer(s.type,!!n.hasSlicePlane,!0),{modelTransform:c,origin:l}=t,d=t.indices,u=t.position,h=u.data.length/u.size,m=U.createBuffer(h);for(let f=0;f<h;f++)m.position.set(f,0,u.data[f*u.size]),m.position.set(f,1,u.data[f*u.size+1]),m.position.set(f,2,u.data[f*u.size+2]);X(i.meta,[0,m.componentIndex.count],m.componentIndex);const g=await this._updatingHandles.addPromise(this._extractEdges(a.writerSettings,m,!1,o,d,r));if(null==e.loaded)return;const p=this._createRenderable(g,i,new ae(c,l),a.key,!1);e.renderables.push(p),a.addRenderable(p),this._gpuMemoryUsage+=p.statistics.gpuMemoryUsage}async _addComponentGeometry(e,t,r,s,n,o,i){if(null==t.loaded)return 0;const a=this._createComponentBuffers(o);if(null==a)return 0;const c=F(o),l=this._acquireRenderer(c,i.hasSlicePlane||!1,!1),d=U.createBuffer(r.length/3);E(d.position.typedBuffer,r,d.position.typedBufferStride,3),X(a.meta,n,d.componentIndex,s);const u=!0,h=l.writerSettings,m=await this._updatingHandles.addPromise(this._extractEdges(h,d,u,!1,s));if(null==t.loaded)return 0;const g=this._createRenderable(m,a,e,l.key,!0);return t.renderables.push(g),l.addRenderable(g),g.statistics.gpuMemoryUsage}async _addObjectMergedGeometries(e,t,r,s,n){const o=new Map;let i=0,a=null,c=0;for(let g=0;g<e.geometries.length;g++){const t=e.geometries[g];if(!t.material.supportsEdges)continue;!a&&t.localOrigin&&(a=t);const r=t.vertexAttributes.get(D.POSITION);c+=r.data.length/r.size,i+=t.edgeIndicesLength}const l=c>=65536?Uint32Array:Uint16Array,d=i?new l(i):null,u=[];let h=0;for(let g=0;g<e.geometries.length;g++){const t=e.geometries[g];if(!t.material.supportsEdges)continue;const r=t.vertexAttributes.get(D.POSITION),s=t.indices.get(D.POSITION);let n=o.get(r.data);if(null==n){n=u.length/3;for(let e=0;e<r.data.length;e+=r.size)u.push(r.data[e]),u.push(r.data[e+1]),u.push(r.data[e+2]);o.set(r.data,n)}if(s)for(let e=0;e<t.edgeIndicesLength;e++)d[h++]=n+s[e]}const m=a||e.geometries[0],p=g(),f=this._computeModelTransformWithLocalOrigin(e,m,p);for(let g=0;g<e.geometries.length;g++)e.geometries[g].localOrigin=f.origin;const _=new ge({data:u,size:3},d,p,f);await this._updatingHandles.addPromise(this._addPositionData(t,_,d.length,r[0],s,n))}_acquireRenderer(e,t,r){const s=V.getKey(e,t,r);let n=this._renderers.get(s);return null==this._strokesTexture&&(this._strokesTexture=K(this.rctx)),n||(n=new V(this.rctx,this.techniqueRepository,{type:e,hasSlicePlane:t,strokesTexture:this._strokesTexture,legacy:r,spherical:this.viewingMode===v.Global}),this._renderers.set(s,n)),++n.refCount,n}_removeRenderable(e){re(e.regular),re(e.silhouette);const t=this._renderers.get(e.rendererKey);if(t){t.removeRenderable(e),--t.refCount,"origin"in e.transform&&this._localOrigins.release(e.transform.origin),this._gpuMemoryUsage-=e.statistics.externalMemoryUsage?0:e.statistics.gpuMemoryUsage;for(const t of e.components.meta)e.components.buffer.releaseIndex(t.index)}}_updateObjectCameraDistances(e){const t=e.camera.eye,r=e.camera.viewForward,s=y(),n=e=>{_(s,e.center,t);const n=b(s,r),o=e.radius,i=n<-o?1/0:n<o?0:n-o;e.renderables.forEach((e=>e.distanceToCamera=i))};this._perObjectData.forEach(n),this._perObjectDataEvictionCache.forEach(n)}_renderRegularEdges(e,t,r){const s=e.bindRegularEdges(r,t),n=r.transparency,o=t.camera.perScreenPixelRatio;e.forEachRenderable((n=>{if(!de(n)||!n.visible)return;const i=me(n.regular.lod.lengths,n.distanceToCamera,o);e.renderRegularEdges(s,n,r,t,i)}),n)}_renderSilhouetteEdges(e,t,r){const s=e.bindSilhouetteEdges(r,t),n=r.transparency,o=t.camera.perScreenPixelRatio;e.forEachRenderable((n=>{if(!he(n)||!n.visible)return;const i=me(n.silhouette.lod.lengths,n.distanceToCamera,o);e.renderSilhouetteEdges(s,n,r,t,i)}),n)}get test(){return{hasRenderedPrimitives:e=>{let t=!1;const r=e.perScreenPixelRatio,s=(e,s)=>e.forEachRenderable((e=>{e.visible&&!t&&(de(e)&&(t=me(e.regular.lod.lengths,e.distanceToCamera,r)>0),!t&&he(e)&&(t=me(e.silhouette.lod.lengths,e.distanceToCamera,r)>0))}),s);return this._renderers.forEach((e=>{t||(s(e,W.OPAQUE),s(e,W.TRANSPARENT))})),t}}}};function re(e){null!=e&&(e.vao.vertexBuffers.instances.dispose(),e.vao.disposeVAOOnly(),e.vao=null)}function se(e){let t=null,s=null;for(let n=0;n<e.geometries.length;n++){const o=e.geometries[n];if(o.material.supportsEdges){if(t){if(!r(t,o.transformation))return!1}else t=o.transformation;if(s||null==o.localOrigin){if(s&&null!=s.localOrigin&&null!=o.localOrigin&&s.localOrigin.id!==o.localOrigin.id)return!1}else s=o}}return!0}e([c({constructOnly:!0})],te.prototype,"rctx",void 0),e([c({constructOnly:!0})],te.prototype,"renderSR",void 0),e([c({constructOnly:!0})],te.prototype,"viewingMode",void 0),e([c({constructOnly:!0})],te.prototype,"techniqueRepository",void 0),e([c({constructOnly:!0})],te.prototype,"setNeedsRender",void 0),e([c({constructOnly:!0})],te.prototype,"schedule",void 0),e([c({readOnly:!0})],te.prototype,"_updatingHandles",void 0),e([c({readOnly:!0})],te.prototype,"updating",null),te=e([l("esri.views.3d.webgl-engine.lib.edgeRendering.EdgeView")],te);class ne{constructor(e,t,r){this.center=t,this.radius=r,this.renderables=new Array,this.loaded=e,this.loaded.then((()=>{null!=this.loaded&&(this.loaded=!0)}))}}class oe{constructor(e,t){this.buffer=e,this.meta=t}}class ie{constructor(e,t){this.vao=e,this.lod=t}}class ae{constructor(e,t){this.modelMatrix=e,this.origin=t}}class ce{constructor(e,t,r,s,n,o,i,a){this.regular=e,this.silhouette=t,this.statistics=r,this.transform=s,this.edgeTransparency=n,this.objectTransparency=o,this.components=i,this.rendererKey=a,this.distanceToCamera=0,this.visible=!0}}class le extends ce{}function de(e){return null!=e.regular}class ue extends ce{}function he(e){return null!=e.silhouette}function me(e,t,r){const n=t*r,o=s(e,n,!0);return-1===o?n<e[0]?e.length:0:e.length-o}class ge{constructor(e,t,r,s){this.position=e,this.indices=t,this.modelTransform=r,this.origin=s}}const pe=m(),fe=()=>Promise.reject();export{te as EdgeView,ae as LegacyTransform,le as RegularRenderable,ce as Renderable,ue as SilhouetteRenderable};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../core/Accessor.js";import{equals as r,binaryIndexOf as s}from"../../../../../core/arrayUtils.js";import n from"../../../../../core/Logger.js";import{clamp as o}from"../../../../../core/mathUtils.js";import{disposeMaybe as i,destroyMaybe as a}from"../../../../../core/maybe.js";import{property as c}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/has.js";import{subclass as l}from"../../../../../core/accessorSupport/decorators/subclass.js";import{f as d,t as u,d as h}from"../../../../../chunks/mat3.js";import{a as m}from"../../../../../chunks/mat3f64.js";import{a as g}from"../../../../../chunks/mat4f64.js";import{s as p,c as f,u as _,j as b}from"../../../../../chunks/vec3.js";import{c as y}from"../../../../../chunks/vec3f64.js";import{UpdatingHandles as j}from"../../../../../core/support/UpdatingHandles.js";import{g as O,a as w}from"../../../../../chunks/sphere.js";import{c as E}from"../../../../../chunks/vec33.js";import{ViewingMode as R}from"../../../../ViewingMode.js";import{encodeElevationOffset as v}from"../../collections/Component/Material/shader/ComponentData.glsl.js";import{TwoVectorPosition as x}from"../../core/util/TwoVectorPosition.js";import{GridLocalOriginFactory as T}from"../GridLocalOriginFactory.js";import{applyToModelMatrix as C}from"../localOriginHelper.js";import{LocalOriginManager as M}from"../LocalOriginManager.js";import{Object3D as P}from"../Object3D.js";import{VertexArrayObject as S}from"../VertexArrayObject.js";import{VertexAttribute as D}from"../VertexAttribute.js";import{VertexLayout as A,EdgeInputBufferLayout as U,EdgeShaderAttributeLocations as B,glVertexLayout as k}from"./bufferLayouts.js";import{RegularEdgeBufferWriter as L,SilhouetteEdgeBufferWriter as I}from"./edgeBufferWriters.js";import{EdgeType as H}from"./edgePreprocessing.js";import{EdgeRenderer as V,lineWidthFractionFactor as G,extensionLengthOffset as N}from"./EdgeRenderer.js";import{EdgePassParameters as q}from"./EdgeShaderParameters.js";import{EdgeWorkerHandle as z}from"./EdgeWorkerHandle.js";import{Transparency as W}from"./interfaces.js";import{generateStrokesTexture as K}from"./strokes.js";import{determineRendererType as F,determineEdgeTransparency as Q,determineObjectTransparency as J,fillComponenBufferIndices as X}from"./util.js";import{BufferManager as Y}from"../TextureBackedBuffer/BufferManager.js";import{EdgeSilhouette as Z}from"../../shaders/sources/edgeRenderer/EdgeUtil.glsl.js";import{BufferObject as $}from"../../../../webgl/BufferObject.js";import{Usage as ee}from"../../../../webgl/enums.js";let te=class extends t{constructor(e){super(e),this._updatingHandles=new j,this._perObjectData=new Map,this._perObjectDataEvictionCache=new Set,this._renderers=new Map,this._gpuMemoryUsage=0,this._workerAbort=new AbortController,this._tmpModelPosition=y(),this._localOrigins=new M(new T(e.renderSR))}initialize(){this._worker=new z(this.schedule),this._componentColorManager=new Y(this.rctx,3);const e=A.createBuffer(4);for(let t=0;t<4;t++)e.sideness.set(t,0,0===t||3===t?0:1),e.sideness.set(t,1,0===t||1===t?0:1);this._verticesBufferObject=$.createVertex(this.rctx,ee.STATIC_DRAW,e.buffer)}destroy(){this.destroyed||(this._perObjectData.forEach((e=>this._discardObjectEntry(e))),this._perObjectData.clear(),this._strokesTexture=i(this._strokesTexture),this._componentColorManager=a(this._componentColorManager),this._workerAbort.abort(),this._worker.destroy(),this._verticesBufferObject=i(this._verticesBufferObject),this._renderers.clear(),this._updatingHandles.destroy(),this._set("schedule",fe))}get updating(){return this._updatingHandles.updating}get usedMemory(){return this._gpuMemoryUsage}shouldRender(){return this._renderers.size>0}async addComponentObject(e,t,r,s,n,o,i,a){if(this.hasObject(e))return this.getObjectMemoryUsage(e);let c;const l=new ne(new Promise((e=>c=e)),r.center,r.radius);this._perObjectData.set(e,l);const d=await this._updatingHandles.addPromise(this._addComponentGeometry(t,l,s,n,o,i,a));return this.setNeedsRender(),c(),d}async addOrUpdateObject3D(e,t,r,s){if(this.destroyed)return void n.getLogger(this).warn("Attempt to add an object to a destroyed instance");const o=this._perObjectData.get(e);let i;o?.renderables.length>0&&this._perObjectDataEvictionCache.add(o);const a=e.boundingVolumeWorldSpace.bounds,c=new ne(new Promise((e=>i=e)),O(a),w(a));this._perObjectData.set(e,c);const l=new Array;if(r.mergeGeometries&&e.geometries.length>1&&se(e))l.push(this._addObjectMergedGeometries(e,c,t,r,s));else for(let n=0;n<e.geometries.length;n++){const o=e.geometries[n];o.material.supportsEdges&&l.push(this._addGeometry(e,c,o,t[0],r,s))}await this._updatingHandles.addPromise(Promise.all(l)),this._perObjectDataEvictionCache.delete(c),this._discardObjectEntry(o),this.setNeedsRender(),i()}_discardObjectEntry(e){e&&(e.renderables.length&&(e.renderables.forEach((e=>this._removeRenderable(e))),this.setNeedsRender()),e.loaded=null)}hasObject(e){return this._perObjectData.has(e)}async updateAllComponentOpacities(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));if(null==r)return;const s=t instanceof Array?e=>t[e]:()=>t;r.renderables.forEach((e=>{const t=e.components.meta.length;for(let r=0;r<t;r++){const t=s(r),n=e.components.meta[r],o=n.index;n.material.opacity=t,e.components.buffer.textureBuffer.setDataElement(o,1,3,255*t)}this._updateTransparency(e)})),this.setNeedsRender()}async getObjectMemoryUsage(e){const t=await this._getObjectEntry(e);return null!=t?t.renderables.reduce(((e,t)=>e+t.statistics.gpuMemoryUsage),0):0}async updateAllComponentMaterials(e,t,r,s){const n=e instanceof P,o=!!r.hasSlicePlane,i=F(t),a=V.getKey(i,o,n),c=await this._updatingHandles.addPromise(this._getObjectEntry(e));null!=c&&(c.renderables.forEach((e=>{if(a!==e.rendererKey){const t=this._renderers.get(e.rendererKey),r=this._acquireRenderer(i,o,n);t.removeRenderable(e),--t.refCount,e.rendererKey=a,r.addRenderable(e)}for(let r=0;r<t.length;r++)e.components.meta[r].material=t[r];s&&this._updateComponentBuffer(e.components),this._updateTransparency(e)})),this.setNeedsRender())}async updateAllVerticalOffsets(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));null!=r&&(r.renderables.forEach((e=>{const r=e.components.meta;for(let s=0;s<r.length;s++)e.components.meta[s].verticalOffset=t?.[s]??0;this._updateComponentBuffer(e.components)})),this.setNeedsRender())}async updateObjectVisibility(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));null!=r&&(r.renderables.forEach((e=>e.visible=t)),this.setNeedsRender())}removeObject(e){const t=this._perObjectData.get(e);t&&(this._perObjectData.delete(e),this._discardObjectEntry(t))}async _getObjectEntry(e){const t=this._perObjectData.get(e);if(!t)throw new Error("no object");return await t.loaded,null==t.loaded?null:t}render(e,t){if(null==this._componentColorManager)return;this._localOrigins.updateViewMatrices(e.camera.viewMatrix);const r=e.camera.viewInverseTransposeMatrix,s=y(),n=new x;let o=0,i=0;if(this._renderers.forEach((r=>{if(0===r.refCount)this._renderers.delete(r.key),r.dispose();else{let s=!0,n=!0;r.forEachRenderable((t=>{t.visible&&(o+=t.statistics.averageEdgeLength,i++,s&&t.regular&&(r.updateTechnique(e,!1),s=!1),n&&t.silhouette&&(r.updateTechnique(e,!0),n=!1))}),t)}})),this._componentColorManager.garbageCollect(),this._componentColorManager.updateTextures(),0===i)return;const a=new q(40*o/i,t);p(s,r[3],r[7],r[11]),n.set(s),f(a.transformWorldFromViewTH,n.high),f(a.transformWorldFromViewTL,n.low),d(a.transformViewFromCameraRelativeRS,e.camera.viewMatrix),u(pe,a.transformViewFromCameraRelativeRS),h(a.transformNormalViewFromGlobal,pe),a.transformProjFromView=e.camera.projectionMatrix,this._updateObjectCameraDistances(e),this._renderers.forEach((t=>{this._renderRegularEdges(t,e,a),this._renderSilhouetteEdges(t,e,a)}))}_updateTransparency(e){const t=Q(e.components.meta),r=J(e.components.meta);t===e.edgeTransparency&&r===e.objectTransparency||(e.edgeTransparency=t,e.objectTransparency=r,this._renderers.get(e.rendererKey).setRenderablesDirty())}_computeModelTransformWithLocalOrigin(e,t,r){e.getCombinedShaderTransformation(t,r);const s=null!=t.localOrigin?this._localOrigins.register(t.localOrigin):this._localOrigins.acquire(p(this._tmpModelPosition,r[12],r[13],r[14]));return t.localOrigin=s.origin,C(s.origin.vec3,r),s}_updateComponentBuffer(e){const{meta:t,buffer:r}=e,s=new Uint8Array(4);for(let n=0;n<t.length;n++){const e=t[n].material,i=t[n].index,a=o(Math.round(e.size*G),0,255),c=o(e.extensionLength,-N,255-N)+N,l="solid"===e.type?H.SOLID:H.SKETCH,d=255*e.opacity,u=e.color,h=255*u[0],m=255*u[1],g=255*u[2],p=255*u[3];r.textureBuffer.setData(i,0,h,m,g,p),r.textureBuffer.setData(i,1,a,c,l,d),v(t[n].verticalOffset,s),r.textureBuffer.setData(i,2,s[0],s[1],s[2],s[3])}}_createComponentBuffers(e){if(null==this._componentColorManager)return null;const t=new Array,r=this._componentColorManager.getBuffer(e.length);for(let n=0;n<e.length;n++){const s=e[n],o=r.acquireIndex();t.push({index:o,verticalOffset:0,material:s})}const s=new oe(r,t);return this._updateComponentBuffer(s),s}_extractEdges(e,t,r,s,n,o=n.length){return this._worker.process({data:t,indices:n,indicesLength:o,writerSettings:e,skipDeduplicate:r},this._workerAbort.signal,s)}_createRenderable(e,t,r,s,n){const o=t=>null!=this._verticesBufferObject?new ie(new S(this.rctx,B,{vertices:k,instances:t===Z.REGULAR?L.glLayout:I.glLayout},{vertices:this._verticesBufferObject,instances:$.createVertex(this.rctx,ee.STATIC_DRAW,t===Z.REGULAR?e.regular.instancesData.buffer:e.silhouette.instancesData.buffer)}),t===Z.REGULAR?e.regular.lodInfo:e.silhouette.lodInfo):null,i=e.regular.lodInfo.lengths.length>0?o(Z.REGULAR):null,a=e.silhouette.lodInfo.lengths.length>0?o(Z.SILHOUETTE):null,c=(i?.vao.memoryUsage??0)+(a?.vao.memoryUsage??0);return new ce(i,a,{gpuMemoryUsage:c,externalMemoryUsage:n,averageEdgeLength:e.averageEdgeLength},r,Q(t.meta),J(t.meta),t,s)}async _addGeometry(e,t,r,s,n,o){const i=r.attributes.get(D.POSITION),a=i.indices,c=g(),l=this._computeModelTransformWithLocalOrigin(e,r,c),d=new ge(i,a,c,l);return this._addPositionData(t,d,r.edgeIndicesLength,s,n,o)}async _addPositionData(e,t,r,s,n,o=!1){if(null==e.loaded)return;const i=this._createComponentBuffers([s]);if(null==i||r<=0)return;const a=this._acquireRenderer(s.type,!!n.hasSlicePlane,!0),{modelTransform:c,origin:l}=t,d=t.indices,u=t.position,h=u.data.length/u.size,m=U.createBuffer(h);for(let f=0;f<h;f++)m.position.set(f,0,u.data[f*u.size]),m.position.set(f,1,u.data[f*u.size+1]),m.position.set(f,2,u.data[f*u.size+2]);X(i.meta,[0,m.componentIndex.count],m.componentIndex);const g=await this._updatingHandles.addPromise(this._extractEdges(a.writerSettings,m,!1,o,d,r));if(null==e.loaded)return;const p=this._createRenderable(g,i,new ae(c,l),a.key,!1);e.renderables.push(p),a.addRenderable(p),this._gpuMemoryUsage+=p.statistics.gpuMemoryUsage}async _addComponentGeometry(e,t,r,s,n,o,i){if(null==t.loaded)return 0;const a=this._createComponentBuffers(o);if(null==a)return 0;const c=F(o),l=this._acquireRenderer(c,i.hasSlicePlane||!1,!1),d=U.createBuffer(r.length/3);E(d.position.typedBuffer,r,d.position.typedBufferStride,3),X(a.meta,n,d.componentIndex,s);const u=!0,h=l.writerSettings,m=await this._updatingHandles.addPromise(this._extractEdges(h,d,u,!1,s));if(null==t.loaded)return 0;const g=this._createRenderable(m,a,e,l.key,!0);return t.renderables.push(g),l.addRenderable(g),g.statistics.gpuMemoryUsage}async _addObjectMergedGeometries(e,t,r,s,n){const o=new Map;let i=0,a=null,c=0;for(let g=0;g<e.geometries.length;g++){const t=e.geometries[g];if(!t.material.supportsEdges)continue;!a&&t.localOrigin&&(a=t);const r=t.attributes.get(D.POSITION);c+=r.data.length/r.size,i+=t.edgeIndicesLength}const l=c>=65536?Uint32Array:Uint16Array,d=i?new l(i):null,u=[];let h=0;for(let g=0;g<e.geometries.length;g++){const t=e.geometries[g];if(!t.material.supportsEdges)continue;const r=t.attributes.get(D.POSITION),s=r.indices;let n=o.get(r.data);if(null==n){n=u.length/3;for(let e=0;e<r.data.length;e+=r.size)u.push(r.data[e]),u.push(r.data[e+1]),u.push(r.data[e+2]);o.set(r.data,n)}if(s)for(let e=0;e<t.edgeIndicesLength;e++)d[h++]=n+s[e]}const m=a||e.geometries[0],p=g(),f=this._computeModelTransformWithLocalOrigin(e,m,p);for(let g=0;g<e.geometries.length;g++)e.geometries[g].localOrigin=f.origin;const _=new ge({data:u,size:3},d,p,f);await this._updatingHandles.addPromise(this._addPositionData(t,_,d.length,r[0],s,n))}_acquireRenderer(e,t,r){const s=V.getKey(e,t,r);let n=this._renderers.get(s);return null==this._strokesTexture&&(this._strokesTexture=K(this.rctx)),n||(n=new V(this.rctx,this.techniqueRepository,{type:e,hasSlicePlane:t,strokesTexture:this._strokesTexture,legacy:r,spherical:this.viewingMode===R.Global}),this._renderers.set(s,n)),++n.refCount,n}_removeRenderable(e){re(e.regular),re(e.silhouette);const t=this._renderers.get(e.rendererKey);if(t){t.removeRenderable(e),--t.refCount,"origin"in e.transform&&this._localOrigins.release(e.transform.origin),this._gpuMemoryUsage-=e.statistics.externalMemoryUsage?0:e.statistics.gpuMemoryUsage;for(const t of e.components.meta)e.components.buffer.releaseIndex(t.index)}}_updateObjectCameraDistances(e){const t=e.camera.eye,r=e.camera.viewForward,s=y(),n=e=>{_(s,e.center,t);const n=b(s,r),o=e.radius,i=n<-o?1/0:n<o?0:n-o;e.renderables.forEach((e=>e.distanceToCamera=i))};this._perObjectData.forEach(n),this._perObjectDataEvictionCache.forEach(n)}_renderRegularEdges(e,t,r){const s=e.bindRegularEdges(r,t),n=r.transparency,o=t.camera.perScreenPixelRatio;e.forEachRenderable((n=>{if(!de(n)||!n.visible)return;const i=me(n.regular.lod.lengths,n.distanceToCamera,o);e.renderRegularEdges(s,n,r,t,i)}),n)}_renderSilhouetteEdges(e,t,r){const s=e.bindSilhouetteEdges(r,t),n=r.transparency,o=t.camera.perScreenPixelRatio;e.forEachRenderable((n=>{if(!he(n)||!n.visible)return;const i=me(n.silhouette.lod.lengths,n.distanceToCamera,o);e.renderSilhouetteEdges(s,n,r,t,i)}),n)}get test(){return{hasRenderedPrimitives:e=>{let t=!1;const r=e.perScreenPixelRatio,s=(e,s)=>e.forEachRenderable((e=>{e.visible&&!t&&(de(e)&&(t=me(e.regular.lod.lengths,e.distanceToCamera,r)>0),!t&&he(e)&&(t=me(e.silhouette.lod.lengths,e.distanceToCamera,r)>0))}),s);return this._renderers.forEach((e=>{t||(s(e,W.OPAQUE),s(e,W.TRANSPARENT))})),t}}}};function re(e){null!=e&&(e.vao.vertexBuffers.instances.dispose(),e.vao.disposeVAOOnly(),e.vao=null)}function se(e){let t=null,s=null;for(let n=0;n<e.geometries.length;n++){const o=e.geometries[n];if(o.material.supportsEdges){if(t){if(!r(t,o.transformation))return!1}else t=o.transformation;if(s||null==o.localOrigin){if(s&&null!=s.localOrigin&&null!=o.localOrigin&&s.localOrigin.id!==o.localOrigin.id)return!1}else s=o}}return!0}e([c({constructOnly:!0})],te.prototype,"rctx",void 0),e([c({constructOnly:!0})],te.prototype,"renderSR",void 0),e([c({constructOnly:!0})],te.prototype,"viewingMode",void 0),e([c({constructOnly:!0})],te.prototype,"techniqueRepository",void 0),e([c({constructOnly:!0})],te.prototype,"setNeedsRender",void 0),e([c({constructOnly:!0})],te.prototype,"schedule",void 0),e([c({readOnly:!0})],te.prototype,"_updatingHandles",void 0),e([c({readOnly:!0})],te.prototype,"updating",null),te=e([l("esri.views.3d.webgl-engine.lib.edgeRendering.EdgeView")],te);class ne{constructor(e,t,r){this.center=t,this.radius=r,this.renderables=new Array,this.loaded=e,this.loaded.then((()=>{null!=this.loaded&&(this.loaded=!0)}))}}class oe{constructor(e,t){this.buffer=e,this.meta=t}}class ie{constructor(e,t){this.vao=e,this.lod=t}}class ae{constructor(e,t){this.modelMatrix=e,this.origin=t}}class ce{constructor(e,t,r,s,n,o,i,a){this.regular=e,this.silhouette=t,this.statistics=r,this.transform=s,this.edgeTransparency=n,this.objectTransparency=o,this.components=i,this.rendererKey=a,this.distanceToCamera=0,this.visible=!0}}class le extends ce{}function de(e){return null!=e.regular}class ue extends ce{}function he(e){return null!=e.silhouette}function me(e,t,r){const n=t*r,o=s(e,n,!0);return-1===o?n<e[0]?e.length:0:e.length-o}class ge{constructor(e,t,r,s){this.position=e,this.indices=t,this.modelTransform=r,this.origin=s}}const pe=m(),fe=()=>Promise.reject();export{te as EdgeView,ae as LegacyTransform,le as RegularRenderable,ce as Renderable,ue as SilhouetteRenderable};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{s as t,g as n,i as r,r as e}from"../../../../chunks/vec3.js";import{c as o}from"../../../../chunks/vec3f64.js";import{areaPoints3d as s}from"../../../../geometry/support/triangle.js";function c(e,o,c){if(!e||!o)return!1;const{size:i,data:f}=e;t(c,0,0,0),t(g,0,0,0);let m=0,h=0;for(let p=0;p<o.length-2;p+=3){const e=o[p]*i,d=o[p+1]*i,j=o[p+2]*i;t(a,f[e],f[e+1],f[e+2]),t(u,f[d],f[d+1],f[d+2]),t(l,f[j],f[j+1],f[j+2]);const z=s(a,u,l);z?(n(a,a,u),n(a,a,l),r(a,a,1/3*z),n(c,c,a),m+=z):(n(g,g,a),n(g,g,u),n(g,g,l),h+=3)}return(0!==h||0!==m)&&(0!==m?(r(c,c,1/m),!0):0!==h&&(r(c,g,1/h),!0))}function i(n,e,o){if(!n||!e)return!1;const{size:s,data:c}=n;t(o,0,0,0);let i=-1,f=0;for(let t=0;t<e.length;t++){const n=e[t]*s;i!==n&&(o[0]+=c[n],o[1]+=c[n+1],o[2]+=c[n+2],f++),i=n}return f>1&&r(o,o,1/f),f>0}function f(o,s,c,i){if(!o)return!1;t(i,0,0,0),t(g,0,0,0);let f=0,l=0;const{size:m,data:h}=o,p=s?s.length-1:h.length/m-1,d=p+(c?2:0);for(let t=0;t<d;t+=2){const o=t<p?t:p,c=t<p?t+1:0,d=(s?s[o]:o)*m,j=(s?s[c]:c)*m;a[0]=h[d],a[1]=h[d+1],a[2]=h[d+2],u[0]=h[j],u[1]=h[j+1],u[2]=h[j+2],r(a,n(a,a,u),.5);const z=e(a,u);z>0?(n(i,i,r(a,a,z)),f+=z):0===f&&(n(g,g,a),l++)}return 0!==f?(r(i,i,1/f),!0):0!==l&&(r(i,g,1/l),!0)}const a=o(),u=o(),l=o(),g=o();export{f as computeAttachmentOriginLines,i as computeAttachmentOriginPoints,c as computeAttachmentOriginTriangles};
5
+ import{s as t,g as n,i as e,r as s}from"../../../../chunks/vec3.js";import{c as r}from"../../../../chunks/vec3f64.js";import{areaPoints3d as o}from"../../../../geometry/support/triangle.js";function c(s,r){if(!s)return!1;const{size:c,data:i,indices:f}=s;t(r,0,0,0),t(m,0,0,0);let d=0,g=0;for(let p=0;p<f.length-2;p+=3){const s=f[p]*c,h=f[p+1]*c,j=f[p+2]*c;t(a,i[s],i[s+1],i[s+2]),t(u,i[h],i[h+1],i[h+2]),t(l,i[j],i[j+1],i[j+2]);const z=o(a,u,l);z?(n(a,a,u),n(a,a,l),e(a,a,1/3*z),n(r,r,a),d+=z):(n(m,m,a),n(m,m,u),n(m,m,l),g+=3)}return(0!==g||0!==d)&&(0!==d?(e(r,r,1/d),!0):0!==g&&(e(r,m,1/g),!0))}function i(n,s){if(!n)return!1;const{size:r,data:o,indices:c}=n;t(s,0,0,0);let i=-1,f=0;for(let t=0;t<c.length;t++){const n=c[t]*r;i!==n&&(s[0]+=o[n],s[1]+=o[n+1],s[2]+=o[n+2],f++),i=n}return f>1&&e(s,s,1/f),f>0}function f(r,o,c){if(!r)return!1;t(c,0,0,0),t(m,0,0,0);let i=0,f=0;const{size:l,data:d,indices:g}=r,p=g.length-1,h=p+(o?2:0);for(let t=0;t<h;t+=2){const r=t<p?t+1:0,o=g[t<p?t:p]*l,h=g[r]*l;a[0]=d[o],a[1]=d[o+1],a[2]=d[o+2],u[0]=d[h],u[1]=d[h+1],u[2]=d[h+2],e(a,n(a,a,u),.5);const j=s(a,u);j>0?(n(c,c,e(a,a,j)),i+=j):0===i&&(n(m,m,a),f++)}return 0!==i?(e(c,c,1/i),!0):0!==f&&(e(c,m,1/f),!0)}const a=r(),u=r(),l=r(),m=r();export{f as computeAttachmentOriginLines,i as computeAttachmentOriginPoints,c as computeAttachmentOriginTriangles};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{unique as e}from"../../../../../core/arrayUtils.js";import{VertexAttribute as t}from"../VertexAttribute.js";class s{constructor(e,t=null){this.geometry=e,this.textures=t}}class r{constructor(e,s,r){this.components=e,this.minScreenSpaceRadius=s,this.pivotOffset=r;const n=this.geometries;this.numVertices=n.reduce(((e,s)=>e+s.indices.get(t.POSITION).length),0)}get geometries(){return e(this.components.map((e=>e.geometry)))}}class n{constructor(e){this.levels=e,this.levels.sort(((e,t)=>e.minScreenSpaceRadius===t.minScreenSpaceRadius?e.numVertices-t.numVertices:e.minScreenSpaceRadius-t.minScreenSpaceRadius))}}function c(t){const s=[];return t.levels.forEach((e=>e.components.forEach((e=>s.push(e.geometry.material))))),e(s)}function o(t){const s=new Array;return t.levels.forEach((e=>e.components.forEach((e=>{null!=e.textures&&s.push(...e.textures)})))),e(s)}function i(t){const s=new Array;return t.levels.forEach((e=>e.components.forEach((e=>s.push(e.geometry))))),e(s)}export{s as LodComponentResources,r as LodLevelResources,n as LodResources,i as geometriesFromLodResources,c as materialsFromLodResources,o as texturesFromLodResources};
5
+ import{unique as e}from"../../../../../core/arrayUtils.js";import{VertexAttribute as t}from"../VertexAttribute.js";class s{constructor(e,t=null){this.geometry=e,this.textures=t}}class r{constructor(e,s,r){this.components=e,this.minScreenSpaceRadius=s,this.pivotOffset=r;const n=this.geometries;this.numVertices=n.reduce(((e,s)=>e+s.attributes.get(t.POSITION).indices.length),0)}get geometries(){return e(this.components.map((e=>e.geometry)))}}class n{constructor(e){this.levels=e,this.levels.sort(((e,t)=>e.minScreenSpaceRadius===t.minScreenSpaceRadius?e.numVertices-t.numVertices:e.minScreenSpaceRadius-t.minScreenSpaceRadius))}}function c(t){const s=[];return t.levels.forEach((e=>e.components.forEach((e=>s.push(e.geometry.material))))),e(s)}function o(t){const s=new Array;return t.levels.forEach((e=>e.components.forEach((e=>{null!=e.textures&&s.push(...e.textures)})))),e(s)}function i(t){const s=new Array;return t.levels.forEach((e=>e.components.forEach((e=>s.push(e.geometry))))),e(s)}export{s as LodComponentResources,r as LodLevelResources,n as LodResources,i as geometriesFromLodResources,c as materialsFromLodResources,o as texturesFromLodResources};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{VertexAttribute as t}from"../lib/VertexAttribute.js";import{writeDefaultAttributes as e}from"./internal/bufferWriterUtils.js";class r{constructor(t){this.vertexBufferLayout=t}elementCount(e){return e.indices.get(t.POSITION).length}write(t,r,i,o,s){e(i,this.vertexBufferLayout,t,r,o,s)}}export{r as DefaultBufferWriter};
5
+ import{VertexAttribute as t}from"../lib/VertexAttribute.js";import{writeDefaultAttributes as e}from"./internal/bufferWriterUtils.js";class r{constructor(t){this.vertexBufferLayout=t}elementCount(e){return e.attributes.get(t.POSITION).indices.length}write(t,r,i,o,s){e(i,this.vertexBufferLayout,t,r,o,s)}}export{r 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.28/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import{clamp as e}from"../../../../core/mathUtils.js";import{f as t}from"../../../../chunks/mat3.js";import{a as s}from"../../../../chunks/mat3f64.js";import{i as r}from"../../../../chunks/mat4.js";import{a as i}from"../../../../chunks/mat4f64.js";import{j as a}from"../../../../chunks/vec2.js";import{a as n,f as o}from"../../../../chunks/vec2f64.js";import{s as c,e as l,n as f,f as u,i as p,c as h,l as m,o as d,t as g,j as S,g as A}from"../../../../chunks/vec3.js";import{c as O,f as v}from"../../../../chunks/vec3f64.js";import{b as T,c as b,f as x}from"../../../../chunks/vec4f64.js";import{isMat4 as I}from"../../../../core/libs/gl-matrix-2/types/mat4.js";import{create as _}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec4u8 as P}from"../../../../geometry/support/buffer/BufferView.js";import{evaluateModelTransformScale as E}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as R}from"../../support/debugFlags.js";import{newLayout as y}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as U}from"../core/shaderLibrary/ShaderOutput.js";import{HUDSpace as j}from"../core/shaderLibrary/hud/HUD.glsl.js";import{GLTextureMaterial as C,GLTextureMaterialBindParameters as L}from"../lib/GLTextureMaterial.js";import{Material as D,RenderOccludedFlag as M}from"../lib/Material.js";import{RenderSlot as z}from"../lib/RenderSlot.js";import{applyScaleFactor as w,applyPrecomputedScaleFactor as F,precomputeScaleFactor as V}from"../lib/screenSizePerspectiveUtils.js";import{assert as N}from"../lib/Util.js";import{VertexAttribute as B}from"../lib/VertexAttribute.js";import{ScaleInfo as X}from"./ScaleInfo.js";import{writePosition as k,writeNormal as G,writeColor as W,writeBufferVec4 as H,writeBufferVec4Zeros as q,writeObjectAndLayerIdColor as Y}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as Z}from"./internal/MaterialUtil.js";import{c as J}from"../../../../chunks/HUDMaterial.glsl.js";import{HUDMaterialTechnique as K}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as Q}from"../shaders/HUDMaterialTechniqueConfiguration.js";class $ extends D{constructor(e){super(e,new be),this._configuration=new Q}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?j.Screen:j.World,this._configuration.hasPolygonOffset=this.parameters.polygonOffset,this._configuration.draped=this.parameters.isDraped,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.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.occlusionPass=t.slot===z.OCCLUSION_PIXELS&&this.parameters.occlusionTest&&(e===U.Color||e===U.Alpha),e===U.Color&&(this._configuration.debugDrawLabelBorder=!!R.LABELS_SHOW_BORDER),this._configuration.depthEnabled=this.parameters.depthEnabled,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}intersect(e,s,i,a,n,o){if(!(i.options.selectionMode&&i.options.hud&&e.visible&&i.point))return;const g=this.parameters,S=i.point,A=i.camera;let{scaleX:v,scaleY:T}=this._getScreenScale(e);v*=A.pixelRatio,T*=A.pixelRatio,t(ue,s),e.vertexAttributes.has(B.FEATUREATTRIBUTE)&&se(ue);const b=e.vertexAttributes.get(B.POSITION),x=e.vertexAttributes.get(B.SIZE),I=e.vertexAttributes.get(B.NORMAL),_=e.vertexAttributes.get(B.AUXPOS1);N(b.size>=3);const P=J(g),E="screen"===this.parameters.centerOffsetUnits;for(let t=0;t<b.data.length/b.size;t++){const e=t*b.size;c(ne,b.data[e],b.data[e+1],b.data[e+2]),l(ne,ne,s);const a=t*x.size;ve[0]=x.data[a]*v,ve[1]=x.data[a+1]*T,l(ne,ne,A.viewMatrix);const n=t*_.size;if(c(me,_.data[n],_.data[n+1],_.data[n+2]),!E&&(ne[0]+=me[0],ne[1]+=me[1],0!==me[2])){const e=me[2];f(me,ne),u(ne,ne,p(me,me,e))}const R=t*I.size;if(c(oe,I.data[R],I.data[R+1],I.data[R+2]),this._normalAndViewAngle(oe,ue,A,Se),this._applyVerticalOffsetTransformationView(ne,Se,A,ie),A.applyProjection(ne,ce),ce[0]>-1){E&&(me[0]||me[1])&&(ce[0]+=me[0]*A.pixelRatio,0!==me[1]&&(ce[1]+=w(me[1],ie.factorAlignment)*A.pixelRatio),A.unapplyProjection(ce,ne)),ce[0]+=this.parameters.screenOffset[0]*A.pixelRatio,ce[1]+=this.parameters.screenOffset[1]*A.pixelRatio,ce[0]=Math.floor(ce[0]),ce[1]=Math.floor(ce[1]),F(ve,ie.factor,ve);const e=Ae*A.pixelRatio;let t=0;if(g.textureIsSignedDistanceField&&(t=g.outlineSize*A.pixelRatio/2),re(S,ce[0],ce[1],ve,e,t,g,P)){const e=i.ray;if(l(fe,ne,r(he,A.viewMatrix)),ce[0]=S[0],ce[1]=S[1],A.unprojectFromRenderScreen(ce,ne)){const t=O();h(t,e.direction);const s=1/m(t);p(t,t,s);o(d(e.origin,ne)*s,t,-1,!0,1,fe)}}}}}intersectDraped(e,t,s,r,i,a){const n=e.vertexAttributes.get(B.POSITION),o=e.vertexAttributes.get(B.SIZE),c=this.parameters,l=J(c);let{scaleX:f,scaleY:u}=this._getScreenScale(e);f*=e.screenToWorldRatio,u*=e.screenToWorldRatio;const p=Oe*e.screenToWorldRatio;for(let h=0;h<n.data.length/n.size;h++){const t=h*n.size,s=n.data[t],m=n.data[t+1],d=h*o.size;ve[0]=o.data[d]*f,ve[1]=o.data[d+1]*u;let g=0;c.textureIsSignedDistanceField&&(g=c.outlineSize*e.screenToWorldRatio/2),re(r,s,m,ve,p,g,c,l)&&i(a.dist,a.normal,-1,!1)}}createBufferWriter(){return new _e(this)}_normalAndViewAngle(e,s,r,i){return I(s)&&(s=t(pe,s)),g(i.normal,e,s),l(i.normal,i.normal,r.viewInverseTransposeMatrix),i.cosAngle=S(le,Te),i}_updateScaleInfo(e,t,s){const r=this.parameters;null!=r.screenSizePerspective?V(s,t,r.screenSizePerspective,e.factor):(e.factor.scale=1,e.factor.factor=0,e.factor.minScaleFactor=0),null!=r.screenSizePerspectiveAlignment?V(s,t,r.screenSizePerspectiveAlignment,e.factorAlignment):(e.factorAlignment.factor=e.factor.factor,e.factorAlignment.scale=e.factor.scale,e.factorAlignment.minScaleFactor=e.factor.minScaleFactor)}applyShaderOffsetsView(e,t,s,r,i,a,n){const o=this._normalAndViewAngle(t,s,i,Se);return this._applyVerticalGroundOffsetView(e,o,i,n),this._applyVerticalOffsetTransformationView(n,o,i,a),this._applyPolygonOffsetView(n,o,r[3],i,n),this._applyCenterOffsetView(n,r,n),n}applyShaderOffsetsNDC(e,t,s,r,i){return this._applyCenterOffsetNDC(e,t,s,r),null!=i&&h(i,r),this._applyPolygonOffsetNDC(r,t,s,r),r}_applyPolygonOffsetView(t,s,r,i,a){const n=i.aboveGround?1:-1;let o=Math.sign(r);0===o&&(o=n);const c=n*o;if(this.parameters.shaderPolygonOffset<=0)return h(a,t);const l=e(Math.abs(s.cosAngle),.01,1),f=1-Math.sqrt(1-l*l)/l/i.viewport[2];return p(a,t,c>0?f:1/f),a}_applyVerticalGroundOffsetView(e,t,s,r){const i=m(e),a=s.aboveGround?1:-1,n=.5*s.computeRenderPixelSizeAtDist(i),o=p(ne,t.normal,a*n);return A(r,e,o),r}_applyVerticalOffsetTransformationView(e,t,s,r){const i=this.parameters;if(!i.verticalOffset||!i.verticalOffset.screenLength){if(i.screenSizePerspective||i.screenSizePerspectiveAlignment){const s=m(e);this._updateScaleInfo(r,s,t.cosAngle)}else r.factor.scale=1,r.factorAlignment.scale=1;return e}const a=m(e),n=i.screenSizePerspectiveAlignment??i.screenSizePerspective,o=Z(s,a,i.verticalOffset,t.cosAngle,n);return this._updateScaleInfo(r,a,t.cosAngle),p(t.normal,t.normal,o),A(e,e,t.normal)}_applyCenterOffsetView(e,t,s){const r="screen"!==this.parameters.centerOffsetUnits;return s!==e&&h(s,e),r&&(s[0]+=t[0],s[1]+=t[1],t[2]&&(f(oe,s),A(s,s,p(oe,oe,t[2])))),s}_applyCenterOffsetNDC(e,t,s,r){const i="screen"!==this.parameters.centerOffsetUnits;return r!==e&&h(r,e),i||(r[0]+=t[0]/s.fullWidth*2,r[1]+=t[1]/s.fullHeight*2),r}_applyPolygonOffsetNDC(e,t,s,r){const i=this.parameters.shaderPolygonOffset;if(e!==r&&h(r,e),i){const e=s.aboveGround?1:-1,a=e*Math.sign(t[3]);r[2]-=(a||e)*i}return r}produces(e,t){if(t===U.Color||t===U.Alpha||t===U.Highlight||t===U.ObjectAndLayerIdColor){if(e===z.DRAPED_MATERIAL)return!0;const{drawInSecondSlot:t,occlusionTest:s}=this.parameters;return e===(t?z.LABEL_MATERIAL:z.HUD_MATERIAL)||s&&e===z.OCCLUSION_PIXELS}return!1}createGLMaterial(e){return new ee(e)}calculateRelativeScreenBounds(e,t,s=_()){return te(this.parameters,e,t,s),s[2]=s[0]+e[0],s[3]=s[1]+e[1],s}_getScreenScale(e){const t=e.vertexAttributes.get(B.FEATUREATTRIBUTE);if(null==t)return{scaleX:1,scaleY:1};const s=T(t.data,ge),[r,i]=E(de,this.parameters,s);return{scaleX:r,scaleY:i}}}class ee extends C{constructor(e){super({...e,...e.material.parameters})}selectProgram(e){return this.ensureTechnique(K,e)}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.selectProgram(e)}}function te(e,t,s,r=ae){return a(r,e.anchorPosition),r[0]*=-t[0],r[1]*=-t[1],r[0]+=e.screenOffset[0]*s,r[1]+=e.screenOffset[1]*s,r}function se(e){const t=e[0],s=e[1],r=e[2],i=e[3],a=e[4],n=e[5],o=e[6],c=e[7],l=e[8],f=1/Math.sqrt(t*t+s*s+r*r),u=1/Math.sqrt(i*i+a*a+n*n),p=1/Math.sqrt(o*o+c*c+l*l);return e[0]=t*f,e[1]=s*f,e[2]=r*f,e[3]=i*u,e[4]=a*u,e[5]=n*u,e[6]=o*p,e[7]=c*p,e[8]=l*p,e}function re(e,t,s,r,i,a,n,o){let c=t-i-(o[0]>0?r[0]*o[0]:0),l=c+r[0]+2*i,f=s-i-(o[1]>0?r[1]*o[1]:0),u=f+r[1]+2*i;const p=n.distanceFieldBoundingBox;return n.textureIsSignedDistanceField&&null!=p&&(c+=r[0]*p[0],f+=r[1]*p[1],l-=r[0]*(1-p[2]),u-=r[1]*(1-p[3]),c-=a,l+=a,f-=a,u+=a),e[0]>c&&e[0]<l&&e[1]>f&&e[1]<u}const ie=new X,ae=n(),ne=O(),oe=O(),ce=b(),le=O(),fe=O(),ue=s(),pe=s(),he=i(),me=O(),de=b(),ge=b(),Se={normal:le,cosAngle:0},Ae=1,Oe=2,ve=[0,0],Te=v(0,0,1);class be extends L{constructor(){super(...arguments),this.renderOccluded=M.Occlude,this.isDecoration=!1,this.color=x(1,1,1,1),this.texCoordScale=[1,1],this.polygonOffset=!1,this.anchorPosition=o(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=x(1,1,1,1),this.outlineSize=0,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.centerOffsetUnits="world",this.drawInSecondSlot=!1,this.depthEnabled=!0,this.isDraped=!1}}const xe=y().vec3f(B.POSITION).vec3f(B.NORMAL).vec2f(B.UV0).vec4u8(B.COLOR).vec2f(B.SIZE).vec4f(B.AUXPOS1).vec4f(B.FEATUREATTRIBUTE),Ie=xe.clone().vec4u8(B.OBJECTANDLAYERIDCOLOR);class _e{constructor(e){this._material=e,this.vertexBufferLayout=has("enable-feature:objectAndLayerId-rendering")?Ie:xe}elementCount(e){return 6*e.indices.get(B.POSITION).length}write(e,t,s,r,i){k(s.indices.get(B.POSITION),s.vertexAttributes.get(B.POSITION).data,e,r.position,i,6),G(s.indices.get(B.NORMAL),s.vertexAttributes.get(B.NORMAL).data,t,r.normal,i,6);const a=s.vertexAttributes.get(B.UV0).data;let n,o,c,l;if(null==a||a.length<4){const e=this._material.parameters;n=0,o=0,c=e.texCoordScale[0],l=e.texCoordScale[1]}else n=a[0],o=a[1],c=a[2],l=a[3];c=Math.min(1.99999,c+1),l=Math.min(1.99999,l+1);let f=s.indices.get(B.POSITION).length,u=i;const p=r.uv0;for(let g=0;g<f;++g)p.set(u,0,n),p.set(u,1,o),u++,p.set(u,0,c),p.set(u,1,o),u++,p.set(u,0,c),p.set(u,1,l),u++,p.set(u,0,c),p.set(u,1,l),u++,p.set(u,0,n),p.set(u,1,l),u++,p.set(u,0,n),p.set(u,1,o),u++;W(s.indices.get(B.COLOR),s.vertexAttributes.get(B.COLOR).data,4,r.color,i,6);const h=s.indices.get(B.SIZE),m=s.vertexAttributes.get(B.SIZE).data;f=h.length;const d=r.size;u=i;for(let g=0;g<f;++g){const e=m[2*h[g]],t=m[2*h[g]+1];for(let s=0;s<6;++s)d.set(u,0,e),d.set(u,1,t),u++}if(s.indices.get(B.AUXPOS1)&&s.vertexAttributes.get(B.AUXPOS1)?H(s.indices.get(B.AUXPOS1),s.vertexAttributes.get(B.AUXPOS1).data,r.auxpos1,i,6):q(r.auxpos1,i,6*f),s.indices.get(B.FEATUREATTRIBUTE)&&s.vertexAttributes.get(B.FEATUREATTRIBUTE)?H(s.indices.get(B.FEATUREATTRIBUTE),s.vertexAttributes.get(B.FEATUREATTRIBUTE).data,r.featureAttribute,i,6):q(r.featureAttribute,i,6*f),null!=s.objectAndLayerIdColor){if(s.indices.get(B.POSITION)){const e=s.indices.get(B.POSITION).length,t=r.getField(B.OBJECTANDLAYERIDCOLOR,P);Y(s.objectAndLayerIdColor,t,e,i,6)}}}}export{$ as HUDMaterial,be as Parameters};
5
+ import has from"../../../../core/has.js";import{clamp as e}from"../../../../core/mathUtils.js";import{f as t}from"../../../../chunks/mat3.js";import{a as s}from"../../../../chunks/mat3f64.js";import{i as r}from"../../../../chunks/mat4.js";import{a as i}from"../../../../chunks/mat4f64.js";import{j as a}from"../../../../chunks/vec2.js";import{a as n,f as o}from"../../../../chunks/vec2f64.js";import{s as c,e as l,n as f,f as u,i as p,c as h,l as m,o as d,t as g,j as S,g as O}from"../../../../chunks/vec3.js";import{c as b,f as A}from"../../../../chunks/vec3f64.js";import{b as v,c as T,f as _}from"../../../../chunks/vec4f64.js";import{isMat4 as I}from"../../../../core/libs/gl-matrix-2/types/mat4.js";import{create as y}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec4u8 as P}from"../../../../geometry/support/buffer/BufferView.js";import{evaluateModelTransformScale as E}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as R}from"../../support/debugFlags.js";import{newLayout as x}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as j}from"../core/shaderLibrary/ShaderOutput.js";import{HUDSpace as C}from"../core/shaderLibrary/hud/HUD.glsl.js";import{GLTextureMaterial as U,GLTextureMaterialBindParameters as D}from"../lib/GLTextureMaterial.js";import{Material as L,RenderOccludedFlag as z}from"../lib/Material.js";import{RenderSlot as M}from"../lib/RenderSlot.js";import{applyScaleFactor as w,applyPrecomputedScaleFactor as V,precomputeScaleFactor as F}from"../lib/screenSizePerspectiveUtils.js";import{assert as B}from"../lib/Util.js";import{VertexAttribute as N}from"../lib/VertexAttribute.js";import{ScaleInfo as k}from"./ScaleInfo.js";import{writePosition as X,writeNormal as G,writeColor as W,writeBufferVec4 as H,writeBufferVec4Zeros as q,writeObjectAndLayerIdColor as Y}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as Z}from"./internal/MaterialUtil.js";import{c as J}from"../../../../chunks/HUDMaterial.glsl.js";import{HUDMaterialTechnique as K}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as Q}from"../shaders/HUDMaterialTechniqueConfiguration.js";class $ extends L{constructor(e){super(e,new Te),this._configuration=new Q}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?C.Screen:C.World,this._configuration.hasPolygonOffset=this.parameters.polygonOffset,this._configuration.draped=this.parameters.isDraped,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.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.occlusionPass=t.slot===M.OCCLUSION_PIXELS&&this.parameters.occlusionTest&&(e===j.Color||e===j.Alpha),e===j.Color&&(this._configuration.debugDrawLabelBorder=!!R.LABELS_SHOW_BORDER),this._configuration.depthEnabled=this.parameters.depthEnabled,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}intersect(e,s,i,a,n,o){if(!(i.options.selectionMode&&i.options.hud&&e.visible&&i.point))return;const g=this.parameters,S=i.point,O=i.camera;let{scaleX:A,scaleY:v}=this._getScreenScale(e);A*=O.pixelRatio,v*=O.pixelRatio,t(ue,s),e.attributes.has(N.FEATUREATTRIBUTE)&&se(ue);const T=e.attributes.get(N.POSITION),_=e.attributes.get(N.SIZE),I=e.attributes.get(N.NORMAL),y=e.attributes.get(N.AUXPOS1);B(T.size>=3);const P=J(g),E="screen"===this.parameters.centerOffsetUnits;for(let t=0;t<T.data.length/T.size;t++){const e=t*T.size;c(ne,T.data[e],T.data[e+1],T.data[e+2]),l(ne,ne,s);const a=t*_.size;Ae[0]=_.data[a]*A,Ae[1]=_.data[a+1]*v,l(ne,ne,O.viewMatrix);const n=t*y.size;if(c(me,y.data[n],y.data[n+1],y.data[n+2]),!E&&(ne[0]+=me[0],ne[1]+=me[1],0!==me[2])){const e=me[2];f(me,ne),u(ne,ne,p(me,me,e))}const R=t*I.size;if(c(oe,I.data[R],I.data[R+1],I.data[R+2]),this._normalAndViewAngle(oe,ue,O,Se),this._applyVerticalOffsetTransformationView(ne,Se,O,ie),O.applyProjection(ne,ce),ce[0]>-1){E&&(me[0]||me[1])&&(ce[0]+=me[0]*O.pixelRatio,0!==me[1]&&(ce[1]+=w(me[1],ie.factorAlignment)*O.pixelRatio),O.unapplyProjection(ce,ne)),ce[0]+=this.parameters.screenOffset[0]*O.pixelRatio,ce[1]+=this.parameters.screenOffset[1]*O.pixelRatio,ce[0]=Math.floor(ce[0]),ce[1]=Math.floor(ce[1]),V(Ae,ie.factor,Ae);const e=Oe*O.pixelRatio;let t=0;if(g.textureIsSignedDistanceField&&(t=g.outlineSize*O.pixelRatio/2),re(S,ce[0],ce[1],Ae,e,t,g,P)){const e=i.ray;if(l(fe,ne,r(he,O.viewMatrix)),ce[0]=S[0],ce[1]=S[1],O.unprojectFromRenderScreen(ce,ne)){const t=b();h(t,e.direction);const s=1/m(t);p(t,t,s);o(d(e.origin,ne)*s,t,-1,!0,1,fe)}}}}}intersectDraped(e,t,s,r,i,a){const n=e.attributes.get(N.POSITION),o=e.attributes.get(N.SIZE),c=this.parameters,l=J(c);let{scaleX:f,scaleY:u}=this._getScreenScale(e);f*=e.screenToWorldRatio,u*=e.screenToWorldRatio;const p=be*e.screenToWorldRatio;for(let h=0;h<n.data.length/n.size;h++){const t=h*n.size,s=n.data[t],m=n.data[t+1],d=h*o.size;Ae[0]=o.data[d]*f,Ae[1]=o.data[d+1]*u;let g=0;c.textureIsSignedDistanceField&&(g=c.outlineSize*e.screenToWorldRatio/2),re(r,s,m,Ae,p,g,c,l)&&i(a.dist,a.normal,-1,!1)}}createBufferWriter(){return new ye(this)}_normalAndViewAngle(e,s,r,i){return I(s)&&(s=t(pe,s)),g(i.normal,e,s),l(i.normal,i.normal,r.viewInverseTransposeMatrix),i.cosAngle=S(le,ve),i}_updateScaleInfo(e,t,s){const r=this.parameters;null!=r.screenSizePerspective?F(s,t,r.screenSizePerspective,e.factor):(e.factor.scale=1,e.factor.factor=0,e.factor.minScaleFactor=0),null!=r.screenSizePerspectiveAlignment?F(s,t,r.screenSizePerspectiveAlignment,e.factorAlignment):(e.factorAlignment.factor=e.factor.factor,e.factorAlignment.scale=e.factor.scale,e.factorAlignment.minScaleFactor=e.factor.minScaleFactor)}applyShaderOffsetsView(e,t,s,r,i,a,n){const o=this._normalAndViewAngle(t,s,i,Se);return this._applyVerticalGroundOffsetView(e,o,i,n),this._applyVerticalOffsetTransformationView(n,o,i,a),this._applyPolygonOffsetView(n,o,r[3],i,n),this._applyCenterOffsetView(n,r,n),n}applyShaderOffsetsNDC(e,t,s,r,i){return this._applyCenterOffsetNDC(e,t,s,r),null!=i&&h(i,r),this._applyPolygonOffsetNDC(r,t,s,r),r}_applyPolygonOffsetView(t,s,r,i,a){const n=i.aboveGround?1:-1;let o=Math.sign(r);0===o&&(o=n);const c=n*o;if(this.parameters.shaderPolygonOffset<=0)return h(a,t);const l=e(Math.abs(s.cosAngle),.01,1),f=1-Math.sqrt(1-l*l)/l/i.viewport[2];return p(a,t,c>0?f:1/f),a}_applyVerticalGroundOffsetView(e,t,s,r){const i=m(e),a=s.aboveGround?1:-1,n=.5*s.computeRenderPixelSizeAtDist(i),o=p(ne,t.normal,a*n);return O(r,e,o),r}_applyVerticalOffsetTransformationView(e,t,s,r){const i=this.parameters;if(!i.verticalOffset||!i.verticalOffset.screenLength){if(i.screenSizePerspective||i.screenSizePerspectiveAlignment){const s=m(e);this._updateScaleInfo(r,s,t.cosAngle)}else r.factor.scale=1,r.factorAlignment.scale=1;return e}const a=m(e),n=i.screenSizePerspectiveAlignment??i.screenSizePerspective,o=Z(s,a,i.verticalOffset,t.cosAngle,n);return this._updateScaleInfo(r,a,t.cosAngle),p(t.normal,t.normal,o),O(e,e,t.normal)}_applyCenterOffsetView(e,t,s){const r="screen"!==this.parameters.centerOffsetUnits;return s!==e&&h(s,e),r&&(s[0]+=t[0],s[1]+=t[1],t[2]&&(f(oe,s),O(s,s,p(oe,oe,t[2])))),s}_applyCenterOffsetNDC(e,t,s,r){const i="screen"!==this.parameters.centerOffsetUnits;return r!==e&&h(r,e),i||(r[0]+=t[0]/s.fullWidth*2,r[1]+=t[1]/s.fullHeight*2),r}_applyPolygonOffsetNDC(e,t,s,r){const i=this.parameters.shaderPolygonOffset;if(e!==r&&h(r,e),i){const e=s.aboveGround?1:-1,a=e*Math.sign(t[3]);r[2]-=(a||e)*i}return r}produces(e,t){if(t===j.Color||t===j.Alpha||t===j.Highlight||t===j.ObjectAndLayerIdColor){if(e===M.DRAPED_MATERIAL)return!0;const{drawInSecondSlot:t,occlusionTest:s}=this.parameters;return e===(t?M.LABEL_MATERIAL:M.HUD_MATERIAL)||s&&e===M.OCCLUSION_PIXELS}return!1}createGLMaterial(e){return new ee(e)}calculateRelativeScreenBounds(e,t,s=y()){return te(this.parameters,e,t,s),s[2]=s[0]+e[0],s[3]=s[1]+e[1],s}_getScreenScale(e){const t=e.attributes.get(N.FEATUREATTRIBUTE);if(null==t)return{scaleX:1,scaleY:1};const s=v(t.data,ge),[r,i]=E(de,this.parameters,s);return{scaleX:r,scaleY:i}}}class ee extends U{constructor(e){super({...e,...e.material.parameters})}selectProgram(e){return this.ensureTechnique(K,e)}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.selectProgram(e)}}function te(e,t,s,r=ae){return a(r,e.anchorPosition),r[0]*=-t[0],r[1]*=-t[1],r[0]+=e.screenOffset[0]*s,r[1]+=e.screenOffset[1]*s,r}function se(e){const t=e[0],s=e[1],r=e[2],i=e[3],a=e[4],n=e[5],o=e[6],c=e[7],l=e[8],f=1/Math.sqrt(t*t+s*s+r*r),u=1/Math.sqrt(i*i+a*a+n*n),p=1/Math.sqrt(o*o+c*c+l*l);return e[0]=t*f,e[1]=s*f,e[2]=r*f,e[3]=i*u,e[4]=a*u,e[5]=n*u,e[6]=o*p,e[7]=c*p,e[8]=l*p,e}function re(e,t,s,r,i,a,n,o){let c=t-i-(o[0]>0?r[0]*o[0]:0),l=c+r[0]+2*i,f=s-i-(o[1]>0?r[1]*o[1]:0),u=f+r[1]+2*i;const p=n.distanceFieldBoundingBox;return n.textureIsSignedDistanceField&&null!=p&&(c+=r[0]*p[0],f+=r[1]*p[1],l-=r[0]*(1-p[2]),u-=r[1]*(1-p[3]),c-=a,l+=a,f-=a,u+=a),e[0]>c&&e[0]<l&&e[1]>f&&e[1]<u}const ie=new k,ae=n(),ne=b(),oe=b(),ce=T(),le=b(),fe=b(),ue=s(),pe=s(),he=i(),me=b(),de=T(),ge=T(),Se={normal:le,cosAngle:0},Oe=1,be=2,Ae=[0,0],ve=A(0,0,1);class Te extends D{constructor(){super(...arguments),this.renderOccluded=z.Occlude,this.isDecoration=!1,this.color=_(1,1,1,1),this.texCoordScale=[1,1],this.polygonOffset=!1,this.anchorPosition=o(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=_(1,1,1,1),this.outlineSize=0,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.centerOffsetUnits="world",this.drawInSecondSlot=!1,this.depthEnabled=!0,this.isDraped=!1}}const _e=x().vec3f(N.POSITION).vec3f(N.NORMAL).vec2f(N.UV0).vec4u8(N.COLOR).vec2f(N.SIZE).vec4f(N.AUXPOS1).vec4f(N.FEATUREATTRIBUTE),Ie=_e.clone().vec4u8(N.OBJECTANDLAYERIDCOLOR);class ye{constructor(e){this._material=e,this.vertexBufferLayout=has("enable-feature:objectAndLayerId-rendering")?Ie:_e}elementCount(e){return 6*e.attributes.get(N.POSITION).indices.length}write(e,t,s,r,i){X(s.attributes.get(N.POSITION),e,r.position,i,6),G(s.attributes.get(N.NORMAL),t,r.normal,i,6);const a=s.attributes.get(N.UV0).data;let n,o,c,l;if(null==a||a.length<4){const e=this._material.parameters;n=0,o=0,c=e.texCoordScale[0],l=e.texCoordScale[1]}else n=a[0],o=a[1],c=a[2],l=a[3];c=Math.min(1.99999,c+1),l=Math.min(1.99999,l+1);let f=s.attributes.get(N.POSITION).indices.length,u=i;const p=r.uv0;for(let g=0;g<f;++g)p.set(u,0,n),p.set(u,1,o),u++,p.set(u,0,c),p.set(u,1,o),u++,p.set(u,0,c),p.set(u,1,l),u++,p.set(u,0,c),p.set(u,1,l),u++,p.set(u,0,n),p.set(u,1,l),u++,p.set(u,0,n),p.set(u,1,o),u++;W(s.attributes.get(N.COLOR),4,r.color,i,6);const{data:h,indices:m}=s.attributes.get(N.SIZE);f=m.length;const d=r.size;u=i;for(let g=0;g<f;++g){const e=h[2*m[g]],t=h[2*m[g]+1];for(let s=0;s<6;++s)d.set(u,0,e),d.set(u,1,t),u++}if(s.attributes.get(N.AUXPOS1)?H(s.attributes.get(N.AUXPOS1),r.auxpos1,i,6):q(r.auxpos1,i,6*f),s.attributes.get(N.FEATUREATTRIBUTE)?H(s.attributes.get(N.FEATUREATTRIBUTE),r.featureAttribute,i,6):q(r.featureAttribute,i,6*f),null!=s.objectAndLayerIdColor){const e=s.attributes.get(N.POSITION)?.indices;if(e){const t=e.length,a=r.getField(N.OBJECTANDLAYERIDCOLOR,P);Y(s.objectAndLayerIdColor,a,t,i,6)}}}}export{$ as HUDMaterial,Te 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.28/esri/copyright.txt for details.
4
4
  */
5
- import{s as t,k as e}from"../../../../chunks/vec2.js";import{a as r}from"../../../../chunks/vec2f64.js";import{newLayout as s}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as i}from"../core/shaderLibrary/ShaderOutput.js";import a from"../lib/GLMaterial.js";import{Material as o}from"../lib/Material.js";import{RenderSlot as n}from"../lib/RenderSlot.js";import{VertexAttribute as u}from"../lib/VertexAttribute.js";import{writePosition as c,writeBufferFloat as l}from"./internal/bufferWriterUtils.js";import{HeatmapDensityPassParameters as f,HeatmapDensityTechniqueConfiguration as m,HeatmapDensityTechnique as T}from"../shaders/HeatmapDensityTechnique.js";const p=2;class h extends f{constructor(){super(...arguments),this.isAttributeDriven=!1,this.usesHalfFloats=!1}}class d extends o{constructor(t){super(t,new h),this._configuration=new m}produces(t,e){return t===n.DRAPED_MATERIAL&&e===i.Color}getConfiguration(){return this._configuration.isAttributeDriven=this.parameters.isAttributeDriven,this._configuration.usesHalfFloat=this.parameters.usesHalfFloats,this._configuration}createGLMaterial(t){return new A(t)}intersect(){}intersectDraped(r,s,i,a,o,n){const c=r.vertexAttributes.get(u.POSITION),{parameters:l}=this,{searchRadius:f}=l,{screenToWorldRatio:m}=r,T=f*m+p*m,h=T*T,d=c.data.length/c.size;for(let u=0;u<d;u++){const r=u*c.size,s=t(E,c.data[r],c.data[r+1]);e(s,a)<h&&o(n.dist,n.normal,-1,!1)}}createBufferWriter(){return new I(this.parameters.isAttributeDriven?g:b)}}class A extends a{beginSlot(t){return this.ensureTechnique(T,t)}}class I{constructor(t){this.vertexBufferLayout=t}elementCount(t){return t.indices.get(u.POSITION).length*v}write(t,e,r,s,i){c(r.indices.get(u.POSITION),r.vertexAttributes.get(u.POSITION).data,t,s.position,i,v);const a=r.indices.get(u.POSITION).length,o=s.uv0;let n=i;for(let u=0;u<a;++u)o.setValues(n++,-1,-1),o.setValues(n++,1,-1),o.setValues(n++,1,1),o.setValues(n++,1,1),o.setValues(n++,-1,1),o.setValues(n++,-1,-1);const f=u.FEATUREATTRIBUTE in s?s.featureAttribute:null;f&&l(r.indices.get(u.FEATUREATTRIBUTE),r.vertexAttributes.get(u.FEATUREATTRIBUTE).data,f,i,v)}}const b=s().vec3f(u.POSITION).vec2f(u.UV0),g=b.clone().f32(u.FEATUREATTRIBUTE),v=6,E=r();export{d as HeatmapDensityMaterial,h as HeatmapDensityMaterialParameters};
5
+ import{s as t,k as e}from"../../../../chunks/vec2.js";import{a as r}from"../../../../chunks/vec2f64.js";import{newLayout as s}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as i}from"../core/shaderLibrary/ShaderOutput.js";import a from"../lib/GLMaterial.js";import{Material as o}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,HeatmapDensityTechniqueConfiguration as m,HeatmapDensityTechnique as p}from"../shaders/HeatmapDensityTechnique.js";const h=2;class T extends f{constructor(){super(...arguments),this.isAttributeDriven=!1,this.usesHalfFloats=!1}}class b extends o{constructor(t){super(t,new T),this._configuration=new m}produces(t,e){return t===n.DRAPED_MATERIAL&&e===i.Color}getConfiguration(){return this._configuration.isAttributeDriven=this.parameters.isAttributeDriven,this._configuration.usesHalfFloat=this.parameters.usesHalfFloats,this._configuration}createGLMaterial(t){return new d(t)}intersect(){}intersectDraped(r,s,i,a,o,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,b=l.data.length/l.size;for(let u=0;u<b;u++){const r=u*l.size,s=t(E,l.data[r],l.data[r+1]);e(s,a)<T&&o(n.dist,n.normal,-1,!1)}}createBufferWriter(){return new g(this.parameters.isAttributeDriven?I:A)}}class d extends a{beginSlot(t){return this.ensureTechnique(p,t)}}class g{constructor(t){this.vertexBufferLayout=t}elementCount(t){return t.attributes.get(u.POSITION).indices.length*v}write(t,e,r,s,i){l(r.attributes.get(u.POSITION),t,s.position,i,v);const a=r.attributes.get(u.POSITION).indices.length,o=s.uv0;let n=i;for(let u=0;u<a;++u)o.setValues(n++,-1,-1),o.setValues(n++,1,-1),o.setValues(n++,1,1),o.setValues(n++,1,1),o.setValues(n++,-1,1),o.setValues(n++,-1,-1);const f=u.FEATUREATTRIBUTE in s?s.featureAttribute:null;f&&c(r.attributes.get(u.FEATUREATTRIBUTE),f,i,v)}}const A=s().vec3f(u.POSITION).vec2f(u.UV0),I=A.clone().f32(u.FEATUREATTRIBUTE),v=6,E=r();export{b as HeatmapDensityMaterial,T as HeatmapDensityMaterialParameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{BufferViewFloat as t}from"../../../../geometry/support/buffer/BufferView.js";import{ShaderOutput as e}from"../core/shaderLibrary/ShaderOutput.js";import{CullFaceOptions as r}from"../lib/basicInterfaces.js";import{GLTextureMaterial as i}from"../lib/GLTextureMaterial.js";import{MaterialParameters as s}from"../lib/Material.js";import{OITPolygonOffsetLimit as a}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as n}from"../lib/RenderSlot.js";import{assert as o}from"../lib/Util.js";import{VertexAttribute as u}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as l}from"./DefaultBufferWriter.js";import{PositionUVLayout as p}from"./DefaultLayouts.js";import{TriangleMaterial as c}from"./TriangleMaterial.js";import{writeBufferFloat as h,writeDefaultAttribute as m}from"./internal/bufferWriterUtils.js";import{vertexAttributeLocations as f,ImageMaterialTechniqueConfiguration as d,ImageMaterialTechnique as _}from"../shaders/ImageMaterialTechnique.js";class g extends c{constructor(t){super(t,new T),this.supportsEdges=!0,this._vertexAttributeLocations=f,this._configuration=new d}getConfiguration(t,e){return this._configuration.output=t,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.transparencyPassType=e.transparencyPassType,this._configuration.enableOffset=e.camera.relativeElevation<a,this._configuration.multipassEnabled=e.multipassEnabled,this._configuration.cullAboveGround=e.multipassTerrain.cullAboveGround,this._configuration.perspectiveInterpolation=this.parameters.perspectiveInterpolation,this._configuration}produces(t,r){if(r===e.Color||r===e.Alpha||r===e.Highlight){if(t===n.DRAPED_MATERIAL)return!0;if(r===e.Highlight)return t===n.OPAQUE_MATERIAL;return t===(this.parameters.transparent?this.parameters.writeDepth?n.TRANSPARENT_MATERIAL:n.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL:n.OPAQUE_MATERIAL)}return!1}createGLMaterial(t){return new A(t)}createBufferWriter(){const t=p.clone();return this.parameters.perspectiveInterpolation&&t.f32(u.PERSPECTIVEDIVIDE),new E(t)}}class A extends i{constructor(t){super({...t,...t.material.parameters})}_updateParameters(t){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.ensureTechnique(_,t)}_updateOccludeeState(t){t.hasOccludees!==this._material.parameters.hasOccludees&&(this._material.setParameters({hasOccludees:t.hasOccludees}),this._updateParameters(t))}beginSlot(t){return this._output!==e.Color&&this._output!==e.Alpha||this._updateOccludeeState(t),this._updateParameters(t)}}class E extends l{write(e,r,i,s,a){for(const n of this.vertexBufferLayout.fields.keys()){const l=i.vertexAttributes.get(n),p=i.indices.get(n);if(l&&p)if(n===u.PERSPECTIVEDIVIDE){o(1===l.size);const e=s.getField(n,t);e&&h(p,l.data,e,a)}else m(n,l,p,e,r,s,a)}}}class T extends s{constructor(){super(...arguments),this.transparent=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.cullFace=r.None,this.hasOccludees=!1,this.opacity=1,this.textureId=null,this.initTextureTransparent=!0,this.perspectiveInterpolation=!1}}export{g as ImageMaterial,T as Parameters};
5
+ import{BufferViewFloat as t}from"../../../../geometry/support/buffer/BufferView.js";import{ShaderOutput as e}from"../core/shaderLibrary/ShaderOutput.js";import{CullFaceOptions as r}from"../lib/basicInterfaces.js";import{GLTextureMaterial as s}from"../lib/GLTextureMaterial.js";import{MaterialParameters as i}from"../lib/Material.js";import{OITPolygonOffsetLimit as a}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as n}from"../lib/RenderSlot.js";import{assert as o}from"../lib/Util.js";import{VertexAttribute as u}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as l}from"./DefaultBufferWriter.js";import{PositionUVLayout as p}from"./DefaultLayouts.js";import{TriangleMaterial as c}from"./TriangleMaterial.js";import{writeBufferFloat as h,writeDefaultAttribute as m}from"./internal/bufferWriterUtils.js";import{vertexAttributeLocations as f,ImageMaterialTechniqueConfiguration as d,ImageMaterialTechnique as _}from"../shaders/ImageMaterialTechnique.js";class g extends c{constructor(t){super(t,new T),this.supportsEdges=!0,this._vertexAttributeLocations=f,this._configuration=new d}getConfiguration(t,e){return this._configuration.output=t,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.transparencyPassType=e.transparencyPassType,this._configuration.enableOffset=e.camera.relativeElevation<a,this._configuration.multipassEnabled=e.multipassEnabled,this._configuration.cullAboveGround=e.multipassTerrain.cullAboveGround,this._configuration.perspectiveInterpolation=this.parameters.perspectiveInterpolation,this._configuration}produces(t,r){if(r===e.Color||r===e.Alpha||r===e.Highlight){if(t===n.DRAPED_MATERIAL)return!0;if(r===e.Highlight)return t===n.OPAQUE_MATERIAL;return t===(this.parameters.transparent?this.parameters.writeDepth?n.TRANSPARENT_MATERIAL:n.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL:n.OPAQUE_MATERIAL)}return!1}createGLMaterial(t){return new E(t)}createBufferWriter(){const t=p.clone();return this.parameters.perspectiveInterpolation&&t.f32(u.PERSPECTIVEDIVIDE),new A(t)}}class E extends s{constructor(t){super({...t,...t.material.parameters})}_updateParameters(t){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.ensureTechnique(_,t)}_updateOccludeeState(t){t.hasOccludees!==this._material.parameters.hasOccludees&&(this._material.setParameters({hasOccludees:t.hasOccludees}),this._updateParameters(t))}beginSlot(t){return this._output!==e.Color&&this._output!==e.Alpha||this._updateOccludeeState(t),this._updateParameters(t)}}class A extends l{write(e,r,s,i,a){for(const n of this.vertexBufferLayout.fields.keys()){const l=s.attributes.get(n);if(l)if(n===u.PERSPECTIVEDIVIDE){o(1===l.size);const e=i.getField(n,t);e&&h(l,e,a)}else m(n,l,e,r,i,a)}}}class T extends i{constructor(){super(...arguments),this.transparent=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.cullFace=r.None,this.hasOccludees=!1,this.opacity=1,this.textureId=null,this.initTextureTransparent=!0,this.perspectiveInterpolation=!1}}export{g as ImageMaterial,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.28/esri/copyright.txt for details.
4
4
  */
5
- import{f as e}from"../../../../chunks/vec2f32.js";import{newLayout as t}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as r}from"../core/shaderLibrary/ShaderOutput.js";import{HUDSpace as i}from"../core/shaderLibrary/hud/HUD.glsl.js";import s from"../lib/GLMaterial.js";import{Material as n,MaterialParameters as a}from"../lib/Material.js";import{RenderSlot as o}from"../lib/RenderSlot.js";import{VertexAttribute as u}from"../lib/VertexAttribute.js";import{writePosition as c,writeNormal as l,writeBufferVec4 as f}from"./internal/bufferWriterUtils.js";import{LineCalloutTechnique as h}from"../shaders/LineCalloutTechnique.js";import{LineCalloutTechniqueConfiguration as d}from"../shaders/LineCalloutTechniqueConfiguration.js";class m extends n{get uniqueMaterialIdentifier(){return this._uniqueMaterialIdentifier}constructor(e){super(e,new g),this._configuration=new d,this._uniqueMaterialIdentifier=m.uniqueMaterialIdentifier(this.parameters)}getPassParameters(){return this.parameters}getConfiguration(e,t){const r=t?.slot!==o.LINE_CALLOUTS;return this._configuration.occlusionTestEnabled=this.parameters.occlusionTest,this._configuration.hasVerticalOffset=null!=this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective,this._configuration.depthHudEnabled=r,this._configuration.depthHudAlignStartEnabled=!!this.parameters.depthHUDAlignStart,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits?i.Screen:i.World,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration}intersect(){}produces(e,t){if(t===r.Color)switch(e){case o.LINE_CALLOUTS:case o.LINE_CALLOUTS_HUD_DEPTH:return!0}return!1}createGLMaterial(e){return new p(e)}createBufferWriter(){return new I}validateParameters(e){const t=m.uniqueMaterialIdentifier(e);t!==this._uniqueMaterialIdentifier&&(this._uniqueMaterialIdentifier=t)}static uniqueMaterialIdentifier(e){return JSON.stringify({horizontalScreenOffset:e.horizontalScreenOffset??0,centerOffsetUnits:e.centerOffsetUnits||"world"})}}class p extends s{beginSlot(e){return this.ensureTechnique(h,e)}}class g extends a{constructor(){super(...arguments),this.horizontalScreenOffset=0,this.color=[0,0,0,1],this.size=1,this.occlusionTest=!1,this.shaderPolygonOffset=1e-5,this.depthHUDAlignStart=!1,this.centerOffsetUnits="world",this.hasSlicePlane=!1}}const O=t().vec3f(u.POSITION).vec3f(u.NORMAL).vec2f(u.UV0).vec4f(u.AUXPOS1),S=[e(0,0),e(1,0),e(0,1),e(1,0),e(1,1),e(0,1)];class I{constructor(){this.vertexBufferLayout=O}elementCount(e){return 6*e.indices.get(u.POSITION).length}write(e,t,r,i,s){c(r.indices.get(u.POSITION),r.vertexAttributes.get(u.POSITION).data,e,i.position,s,6),l(r.indices.get(u.NORMAL),r.vertexAttributes.get(u.NORMAL).data,t,i.normal,s,6),f(r.indices.get(u.AUXPOS1),r.vertexAttributes.get(u.AUXPOS1).data,i.auxpos1,s,6);for(let n=0;n<S.length;++n)i.uv0.setVec(s+n,S[n])}}export{m as LineCalloutMaterial,g as Parameters};
5
+ import{f as e}from"../../../../chunks/vec2f32.js";import{newLayout as t}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as r}from"../core/shaderLibrary/ShaderOutput.js";import{HUDSpace as i}from"../core/shaderLibrary/hud/HUD.glsl.js";import s from"../lib/GLMaterial.js";import{Material as n,MaterialParameters as a}from"../lib/Material.js";import{RenderSlot as o}from"../lib/RenderSlot.js";import{VertexAttribute as u}from"../lib/VertexAttribute.js";import{writePosition as l,writeNormal as c,writeBufferVec4 as f}from"./internal/bufferWriterUtils.js";import{LineCalloutTechnique as h}from"../shaders/LineCalloutTechnique.js";import{LineCalloutTechniqueConfiguration as d}from"../shaders/LineCalloutTechniqueConfiguration.js";class m extends n{get uniqueMaterialIdentifier(){return this._uniqueMaterialIdentifier}constructor(e){super(e,new g),this._configuration=new d,this._uniqueMaterialIdentifier=m.uniqueMaterialIdentifier(this.parameters)}getPassParameters(){return this.parameters}getConfiguration(e,t){const r=t?.slot!==o.LINE_CALLOUTS;return this._configuration.occlusionTestEnabled=this.parameters.occlusionTest,this._configuration.hasVerticalOffset=null!=this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective,this._configuration.depthHudEnabled=r,this._configuration.depthHudAlignStartEnabled=!!this.parameters.depthHUDAlignStart,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits?i.Screen:i.World,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration}intersect(){}produces(e,t){if(t===r.Color)switch(e){case o.LINE_CALLOUTS:case o.LINE_CALLOUTS_HUD_DEPTH:return!0}return!1}createGLMaterial(e){return new p(e)}createBufferWriter(){return new b}validateParameters(e){const t=m.uniqueMaterialIdentifier(e);t!==this._uniqueMaterialIdentifier&&(this._uniqueMaterialIdentifier=t)}static uniqueMaterialIdentifier(e){return JSON.stringify({horizontalScreenOffset:e.horizontalScreenOffset??0,centerOffsetUnits:e.centerOffsetUnits||"world"})}}class p extends s{beginSlot(e){return this.ensureTechnique(h,e)}}class g extends a{constructor(){super(...arguments),this.horizontalScreenOffset=0,this.color=[0,0,0,1],this.size=1,this.occlusionTest=!1,this.shaderPolygonOffset=1e-5,this.depthHUDAlignStart=!1,this.centerOffsetUnits="world",this.hasSlicePlane=!1}}const O=t().vec3f(u.POSITION).vec3f(u.NORMAL).vec2f(u.UV0).vec4f(u.AUXPOS1),S=[e(0,0),e(1,0),e(0,1),e(1,0),e(1,1),e(0,1)];class b{constructor(){this.vertexBufferLayout=O}elementCount(e){return 6*e.attributes.get(u.POSITION).indices.length}write(e,t,r,i,s){l(r.attributes.get(u.POSITION),e,i.position,s,6),c(r.attributes.get(u.NORMAL),t,i.normal,s,6),f(r.attributes.get(u.AUXPOS1),i.auxpos1,s,6);for(let n=0;n<S.length;++n)i.uv0.setVec(s+n,S[n])}}export{m as LineCalloutMaterial,g 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.28/esri/copyright.txt for details.
4
4
  */
5
- import{s as e,G as t,e as r}from"../../../../chunks/vec3.js";import{c as i}from"../../../../chunks/vec3f64.js";import{newLayout as s}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as a}from"../core/shaderLibrary/ShaderOutput.js";import{GLTextureMaterial as o}from"../lib/GLTextureMaterial.js";import{Material as n,RenderOccludedFlag as h}from"../lib/Material.js";import{RenderSlot as c}from"../lib/RenderSlot.js";import{VertexAttribute as u}from"../lib/VertexAttribute.js";import{VisualVariablePassParameters as p}from"./VisualVariablePassParameters.js";import{vertexAttributeLocations as l,LineMarkerTechnique as m}from"../shaders/LineMarkerTechnique.js";import{LineMarkerTechniqueConfiguration as d,LineMarkerSpace as A,LineMarkerAnchor as T}from"../shaders/LineMarkerTechniqueConfiguration.js";import{CapType as _}from"../shaders/RibbonLineTechniqueConfiguration.js";class v extends n{constructor(e){super(e,new E),this._vertexAttributeLocations=l,this._configuration=new d,this._layout=this.createLayout()}getConfiguration(e,t){return this._configuration.output=e,this._configuration.space=t.slot===c.DRAPED_MATERIAL?A.Draped:this.parameters.worldSpace?A.World:A.Screen,this._configuration.hideOnShortSegments=this.parameters.hideOnShortSegments,this._configuration.hasCap=this.parameters.cap!==_.BUTT,this._configuration.anchor=this.parameters.anchor,this._configuration.hasTip=this.parameters.hasTip,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.occluder=this.parameters.renderOccluded===h.OccludeAndTransparentStencil,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}intersect(){}createLayout(){const e=s().vec3f(u.POSITION).vec2f(u.UV0).vec3f(u.AUXPOS1);return this.parameters.worldSpace&&e.vec3f(u.NORMAL),this.parameters.vvSize?e.f32(u.SIZEFEATUREATTRIBUTE):e.f32(u.SIZE),this.parameters.vvColor?e.f32(u.COLORFEATUREATTRIBUTE):e.vec4f(u.COLOR),this.parameters.vvOpacity&&e.f32(u.OPACITYFEATUREATTRIBUTE),e}createBufferWriter(){return new O(this._layout,this.parameters)}produces(e,t){if(t===a.Color||t===a.Alpha||t===a.Highlight||t===a.Depth){if(e===c.DRAPED_MATERIAL)return!0;if(this.parameters.renderOccluded===h.OccludeAndTransparentStencil)return e===c.OPAQUE_MATERIAL||e===c.OCCLUDER_MATERIAL||e===c.TRANSPARENT_OCCLUDER_MATERIAL;if(t===a.Color||t===a.Alpha){return e===(this.parameters.writeDepth?c.TRANSPARENT_MATERIAL:c.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL)}return e===c.OPAQUE_MATERIAL}return!1}createGLMaterial(e){return new f(e)}}class f extends o{constructor(){super(...arguments),this._markerPrimitive=null}dispose(){super.dispose(),this._markerTextureRepository.release(this._markerPrimitive),this._markerPrimitive=null}_updateParameters(e){const t=this._material.parameters.markerPrimitive;return t!==this._markerPrimitive&&(this._material.setParameters({markerTexture:this._markerTextureRepository.swap(t,this._markerPrimitive)}),this._markerPrimitive=t),this._material.setParameters(this.textureBindParameters),this.ensureTechnique(m,e)}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){return this._output!==a.Color&&this._output!==a.Alpha||this._updateOccludeeState(e),this._updateParameters(e)}}class E extends p{constructor(){super(...arguments),this.width=0,this.color=[1,1,1,1],this.markerPrimitive="arrow",this.placement="end",this.cap=_.BUTT,this.anchor=T.Center,this.hasTip=!1,this.worldSpace=!1,this.hideOnShortSegments=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.hasOccludees=!1,this.markerTexture=null}}class O{constructor(e,t){this.vertexBufferLayout=e,this._parameters=t}elementCount(){return"begin-end"===this._parameters.placement?12:6}write(i,s,a,o,n){const h=a.vertexAttributes.get(u.POSITION).data,c=h.length/3;let p=[1,0,0];const l=a.vertexAttributes.get(u.NORMAL);this._parameters.worldSpace&&null!=l&&(p=l.data);let m=1,d=0;this._parameters.vvSize?d=a.vertexAttributes.get(u.SIZEFEATUREATTRIBUTE).data[0]:a.vertexAttributes.has(u.SIZE)&&(m=a.vertexAttributes.get(u.SIZE).data[0]);let A=[1,1,1,1],T=0;this._parameters.vvColor?T=a.vertexAttributes.get(u.COLORFEATUREATTRIBUTE).data[0]:a.vertexAttributes.has(u.COLOR)&&(A=a.vertexAttributes.get(u.COLOR).data);let _=0;this._parameters.vvOpacity&&(_=a.vertexAttributes.get(u.OPACITYFEATUREATTRIBUTE).data[0]);const v=new Float32Array(o.buffer);let f=n*(this.vertexBufferLayout.stride/4);const E=(e,t,r,i)=>{if(v[f++]=e[0],v[f++]=e[1],v[f++]=e[2],v[f++]=r[0],v[f++]=r[1],v[f++]=t[0],v[f++]=t[1],v[f++]=t[2],this._parameters.worldSpace&&(v[f++]=p[0],v[f++]=p[1],v[f++]=p[2]),this._parameters.vvSize?v[f++]=d:v[f++]=m,this._parameters.vvColor)v[f++]=T;else{const e=Math.min(4*i,A.length-4);v[f++]=A[e],v[f++]=A[e+1],v[f++]=A[e+2],v[f++]=A[e+3]}this._parameters.vvOpacity&&(v[f++]=_)};let O;!function(e){e[e.ASCENDING=1]="ASCENDING",e[e.DESCENDING=-1]="DESCENDING"}(O||(O={}));const g=(s,a)=>{const o=e(S,h[3*s],h[3*s+1],h[3*s+2]),n=R;let u=s+a;do{e(n,h[3*u],h[3*u+1],h[3*u+2]),u+=a}while(t(o,n)&&u>=0&&u<c);i&&(r(o,o,i),r(n,n,i)),E(o,n,[-1,-1],s),E(o,n,[1,-1],s),E(o,n,[1,1],s),E(o,n,[-1,-1],s),E(o,n,[1,1],s),E(o,n,[-1,1],s)},I=this._parameters.placement;"begin"!==I&&"begin-end"!==I||g(0,O.ASCENDING),"end"!==I&&"begin-end"!==I||g(c-1,O.DESCENDING)}}const S=i(),R=i();export{v as LineMarkerMaterial,E as Parameters};
5
+ import{s as t,G as e,e as r}from"../../../../chunks/vec3.js";import{c as a}from"../../../../chunks/vec3f64.js";import{newLayout as i}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as s}from"../core/shaderLibrary/ShaderOutput.js";import{GLTextureMaterial as o}from"../lib/GLTextureMaterial.js";import{Material as n,RenderOccludedFlag as h}from"../lib/Material.js";import{RenderSlot as c}from"../lib/RenderSlot.js";import{VertexAttribute as u}from"../lib/VertexAttribute.js";import{VisualVariablePassParameters as p}from"./VisualVariablePassParameters.js";import{vertexAttributeLocations as l,LineMarkerTechnique as m}from"../shaders/LineMarkerTechnique.js";import{LineMarkerTechniqueConfiguration as d,LineMarkerSpace as T,LineMarkerAnchor as _}from"../shaders/LineMarkerTechniqueConfiguration.js";import{CapType as f}from"../shaders/RibbonLineTechniqueConfiguration.js";class A extends n{constructor(t){super(t,new v),this._vertexAttributeLocations=l,this._configuration=new d,this._layout=this.createLayout()}getConfiguration(t,e){return this._configuration.output=t,this._configuration.space=e.slot===c.DRAPED_MATERIAL?T.Draped:this.parameters.worldSpace?T.World:T.Screen,this._configuration.hideOnShortSegments=this.parameters.hideOnShortSegments,this._configuration.hasCap=this.parameters.cap!==f.BUTT,this._configuration.anchor=this.parameters.anchor,this._configuration.hasTip=this.parameters.hasTip,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.occluder=this.parameters.renderOccluded===h.OccludeAndTransparentStencil,this._configuration.transparencyPassType=e.transparencyPassType,this._configuration.multipassEnabled=e.multipassEnabled,this._configuration.cullAboveGround=e.multipassTerrain.cullAboveGround,this._configuration}intersect(){}createLayout(){const t=i().vec3f(u.POSITION).vec2f(u.UV0).vec3f(u.AUXPOS1);return this.parameters.worldSpace&&t.vec3f(u.NORMAL),this.parameters.vvSize?t.f32(u.SIZEFEATUREATTRIBUTE):t.f32(u.SIZE),this.parameters.vvColor?t.f32(u.COLORFEATUREATTRIBUTE):t.vec4f(u.COLOR),this.parameters.vvOpacity&&t.f32(u.OPACITYFEATUREATTRIBUTE),t}createBufferWriter(){return new O(this._layout,this.parameters)}produces(t,e){if(e===s.Color||e===s.Alpha||e===s.Highlight||e===s.Depth){if(t===c.DRAPED_MATERIAL)return!0;if(this.parameters.renderOccluded===h.OccludeAndTransparentStencil)return t===c.OPAQUE_MATERIAL||t===c.OCCLUDER_MATERIAL||t===c.TRANSPARENT_OCCLUDER_MATERIAL;if(e===s.Color||e===s.Alpha){return t===(this.parameters.writeDepth?c.TRANSPARENT_MATERIAL:c.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL)}return t===c.OPAQUE_MATERIAL}return!1}createGLMaterial(t){return new E(t)}}class E extends o{constructor(){super(...arguments),this._markerPrimitive=null}dispose(){super.dispose(),this._markerTextureRepository.release(this._markerPrimitive),this._markerPrimitive=null}_updateParameters(t){const e=this._material.parameters.markerPrimitive;return e!==this._markerPrimitive&&(this._material.setParameters({markerTexture:this._markerTextureRepository.swap(e,this._markerPrimitive)}),this._markerPrimitive=e),this._material.setParameters(this.textureBindParameters),this.ensureTechnique(m,t)}_updateOccludeeState(t){t.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:t.hasOccludees})}beginSlot(t){return this._output!==s.Color&&this._output!==s.Alpha||this._updateOccludeeState(t),this._updateParameters(t)}}class v extends p{constructor(){super(...arguments),this.width=0,this.color=[1,1,1,1],this.markerPrimitive="arrow",this.placement="end",this.cap=f.BUTT,this.anchor=_.Center,this.hasTip=!1,this.worldSpace=!1,this.hideOnShortSegments=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.hasOccludees=!1,this.markerTexture=null}}class O{constructor(t,e){this.vertexBufferLayout=t,this._parameters=e}elementCount(){return"begin-end"===this._parameters.placement?12:6}write(a,i,s,o,n){const h=s.attributes.get(u.POSITION).data,c=h.length/3;let p=[1,0,0];const l=s.attributes.get(u.NORMAL);this._parameters.worldSpace&&null!=l&&(p=l.data);let m=1,d=0;this._parameters.vvSize?d=s.attributes.get(u.SIZEFEATUREATTRIBUTE).data[0]:s.attributes.has(u.SIZE)&&(m=s.attributes.get(u.SIZE).data[0]);let T=[1,1,1,1],_=0;this._parameters.vvColor?_=s.attributes.get(u.COLORFEATUREATTRIBUTE).data[0]:s.attributes.has(u.COLOR)&&(T=s.attributes.get(u.COLOR).data);let f=0;this._parameters.vvOpacity&&(f=s.attributes.get(u.OPACITYFEATUREATTRIBUTE).data[0]);const A=new Float32Array(o.buffer);let E=n*(this.vertexBufferLayout.stride/4);const v=(t,e,r,a)=>{if(A[E++]=t[0],A[E++]=t[1],A[E++]=t[2],A[E++]=r[0],A[E++]=r[1],A[E++]=e[0],A[E++]=e[1],A[E++]=e[2],this._parameters.worldSpace&&(A[E++]=p[0],A[E++]=p[1],A[E++]=p[2]),this._parameters.vvSize?A[E++]=d:A[E++]=m,this._parameters.vvColor)A[E++]=_;else{const t=Math.min(4*a,T.length-4);A[E++]=T[t],A[E++]=T[t+1],A[E++]=T[t+2],A[E++]=T[t+3]}this._parameters.vvOpacity&&(A[E++]=f)};let O;!function(t){t[t.ASCENDING=1]="ASCENDING",t[t.DESCENDING=-1]="DESCENDING"}(O||(O={}));const g=(i,s)=>{const o=t(S,h[3*i],h[3*i+1],h[3*i+2]),n=R;let u=i+s;do{t(n,h[3*u],h[3*u+1],h[3*u+2]),u+=s}while(e(o,n)&&u>=0&&u<c);a&&(r(o,o,a),r(n,n,a)),v(o,n,[-1,-1],i),v(o,n,[1,-1],i),v(o,n,[1,1],i),v(o,n,[-1,-1],i),v(o,n,[1,1],i),v(o,n,[-1,1],i)},I=this._parameters.placement;"begin"!==I&&"begin-end"!==I||g(0,O.ASCENDING),"end"!==I&&"begin-end"!==I||g(c-1,O.DESCENDING)}}const S=a(),R=a();export{A as LineMarkerMaterial,v 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.28/esri/copyright.txt for details.
4
4
  */
5
- import{s as t,n as e,f as r,b as s,o,e as n}from"../../../../chunks/vec3.js";import{c as i}from"../../../../chunks/vec3f64.js";import{f as a}from"../../../../chunks/vec4f64.js";import{newLayout as c}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as u}from"../core/shaderLibrary/ShaderOutput.js";import f from"../lib/GLMaterial.js";import{Material as p,MaterialParameters as l}from"../lib/Material.js";import{RenderSlot as h}from"../lib/RenderSlot.js";import{VertexAttribute as m}from"../lib/VertexAttribute.js";import{MeasurementArrowTechniqueConfiguration as d,MeasurementArrowTechnique as g}from"../shaders/MeasurementArrowTechnique.js";class O extends p{constructor(t){super(t,new T),this._configuration=new d}getConfiguration(t,e){return this._configuration.polygonOffsetEnabled=this.parameters.polygonOffset,this._configuration.transparent=this._transparent,this._configuration.transparencyPassType=e.transparencyPassType,this._configuration}intersect(){}produces(t,e){if(e===u.Color||e===u.Alpha){return t===(this._transparent?h.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL:h.OPAQUE_MATERIAL)}return!1}createGLMaterial(t){return new A(t)}createBufferWriter(){return new j}get _transparent(){const{parameters:t}=this;return t.outlineColor[3]<1||t.stripeEvenColor[3]<1||t.stripeOddColor[3]<1}}class A extends f{beginSlot(t){return this.ensureTechnique(g,t)}}class T extends l{constructor(){super(...arguments),this.width=32,this.outlineSize=.2,this.outlineColor=a(1,.5,0,1),this.stripeEvenColor=a(1,1,1,1),this.stripeOddColor=a(1,.5,0,1),this.stripeLength=1,this.polygonOffset=!1}}const v=c().vec3f(m.POSITION).vec3f(m.NORMAL).vec2f(m.UV0).f32(m.AUXPOS1),I=i(),_=i(),b=i(),L=i(),S=i();class j{constructor(){this.vertexBufferLayout=v}elementCount(t){return 2*(t.indices.get(m.POSITION).length/2+1)}write(i,a,c,u,f){const p=c.vertexAttributes.get(m.POSITION).data,l=c.vertexAttributes.get(m.NORMAL).data,h=p.length/3,d=c&&c.indices&&c.indices.get(m.POSITION);d&&d.length!==2*(h-1)&&console.warn("MeasurementArrowMaterial does not support indices");const g=I,O=_,A=b,T=L,v=S,j=u.position,y=u.normal,E=u.uv0;let M=0;for(let m=0;m<h;++m){const c=3*m;if(t(g,p[c],p[c+1],p[c+2]),m<h-1){const o=3*(m+1);t(O,p[o],p[o+1],p[o+2]),t(v,l[o],l[o+1],l[o+2]),e(v,v),r(A,O,g),e(A,A),s(T,v,A),e(T,T)}const u=o(g,O);i&&a&&(n(g,g,i),n(O,O,i),n(T,T,a));const d=f+2*m,I=d+1;j.setVec(d,g),j.setVec(I,g),y.setVec(d,T),y.setVec(I,T),E.set(d,0,M),E.set(d,1,-1),E.set(I,0,M),E.set(I,1,1),m<h-1&&(M+=u)}const P=u.auxpos1;for(let t=0;t<2*h;++t)P.set(f+t,M)}}export{O as MeasurementArrowMaterial,T as Parameters};
5
+ import{s as t,n as e,f as r,b as s,o,e as n}from"../../../../chunks/vec3.js";import{c as i}from"../../../../chunks/vec3f64.js";import{f as a}from"../../../../chunks/vec4f64.js";import{newLayout as c}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as u}from"../core/shaderLibrary/ShaderOutput.js";import f from"../lib/GLMaterial.js";import{Material as p,MaterialParameters as l}from"../lib/Material.js";import{RenderSlot as h}from"../lib/RenderSlot.js";import{VertexAttribute as m}from"../lib/VertexAttribute.js";import{MeasurementArrowTechniqueConfiguration as d,MeasurementArrowTechnique as g}from"../shaders/MeasurementArrowTechnique.js";class O extends p{constructor(t){super(t,new b),this._configuration=new d}getConfiguration(t,e){return this._configuration.polygonOffsetEnabled=this.parameters.polygonOffset,this._configuration.transparent=this._transparent,this._configuration.transparencyPassType=e.transparencyPassType,this._configuration}intersect(){}produces(t,e){if(e===u.Color||e===u.Alpha){return t===(this._transparent?h.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL:h.OPAQUE_MATERIAL)}return!1}createGLMaterial(t){return new A(t)}createBufferWriter(){return new y}get _transparent(){const{parameters:t}=this;return t.outlineColor[3]<1||t.stripeEvenColor[3]<1||t.stripeOddColor[3]<1}}class A extends f{beginSlot(t){return this.ensureTechnique(g,t)}}class b extends l{constructor(){super(...arguments),this.width=32,this.outlineSize=.2,this.outlineColor=a(1,.5,0,1),this.stripeEvenColor=a(1,1,1,1),this.stripeOddColor=a(1,.5,0,1),this.stripeLength=1,this.polygonOffset=!1}}const T=c().vec3f(m.POSITION).vec3f(m.NORMAL).vec2f(m.UV0).f32(m.AUXPOS1),_=i(),v=i(),I=i(),L=i(),j=i();class y{constructor(){this.vertexBufferLayout=T}elementCount(t){return 2*(t.attributes.get(m.POSITION).indices.length/2+1)}write(i,a,c,u,f){const{data:p,indices:l}=c.attributes.get(m.POSITION),h=c.attributes.get(m.NORMAL).data,d=p.length/3;l&&l.length!==2*(d-1)&&console.warn("MeasurementArrowMaterial does not support indices");const g=_,O=v,A=I,b=L,T=j,y=u.position,E=u.normal,M=u.uv0;let S=0;for(let m=0;m<d;++m){const c=3*m;if(t(g,p[c],p[c+1],p[c+2]),m<d-1){const o=3*(m+1);t(O,p[o],p[o+1],p[o+2]),t(T,h[o],h[o+1],h[o+2]),e(T,T),r(A,O,g),e(A,A),s(b,T,A),e(b,b)}const u=o(g,O);i&&a&&(n(g,g,i),n(O,O,i),n(b,b,a));const l=f+2*m,_=l+1;y.setVec(l,g),y.setVec(_,g),E.setVec(l,b),E.setVec(_,b),M.set(l,0,S),M.set(l,1,-1),M.set(_,0,S),M.set(_,1,1),m<d-1&&(S+=u)}const w=u.auxpos1;for(let t=0;t<2*d;++t)w.set(f+t,S)}}export{O as MeasurementArrowMaterial,b 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.28/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{j as s}from"../../../../chunks/vec2.js";import{s as o,f as i,j as a,i as n,g as c,c as u,l,o as m}from"../../../../chunks/vec3.js";import{c as f}from"../../../../chunks/vec3f64.js";import{O as h}from"../../../../chunks/vec4f64.js";import{PlaneIndex as p}from"../../../../geometry/support/frustum.js";import{create as d,distance2 as g,fromPoints as j,closestLineSegmentPoint as A}from"../../../../geometry/support/lineSegment.js";import{create as b,fromPoints as O,signedDistance as S,normal as _}from"../../../../geometry/support/plane.js";import{ShaderOutput as L}from"../core/shaderLibrary/ShaderOutput.js";import R from"../lib/GLMaterial.js";import{Material as v,MaterialParameters as x}from"../lib/Material.js";import{RenderSlot as y}from"../lib/RenderSlot.js";import{isTranslationMatrix as E}from"../lib/Util.js";import{VertexAttribute as N}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as T}from"./DefaultBufferWriter.js";import{PositionColorLayout as M,PositionLayout as C}from"./DefaultLayouts.js";import{NativeLineTechnique as P}from"../shaders/NativeLineTechnique.js";import{NativeLineTechniqueConfiguration as w}from"../shaders/NativeLineTechniqueConfiguration.js";class I extends v{constructor(e){super(e,new U),this._configuration=new w}getConfiguration(e){return this._configuration.output=e,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVertexColors=this.parameters.hasVertexColors,this._configuration.transparent=this.parameters.color[3]<1||this.parameters.width<1,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration}intersect(t,r,f,h,d,b){if(!f.options.selectionMode||!t.visible)return;if(!E(r))return void e.getLogger("esri.views.3d.webgl-engine.materials.NativeLineMaterial").error("intersection assumes a translation-only matrix");const L=t.vertexAttributes.get(N.POSITION).data,R=f.camera,v=Z;s(v,f.point);const x=2;o(z[0],v[0]-x,v[1]+x,0),o(z[1],v[0]+x,v[1]+x,0),o(z[2],v[0]+x,v[1]-x,0),o(z[3],v[0]-x,v[1]-x,0);for(let e=0;e<4;e++)if(!R.unprojectFromRenderScreen(z[e],J[e]))return;O(R.eye,J[0],J[1],K),O(R.eye,J[1],J[2],Y),O(R.eye,J[2],J[3],$),O(R.eye,J[3],J[0],ee);let y=Number.MAX_VALUE,T=0;for(let e=0;e<L.length-5;e+=3){if(D[0]=L[e]+r[12],D[1]=L[e+1]+r[13],D[2]=L[e+2]+r[14],k[0]=L[e+3]+r[12],k[1]=L[e+4]+r[13],k[2]=L[e+5]+r[14],S(K,D)<0&&S(K,k)<0||S(Y,D)<0&&S(Y,k)<0||S($,D)<0&&S($,k)<0||S(ee,D)<0&&S(ee,k)<0)continue;if(R.projectToRenderScreen(D,W),R.projectToRenderScreen(k,X),W[2]<0&&X[2]>0){i(q,D,k);const e=R.frustum,t=-S(e[p.NEAR],D)/a(q,_(e[p.NEAR]));n(q,q,t),c(D,D,q),R.projectToRenderScreen(D,W)}else if(W[2]>0&&X[2]<0){i(q,k,D);const e=R.frustum,t=-S(e[p.NEAR],k)/a(q,_(e[p.NEAR]));n(q,q,t),c(k,k,q),R.projectToRenderScreen(k,X)}else if(W[2]<0&&X[2]<0)continue;W[2]=0,X[2]=0;const t=g(j(W,X,H),v);t<y&&(y=t,u(G,D),u(F,k),T=e/3)}const M=f.rayBegin,C=f.rayEnd;if(y<x*x){let e=Number.MAX_VALUE;if(A(j(G,F,H),j(M,C,Q),B)){i(B,B,M);const t=l(B);n(B,B,1/t),e=t/m(M,C)}b(e,B,T,!1)}}intersectDraped(e,r,s,o,i,a){if(!s.options.selectionMode)return;const n=e.vertexAttributes.get(N.POSITION).data,c=e.vertexAttributes.get(N.SIZE),u=c?c.data[0]:0,l=o[0],m=o[1],f=((u+1)/2+4)*e.screenToWorldRatio;let h=Number.MAX_VALUE,p=0;for(let d=0;d<n.length-5;d+=3){const e=n[d],r=n[d+1],s=l-e,o=m-r,i=n[d+3]-e,a=n[d+4]-r,c=t((i*s+a*o)/(i*i+a*a),0,1),u=i*c-s,f=a*c-o,g=u*u+f*f;g<h&&(h=g,p=d/3)}h<f*f&&i(a.dist,a.normal,p,!1)}produces(e,t){return!(t!==L.Color&&t!==L.Highlight&&t!==L.ObjectAndLayerIdColor||e!==y.OPAQUE_MATERIAL&&e!==y.DRAPED_MATERIAL)}createGLMaterial(e){return new V(e)}createBufferWriter(){const e=this.parameters.hasVertexColors?M:C;return new T(e)}}class V extends R{_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){return this._output===L.Color&&this._updateOccludeeState(e),this.ensureTechnique(P,e)}}class U extends x{constructor(){super(...arguments),this.color=h,this.hasVertexColors=!1,this.hasSlicePlane=!1,this.width=1,this.hasOccludees=!1}}const D=f(),k=f(),q=f(),B=f(),W=r(),X=r(),G=f(),F=f(),H=d(),Q=d(),Z=f(),z=[r(),r(),r(),r()],J=[f(),f(),f(),f()],K=b(),Y=b(),$=b(),ee=b();export{I as NativeLineMaterial,U as Parameters};
5
+ import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{j as s}from"../../../../chunks/vec2.js";import{s as o,f as i,j as a,i as n,g as c,c as u,l,o as m}from"../../../../chunks/vec3.js";import{c as f}from"../../../../chunks/vec3f64.js";import{O as h}from"../../../../chunks/vec4f64.js";import{PlaneIndex as p}from"../../../../geometry/support/frustum.js";import{create as d,distance2 as g,fromPoints as j,closestLineSegmentPoint as A}from"../../../../geometry/support/lineSegment.js";import{create as b,fromPoints as O,signedDistance as S,normal as _}from"../../../../geometry/support/plane.js";import{ShaderOutput as L}from"../core/shaderLibrary/ShaderOutput.js";import R from"../lib/GLMaterial.js";import{Material as y,MaterialParameters as E}from"../lib/Material.js";import{RenderSlot as N}from"../lib/RenderSlot.js";import{isTranslationMatrix as T}from"../lib/Util.js";import{VertexAttribute as M}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as v}from"./DefaultBufferWriter.js";import{PositionColorLayout as x,PositionLayout as C}from"./DefaultLayouts.js";import{NativeLineTechnique as P}from"../shaders/NativeLineTechnique.js";import{NativeLineTechniqueConfiguration as w}from"../shaders/NativeLineTechniqueConfiguration.js";class I extends y{constructor(e){super(e,new U),this._configuration=new w}getConfiguration(e){return this._configuration.output=e,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVertexColors=this.parameters.hasVertexColors,this._configuration.transparent=this.parameters.color[3]<1||this.parameters.width<1,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration}intersect(t,r,f,h,d,b){if(!f.options.selectionMode||!t.visible)return;if(!T(r))return void e.getLogger("esri.views.3d.webgl-engine.materials.NativeLineMaterial").error("intersection assumes a translation-only matrix");const L=t.attributes.get(M.POSITION).data,R=f.camera,y=Z;s(y,f.point);const E=2;o(z[0],y[0]-E,y[1]+E,0),o(z[1],y[0]+E,y[1]+E,0),o(z[2],y[0]+E,y[1]-E,0),o(z[3],y[0]-E,y[1]-E,0);for(let e=0;e<4;e++)if(!R.unprojectFromRenderScreen(z[e],J[e]))return;O(R.eye,J[0],J[1],K),O(R.eye,J[1],J[2],Y),O(R.eye,J[2],J[3],$),O(R.eye,J[3],J[0],ee);let N=Number.MAX_VALUE,v=0;for(let e=0;e<L.length-5;e+=3){if(D[0]=L[e]+r[12],D[1]=L[e+1]+r[13],D[2]=L[e+2]+r[14],k[0]=L[e+3]+r[12],k[1]=L[e+4]+r[13],k[2]=L[e+5]+r[14],S(K,D)<0&&S(K,k)<0||S(Y,D)<0&&S(Y,k)<0||S($,D)<0&&S($,k)<0||S(ee,D)<0&&S(ee,k)<0)continue;if(R.projectToRenderScreen(D,W),R.projectToRenderScreen(k,X),W[2]<0&&X[2]>0){i(q,D,k);const e=R.frustum,t=-S(e[p.NEAR],D)/a(q,_(e[p.NEAR]));n(q,q,t),c(D,D,q),R.projectToRenderScreen(D,W)}else if(W[2]>0&&X[2]<0){i(q,k,D);const e=R.frustum,t=-S(e[p.NEAR],k)/a(q,_(e[p.NEAR]));n(q,q,t),c(k,k,q),R.projectToRenderScreen(k,X)}else if(W[2]<0&&X[2]<0)continue;W[2]=0,X[2]=0;const t=g(j(W,X,H),y);t<N&&(N=t,u(G,D),u(F,k),v=e/3)}const x=f.rayBegin,C=f.rayEnd;if(N<E*E){let e=Number.MAX_VALUE;if(A(j(G,F,H),j(x,C,Q),B)){i(B,B,x);const t=l(B);n(B,B,1/t),e=t/m(x,C)}b(e,B,v,!1)}}intersectDraped(e,r,s,o,i,a){if(!s.options.selectionMode)return;const n=e.attributes.get(M.POSITION).data,c=e.attributes.get(M.SIZE),u=c?c.data[0]:0,l=o[0],m=o[1],f=((u+1)/2+4)*e.screenToWorldRatio;let h=Number.MAX_VALUE,p=0;for(let d=0;d<n.length-5;d+=3){const e=n[d],r=n[d+1],s=l-e,o=m-r,i=n[d+3]-e,a=n[d+4]-r,c=t((i*s+a*o)/(i*i+a*a),0,1),u=i*c-s,f=a*c-o,g=u*u+f*f;g<h&&(h=g,p=d/3)}h<f*f&&i(a.dist,a.normal,p,!1)}produces(e,t){return!(t!==L.Color&&t!==L.Highlight&&t!==L.ObjectAndLayerIdColor||e!==N.OPAQUE_MATERIAL&&e!==N.DRAPED_MATERIAL)}createGLMaterial(e){return new V(e)}createBufferWriter(){const e=this.parameters.hasVertexColors?x:C;return new v(e)}}class V extends R{_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){return this._output===L.Color&&this._updateOccludeeState(e),this.ensureTechnique(P,e)}}class U extends E{constructor(){super(...arguments),this.color=h,this.hasVertexColors=!1,this.hasSlicePlane=!1,this.width=1,this.hasOccludees=!1}}const D=f(),k=f(),q=f(),B=f(),W=r(),X=r(),G=f(),F=f(),H=d(),Q=d(),Z=f(),z=[r(),r(),r(),r()],J=[f(),f(),f(),f()],K=b(),Y=b(),$=b(),ee=b();export{I as NativeLineMaterial,U 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.28/esri/copyright.txt for details.
4
4
  */
5
- import{f as t}from"../../../../chunks/vec4f64.js";import{BufferViewMat3f as e,BufferViewVec4f as r}from"../../../../geometry/support/buffer/BufferView.js";import{newLayout as i}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as s}from"../core/shaderLibrary/ShaderOutput.js";import{CullFaceOptions as a}from"../lib/basicInterfaces.js";import o from"../lib/GLMaterial.js";import{OITPolygonOffsetLimit as n}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as h}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{Style as p}from"./PatternStyle.js";import{TriangleMaterial as f}from"./TriangleMaterial.js";import{VisualVariablePassParameters as m}from"./VisualVariablePassParameters.js";import{writeDefaultAttribute as d,writeBufferVec4 as g}from"./internal/bufferWriterUtils.js";import{vertexAttributeLocations as _,PatternTechniqueConfiguration as A,PatternTechnique as T}from"../shaders/PatternTechnique.js";class b extends f{constructor(t){super(t,new P),this.supportsEdges=!0,this._vertexAttributeLocations=_,this._configuration=new A}getConfiguration(t,e){return this._configuration.output=t,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasVertexColors=this.parameters.hasVertexColors&&!this.parameters.vvColor,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.style=this.parameters.style,this._configuration.patternSpacing=this.parameters.patternSpacing,this._configuration.lineWidth=this.parameters.lineWidth,this._configuration.draped=this.parameters.draped,this._configuration.transparencyPassType=e.transparencyPassType,this._configuration.enableOffset=e.camera.relativeElevation<n,this._configuration.multipassEnabled=e.multipassEnabled,this._configuration.cullAboveGround=e.multipassTerrain.cullAboveGround,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration}produces(t,e){if(e===s.Color||e===s.Alpha||e===s.Highlight||e===s.Depth&&this.parameters.writeLinearDepth){if(t===h.DRAPED_MATERIAL)return!0;if(e===s.Highlight)return t===h.OPAQUE_MATERIAL;return t===(this.parameters.writeDepth?h.TRANSPARENT_MATERIAL:h.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL)}return!1}createGLMaterial(t){return new E(t)}createBufferWriter(){const t=i().vec3f(l.POSITION).vec4f(l.UVMAPSPACE);return this.parameters.draped||t.mat3f(l.BOUNDINGRECT),this.parameters.vvColor?t.f32(l.COLORFEATUREATTRIBUTE):t.vec4u8(l.COLOR),new O(t)}}class E extends o{_updateParameters(t){return this.ensureTechnique(T,t)}_updateOccludeeState(t){t.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:t.hasOccludees})}beginSlot(t){return this._output!==s.Color&&this._output!==s.Alpha||this._updateOccludeeState(t),this._updateParameters(t)}}class O extends c{write(t,i,s,a,o){for(const n of this.vertexBufferLayout.fields.keys()){const h=s.vertexAttributes.get(n),c=s.indices.get(n);if(h&&c)switch(n){case l.UVMAPSPACE:{u(4===h.size);const t=a.getField(n,r);t&&g(c,h.data,t,o);break}case l.BOUNDINGRECT:{u(9===h.size);const r=a.getField(n,e);r&&this.writeBoundingRect(c,h.data,t,r,o);break}default:d(n,h,c,t,i,a,o)}}}writeBoundingRect(t,e,r,i,s){const a=r,o=i.typedBuffer,n=i.typedBufferStride,h=t.length;s*=n;for(let u=0;u<h;++u){const r=9*t[u],i=e[r],h=e[r+1],l=e[r+2];o[s]=a[0]*i+a[4]*h+a[8]*l+a[12],o[s+1]=a[1]*i+a[5]*h+a[9]*l+a[13],o[s+2]=a[2]*i+a[6]*h+a[10]*l+a[14];for(let t=3;t<9;++t)o[s+t]=e[r+t];s+=n}}}class P extends m{constructor(){super(...arguments),this.color=t(1,1,1,1),this.writeDepth=!0,this.writeLinearDepth=!1,this.hasVertexColors=!1,this.polygonOffset=!1,this.hasSlicePlane=!1,this.cullFace=a.None,this.hasOccludees=!1,this.style=p.Cross,this.patternSpacing=10,this.lineWidth=1,this.draped=!0}}export{P as Parameters,b as PatternMaterial};
5
+ import{f as t}from"../../../../chunks/vec4f64.js";import{BufferViewMat3f as e,BufferViewVec4f as r}from"../../../../geometry/support/buffer/BufferView.js";import{newLayout as i}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as s}from"../core/shaderLibrary/ShaderOutput.js";import{CullFaceOptions as a}from"../lib/basicInterfaces.js";import o from"../lib/GLMaterial.js";import{OITPolygonOffsetLimit as n}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as h}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{Style as p}from"./PatternStyle.js";import{TriangleMaterial as f}from"./TriangleMaterial.js";import{VisualVariablePassParameters as m}from"./VisualVariablePassParameters.js";import{writeDefaultAttribute as d,writeBufferVec4 as g}from"./internal/bufferWriterUtils.js";import{vertexAttributeLocations as _,PatternTechniqueConfiguration as A,PatternTechnique as T}from"../shaders/PatternTechnique.js";class b extends f{constructor(t){super(t,new P),this.supportsEdges=!0,this._vertexAttributeLocations=_,this._configuration=new A}getConfiguration(t,e){return this._configuration.output=t,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasVertexColors=this.parameters.hasVertexColors&&!this.parameters.vvColor,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.style=this.parameters.style,this._configuration.patternSpacing=this.parameters.patternSpacing,this._configuration.lineWidth=this.parameters.lineWidth,this._configuration.draped=this.parameters.draped,this._configuration.transparencyPassType=e.transparencyPassType,this._configuration.enableOffset=e.camera.relativeElevation<n,this._configuration.multipassEnabled=e.multipassEnabled,this._configuration.cullAboveGround=e.multipassTerrain.cullAboveGround,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration}produces(t,e){if(e===s.Color||e===s.Alpha||e===s.Highlight||e===s.Depth&&this.parameters.writeLinearDepth){if(t===h.DRAPED_MATERIAL)return!0;if(e===s.Highlight)return t===h.OPAQUE_MATERIAL;return t===(this.parameters.writeDepth?h.TRANSPARENT_MATERIAL:h.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL)}return!1}createGLMaterial(t){return new E(t)}createBufferWriter(){const t=i().vec3f(l.POSITION).vec4f(l.UVMAPSPACE);return this.parameters.draped||t.mat3f(l.BOUNDINGRECT),this.parameters.vvColor?t.f32(l.COLORFEATUREATTRIBUTE):t.vec4u8(l.COLOR),new O(t)}}class E extends o{_updateParameters(t){return this.ensureTechnique(T,t)}_updateOccludeeState(t){t.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:t.hasOccludees})}beginSlot(t){return this._output!==s.Color&&this._output!==s.Alpha||this._updateOccludeeState(t),this._updateParameters(t)}}class O extends c{write(t,i,s,a,o){for(const n of this.vertexBufferLayout.fields.keys()){const h=s.attributes.get(n),c=h?.indices;if(h&&c)switch(n){case l.UVMAPSPACE:{u(4===h.size);const t=a.getField(n,r);t&&g(h,t,o);break}case l.BOUNDINGRECT:{u(9===h.size);const r=a.getField(n,e);r&&this.writeBoundingRect(h,t,r,o);break}default:d(n,h,t,i,a,o)}}}writeBoundingRect(t,e,r,i){const{data:s,indices:a}=t,o=e,n=r.typedBuffer,h=r.typedBufferStride,u=a.length;i*=h;for(let l=0;l<u;++l){const t=9*a[l],e=s[t],r=s[t+1],u=s[t+2];n[i]=o[0]*e+o[4]*r+o[8]*u+o[12],n[i+1]=o[1]*e+o[5]*r+o[9]*u+o[13],n[i+2]=o[2]*e+o[6]*r+o[10]*u+o[14];for(let a=3;a<9;++a)n[i+a]=s[t+a];i+=h}}}class P extends m{constructor(){super(...arguments),this.color=t(1,1,1,1),this.writeDepth=!0,this.writeLinearDepth=!1,this.hasVertexColors=!1,this.polygonOffset=!1,this.hasSlicePlane=!1,this.cullFace=a.None,this.hasOccludees=!1,this.style=p.Cross,this.patternSpacing=10,this.lineWidth=1,this.draped=!0}}export{P as Parameters,b as PatternMaterial};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{j as s}from"../../../../chunks/vec2.js";import{s as i,f as a,j as n,i as o,g as l,c as u,l as c,o as h,e as p}from"../../../../chunks/vec3.js";import{c as f}from"../../../../chunks/vec3f64.js";import{O as m}from"../../../../chunks/vec4f64.js";import{PlaneIndex as T}from"../../../../geometry/support/frustum.js";import{create as d,distance2 as A,fromPoints as _,closestLineSegmentPoint as E}from"../../../../geometry/support/lineSegment.js";import{create as R,fromPoints as I,signedDistance as g,normal as S}from"../../../../geometry/support/plane.js";import{newLayout as v}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as O}from"../core/shaderLibrary/ShaderOutput.js";import b from"../lib/GLMaterial.js";import{Material as P,RenderOccludedFlag as L}from"../lib/Material.js";import{RenderSlot as N}from"../lib/RenderSlot.js";import{isTranslationMatrix as C}from"../lib/Util.js";import{VertexAttribute as y}from"../lib/VertexAttribute.js";import{VisualVariablePassParameters as j}from"./VisualVariablePassParameters.js";import{LineMarkerAnchor as U}from"../shaders/LineMarkerTechniqueConfiguration.js";import{r as x}from"../../../../chunks/RibbonLine.glsl.js";import{vertexAttributeLocations as D,RibbonLineTechnique as F}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as w,CapType as B}from"../shaders/RibbonLineTechniqueConfiguration.js";var J;!function(e){e[e.LEFT_JOIN_START=-2]="LEFT_JOIN_START",e[e.LEFT_JOIN_END=-1]="LEFT_JOIN_END",e[e.LEFT_CAP_START=-4]="LEFT_CAP_START",e[e.LEFT_CAP_END=-5]="LEFT_CAP_END",e[e.RIGHT_JOIN_START=2]="RIGHT_JOIN_START",e[e.RIGHT_JOIN_END=1]="RIGHT_JOIN_END",e[e.RIGHT_CAP_START=4]="RIGHT_CAP_START",e[e.RIGHT_CAP_END=5]="RIGHT_CAP_END"}(J||(J={}));class M extends P{constructor(e){super(e,new z),this._configuration=new w,this._vertexAttributeLocations=D}isClosed(e,t){return V(this.parameters,e,t)}getConfiguration(e,t){this._configuration.output=e,this._configuration.draped=t.slot===N.DRAPED_MATERIAL;const r=null!=this.parameters.stipplePattern&&e!==O.Highlight;return this._configuration.stippleEnabled=r,this._configuration.stippleOffColorEnabled=r&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=r&&this.parameters.stipplePreferContinuous,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&W(this.parameters.markerParameters),this._configuration.hasPolygonOffset=this.parameters.hasPolygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.occluder=this.parameters.renderOccluded===L.OccludeAndTransparentStencil,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration.wireframe=this.parameters.wireframe,this._configuration}intersectDraped(e,r,s,i,a,n){if(!s.options.selectionMode)return;const o=e.vertexAttributes.get(y.POSITION).data,l=e.vertexAttributes.get(y.SIZE);let u=this.parameters.width;if(this.parameters.vvSize){const r=e.vertexAttributes.get(y.SIZEFEATUREATTRIBUTE).data[0];u*=t(this.parameters.vvSize.offset[0]+r*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else l&&(u*=l.data[0]);const c=i[0],h=i[1],p=(u/2+4)*e.screenToWorldRatio;let f=Number.MAX_VALUE,m=0;for(let T=0;T<o.length-5;T+=3){const e=o[T],r=o[T+1],s=c-e,i=h-r,a=o[T+3]-e,n=o[T+4]-r,l=t((a*s+n*i)/(a*a+n*n),0,1),u=a*l-s,p=n*l-i,d=u*u+p*p;d<f&&(f=d,m=T/3)}f<p*p&&a(n.dist,n.normal,m,!1)}intersect(r,p,f,m,d,R){if(!f.options.selectionMode||!r.visible)return;if(!C(p))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const v=r.vertexAttributes,O=v.get(y.POSITION).data;let b=this.parameters.width;if(this.parameters.vvSize){const e=v.get(y.SIZEFEATUREATTRIBUTE).data[0];b*=t(this.parameters.vvSize.offset[0]+e*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else v.has(y.SIZE)&&(b*=v.get(y.SIZE).data[0]);const P=f.camera,L=K;s(L,f.point);const N=b*P.pixelRatio/2+4*P.pixelRatio;i(le[0],L[0]-N,L[1]+N,0),i(le[1],L[0]+N,L[1]+N,0),i(le[2],L[0]+N,L[1]-N,0),i(le[3],L[0]-N,L[1]-N,0);for(let e=0;e<4;e++)if(!P.unprojectFromRenderScreen(le[e],ue[e]))return;I(P.eye,ue[0],ue[1],ce),I(P.eye,ue[1],ue[2],he),I(P.eye,ue[2],ue[3],pe),I(P.eye,ue[3],ue[0],fe);let j=Number.MAX_VALUE,U=0;const x=Z(this.parameters,v,r.indices)?O.length-2:O.length-5;for(let e=0;e<x;e+=3){Y[0]=O[e]+p[12],Y[1]=O[e+1]+p[13],Y[2]=O[e+2]+p[14];const t=(e+3)%O.length;if(X[0]=O[t]+p[12],X[1]=O[t+1]+p[13],X[2]=O[t+2]+p[14],g(ce,Y)<0&&g(ce,X)<0||g(he,Y)<0&&g(he,X)<0||g(pe,Y)<0&&g(pe,X)<0||g(fe,Y)<0&&g(fe,X)<0)continue;if(P.projectToRenderScreen(Y,$),P.projectToRenderScreen(X,ee),$[2]<0&&ee[2]>0){a(q,Y,X);const e=P.frustum,t=-g(e[T.NEAR],Y)/n(q,S(e[T.NEAR]));o(q,q,t),l(Y,Y,q),P.projectToRenderScreen(Y,$)}else if($[2]>0&&ee[2]<0){a(q,X,Y);const e=P.frustum,t=-g(e[T.NEAR],X)/n(q,S(e[T.NEAR]));o(q,q,t),l(X,X,q),P.projectToRenderScreen(X,ee)}else if($[2]<0&&ee[2]<0)continue;$[2]=0,ee[2]=0;const r=A(_($,ee,se),L);r<j&&(j=r,u(te,Y),u(re,X),U=e/3)}const D=f.rayBegin,F=f.rayEnd;if(j<N*N){let e=Number.MAX_VALUE;if(E(_(te,re,se),_(D,F,ie),Q)){a(Q,Q,D);const t=c(Q);o(Q,Q,1/t),e=t/h(D,F)}R(e,Q,U,!1)}}get _layout(){const e=v().vec3f(y.POSITION).f32(y.SUBDIVISIONFACTOR).vec2f(y.UV0).vec3f(y.AUXPOS1).vec3f(y.AUXPOS2);return this.parameters.vvSize?e.f32(y.SIZEFEATUREATTRIBUTE):e.f32(y.SIZE),this.parameters.vvColor?e.f32(y.COLORFEATUREATTRIBUTE):e.vec4f(y.COLOR),this.parameters.vvOpacity&&e.f32(y.OPACITYFEATUREATTRIBUTE),has("enable-feature:objectAndLayerId-rendering")&&e.vec4u8(y.OBJECTANDLAYERIDCOLOR),e}createBufferWriter(){return new H(this._layout,this.parameters)}produces(e,t){if(t===O.Color||t===O.Alpha||t===O.Highlight||t===O.Depth||t===O.ObjectAndLayerIdColor){if(e===N.DRAPED_MATERIAL)return!0;if(this.parameters.renderOccluded===L.OccludeAndTransparentStencil)return e===N.OPAQUE_MATERIAL||e===N.OCCLUDER_MATERIAL||e===N.TRANSPARENT_OCCLUDER_MATERIAL;if(t===O.Color||t===O.Alpha){return e===(this.parameters.writeDepth?N.TRANSPARENT_MATERIAL:N.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL)}return e===N.OPAQUE_MATERIAL}return!1}createGLMaterial(e){return new G(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}}class G extends b{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextureRepository.release(this._stipplePattern),this._stipplePattern=null}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){this._output!==O.Color&&this._output!==O.Alpha||this._updateOccludeeState(e);const t=this._material.parameters.stipplePattern;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextureRepository.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.ensureTechnique(F,e)}}class z extends j{constructor(){super(...arguments),this.width=0,this.color=m,this.join="miter",this.cap=B.BUTT,this.miterLimit=5,this.writeDepth=!0,this.hasPolygonOffset=!1,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.hasOccludees=!1,this.wireframe=!1}}class H{constructor(e,t){this.vertexBufferLayout=e,this._parameters=t,this.numJoinSubdivisions=0;const r=t.stipplePattern?1:0;switch(this._parameters.join){case"miter":case"bevel":this.numJoinSubdivisions=r;break;case"round":this.numJoinSubdivisions=x+r}}_isClosed(e){return Z(this._parameters,e.vertexAttributes,e.indices)}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){const t=2,r=e.indices.get(y.POSITION).length/2+1,s=this._isClosed(e);let i=s?2:2*t;return i+=((s?r:r-1)-(s?0:1))*(2*this.numJoinSubdivisions+4),i+=2,this._parameters.wireframe&&(i=2+4*(i-2)),i}write(e,t,r,s,a){const n=ae,o=ne,l=oe,c=r.vertexAttributes.get(y.POSITION).data,f=r.indices&&r.indices.get(y.POSITION),m=r.vertexAttributes.get(y.DISTANCETOSTART)?.data;f&&f.length!==2*(c.length/3-1)&&console.warn("RibbonLineMaterial does not support indices");let T=1,d=0;const A=this.vertexBufferLayout.fields.has(y.SIZEFEATUREATTRIBUTE);A?d=r.vertexAttributes.get(y.SIZEFEATUREATTRIBUTE).data[0]:r.vertexAttributes.has(y.SIZE)&&(T=r.vertexAttributes.get(y.SIZE).data[0]);let _=[1,1,1,1],E=0;const R=this.vertexBufferLayout.fields.has(y.COLORFEATUREATTRIBUTE);R?E=r.vertexAttributes.get(y.COLORFEATUREATTRIBUTE).data[0]:r.vertexAttributes.has(y.COLOR)&&(_=r.vertexAttributes.get(y.COLOR).data);const I=has("enable-feature:objectAndLayerId-rendering")?r.objectAndLayerIdColor:null;let g=0;const S=this.vertexBufferLayout.fields.has(y.OPACITYFEATUREATTRIBUTE);S&&(g=r.vertexAttributes.get(y.OPACITYFEATUREATTRIBUTE).data[0]);const v=c.length/3,O=new Float32Array(s.buffer),b=has("enable-feature:objectAndLayerId-rendering")?new Uint8Array(s.buffer):null,P=this.vertexBufferLayout.stride/4;let L=a*P;const N=L;let C=0;const j=m?(e,t,r)=>C=m[r]:(e,t,r)=>C+=h(e,t),U=has("enable-feature:objectAndLayerId-rendering"),x=(e,t,r,s,i,a,n)=>{if(O[L++]=t[0],O[L++]=t[1],O[L++]=t[2],O[L++]=s,O[L++]=n,O[L++]=i,O[L++]=e[0],O[L++]=e[1],O[L++]=e[2],O[L++]=r[0],O[L++]=r[1],O[L++]=r[2],O[L++]=A?d:T,R)O[L++]=E;else{const e=Math.min(4*a,_.length-4);O[L++]=_[e],O[L++]=_[e+1],O[L++]=_[e+2],O[L++]=_[e+3]}S&&(O[L++]=g),U&&(null!=I&&(b[4*L]=I[0],b[4*L+1]=I[1],b[4*L+2]=I[2],b[4*L+3]=I[3]),L++)};L+=P,i(o,c[0],c[1],c[2]),e&&p(o,o,e);const D=this._isClosed(r);if(D){const t=c.length-3;i(n,c[t],c[t+1],c[t+2]),e&&p(n,n,e)}else i(l,c[3],c[4],c[5]),e&&p(l,l,e),x(o,o,l,1,J.LEFT_CAP_START,0,0),x(o,o,l,1,J.RIGHT_CAP_START,0,0),u(n,o),u(o,l);const F=D?0:1,w=D?v:v-1;for(let h=F;h<w;h++){const t=(h+1)%v*3;i(l,c[t],c[t+1],c[t+2]),e&&p(l,l,e),j(n,o,h),x(n,o,l,0,J.LEFT_JOIN_END,h,C),x(n,o,l,0,J.RIGHT_JOIN_END,h,C);const r=this.numJoinSubdivisions;for(let e=0;e<r;++e){const t=(e+1)/(r+1);x(n,o,l,t,J.LEFT_JOIN_END,h,C),x(n,o,l,t,J.RIGHT_JOIN_END,h,C)}x(n,o,l,1,J.LEFT_JOIN_START,h,C),x(n,o,l,1,J.RIGHT_JOIN_START,h,C),u(n,o),u(o,l)}D?(i(l,c[3],c[4],c[5]),e&&p(l,l,e),C=j(n,o,w),x(n,o,l,0,J.LEFT_JOIN_END,F,C),x(n,o,l,0,J.RIGHT_JOIN_END,F,C)):(C=j(n,o,w),x(n,o,o,0,J.LEFT_CAP_END,w,C),x(n,o,o,0,J.RIGHT_CAP_END,w,C)),k(O,N+P,O,N,P);L=k(O,L-P,O,L,P),this._parameters.wireframe&&this._addWireframeVertices(s,N,L,P)}_addWireframeVertices(e,t,r,s){const i=new Float32Array(e.buffer,r*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,r-t);let n=0;const o=e=>n=k(a,e,i,n,s);for(let l=0;l<a.length-1;l+=2*s)o(l),o(l+2*s),o(l+1*s),o(l+2*s),o(l+1*s),o(l+3*s)}}function k(e,t,r,s,i){for(let a=0;a<i;a++)r[s++]=e[t++];return s}function Z(e,t,r){return V(e,t.get(y.POSITION).data,r?r.get(y.POSITION):null)}function V(e,t,r){return!!e.isClosed&&(r?r.length>2:t.length>6)}function W(e){return e.anchor===U.Tip&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}const Y=f(),X=f(),q=f(),Q=f(),K=f(),$=r(),ee=r(),te=f(),re=f(),se=d(),ie=d(),ae=f(),ne=f(),oe=f(),le=[r(),r(),r(),r()],ue=[f(),f(),f(),f()],ce=R(),he=R(),pe=R(),fe=R();export{z as Parameters,M as RibbonLineMaterial};
5
+ import has from"../../../../core/has.js";import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{j as s}from"../../../../chunks/vec2.js";import{s as i,f as a,j as n,i as o,g as l,c as u,l as c,o as h,e as p}from"../../../../chunks/vec3.js";import{c as f}from"../../../../chunks/vec3f64.js";import{O as m}from"../../../../chunks/vec4f64.js";import{PlaneIndex as T}from"../../../../geometry/support/frustum.js";import{create as d,distance2 as _,fromPoints as E,closestLineSegmentPoint as A}from"../../../../geometry/support/lineSegment.js";import{create as R,fromPoints as I,signedDistance as S,normal as g}from"../../../../geometry/support/plane.js";import{newLayout as O}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as b}from"../core/shaderLibrary/ShaderOutput.js";import v from"../lib/GLMaterial.js";import{Material as L,RenderOccludedFlag as P}from"../lib/Material.js";import{RenderSlot as N}from"../lib/RenderSlot.js";import{isTranslationMatrix as C}from"../lib/Util.js";import{VertexAttribute as y}from"../lib/VertexAttribute.js";import{VisualVariablePassParameters as j}from"./VisualVariablePassParameters.js";import{LineMarkerAnchor as U}from"../shaders/LineMarkerTechniqueConfiguration.js";import{r as D}from"../../../../chunks/RibbonLine.glsl.js";import{vertexAttributeLocations as F,RibbonLineTechnique as w}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as B,CapType as J}from"../shaders/RibbonLineTechniqueConfiguration.js";var M;!function(e){e[e.LEFT_JOIN_START=-2]="LEFT_JOIN_START",e[e.LEFT_JOIN_END=-1]="LEFT_JOIN_END",e[e.LEFT_CAP_START=-4]="LEFT_CAP_START",e[e.LEFT_CAP_END=-5]="LEFT_CAP_END",e[e.RIGHT_JOIN_START=2]="RIGHT_JOIN_START",e[e.RIGHT_JOIN_END=1]="RIGHT_JOIN_END",e[e.RIGHT_CAP_START=4]="RIGHT_CAP_START",e[e.RIGHT_CAP_END=5]="RIGHT_CAP_END"}(M||(M={}));class x extends L{constructor(e){super(e,new z),this._configuration=new B,this._vertexAttributeLocations=F}getConfiguration(e,t){this._configuration.output=e,this._configuration.draped=t.slot===N.DRAPED_MATERIAL;const r=null!=this.parameters.stipplePattern&&e!==b.Highlight;return this._configuration.stippleEnabled=r,this._configuration.stippleOffColorEnabled=r&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=r&&this.parameters.stipplePreferContinuous,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&V(this.parameters.markerParameters),this._configuration.hasPolygonOffset=this.parameters.hasPolygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.occluder=this.parameters.renderOccluded===P.OccludeAndTransparentStencil,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration.wireframe=this.parameters.wireframe,this._configuration}intersectDraped(e,r,s,i,a,n){if(!s.options.selectionMode)return;const o=e.attributes.get(y.POSITION).data,l=e.attributes.get(y.SIZE);let u=this.parameters.width;if(this.parameters.vvSize){const r=e.attributes.get(y.SIZEFEATUREATTRIBUTE).data[0];u*=t(this.parameters.vvSize.offset[0]+r*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else l&&(u*=l.data[0]);const c=i[0],h=i[1],p=(u/2+4)*e.screenToWorldRatio;let f=Number.MAX_VALUE,m=0;for(let T=0;T<o.length-5;T+=3){const e=o[T],r=o[T+1],s=c-e,i=h-r,a=o[T+3]-e,n=o[T+4]-r,l=t((a*s+n*i)/(a*a+n*n),0,1),u=a*l-s,p=n*l-i,d=u*u+p*p;d<f&&(f=d,m=T/3)}f<p*p&&a(n.dist,n.normal,m,!1)}intersect(r,p,f,m,d,R){if(!f.options.selectionMode||!r.visible)return;if(!C(p))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const O=r.attributes,b=O.get(y.POSITION).data;let v=this.parameters.width;if(this.parameters.vvSize){const e=O.get(y.SIZEFEATUREATTRIBUTE).data[0];v*=t(this.parameters.vvSize.offset[0]+e*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else O.has(y.SIZE)&&(v*=O.get(y.SIZE).data[0]);const L=f.camera,P=Q;s(P,f.point);const N=v*L.pixelRatio/2+4*L.pixelRatio;i(oe[0],P[0]-N,P[1]+N,0),i(oe[1],P[0]+N,P[1]+N,0),i(oe[2],P[0]+N,P[1]-N,0),i(oe[3],P[0]-N,P[1]-N,0);for(let e=0;e<4;e++)if(!L.unprojectFromRenderScreen(oe[e],le[e]))return;I(L.eye,le[0],le[1],ue),I(L.eye,le[1],le[2],ce),I(L.eye,le[2],le[3],he),I(L.eye,le[3],le[0],pe);let j=Number.MAX_VALUE,U=0;const D=Z(this.parameters,O)?b.length-2:b.length-5;for(let e=0;e<D;e+=3){W[0]=b[e]+p[12],W[1]=b[e+1]+p[13],W[2]=b[e+2]+p[14];const t=(e+3)%b.length;if(Y[0]=b[t]+p[12],Y[1]=b[t+1]+p[13],Y[2]=b[t+2]+p[14],S(ue,W)<0&&S(ue,Y)<0||S(ce,W)<0&&S(ce,Y)<0||S(he,W)<0&&S(he,Y)<0||S(pe,W)<0&&S(pe,Y)<0)continue;if(L.projectToRenderScreen(W,K),L.projectToRenderScreen(Y,$),K[2]<0&&$[2]>0){a(X,W,Y);const e=L.frustum,t=-S(e[T.NEAR],W)/n(X,g(e[T.NEAR]));o(X,X,t),l(W,W,X),L.projectToRenderScreen(W,K)}else if(K[2]>0&&$[2]<0){a(X,Y,W);const e=L.frustum,t=-S(e[T.NEAR],Y)/n(X,g(e[T.NEAR]));o(X,X,t),l(Y,Y,X),L.projectToRenderScreen(Y,$)}else if(K[2]<0&&$[2]<0)continue;K[2]=0,$[2]=0;const r=_(E(K,$,re),P);r<j&&(j=r,u(ee,W),u(te,Y),U=e/3)}const F=f.rayBegin,w=f.rayEnd;if(j<N*N){let e=Number.MAX_VALUE;if(A(E(ee,te,re),E(F,w,se),q)){a(q,q,F);const t=c(q);o(q,q,1/t),e=t/h(F,w)}R(e,q,U,!1)}}get _layout(){const e=O().vec3f(y.POSITION).f32(y.SUBDIVISIONFACTOR).vec2f(y.UV0).vec3f(y.AUXPOS1).vec3f(y.AUXPOS2);return this.parameters.vvSize?e.f32(y.SIZEFEATUREATTRIBUTE):e.f32(y.SIZE),this.parameters.vvColor?e.f32(y.COLORFEATUREATTRIBUTE):e.vec4f(y.COLOR),this.parameters.vvOpacity&&e.f32(y.OPACITYFEATUREATTRIBUTE),has("enable-feature:objectAndLayerId-rendering")&&e.vec4u8(y.OBJECTANDLAYERIDCOLOR),e}createBufferWriter(){return new H(this._layout,this.parameters)}produces(e,t){if(t===b.Color||t===b.Alpha||t===b.Highlight||t===b.Depth||t===b.ObjectAndLayerIdColor){if(e===N.DRAPED_MATERIAL)return!0;if(this.parameters.renderOccluded===P.OccludeAndTransparentStencil)return e===N.OPAQUE_MATERIAL||e===N.OCCLUDER_MATERIAL||e===N.TRANSPARENT_OCCLUDER_MATERIAL;if(t===b.Color||t===b.Alpha){return e===(this.parameters.writeDepth?N.TRANSPARENT_MATERIAL:N.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL)}return e===N.OPAQUE_MATERIAL}return!1}createGLMaterial(e){return new G(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}}class G extends v{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextureRepository.release(this._stipplePattern),this._stipplePattern=null}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){this._output!==b.Color&&this._output!==b.Alpha||this._updateOccludeeState(e);const t=this._material.parameters.stipplePattern;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextureRepository.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.ensureTechnique(w,e)}}class z extends j{constructor(){super(...arguments),this.width=0,this.color=m,this.join="miter",this.cap=J.BUTT,this.miterLimit=5,this.writeDepth=!0,this.hasPolygonOffset=!1,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.hasOccludees=!1,this.wireframe=!1}}class H{constructor(e,t){this.vertexBufferLayout=e,this._parameters=t,this.numJoinSubdivisions=0;const r=t.stipplePattern?1:0;switch(this._parameters.join){case"miter":case"bevel":this.numJoinSubdivisions=r;break;case"round":this.numJoinSubdivisions=D+r}}_isClosed(e){return Z(this._parameters,e.attributes)}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){const t=2,r=e.attributes.get(y.POSITION).indices.length/2+1,s=this._isClosed(e);let i=s?2:2*t;return i+=((s?r:r-1)-(s?0:1))*(2*this.numJoinSubdivisions+4),i+=2,this._parameters.wireframe&&(i=2+4*(i-2)),i}write(e,t,r,s,a){const n=ie,o=ae,l=ne,c=r.attributes.get(y.POSITION),f=c.indices,m=c.data.length/3,T=r.attributes.get(y.DISTANCETOSTART)?.data;f&&f.length!==2*(m-1)&&console.warn("RibbonLineMaterial does not support indices");let d=1,_=0;const E=this.vertexBufferLayout.fields.has(y.SIZEFEATUREATTRIBUTE);E?_=r.attributes.get(y.SIZEFEATUREATTRIBUTE).data[0]:r.attributes.has(y.SIZE)&&(d=r.attributes.get(y.SIZE).data[0]);let A=[1,1,1,1],R=0;const I=this.vertexBufferLayout.fields.has(y.COLORFEATUREATTRIBUTE);I?R=r.attributes.get(y.COLORFEATUREATTRIBUTE).data[0]:r.attributes.has(y.COLOR)&&(A=r.attributes.get(y.COLOR).data);const S=has("enable-feature:objectAndLayerId-rendering")?r.objectAndLayerIdColor:null;let g=0;const O=this.vertexBufferLayout.fields.has(y.OPACITYFEATUREATTRIBUTE);O&&(g=r.attributes.get(y.OPACITYFEATUREATTRIBUTE).data[0]);const b=new Float32Array(s.buffer),v=has("enable-feature:objectAndLayerId-rendering")?new Uint8Array(s.buffer):null,L=this.vertexBufferLayout.stride/4;let P=a*L;const N=P;let C=0;const j=T?(e,t,r)=>C=T[r]:(e,t,r)=>C+=h(e,t),U=has("enable-feature:objectAndLayerId-rendering"),D=(e,t,r,s,i,a,n)=>{if(b[P++]=t[0],b[P++]=t[1],b[P++]=t[2],b[P++]=s,b[P++]=n,b[P++]=i,b[P++]=e[0],b[P++]=e[1],b[P++]=e[2],b[P++]=r[0],b[P++]=r[1],b[P++]=r[2],b[P++]=E?_:d,I)b[P++]=R;else{const e=Math.min(4*a,A.length-4);b[P++]=A[e],b[P++]=A[e+1],b[P++]=A[e+2],b[P++]=A[e+3]}O&&(b[P++]=g),U&&(null!=S&&(v[4*P]=S[0],v[4*P+1]=S[1],v[4*P+2]=S[2],v[4*P+3]=S[3]),P++)};P+=L,i(o,c.data[0],c.data[1],c.data[2]),e&&p(o,o,e);const F=this._isClosed(r);if(F){const t=c.data.length-3;i(n,c.data[t],c.data[t+1],c.data[t+2]),e&&p(n,n,e)}else i(l,c.data[3],c.data[4],c.data[5]),e&&p(l,l,e),D(o,o,l,1,M.LEFT_CAP_START,0,0),D(o,o,l,1,M.RIGHT_CAP_START,0,0),u(n,o),u(o,l);const w=F?0:1,B=F?m:m-1;for(let h=w;h<B;h++){const t=(h+1)%m*3;i(l,c.data[t],c.data[t+1],c.data[t+2]),e&&p(l,l,e),j(n,o,h),D(n,o,l,0,M.LEFT_JOIN_END,h,C),D(n,o,l,0,M.RIGHT_JOIN_END,h,C);const r=this.numJoinSubdivisions;for(let e=0;e<r;++e){const t=(e+1)/(r+1);D(n,o,l,t,M.LEFT_JOIN_END,h,C),D(n,o,l,t,M.RIGHT_JOIN_END,h,C)}D(n,o,l,1,M.LEFT_JOIN_START,h,C),D(n,o,l,1,M.RIGHT_JOIN_START,h,C),u(n,o),u(o,l)}F?(i(l,c.data[3],c.data[4],c.data[5]),e&&p(l,l,e),C=j(n,o,B),D(n,o,l,0,M.LEFT_JOIN_END,w,C),D(n,o,l,0,M.RIGHT_JOIN_END,w,C)):(C=j(n,o,B),D(n,o,o,0,M.LEFT_CAP_END,B,C),D(n,o,o,0,M.RIGHT_CAP_END,B,C)),k(b,N+L,b,N,L);P=k(b,P-L,b,P,L),this._parameters.wireframe&&this._addWireframeVertices(s,N,P,L)}_addWireframeVertices(e,t,r,s){const i=new Float32Array(e.buffer,r*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,r-t);let n=0;const o=e=>n=k(a,e,i,n,s);for(let l=0;l<a.length-1;l+=2*s)o(l),o(l+2*s),o(l+1*s),o(l+2*s),o(l+1*s),o(l+3*s)}}function k(e,t,r,s,i){for(let a=0;a<i;a++)r[s++]=e[t++];return s}function Z(e,t){if(!e.isClosed)return!1;return t.get(y.POSITION).indices.length>2}function V(e){return e.anchor===U.Tip&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}const W=f(),Y=f(),X=f(),q=f(),Q=f(),K=r(),$=r(),ee=f(),te=f(),re=d(),se=d(),ie=f(),ae=f(),ne=f(),oe=[r(),r(),r(),r()],le=[f(),f(),f(),f()],ue=R(),ce=R(),he=R(),pe=R();export{z as Parameters,x as RibbonLineMaterial};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{n as e,s as t,i as r,g as i}from"../../../../chunks/vec3.js";import{c as s}from"../../../../chunks/vec3f64.js";import{f as a}from"../../../../chunks/vec4f64.js";import{center as n,scale as o}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as c}from"../../../../geometry/support/buffer/BufferView.js";import{newLayout as l}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as u}from"../core/shaderLibrary/ShaderOutput.js";import{CullFaceOptions as h}from"../lib/basicInterfaces.js";import p from"../lib/GLMaterial.js";import{Material as f,MaterialParameters as m}from"../lib/Material.js";import{RenderSlot as d}from"../lib/RenderSlot.js";import{assert as b}from"../lib/Util.js";import{VertexAttribute as E}from"../lib/VertexAttribute.js";import{writeDefaultAttributes as S,writePosition as g}from"./internal/bufferWriterUtils.js";import{intersectTriangleGeometry as T}from"./internal/MaterialUtil.js";import{ShadedColorMaterialTechniqueConfiguration as A,vertexAttributeLocations as _,ShadedColorMaterialTechnique as F}from"../shaders/ShadedColorMaterialTechnique.js";class v extends f{constructor(e){super(e,new O),this.supportsEdges=!0,this._configuration=new A,this._vertexAttributeLocations=_}getConfiguration(e,t){return this._configuration.output=e,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this._isTransparent,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.screenSizeEnabled=this.parameters.screenSizeEnabled,this._configuration.shadingEnabled=this.parameters.shadingEnabled,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}intersect(e,s,a,c,l,u){if(this.parameters.screenSizeEnabled){const s=e.vertexAttributes.get(E.OFFSET),h={applyToVertex:(e,n,o,c)=>{const l=t(w,s.data[3*c],s.data[3*c+1],s.data[3*c+2]),u=t(z,e,n,o);return r(l,l,this.parameters.screenSizeScale*a.camera.computeRenderPixelSizeAt(l)),i(u,u,l),[u[0],u[1],u[2]]},applyToAabb:e=>{const t=n(e,w);return o(e,this.parameters.screenSizeScale*a.camera.computeRenderPixelSizeAt(t))}};T(e,a,c,l,h,u)}else T(e,a,c,l,void 0,u)}produces(e,t){if(t===u.Highlight)return e===d.OPAQUE_MATERIAL;if(t===u.Color||t===u.Alpha||t===u.ObjectAndLayerIdColor){let t=d.OPAQUE_MATERIAL;return this._isTransparent&&(t=this.parameters.writeDepth?d.TRANSPARENT_MATERIAL:d.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),e===t||e===d.DRAPED_MATERIAL}return!1}createGLMaterial(e){return new j(e)}createBufferWriter(){return new x(this.parameters.screenSizeEnabled)}get _isTransparent(){return this.parameters.color[3]<1||this.parameters.forceTransparentMode}}class j extends p{beginSlot(e){return this.ensureTechnique(F,e)}}class O extends m{constructor(){super(...arguments),this.color=a(1,1,1,1),this.shadingTint=a(0,0,0,.25),this.shadingDirection=e(s(),[.5,-.5,-.5]),this.screenSizeScale=14,this.forceTransparentMode=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.cullFace=h.None,this.screenSizeEnabled=!1,this.shadingEnabled=!0}}class x{constructor(e){this.screenSizeEnabled=e;const t=l().vec3f(E.POSITION).vec3f(E.NORMAL);this.screenSizeEnabled&&t.vec3f(E.OFFSET),this.vertexBufferLayout=t}elementCount(e){return e.indices.get(E.POSITION).length}write(e,t,r,i,s){if(S(r,this.vertexBufferLayout,e,t,i,s),this.screenSizeEnabled){if(!r.vertexAttributes.has(E.OFFSET))throw new Error(`${E.OFFSET} vertex attribute required for screenSizeEnabled ShadedColorMaterial`);{const e=r.vertexAttributes.get(E.OFFSET),a=r.indices.get(E.OFFSET);b(3===e.size);const n=i.getField(E.OFFSET,c);if(!n)throw new Error("unable to acquire view for "+E.OFFSET);g(a,e.data,t,n,s)}}}}const w=s(),z=s();export{v as ShadedColorMaterial,O as ShadedColorMaterialParameters};
5
+ import{n as e,s as t,i as r,g as i}from"../../../../chunks/vec3.js";import{c as s}from"../../../../chunks/vec3f64.js";import{f as a}from"../../../../chunks/vec4f64.js";import{center as n,scale as o}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as c}from"../../../../geometry/support/buffer/BufferView.js";import{newLayout as l}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as u}from"../core/shaderLibrary/ShaderOutput.js";import{CullFaceOptions as h}from"../lib/basicInterfaces.js";import p from"../lib/GLMaterial.js";import{Material as f,MaterialParameters as m}from"../lib/Material.js";import{RenderSlot as d}from"../lib/RenderSlot.js";import{assert as b}from"../lib/Util.js";import{VertexAttribute as S}from"../lib/VertexAttribute.js";import{writeDefaultAttributes as E,writePosition as g}from"./internal/bufferWriterUtils.js";import{intersectTriangleGeometry as T}from"./internal/MaterialUtil.js";import{ShadedColorMaterialTechniqueConfiguration as A,vertexAttributeLocations as _,ShadedColorMaterialTechnique as F}from"../shaders/ShadedColorMaterialTechnique.js";class j extends f{constructor(e){super(e,new v),this.supportsEdges=!0,this._configuration=new A,this._vertexAttributeLocations=_}getConfiguration(e,t){return this._configuration.output=e,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this._isTransparent,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.screenSizeEnabled=this.parameters.screenSizeEnabled,this._configuration.shadingEnabled=this.parameters.shadingEnabled,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}intersect(e,s,a,c,l,u){if(this.parameters.screenSizeEnabled){const s=e.attributes.get(S.OFFSET),h={applyToVertex:(e,n,o,c)=>{const l=t(z,s.data[3*c],s.data[3*c+1],s.data[3*c+2]),u=t(L,e,n,o);return r(l,l,this.parameters.screenSizeScale*a.camera.computeScreenPixelSizeAt(l)),i(u,u,l),[u[0],u[1],u[2]]},applyToAabb:e=>{const t=n(e,z);return o(e,this.parameters.screenSizeScale*a.camera.computeScreenPixelSizeAt(t))}};T(e,a,c,l,h,u)}else T(e,a,c,l,void 0,u)}produces(e,t){if(t===u.Highlight)return e===d.OPAQUE_MATERIAL;if(t===u.Color||t===u.Alpha||t===u.ObjectAndLayerIdColor){let t=d.OPAQUE_MATERIAL;return this._isTransparent&&(t=this.parameters.writeDepth?d.TRANSPARENT_MATERIAL:d.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),e===t||e===d.DRAPED_MATERIAL}return!1}createGLMaterial(e){return new O(e)}createBufferWriter(){return new w(this.parameters.screenSizeEnabled)}get _isTransparent(){return this.parameters.color[3]<1||this.parameters.forceTransparentMode}}class O extends p{beginSlot(e){return this.ensureTechnique(F,e)}}class v extends m{constructor(){super(...arguments),this.color=a(1,1,1,1),this.shadingTint=a(0,0,0,.25),this.shadingDirection=e(s(),[.5,-.5,-.5]),this.screenSizeScale=14,this.forceTransparentMode=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.cullFace=h.None,this.screenSizeEnabled=!1,this.shadingEnabled=!0}}class w{constructor(e){this.screenSizeEnabled=e;const t=l().vec3f(S.POSITION).vec3f(S.NORMAL);this.screenSizeEnabled&&t.vec3f(S.OFFSET),this.vertexBufferLayout=t}elementCount(e){return e.attributes.get(S.POSITION).indices.length}write(e,t,r,i,s){if(E(r,this.vertexBufferLayout,e,t,i,s),this.screenSizeEnabled){if(!r.attributes.has(S.OFFSET))throw new Error(`${S.OFFSET} vertex attribute required for screenSizeEnabled ShadedColorMaterial`);{const e=r.attributes.get(S.OFFSET);b(3===e.size);const a=i.getField(S.OFFSET,c);if(!a)throw new Error("unable to acquire view for "+S.OFFSET);g(e,t,a,s)}}}}const z=s(),L=s();export{j as ShadedColorMaterial,v as ShadedColorMaterialParameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{update as t}from"../../../../../core/arrayUtils.js";import{clamp as n}from"../../../../../core/mathUtils.js";import{s as e,b as o,n as i}from"../../../../../chunks/vec3.js";import{c as r}from"../../../../../chunks/vec3f64.js";import{create as s,setMin as c,setMax as l}from"../../../../../geometry/support/aaBoundingBox.js";import{ContentObjectType as f}from"../../lib/ContentObjectType.js";import{scale as u}from"../../lib/screenSizePerspectiveUtils.js";import{assert as a}from"../../lib/Util.js";import{VertexAttribute as m}from"../../lib/VertexAttribute.js";const p=s();function h(t,n,e,o,i,r){if(t.visible)if(t.boundingInfo){a(t.type===f.Mesh);const s=n.tolerance;x(t.boundingInfo,e,o,s,i,r)}else{const n=t.indices.get(m.POSITION),s=t.vertexAttributes.get(m.POSITION);g(e,o,0,n.length/3,n,s,void 0,i,r)}}const b=r();function x(t,n,e,o,i,r){if(null==t)return;const s=T(n,e,b);if(c(p,t.bbMin),l(p,t.bbMax),null!=i&&i.applyToAabb(p),I(p,n,s,o)){const{primitiveIndices:s,indices:c,position:l}=t,f=s?s.length:c.length/3;if(f>S){const s=t.getChildren();if(void 0!==s){for(const t of s)x(t,n,e,o,i,r);return}}g(n,e,0,f,c,l,s,i,r)}}const d=r();function g(t,n,e,o,i,r,s,c,l){if(s)return M(t,n,e,o,i,r,s,c,l);const{data:f,stride:u}=r,a=t[0],m=t[1],p=t[2],h=n[0]-a,b=n[1]-m,x=n[2]-p;for(let g=e,M=3*e;g<o;++g){let t=u*i[M++],n=f[t++],e=f[t++],o=f[t];t=u*i[M++];let r=f[t++],s=f[t++],y=f[t];t=u*i[M++];let j=f[t++],T=f[t++],I=f[t];null!=c&&([n,e,o]=c.applyToVertex(n,e,o,g),[r,s,y]=c.applyToVertex(r,s,y,g),[j,T,I]=c.applyToVertex(j,T,I,g));const O=r-n,V=s-e,L=y-o,N=j-n,A=T-e,P=I-o,S=b*P-A*x,E=x*N-P*h,U=h*A-N*b,W=O*S+V*E+L*U;if(Math.abs(W)<=Number.EPSILON)continue;const k=a-n,B=m-e,C=p-o,z=k*S+B*E+C*U;if(W>0){if(z<0||z>W)continue}else if(z>0||z<W)continue;const H=B*L-V*C,R=C*O-L*k,Y=k*V-O*B,q=h*H+b*R+x*Y;if(W>0){if(q<0||z+q>W)continue}else if(q>0||z+q<W)continue;const w=(N*H+A*R+P*Y)/W;if(w>=0){l(w,v(O,V,L,N,A,P,d),g,!1)}}}function M(t,n,e,o,i,r,s,c,l){const{data:f,stride:u}=r,a=t[0],m=t[1],p=t[2],h=n[0]-a,b=n[1]-m,x=n[2]-p;for(let g=e;g<o;++g){const t=s[g];let n=3*t,e=u*i[n++],o=f[e++],r=f[e++],M=f[e];e=u*i[n++];let y=f[e++],j=f[e++],T=f[e];e=u*i[n];let I=f[e++],O=f[e++],V=f[e];null!=c&&([o,r,M]=c.applyToVertex(o,r,M,g),[y,j,T]=c.applyToVertex(y,j,T,g),[I,O,V]=c.applyToVertex(I,O,V,g));const L=y-o,N=j-r,A=T-M,P=I-o,S=O-r,E=V-M,U=b*E-S*x,W=x*P-E*h,k=h*S-P*b,B=L*U+N*W+A*k;if(Math.abs(B)<=Number.EPSILON)continue;const C=a-o,z=m-r,H=p-M,R=C*U+z*W+H*k;if(B>0){if(R<0||R>B)continue}else if(R>0||R<B)continue;const Y=z*A-N*H,q=H*L-A*C,w=C*N-L*z,D=h*Y+b*q+x*w;if(B>0){if(D<0||R+D>B)continue}else if(D>0||R+D<B)continue;const F=(P*Y+S*q+E*w)/B;if(F>=0){l(F,v(L,N,A,P,S,E,d),t,!1)}}}const y=r(),j=r();function v(t,n,r,s,c,l,f){return e(y,t,n,r),e(j,s,c,l),o(f,y,j),i(f,f),f}function T(t,n,o){return e(o,1/(n[0]-t[0]),1/(n[1]-t[1]),1/(n[2]-t[2]))}function I(t,n,e,o){return O(t,n,e,o,1/0)}function O(t,n,e,o,i){const r=(t[0]-o-n[0])*e[0],s=(t[3]+o-n[0])*e[0];let c=Math.min(r,s),l=Math.max(r,s);const f=(t[1]-o-n[1])*e[1],u=(t[4]+o-n[1])*e[1];if(l=Math.min(l,Math.max(f,u)),l<0)return!1;if(c=Math.max(c,Math.min(f,u)),c>l)return!1;const a=(t[2]-o-n[2])*e[2],m=(t[5]+o-n[2])*e[2];return l=Math.min(l,Math.max(a,m)),!(l<0)&&(c=Math.max(c,Math.min(a,m)),!(c>l)&&c<i)}function V(t,e,o,i,r){let s=(o.screenLength||0)*t.pixelRatio;null!=r&&(s=u(s,i,e,r));const c=s*Math.tan(.5*t.fovY)/(.5*t.fullHeight);return n(c*e,o.minWorldLength||0,null!=o.maxWorldLength?o.maxWorldLength:1/0)}function L(t,n){const e=n?L(n):{};for(const o in t){let n=t[o];n&&n.forEach&&(n=A(n)),null==n&&o in e||(e[o]=n)}return e}function N(n,e){let o=!1;for(const i in e){const r=e[i];void 0!==r&&(Array.isArray(r)?null===n[i]?(n[i]=r.slice(),o=!0):t(n[i],r)&&(o=!0):n[i]!==r&&(o=!0,n[i]=r))}return o}function A(t){const n=[];return t.forEach((t=>n.push(t))),n}const P={multiply:1,ignore:2,replace:3,tint:4},S=1e3;export{P as colorMixModes,T as computeInvDir,v as computeNormal,L as copyParameters,I as intersectAabbInvDir,O as intersectAabbInvDirBefore,h as intersectTriangleGeometry,g as intersectTriangles,N as updateParameters,V as verticalOffsetAtDistance};
5
+ import{update as t}from"../../../../../core/arrayUtils.js";import{clamp as n}from"../../../../../core/mathUtils.js";import{s as e,b as o,n as i}from"../../../../../chunks/vec3.js";import{c as r}from"../../../../../chunks/vec3f64.js";import{create as s,setMin as c,setMax as l}from"../../../../../geometry/support/aaBoundingBox.js";import{ContentObjectType as f}from"../../lib/ContentObjectType.js";import{scale as u}from"../../lib/screenSizePerspectiveUtils.js";import{assert as a}from"../../lib/Util.js";import{VertexAttribute as m}from"../../lib/VertexAttribute.js";const p=s();function h(t,n,e,o,i,r){if(t.visible)if(t.boundingInfo){a(t.type===f.Mesh);const s=n.tolerance;d(t.boundingInfo,e,o,s,i,r)}else{const n=t.attributes.get(m.POSITION),s=n.indices;M(e,o,0,s.length/3,s,n,void 0,i,r)}}const b=r();function d(t,n,e,o,i,r){if(null==t)return;const s=T(n,e,b);if(c(p,t.bbMin),l(p,t.bbMax),null!=i&&i.applyToAabb(p),I(p,n,s,o)){const{primitiveIndices:s,position:c}=t,l=s?s.length:c.indices.length/3;if(l>P){const s=t.getChildren();if(void 0!==s){for(const t of s)d(t,n,e,o,i,r);return}}M(n,e,0,l,c.indices,c,s,i,r)}}const x=r();function M(t,n,e,o,i,r,s,c,l){if(s)return g(t,n,e,o,i,r,s,c,l);const{data:f,stride:u}=r,a=t[0],m=t[1],p=t[2],h=n[0]-a,b=n[1]-m,d=n[2]-p;for(let M=e,g=3*e;M<o;++M){let t=u*i[g++],n=f[t++],e=f[t++],o=f[t];t=u*i[g++];let r=f[t++],s=f[t++],y=f[t];t=u*i[g++];let j=f[t++],T=f[t++],I=f[t];null!=c&&([n,e,o]=c.applyToVertex(n,e,o,M),[r,s,y]=c.applyToVertex(r,s,y,M),[j,T,I]=c.applyToVertex(j,T,I,M));const V=r-n,L=s-e,N=y-o,O=j-n,A=T-e,E=I-o,P=b*E-A*d,S=d*O-E*h,U=h*A-O*b,W=V*P+L*S+N*U;if(Math.abs(W)<=Number.EPSILON)continue;const k=a-n,B=m-e,C=p-o,z=k*P+B*S+C*U;if(W>0){if(z<0||z>W)continue}else if(z>0||z<W)continue;const H=B*N-L*C,R=C*V-N*k,Y=k*L-V*B,q=h*H+b*R+d*Y;if(W>0){if(q<0||z+q>W)continue}else if(q>0||z+q<W)continue;const w=(O*H+A*R+E*Y)/W;if(w>=0){l(w,v(V,L,N,O,A,E,x),M,!1)}}}function g(t,n,e,o,i,r,s,c,l){const{data:f,stride:u}=r,a=t[0],m=t[1],p=t[2],h=n[0]-a,b=n[1]-m,d=n[2]-p;for(let M=e;M<o;++M){const t=s[M];let n=3*t,e=u*i[n++],o=f[e++],r=f[e++],g=f[e];e=u*i[n++];let y=f[e++],j=f[e++],T=f[e];e=u*i[n];let I=f[e++],V=f[e++],L=f[e];null!=c&&([o,r,g]=c.applyToVertex(o,r,g,M),[y,j,T]=c.applyToVertex(y,j,T,M),[I,V,L]=c.applyToVertex(I,V,L,M));const N=y-o,O=j-r,A=T-g,E=I-o,P=V-r,S=L-g,U=b*S-P*d,W=d*E-S*h,k=h*P-E*b,B=N*U+O*W+A*k;if(Math.abs(B)<=Number.EPSILON)continue;const C=a-o,z=m-r,H=p-g,R=C*U+z*W+H*k;if(B>0){if(R<0||R>B)continue}else if(R>0||R<B)continue;const Y=z*A-O*H,q=H*N-A*C,w=C*O-N*z,D=h*Y+b*q+d*w;if(B>0){if(D<0||R+D>B)continue}else if(D>0||R+D<B)continue;const F=(E*Y+P*q+S*w)/B;if(F>=0){l(F,v(N,O,A,E,P,S,x),t,!1)}}}const y=r(),j=r();function v(t,n,r,s,c,l,f){return e(y,t,n,r),e(j,s,c,l),o(f,y,j),i(f,f),f}function T(t,n,o){return e(o,1/(n[0]-t[0]),1/(n[1]-t[1]),1/(n[2]-t[2]))}function I(t,n,e,o){return V(t,n,e,o,1/0)}function V(t,n,e,o,i){const r=(t[0]-o-n[0])*e[0],s=(t[3]+o-n[0])*e[0];let c=Math.min(r,s),l=Math.max(r,s);const f=(t[1]-o-n[1])*e[1],u=(t[4]+o-n[1])*e[1];if(l=Math.min(l,Math.max(f,u)),l<0)return!1;if(c=Math.max(c,Math.min(f,u)),c>l)return!1;const a=(t[2]-o-n[2])*e[2],m=(t[5]+o-n[2])*e[2];return l=Math.min(l,Math.max(a,m)),!(l<0)&&(c=Math.max(c,Math.min(a,m)),!(c>l)&&c<i)}function L(t,e,o,i,r){let s=(o.screenLength||0)*t.pixelRatio;null!=r&&(s=u(s,i,e,r));const c=s*Math.tan(.5*t.fovY)/(.5*t.fullHeight);return n(c*e,o.minWorldLength||0,null!=o.maxWorldLength?o.maxWorldLength:1/0)}function N(t,n){const e=n?N(n):{};for(const o in t){let n=t[o];n&&n.forEach&&(n=A(n)),null==n&&o in e||(e[o]=n)}return e}function O(n,e){let o=!1;for(const i in e){const r=e[i];void 0!==r&&(Array.isArray(r)?null===n[i]?(n[i]=r.slice(),o=!0):t(n[i],r)&&(o=!0):n[i]!==r&&(o=!0,n[i]=r))}return o}function A(t){const n=[];return t.forEach((t=>n.push(t))),n}const E={multiply:1,ignore:2,replace:3,tint:4},P=1e3;export{E as colorMixModes,T as computeInvDir,v as computeNormal,N as copyParameters,I as intersectAabbInvDir,V as intersectAabbInvDirBefore,h as intersectTriangleGeometry,M as intersectTriangles,O as updateParameters,L as verticalOffsetAtDistance};