@arcgis/core 4.31.0-next.20240619 → 4.31.0-next.20240621

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 (189) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{3a74d3fc690177a703f5.js → 019ce38b02e3bf517125.js} +1 -1
  3. package/assets/esri/core/workers/chunks/{222807cfaa2e17d0efea.js → 6745cedf6f82c8917904.js} +1 -1
  4. package/assets/esri/core/workers/chunks/7b6cd976367a0dd297d6.js +1 -0
  5. package/assets/esri/core/workers/chunks/{d7c0728bdd9a7fd1d701.js → 9d677af08238d9e09e72.js} +36 -25
  6. package/assets/esri/core/workers/chunks/bedf60888f07b78b314d.js +1 -0
  7. package/assets/esri/core/workers/chunks/c39237c00c1d588dc107.js +1 -0
  8. package/assets/esri/core/workers/chunks/cf1530abe2842f3d8eb0.js +1 -0
  9. package/assets/esri/core/workers/chunks/de7fa31d86a65ccdffc1.js +1 -0
  10. package/assets/esri/core/workers/chunks/{8ee8f3c54b2cce217845.js → f13fb6b712e364bbf48c.js} +1 -1
  11. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_ar.json +1 -1
  12. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_bg.json +1 -1
  13. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_bs.json +1 -1
  14. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_ca.json +1 -1
  15. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_cs.json +1 -1
  16. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_da.json +1 -1
  17. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_de.json +1 -1
  18. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_el.json +1 -1
  19. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_es.json +1 -1
  20. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_et.json +1 -1
  21. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_fi.json +1 -1
  22. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_fr.json +1 -1
  23. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_he.json +1 -1
  24. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_hr.json +1 -1
  25. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_hu.json +1 -1
  26. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_id.json +1 -1
  27. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_it.json +1 -1
  28. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_ja.json +1 -1
  29. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_ko.json +1 -1
  30. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_lt.json +1 -1
  31. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_lv.json +1 -1
  32. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_nb.json +1 -1
  33. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_nl.json +1 -1
  34. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_pl.json +1 -1
  35. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_pt-BR.json +1 -1
  36. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_pt-PT.json +1 -1
  37. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_ro.json +1 -1
  38. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_ru.json +1 -1
  39. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_sk.json +1 -1
  40. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_sl.json +1 -1
  41. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_sr.json +1 -1
  42. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_sv.json +1 -1
  43. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_th.json +1 -1
  44. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_tr.json +1 -1
  45. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_uk.json +1 -1
  46. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_vi.json +1 -1
  47. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_zh-CN.json +1 -1
  48. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_zh-HK.json +1 -1
  49. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_zh-TW.json +1 -1
  50. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ar.json +1 -1
  51. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_bg.json +1 -1
  52. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_bs.json +1 -1
  53. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ca.json +1 -1
  54. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_cs.json +1 -1
  55. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_da.json +1 -1
  56. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_de.json +1 -1
  57. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_el.json +1 -1
  58. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_es.json +1 -1
  59. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_et.json +1 -1
  60. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_fi.json +1 -1
  61. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_fr.json +1 -1
  62. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_he.json +1 -1
  63. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_hr.json +1 -1
  64. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_hu.json +1 -1
  65. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_id.json +1 -1
  66. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_it.json +1 -1
  67. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ja.json +1 -1
  68. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ko.json +1 -1
  69. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_lt.json +1 -1
  70. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_lv.json +1 -1
  71. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_nb.json +1 -1
  72. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_nl.json +1 -1
  73. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pl.json +1 -1
  74. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pt-BR.json +1 -1
  75. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pt-PT.json +1 -1
  76. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ro.json +1 -1
  77. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ru.json +1 -1
  78. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sk.json +1 -1
  79. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sl.json +1 -1
  80. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sr.json +1 -1
  81. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sv.json +1 -1
  82. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_th.json +1 -1
  83. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_tr.json +1 -1
  84. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_uk.json +1 -1
  85. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_vi.json +1 -1
  86. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-CN.json +1 -1
  87. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-HK.json +1 -1
  88. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-TW.json +1 -1
  89. package/chunks/CheckerBoard.glsl.js +9 -6
  90. package/chunks/ComponentShader.glsl.js +23 -23
  91. package/chunks/HUDMaterial.glsl.js +29 -33
  92. package/chunks/HighlightApply.glsl.js +150 -23
  93. package/chunks/HighlightDownsample.glsl.js +25 -12
  94. package/chunks/ImageMaterial.glsl.js +1 -2
  95. package/chunks/LineMarker.glsl.js +30 -30
  96. package/chunks/RibbonLine.glsl.js +42 -42
  97. package/chunks/ShadowHighlight.glsl.js +15 -6
  98. package/chunks/Terrain.glsl.js +6 -3
  99. package/interfaces.d.ts +50 -14
  100. package/layers/graphics/sources/FeatureLayerSource.js +1 -1
  101. package/layers/mixins/EditBusLayer.js +1 -1
  102. package/layers/mixins/FeatureLayerBase.js +1 -1
  103. package/layers/orientedImagery/core/ExposurePoint.js +1 -1
  104. package/layers/orientedImagery/transformations/imageToGroundUtils.js +1 -1
  105. package/layers/support/featureLayerUtils.js +1 -1
  106. package/package.json +1 -1
  107. package/portal/schemas/definitions.js +1 -1
  108. package/rest/knowledgeGraph/wasmInterface/WasmDataModelWrapperInterfaces.js +1 -1
  109. package/support/revision.js +1 -1
  110. package/views/2d/layers/support/ExportStrategy.js +1 -1
  111. package/views/3d/layers/I3SMeshView3D.js +1 -1
  112. package/views/3d/layers/SceneLayerView3D.js +1 -1
  113. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  114. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  115. package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
  116. package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
  117. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  118. package/views/3d/layers/i3s/Highlights.js +1 -1
  119. package/views/3d/layers/i3s/PointRenderer.js +1 -1
  120. package/views/3d/support/HighlightOptions.js +1 -1
  121. package/views/3d/support/HighlightOptionsBase.js +5 -0
  122. package/views/3d/terrain/OverlayRenderTargets.js +1 -1
  123. package/views/3d/terrain/TerrainRenderer.js +1 -1
  124. package/views/3d/webgl-engine/collections/Component/ComponentData.js +1 -1
  125. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  126. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  127. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentData.glsl.js +1 -2
  128. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  129. package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
  130. package/views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js +18 -7
  131. package/views/3d/webgl-engine/core/shaderModules/Integer2PassUniform.js +5 -0
  132. package/views/3d/webgl-engine/effects/RenderPlugin.js +1 -1
  133. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  134. package/views/3d/webgl-engine/effects/highlight/HighlightPassParameters.js +1 -1
  135. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  136. package/views/3d/webgl-engine/lib/DefaultVertexBufferLayouts.js +1 -1
  137. package/views/3d/webgl-engine/lib/Material.js +1 -1
  138. package/views/3d/webgl-engine/lib/Program.js +1 -1
  139. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  140. package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
  141. package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
  142. package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
  143. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  144. package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
  145. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  146. package/views/3d/webgl-engine/lib/edgeRendering/interfaces.js +1 -1
  147. package/views/3d/webgl-engine/lib/edgeRendering/util.js +1 -1
  148. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  149. package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
  150. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  151. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  152. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  153. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  154. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  155. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  156. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  157. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  158. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  159. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  160. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  161. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  162. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  163. package/views/3d/webgl-engine/shaders/CheckerBoard.glsl.js +1 -1
  164. package/views/3d/webgl-engine/shaders/HUDMaterialTechnique.js +1 -1
  165. package/views/3d/webgl-engine/shaders/HighlightApply.glsl.js +1 -1
  166. package/views/3d/webgl-engine/shaders/LineMarker.glsl.js +1 -1
  167. package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
  168. package/views/3d/webgl-engine/shaders/ShadowHighlight.glsl.js +1 -1
  169. package/views/SceneView.js +1 -1
  170. package/views/SelectionManager.js +1 -1
  171. package/views/support/HighlightDefaults.js +1 -1
  172. package/views/webgl/BufferObject.js +1 -1
  173. package/views/webgl/RenderingContext.js +1 -1
  174. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  175. package/widgets/OrientedImageryViewer/adapters/OrientedImageryViewerViewModelAdapter2D.js +1 -1
  176. package/widgets/OrientedImageryViewer/utils.js +1 -1
  177. package/widgets/OrientedImageryViewer.js +1 -1
  178. package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
  179. package/widgets/PanoramicViewer/constants.js +1 -1
  180. package/widgets/PanoramicViewer/utils.js +1 -1
  181. package/widgets/Print.js +1 -1
  182. package/assets/esri/core/workers/chunks/24484bd0185ea0f79760.js +0 -1
  183. package/assets/esri/core/workers/chunks/4f2be9fd4ff5b3ad3110.js +0 -1
  184. package/assets/esri/core/workers/chunks/88c7d84a1fde246ca71f.js +0 -1
  185. package/assets/esri/core/workers/chunks/986520dd0de64105dbff.js +0 -1
  186. package/assets/esri/core/workers/chunks/ad0a87dba95785ad6171.js +0 -1
  187. package/chunks/HighlightBlur.glsl.js +0 -25
  188. package/views/3d/webgl-engine/effects/highlight/HighlightBlurTechnique.js +0 -5
  189. package/views/3d/webgl-engine/shaders/HighlightBlur.glsl.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{unpackFloatRGBA as t}from"../../../../core/floatRGBA.js";import e from"../../../../core/PooledArray.js";import{multiply as r,copy as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{h as s}from"../../../../chunks/vec32.js";import{l as a}from"../../../../chunks/vec42.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{intersectsSphere as h,create as f,copy as c}from"../../../../geometry/support/frustum.js";import{g as l,c as u}from"../../../../chunks/sphere.js";import{maxScale as _}from"../../support/mathUtils.js";import{empty as d,union as m,set as g,DepthRange as p}from"./depthRange.js";import b from"./Octree.js";import{assert as w}from"./Util.js";const v=1e4,R=100,j=500,C=500,A=.1;function B(e,r,i){return t(r,e)*(i[1]-i[0])+i[0]}function M(t,e,r){let i=0;if(!e.some((t=>!!t.material&&(i+=t.numGeometries,i>=v))))return Q.compute(t,e);const n=d();return r.forAll((e=>m(n,O(t,e)))),n}function O(t,e){if(!e.visible)return;const r=d(),i=e.getSpatialQueryAccelerator();return i?x(r,t,i):D(r,t,e.objects),r}function x(t,e,r){const i=e.eye,n=e.viewForward,s=e.frustum,a=t=>t.visible,o=r.objectCount;if(o<j)g(G,e.near,Math.min(t.near,e.far)),r.forEachInDepthRange(i,n,b.DepthOrder.FRONT_TO_BACK,G,((r,i)=>{T(t,e,r),G.far=t.near,i.setRange(G)}),s,a),g(G,Math.max(t.far,e.near),e.far),r.forEachInDepthRange(i,n,b.DepthOrder.BACK_TO_FRONT,G,((r,i)=>{T(t,e,r),G.near=t.far,i.setRange(G)}),s,a);else{const i=Math.max(Math.min(o,C),Math.ceil(o*A)),h=r.findClosest(n,b.DepthOrder.FRONT_TO_BACK,s,a,i),f=r.findClosest(n,b.DepthOrder.BACK_TO_FRONT,s,a,i);h&&f&&(I(t,e,h.boundingVolumeWorldSpace.bounds),I(t,e,f.boundingVolumeWorldSpace.bounds))}}function D(t,e,r){U.clear(),r.forAll((t=>{t.visible&&0!==t.geometries.length&&U.add(t)})),U.empty||(U.sort(e),g(G,e.near,Math.min(t.near,e.far)),U.forEachInDepthRange(G,b.DepthOrder.FRONT_TO_BACK,((r,i)=>{i<t.near&&T(t,e,r)})),g(G,Math.max(t.far,e.near),e.far),U.forEachInDepthRange(G,b.DepthOrder.BACK_TO_FRONT,((e,r,i)=>{t.far=Math.max(t.far,i)})))}function T(t,e,i){if(!i.visible)return;if(!h(e.frustum,i.boundingVolumeWorldSpace.bounds))return;const n=i.transformation,s=k;i.geometries.forEach((i=>{r(s,n,i.transformation);const a=_(s);F(t,e,i.boundingInfo,s,a)}))}function F(t,e,r,i,n){if(null==r)return;s(l(V),r.center,i);const{eye:a,viewForward:o}=e,f=o[0]*(V[0]-a[0])+o[1]*(V[1]-a[1])+o[2]*(V[2]-a[2]);if(V[3]=r.radius*n,!(f-V[3]>t.near&&f+V[3]<t.far)&&h(e.frustum,V))if(r.radius>R&&r.getChildren())for(const s of r.getChildren())F(t,e,s,i,n);else q.unionDepthRangeWithAABB(t,e.viewProjectionMatrix,i,r.bbMin,r.bbMax)}function I(t,e,r){const i=e.eye,n=e.viewForward,s=(r[0]-i[0])*n[0]+(r[1]-i[1])*n[1]+(r[2]-i[2])*n[2];t.near=Math.min(t.near,s-r[3]),t.far=Math.max(t.far,s+r[3])}class y{constructor(){this._items=new e({allocator:t=>t||{object:null,distance:0,near:0,far:0},deallocator:t=>(t.object=null,t.distance=0,t.near=0,t.far=0,t)})}get length(){return this._items.length}get empty(){return 0===this._items.length}clear(){this._items.clear()}add(t){this._items.pushNew().object=t}sort(t){const e=t.eye,r=t.viewForward;this._items.forAll((t=>{const i=t.object.boundingVolumeWorldSpace.bounds,n=(i[0]-e[0])*r[0]+(i[1]-e[1])*r[1]+(i[2]-e[2])*r[2];t.distance=n,t.near=n-i[3],t.far=n+i[3]})),this._items.sort(((t,e)=>t.distance-e.distance))}forEachInDepthRange(t,e,r){if(e===b.DepthOrder.FRONT_TO_BACK)for(let i=0;i<this._items.length;++i){const e=this._items.data[i];e.far<t.near||e.near>t.far||r(e.object,e.near,e.far)}else for(let i=this._items.length-1;i>=0;--i){const e=this._items.data[i];e.far<t.near||e.near>t.far||r(e.object,e.near,e.far)}}}class P{constructor(){this._view=n(),this._viewProj=n(),this._frustum=f(),this._geometries=new Array,this._near=[],this._far=[],this._nearCandidates=[],this._farCandidates=[],this._looseRange={near:0,far:0}}compute(t,e){this._reset(),i(this._view,t.viewMatrix),r(this._viewProj,t.projectionMatrix,this._view),c(this._frustum,t.frustum);const n=this._view,s=n[2],a=n[6],o=n[10],h=n[14];e.forAll((t=>{t.material&&t.forEachGeometry&&t.forEachGeometry((t=>{if(!t.visible||!t.castShadow)return;const e=t.boundingSphere,r=s*e[0]+a*e[1]+o*e[2]+h,i=r-e[3],n=r+e[3];this._geometries.push(t),this._near.push(-n),this._far.push(-i)}))}));const f=new p;if(0===this._geometries.length)return f;for(let r=0;r<this._geometries.length;++r)this._near[r]>f.far&&(f.far=this._near[r]),this._near[r]>2&&this._far[r]<f.near&&(f.near=this._far[r]);const l=this._looseRange;l.near=Math.max(.5*f.near,2),l.far=2*f.far;let u=0,_=0;for(let r=0;r<this._geometries.length;++r)this._near[r]<f.near&&(this._near[r]>=l.near?f.near=this._near[r]:this._nearCandidates[u++]=r),this._far[r]>f.far&&(this._far[r]<=l.far?f.far=this._far[r]:this._farCandidates[_++]=r);if(0===this._nearCandidates.length&&0===this._farCandidates.length)return f;this._nearCandidates.sort(((t,e)=>this._near[t]<this._near[e]?-1:this._near[t]>this._near[e]?1:0)),this._farCandidates.sort(((t,e)=>this._far[t]<this._far[e]?1:this._far[t]>this._far[e]?-1:0));for(let r=0;r<this._nearCandidates.length;++r){const t=this._nearCandidates[r];if(this._near[t]<f.near){const e=this._geometries[t],r=e.boundingInfo;this._includeNearBoundingInfoRec(r,e.shaderTransformation,f)}}for(let r=0;r<this._farCandidates.length;++r){const t=this._farCandidates[r];if(this._far[t]>f.far){const e=this._geometries[t],r=e.boundingInfo;this._includeFarBoundingInfoRec(r,e.shaderTransformation,f)}}return this._reset(),f}_reset(){this._geometries.length=0,this._near.length=0,this._far.length=0,this._nearCandidates.length=0,this._farCandidates.length=0}_includeNearBoundingInfoRec(t,e,r){if(null==t)return;const i=t.center;s(l(V),i,e);const n=_(e),a=V[0],o=V[1],h=V[2],f=t.radius*n,c=this._frustum;if(c[0][0]*a+c[0][1]*o+c[0][2]*h+c[0][3]>f||c[1][0]*a+c[1][1]*o+c[1][2]*h+c[1][3]>f||c[2][0]*a+c[2][1]*o+c[2][2]*h+c[2][3]>f||c[3][0]*a+c[3][1]*o+c[3][2]*h+c[3][3]>f)return;const u=this._view[2]*a+this._view[6]*o+this._view[10]*h+this._view[14],d=u+f;if(!(-(u-f)<2||-d>=r.near))if(-d>this._looseRange.near)r.near=-d;else{if(f>R){const i=t.getChildren();if(void 0!==i){for(const t of i)this._includeNearBoundingInfoRec(t,e,r);return}}q.unionDepthRangeWithAABB(r,this._viewProj,e,t.bbMin,t.bbMax)}}_includeFarBoundingInfoRec(t,e,r){if(null==t)return;let i=t.radius;const n=t.center;s(l(V),n,e);const a=_(e),o=V[0],h=V[1],f=V[2];i*=a;const c=this._frustum;if(c[0][0]*o+c[0][1]*h+c[0][2]*f+c[0][3]>i||c[1][0]*o+c[1][1]*h+c[1][2]*f+c[1][3]>i||c[2][0]*o+c[2][1]*h+c[2][2]*f+c[2][3]>i||c[3][0]*o+c[3][1]*h+c[3][2]*f+c[3][3]>i)return;const u=this._view[2]*o+this._view[6]*h+this._view[10]*f+this._view[14]-i;if(!(-u<=r.far))if(-u<this._looseRange.far)r.far=-u;else{if(i>R){const i=t.getChildren();if(void 0!==i){for(const t of i)this._includeFarBoundingInfoRec(t,e,r);return}}q.unionDepthRangeWithAABB(r,this._viewProj,e,t.bbMin,t.bbMax)}}}class N{constructor(){this._modelViewProj=n(),this._clipPosition=[o(),o(),o(),o(),o(),o(),o(),o()]}unionDepthRangeWithAABB(t,e,i,n,s){const a=this._modelViewProj;r(a,e,i);let o=!1;for(let r=0;r<8;++r){const t=this._clipPosition[r],e=0===r||3===r||4===r||7===r?n[0]:s[0],i=0===r||1===r||4===r||5===r?n[1]:s[1],o=r<4?n[2]:s[2];t[0]=a[0]*e+a[4]*i+a[8]*o+a[12],t[1]=a[1]*e+a[5]*i+a[9]*o+a[13],t[2]=a[2]*e+a[6]*i+a[10]*o+a[14],t[3]=a[3]*e+a[7]*i+a[11]*o+a[15]}for(let r=0;r<12;++r){const e=E(this._clipPosition[S[r][0]],this._clipPosition[S[r][1]],this._clipPosition[S[r][2]]);let i=!0;for(let t=0;t<e.length;++t){if(e[t][3]>=2){i=!1;break}}if(!i){o=!0;for(let r=0;r<e.length;++r){const i=e[r][3];Number.isFinite(i)&&(t.near=Math.min(i,t.near),t.far=Math.max(i,t.far))}}}return o}}function E(t,e,r){let i=[t,e,r];for(let n=0;n<4;++n){const t=i;i=[];for(let e=0;e<t.length;++e){const r=t[e],s=t[(e+1)%t.length];W(s,n)?(W(r,n)||i.push(K(r,s,n)),i.push(s)):W(r,n)&&i.push(K(r,s,n))}}return i}function W(t,e){return 0===e?t[0]>=-t[3]:1===e?t[1]>=-t[3]:2===e?t[0]<=t[3]:3===e?t[1]<=t[3]:void w(!1)}function K(t,e,r){let i=0;return 0===r?i=(-t[3]-t[0])/(e[0]-t[0]+e[3]-t[3]):1===r?i=(-t[3]-t[1])/(e[1]-t[1]+e[3]-t[3]):2===r?i=(t[3]-t[0])/(e[0]-t[0]-e[3]+t[3]):3===r&&(i=(t[3]-t[1])/(e[1]-t[1]-e[3]+t[3])),a(o(),t,e,i)}const S=[[0,1,3],[2,3,1],[1,5,2],[6,2,5],[5,4,6],[7,6,4],[4,0,7],[3,7,0],[3,2,7],[6,7,2],[4,5,0],[1,0,5]],V=u(),k=n(),G=d(),U=new y,Q=new P,q=new N;export{P as DepthRangeFromRenderGeometries,O as depthRangeFromLayer,M as depthRangeFromScene,B as textureToDepth};
5
+ import{unpackFloatRGBA as t}from"../../../../core/floatRGBA.js";import e from"../../../../core/PooledArray.js";import{multiply as r,copy as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{h as s}from"../../../../chunks/vec32.js";import{l as a}from"../../../../chunks/vec42.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{intersectsSphere as h,create as f,copy as c}from"../../../../geometry/support/frustum.js";import{g as l,c as u}from"../../../../chunks/sphere.js";import{maxScale as _}from"../../support/mathUtils.js";import{empty as d,union as m,set as g,DepthRange as p}from"./depthRange.js";import b from"./Octree.js";import{assert as w}from"./Util.js";const v=1e4,R=100,j=500,C=500,A=.1;function B(e,r,i){return t(r,e)*(i[1]-i[0])+i[0]}function M(t,e,r){let i=0;if(!e.some((t=>!!t.material&&(i+=t.numGeometries,i>=v))))return Q.compute(t,e);const n=d();return r.forAll((e=>m(n,O(t,e)))),n}function O(t,e){if(!e.visible)return;const r=d(),i=e.getSpatialQueryAccelerator();return i?x(r,t,i):D(r,t,e.objects),r}function x(t,e,r){const i=e.eye,n=e.viewForward,s=e.frustum,a=t=>t.visible,o=r.objectCount;if(o<j)g(G,e.near,Math.min(t.near,e.far)),r.forEachInDepthRange(i,n,b.DepthOrder.FRONT_TO_BACK,G,((r,i)=>{T(t,e,r),G.far=t.near,i.setRange(G)}),s,a),g(G,Math.max(t.far,e.near),e.far),r.forEachInDepthRange(i,n,b.DepthOrder.BACK_TO_FRONT,G,((r,i)=>{T(t,e,r),G.near=t.far,i.setRange(G)}),s,a);else{const i=Math.max(Math.min(o,C),Math.ceil(o*A)),h=r.findClosest(n,b.DepthOrder.FRONT_TO_BACK,s,a,i),f=r.findClosest(n,b.DepthOrder.BACK_TO_FRONT,s,a,i);h&&f&&(I(t,e,h.boundingVolumeWorldSpace.bounds),I(t,e,f.boundingVolumeWorldSpace.bounds))}}function D(t,e,r){U.clear(),r.forAll((t=>{t.visible&&0!==t.geometries.length&&U.add(t)})),U.empty||(U.sort(e),g(G,e.near,Math.min(t.near,e.far)),U.forEachInDepthRange(G,b.DepthOrder.FRONT_TO_BACK,((r,i)=>{i<t.near&&T(t,e,r)})),g(G,Math.max(t.far,e.near),e.far),U.forEachInDepthRange(G,b.DepthOrder.BACK_TO_FRONT,((e,r,i)=>{t.far=Math.max(t.far,i)})))}function T(t,e,i){if(!i.visible)return;if(!h(e.frustum,i.boundingVolumeWorldSpace.bounds))return;const n=i.transformation,s=k;i.geometries.forEach((i=>{r(s,n,i.transformation);const a=_(s);F(t,e,i.boundingInfo,s,a)}))}function F(t,e,r,i,n){if(null==r)return;s(l(V),r.center,i);const{eye:a,viewForward:o}=e,f=o[0]*(V[0]-a[0])+o[1]*(V[1]-a[1])+o[2]*(V[2]-a[2]);if(V[3]=r.radius*n,!(f-V[3]>t.near&&f+V[3]<t.far)&&h(e.frustum,V))if(r.radius>R&&r.getChildren())for(const s of r.getChildren())F(t,e,s,i,n);else q.unionDepthRangeWithAABB(t,e.viewProjectionMatrix,i,r.bbMin,r.bbMax)}function I(t,e,r){const i=e.eye,n=e.viewForward,s=(r[0]-i[0])*n[0]+(r[1]-i[1])*n[1]+(r[2]-i[2])*n[2];t.near=Math.min(t.near,s-r[3]),t.far=Math.max(t.far,s+r[3])}class P{constructor(){this._items=new e({allocator:t=>t||{object:null,distance:0,near:0,far:0},deallocator:t=>(t.object=null,t.distance=0,t.near=0,t.far=0,t)})}get length(){return this._items.length}get empty(){return 0===this._items.length}clear(){this._items.clear()}add(t){this._items.pushNew().object=t}sort(t){const e=t.eye,r=t.viewForward;this._items.forAll((t=>{const i=t.object.boundingVolumeWorldSpace.bounds,n=(i[0]-e[0])*r[0]+(i[1]-e[1])*r[1]+(i[2]-e[2])*r[2];t.distance=n,t.near=n-i[3],t.far=n+i[3]})),this._items.sort(((t,e)=>t.distance-e.distance))}forEachInDepthRange(t,e,r){if(e===b.DepthOrder.FRONT_TO_BACK)for(let i=0;i<this._items.length;++i){const e=this._items.data[i];e.far<t.near||e.near>t.far||r(e.object,e.near,e.far)}else for(let i=this._items.length-1;i>=0;--i){const e=this._items.data[i];e.far<t.near||e.near>t.far||r(e.object,e.near,e.far)}}}class y{constructor(){this._view=n(),this._viewProj=n(),this._frustum=f(),this._geometries=new Array,this._near=[],this._far=[],this._nearCandidates=[],this._farCandidates=[],this._looseRange={near:0,far:0}}compute(t,e){this._reset(),i(this._view,t.viewMatrix),r(this._viewProj,t.projectionMatrix,this._view),c(this._frustum,t.frustum);const n=this._view,s=n[2],a=n[6],o=n[10],h=n[14];e.forAll((t=>{t.forEachGeometry((t=>{if(!t.visible||!t.castShadow)return;const e=t.boundingSphere,r=s*e[0]+a*e[1]+o*e[2]+h,i=r-e[3],n=r+e[3];this._geometries.push(t),this._near.push(-n),this._far.push(-i)}))}));const f=new p;if(0===this._geometries.length)return f;for(let r=0;r<this._geometries.length;++r)this._near[r]>f.far&&(f.far=this._near[r]),this._near[r]>2&&this._far[r]<f.near&&(f.near=this._far[r]);const l=this._looseRange;l.near=Math.max(.5*f.near,2),l.far=2*f.far;let u=0,_=0;for(let r=0;r<this._geometries.length;++r)this._near[r]<f.near&&(this._near[r]>=l.near?f.near=this._near[r]:this._nearCandidates[u++]=r),this._far[r]>f.far&&(this._far[r]<=l.far?f.far=this._far[r]:this._farCandidates[_++]=r);if(0===this._nearCandidates.length&&0===this._farCandidates.length)return f;this._nearCandidates.sort(((t,e)=>this._near[t]<this._near[e]?-1:this._near[t]>this._near[e]?1:0)),this._farCandidates.sort(((t,e)=>this._far[t]<this._far[e]?1:this._far[t]>this._far[e]?-1:0));for(let r=0;r<this._nearCandidates.length;++r){const t=this._nearCandidates[r];if(this._near[t]<f.near){const e=this._geometries[t],r=e.boundingInfo;this._includeNearBoundingInfoRec(r,e.shaderTransformation,f)}}for(let r=0;r<this._farCandidates.length;++r){const t=this._farCandidates[r];if(this._far[t]>f.far){const e=this._geometries[t],r=e.boundingInfo;this._includeFarBoundingInfoRec(r,e.shaderTransformation,f)}}return this._reset(),f}_reset(){this._geometries.length=0,this._near.length=0,this._far.length=0,this._nearCandidates.length=0,this._farCandidates.length=0}_includeNearBoundingInfoRec(t,e,r){if(null==t)return;const i=t.center;s(l(V),i,e);const n=_(e),a=V[0],o=V[1],h=V[2],f=t.radius*n,c=this._frustum;if(c[0][0]*a+c[0][1]*o+c[0][2]*h+c[0][3]>f||c[1][0]*a+c[1][1]*o+c[1][2]*h+c[1][3]>f||c[2][0]*a+c[2][1]*o+c[2][2]*h+c[2][3]>f||c[3][0]*a+c[3][1]*o+c[3][2]*h+c[3][3]>f)return;const u=this._view[2]*a+this._view[6]*o+this._view[10]*h+this._view[14],d=u+f;if(!(-(u-f)<2||-d>=r.near))if(-d>this._looseRange.near)r.near=-d;else{if(f>R){const i=t.getChildren();if(void 0!==i){for(const t of i)this._includeNearBoundingInfoRec(t,e,r);return}}q.unionDepthRangeWithAABB(r,this._viewProj,e,t.bbMin,t.bbMax)}}_includeFarBoundingInfoRec(t,e,r){if(null==t)return;let i=t.radius;const n=t.center;s(l(V),n,e);const a=_(e),o=V[0],h=V[1],f=V[2];i*=a;const c=this._frustum;if(c[0][0]*o+c[0][1]*h+c[0][2]*f+c[0][3]>i||c[1][0]*o+c[1][1]*h+c[1][2]*f+c[1][3]>i||c[2][0]*o+c[2][1]*h+c[2][2]*f+c[2][3]>i||c[3][0]*o+c[3][1]*h+c[3][2]*f+c[3][3]>i)return;const u=this._view[2]*o+this._view[6]*h+this._view[10]*f+this._view[14]-i;if(!(-u<=r.far))if(-u<this._looseRange.far)r.far=-u;else{if(i>R){const i=t.getChildren();if(void 0!==i){for(const t of i)this._includeFarBoundingInfoRec(t,e,r);return}}q.unionDepthRangeWithAABB(r,this._viewProj,e,t.bbMin,t.bbMax)}}}class N{constructor(){this._modelViewProj=n(),this._clipPosition=[o(),o(),o(),o(),o(),o(),o(),o()]}unionDepthRangeWithAABB(t,e,i,n,s){const a=this._modelViewProj;r(a,e,i);let o=!1;for(let r=0;r<8;++r){const t=this._clipPosition[r],e=0===r||3===r||4===r||7===r?n[0]:s[0],i=0===r||1===r||4===r||5===r?n[1]:s[1],o=r<4?n[2]:s[2];t[0]=a[0]*e+a[4]*i+a[8]*o+a[12],t[1]=a[1]*e+a[5]*i+a[9]*o+a[13],t[2]=a[2]*e+a[6]*i+a[10]*o+a[14],t[3]=a[3]*e+a[7]*i+a[11]*o+a[15]}for(let r=0;r<12;++r){const e=W(this._clipPosition[S[r][0]],this._clipPosition[S[r][1]],this._clipPosition[S[r][2]]);let i=!0;for(let t=0;t<e.length;++t){if(e[t][3]>=2){i=!1;break}}if(!i){o=!0;for(let r=0;r<e.length;++r){const i=e[r][3];Number.isFinite(i)&&(t.near=Math.min(i,t.near),t.far=Math.max(i,t.far))}}}return o}}function W(t,e,r){let i=[t,e,r];for(let n=0;n<4;++n){const t=i;i=[];for(let e=0;e<t.length;++e){const r=t[e],s=t[(e+1)%t.length];E(s,n)?(E(r,n)||i.push(K(r,s,n)),i.push(s)):E(r,n)&&i.push(K(r,s,n))}}return i}function E(t,e){return 0===e?t[0]>=-t[3]:1===e?t[1]>=-t[3]:2===e?t[0]<=t[3]:3===e?t[1]<=t[3]:void w(!1)}function K(t,e,r){let i=0;return 0===r?i=(-t[3]-t[0])/(e[0]-t[0]+e[3]-t[3]):1===r?i=(-t[3]-t[1])/(e[1]-t[1]+e[3]-t[3]):2===r?i=(t[3]-t[0])/(e[0]-t[0]-e[3]+t[3]):3===r&&(i=(t[3]-t[1])/(e[1]-t[1]-e[3]+t[3])),a(o(),t,e,i)}const S=[[0,1,3],[2,3,1],[1,5,2],[6,2,5],[5,4,6],[7,6,4],[4,0,7],[3,7,0],[3,2,7],[6,7,2],[4,5,0],[1,0,5]],V=u(),k=n(),G=d(),U=new P,Q=new y,q=new N;export{y as DepthRangeFromRenderGeometries,O as depthRangeFromLayer,M as depthRangeFromScene,B as textureToDepth};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{releaseMaybe as e}from"../../../../../core/maybe.js";import r from"../../../../../core/PooledArray.js";import{transpose as t,invert as s}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{s as n}from"../../../../../chunks/vec32.js";import{debugFlags as a}from"../../../support/debugFlags.js";import{TwoVectorPosition as o}from"../../core/util/TwoVectorPosition.js";import{EdgeDrawParameters as d}from"./EdgeShaderParameters.js";import{EdgeShaderTechnique as l}from"./EdgeShaderTechnique.js";import{EdgeShaderTechniqueConfiguration as h}from"./EdgeShaderTechniqueConfiguration.js";import{Transparency as c}from"./interfaces.js";import{EdgeType as u}from"../../shaders/sources/edgeRenderer/EdgeUtil.glsl.js";import{PrimitiveType as _}from"../../../../webgl/enums.js";const m=8,g=128,f={type:u.Solid,hasSlicePlane:!1,strokesTexture:null,legacy:!0,spherical:!0};class b{constructor(e,t,s){this._rctx=e,this._techniques=t,this._configuration=new h,this.refCount=0,this._renderables=new Set,this._sortedRenderables={[c.TRANSPARENT]:{[c.TRANSPARENT]:new r,[c.OPAQUE]:new r},[c.OPAQUE]:{[c.TRANSPARENT]:new r,[c.OPAQUE]:new r}},this._renderablesDirty=!1,this._drawParameters=new d,this._settings={...f,...s},this.key=b.getKey(this._settings.type,this._settings.hasSlicePlane,this._settings.legacy);const i=this._settings.strokesTexture.variants;this.writerSettings={variants:i,reducedPrecision:a.TESTS_DISABLE_OPTIMIZATIONS},this._configuration.legacy=this._settings.legacy,this._configuration.type=this._settings.type,this._configuration.silhouette=!1,this._configuration.hasSlicePlane=this._settings.hasSlicePlane,this._configuration.doublePrecisionRequiresObfuscation=e.driverTest.doublePrecisionRequiresObfuscation.result,this._configuration.spherical=s.spherical}dispose(){this._technique=e(this._technique)}addRenderable(e){this._renderables.add(e),this._renderablesDirty=!0}removeRenderable(e){this._renderables.delete(e),this._renderablesDirty=!0}setRenderablesDirty(){this._renderablesDirty=!0}forEachRenderable(e,r){this._renderablesDirty&&this._sortRenderables();const t=this._sortedRenderables[r];t[c.TRANSPARENT].forAll(e),t[c.OPAQUE].forAll(e)}updateTechnique(e,r){return this._configuration.multipassEnabled=!!e.multipassEnabled,this._configuration.cullAboveGround=!!e.multipassTerrain.cullAboveGround,this._configuration.silhouette=r,this._technique=this._techniques.releaseAndAcquire(l,this._configuration,this._technique),this._technique}bindRegularEdges(e,r){return this._lastOriginId=null,this._rctx.bindTechnique(this.updateTechnique(r,!1),r,e)}bindSilhouetteEdges(e,r){return this._lastOriginId=null,this._rctx.bindTechnique(this.updateTechnique(r,!0),r,e)}renderRegularEdges(e,r,t,s,i){this._render(e,r,r.regular.vao,t,s,i)}renderSilhouetteEdges(e,r,t,s,i){this._render(e,r,r.silhouette.vao,t,s,i)}_render(e,r,t,s,i,n){n>0&&(this._bindDraw(e,r,s,i),this._rctx.bindVAO(t),this._rctx.drawArraysInstanced(_.TRIANGLE_FAN,0,4,n))}_bindDraw(e,r,i,a){this._drawParameters.componentDataTexture=r.components.buffer.textureBuffer.texture,this._drawParameters.strokesTexture=this._settings.strokesTexture;const d=r.transform.origin;if(d){const t=d.origin.id;this._lastOriginId!==t&&(e.setUniformMatrix4fv("localView",d.viewMatrix),this._lastOriginId=t),e.setUniformMatrix4fv("model",r.transform.modelMatrix),this._drawParameters.slicePlaneLocalOrigin=d.origin.vec3}else{const e=new o(r.transform.position),i=t(T,s(T,r.transform.rotationScale));this._drawParameters.transformWorldFromModelTL=e.low,this._drawParameters.transformWorldFromModelTH=e.high,this._drawParameters.transformWorldFromModelRS=r.transform.rotationScale,this._drawParameters.transformNormalGlobalFromModel=i;const d=a.camera.viewInverseTransposeMatrix;n(this._drawParameters.slicePlaneLocalOrigin,d[3],d[7],d[11])}e.bindDraw(this._drawParameters,a,i)}_sortRenderables(){this._renderablesDirty=!1,this._sortedRenderables[c.TRANSPARENT][c.TRANSPARENT].clear(),this._sortedRenderables[c.TRANSPARENT][c.OPAQUE].clear(),this._sortedRenderables[c.OPAQUE][c.TRANSPARENT].clear(),this._sortedRenderables[c.OPAQUE][c.OPAQUE].clear(),this._renderables.forEach((e=>{e.objectTransparency!==c.INVISIBLE&&e.edgeTransparency!==c.INVISIBLE&&this._sortedRenderables[e.objectTransparency][e.edgeTransparency].push(e)}));const e=(e,r)=>e.transform.origin?r.transform.origin?e.transform.origin.origin.id<r.transform.origin.origin.id?-1:e.transform.origin.origin.id>r.transform.origin.origin.id?1:0:1:0;this._sortedRenderables[c.TRANSPARENT][c.TRANSPARENT].sort(e),this._sortedRenderables[c.TRANSPARENT][c.OPAQUE].sort(e),this._sortedRenderables[c.OPAQUE][c.TRANSPARENT].sort(e),this._sortedRenderables[c.OPAQUE][c.OPAQUE].sort(e)}static getKey(e,r,t){return`edges-t:${e}:${r}:${t}`}}const T=i();export{b as EdgeRenderer,g as extensionLengthOffset,m as lineWidthFractionFactor};
5
+ import{releaseMaybe as e}from"../../../../../core/maybe.js";import r from"../../../../../core/PooledArray.js";import{transpose as t,invert as s}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{s as n}from"../../../../../chunks/vec32.js";import{debugFlags as o}from"../../../support/debugFlags.js";import{TwoVectorPosition as a}from"../../core/util/TwoVectorPosition.js";import{EdgeDrawParameters as d}from"./EdgeShaderParameters.js";import{EdgeShaderTechnique as l}from"./EdgeShaderTechnique.js";import{EdgeShaderTechniqueConfiguration as h}from"./EdgeShaderTechniqueConfiguration.js";import{Transparency as c}from"./interfaces.js";import{EdgeType as u}from"../../shaders/sources/edgeRenderer/EdgeUtil.glsl.js";import{PrimitiveType as _}from"../../../../webgl/enums.js";const m=8,g=128,f={type:u.Solid,hasSlicePlane:!1,strokesTexture:null,legacy:!0,spherical:!0};class b{constructor(e,t,s){this._rctx=e,this._techniques=t,this._configuration=new h,this.refCount=0,this._renderables=new Set,this._sortedRenderables={[c.TRANSPARENT]:{[c.TRANSPARENT]:new r,[c.OPAQUE]:new r},[c.OPAQUE]:{[c.TRANSPARENT]:new r,[c.OPAQUE]:new r}},this._renderablesDirty=!1,this._drawParameters=new d,this._settings={...f,...s},this.key=b.getKey(this._settings.type,this._settings.hasSlicePlane,this._settings.legacy);const i=this._settings.strokesTexture.variants;this.writerSettings={variants:i,reducedPrecision:o.TESTS_DISABLE_OPTIMIZATIONS},this._configuration.legacy=this._settings.legacy,this._configuration.type=this._settings.type,this._configuration.silhouette=!1,this._configuration.hasSlicePlane=this._settings.hasSlicePlane,this._configuration.doublePrecisionRequiresObfuscation=e.driverTest.doublePrecisionRequiresObfuscation.result,this._configuration.spherical=s.spherical}dispose(){this._technique=e(this._technique)}addRenderable(e){this._renderables.add(e),this._renderablesDirty=!0}removeRenderable(e){this._renderables.delete(e),this._renderablesDirty=!0}setRenderablesDirty(){this._renderablesDirty=!0}forEachRenderable(e,r){this._renderablesDirty&&this._sortRenderables();const t=this._sortedRenderables[r];t[c.TRANSPARENT].forAll(e),t[c.OPAQUE].forAll(e)}updateTechnique(e,r){return this._configuration.multipassEnabled=!!e.multipassEnabled,this._configuration.cullAboveGround=!!e.multipassTerrain.cullAboveGround,this._configuration.silhouette=r,this._technique=this._techniques.releaseAndAcquire(l,this._configuration,this._technique),this._technique}bindRegularEdges(e,r){return this._lastOriginId=null,this._rctx.bindTechnique(this.updateTechnique(r,!1),r,e)}bindSilhouetteEdges(e,r){return this._lastOriginId=null,this._rctx.bindTechnique(this.updateTechnique(r,!0),r,e)}renderRegularEdges(e,r,t,s,i){this._render(e,r,r.regular.vao,t,s,i)}renderSilhouetteEdges(e,r,t,s,i){this._render(e,r,r.silhouette.vao,t,s,i)}_render(e,r,t,s,i,n){n>0&&(this._bindDraw(e,r,s,i),this._rctx.bindVAO(t),this._rctx.drawArraysInstanced(_.TRIANGLE_FAN,0,4,n))}_bindDraw(e,r,i,o){this._drawParameters.componentDataTexture=r.components.buffer.textureBuffer.texture,this._drawParameters.strokesTexture=this._settings.strokesTexture;const d=r.transform.origin;if(d){const t=d.origin.id;this._lastOriginId!==t&&(e.setUniformMatrix4fv("localView",d.viewMatrix),this._lastOriginId=t),e.setUniformMatrix4fv("model",r.transform.modelMatrix),this._drawParameters.slicePlaneLocalOrigin=d.origin.vec3}else{const e=new a(r.transform.position),i=t(A,s(A,r.transform.rotationScale));this._drawParameters.transformWorldFromModelTL=e.low,this._drawParameters.transformWorldFromModelTH=e.high,this._drawParameters.transformWorldFromModelRS=r.transform.rotationScale,this._drawParameters.transformNormalGlobalFromModel=i;const d=o.camera.viewInverseTransposeMatrix;n(this._drawParameters.slicePlaneLocalOrigin,d[3],d[7],d[11])}e.bindDraw(this._drawParameters,o,i)}_sortRenderables(){this._renderablesDirty=!1,this._sortedRenderables[c.TRANSPARENT][c.TRANSPARENT].clear(),this._sortedRenderables[c.TRANSPARENT][c.OPAQUE].clear(),this._sortedRenderables[c.OPAQUE][c.TRANSPARENT].clear(),this._sortedRenderables[c.OPAQUE][c.OPAQUE].clear(),this._renderables.forEach((e=>this._sortedRenderables[e.objectTransparency][e.edgeTransparency].push(e)));const e=(e,r)=>e.transform.origin?r.transform.origin?e.transform.origin.origin.id<r.transform.origin.origin.id?-1:e.transform.origin.origin.id>r.transform.origin.origin.id?1:0:1:0;this._sortedRenderables[c.TRANSPARENT][c.TRANSPARENT].sort(e),this._sortedRenderables[c.TRANSPARENT][c.OPAQUE].sort(e),this._sortedRenderables[c.OPAQUE][c.TRANSPARENT].sort(e),this._sortedRenderables[c.OPAQUE][c.OPAQUE].sort(e)}static getKey(e,r,t){return`edges-t:${e}:${r}:${t}`}}const A=i();export{b as EdgeRenderer,g as extensionLengthOffset,m as lineWidthFractionFactor};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/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"../../../../../core/has.js";import n from"../../../../../core/Logger.js";import{clamp as i}from"../../../../../core/mathUtils.js";import{disposeMaybe as o,destroyMaybe as a}from"../../../../../core/maybe.js";import{isAbortError as c,onAbortOrThrow as l}from"../../../../../core/promiseUtils.js";import{property as d}from"../../../../../core/accessorSupport/decorators/property.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as u,transpose as m,invert as g}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as f}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as p}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as _,c as b,z as y,m as j}from"../../../../../chunks/vec32.js";import{create as O,clone as w}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as E}from"../../../../../core/support/UpdatingHandles.js";import{g as v,b as x}from"../../../../../chunks/sphere.js";import{c as R}from"../../../../../chunks/vec33.js";import{ViewingMode as M}from"../../../../ViewingMode.js";import{encodeElevationOffset as T}from"../../collections/Component/Material/shader/ComponentData.glsl.js";import{TwoVectorPosition as C}from"../../core/util/TwoVectorPosition.js";import{Attribute as A}from"../Attribute.js";import{GridLocalOriginFactory as P}from"../GridLocalOriginFactory.js";import{applyToModelMatrix as D}from"../localOriginHelper.js";import{LocalOriginManager as U}from"../LocalOriginManager.js";import{Object3D as L}from"../Object3D.js";import{VertexArrayObject as S}from"../VertexArrayObject.js";import{VertexAttribute as k}from"../VertexAttribute.js";import{VertexLayout as I,EdgeInputBufferLayout as B,EdgeShaderAttributeLocations as V,glVertexLayout as H}from"./bufferLayouts.js";import{RegularEdgeBufferWriter as G,SilhouetteEdgeBufferWriter as N}from"./edgeBufferWriters.js";import{EdgeRenderer as W,lineWidthFractionFactor as q,extensionLengthOffset as z}from"./EdgeRenderer.js";import{EdgePassParameters as F}from"./EdgeShaderParameters.js";import{EdgeWorkerHandle as K}from"./EdgeWorkerHandle.js";import"./interfaces.js";import{generateStrokesTexture as J}from"./strokes.js";import{determineRendererType as Q,determineEdgeTransparency as X,determineObjectTransparency as Y,fillComponentBufferIndices as Z}from"./util.js";import{BufferManager as $}from"../TextureBackedBuffer/BufferManager.js";import{EdgeSilhouette as ee}from"../../shaders/sources/edgeRenderer/EdgeUtil.glsl.js";import{BufferObject as te}from"../../../../webgl/BufferObject.js";import{Usage as re}from"../../../../webgl/enums.js";const se=128;let ne=class extends t{constructor(e){super(e),this._updatingHandles=new E,this._objectEntries=new Map,this._pendingDeletions=new Map,this._renderers=new Map,this._gpuMemoryUsage=0,this._workerAbort=new AbortController,this._tmpModelPosition=O(),this._localOrigins=new U(new P(e.renderSR));const t=I.createBuffer(4);for(let r=0;r<4;r++)t.sideness.set(r,0,0===r||3===r?0:1),t.sideness.set(r,1,0===r||1===r?0:1);this._verticesBufferObject=te.createVertex(e.rctx,re.STATIC_DRAW,t.buffer)}initialize(){this._worker=new K(this.schedule),this._componentColorManager=new $(this.rctx,3)}destroy(){this.destroyed||(this._objectEntries.forEach((e=>this._discardObjectEntry(e))),this._objectEntries.clear(),this._pendingDeletions.forEach((e=>this._discardObjectEntry(e))),this._pendingDeletions.clear(),this._strokesTexture=o(this._strokesTexture),this._componentColorManager=a(this._componentColorManager),this._workerAbort.abort(),this._worker.destroy(),this._verticesBufferObject.dispose(),this._renderers.clear(),this._updatingHandles.destroy(),this._set("schedule",we))}get updating(){return this._updatingHandles.updating}get usedMemory(){return this._gpuMemoryUsage}shouldRender(){return this._renderers.size>0}async addComponentObject(e,t,r,s,n,i,o){if(this.hasObject(e))return this._getObjectMemoryUsage(e);let a;const c=new ae(null,new Promise((e=>a=e)),e.obb.center,e.obb.radius);this._objectEntries.set(e,c);const l=await this._updatingHandles.addPromise(this._addComponentGeometry(e.transform,c,t,r,s,n,i,o));return this.setNeedsRender(),a(),l}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 i=new AbortController;let o;const a=e.boundingVolumeWorldSpace.bounds,l=new ae(i,new Promise((e=>o=e)),v(a),x(a)),d=this._objectEntries.get(e);d&&(this._pendingDeletions.has(e)?this._discardObjectEntry(d):this._pendingDeletions.set(e,d)),this._objectEntries.set(e,l);try{const n=new Array;if(r.mergeGeometries&&e.geometries.length>1&&oe(e))n.push(this._addObjectMergedGeometries(e,l,t,r,s));else for(const i of e.geometries)i.material.supportsEdges&&n.push(this._addGeometry(e,l,i,t[0],r,s));await this._updatingHandles.addPromise(Promise.all(n)),this._removePendingDeletion(e)}catch(h){c(h)?this._discardObjectEntry(l):this._removePendingDeletion(e)}finally{this.setNeedsRender(),o()}}removeObject(e){const t=this._objectEntries.get(e);this._objectEntries.delete(e),this._discardObjectEntry(t),this._removePendingDeletion(e)}_removePendingDeletion(e){const t=this._pendingDeletions.get(e);this._pendingDeletions.delete(e),this._discardObjectEntry(t)}async _getObjectEntry(e){const t=this._objectEntries.get(e);if(!t)throw new Error("no object");return await t.loaded,null==t.loaded?null:t}fastUpdateObject3DEdgesTransform(e){if(this.destroyed)return!1;const t=this._objectEntries.get(e);if(!t)return!1;const{geometries:r}=e,{renderables:s}=t;if(0===r.length||0===s.length)return!0;if(s.length>1)return!1;const[n]=s,i=n.transform;if(!(i instanceof de))return!1;const[o]=r;if(o.localOrigin!==i.origin.origin)return!1;const a=p(),c=this._computeModelTransformWithLocalOrigin(e,o,a);return n.transform=new de(a,c),this.setNeedsRender(),!0}_discardObjectEntry(e){e&&(e.abort?.abort(),e.renderables.length&&(e.renderables.forEach((e=>this._removeRenderable(e))),this.setNeedsRender()),e.loaded=null)}hasObject(e){return this._objectEntries.has(e)}async updateAllComponentOpacities(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));if(null==r)return;const s=Array.isArray(t)?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],i=n.index;n.material.opacity=t,e.components.buffer.textureBuffer.setDataElement(i,1,3,255*t)}this._updateTransparency(e)})),this.setNeedsRender()}async _getObjectMemoryUsage(e){const t=await this._getObjectEntry(e);return t?t.renderables.reduce(((e,t)=>e+t.statistics.gpuMemoryUsage),0):0}async updateAllComponentMaterials(e,t,r,s){const n=e instanceof L,i=!!r.hasSlicePlane,o=Q(t),a=W.getKey(o,i,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(o,i,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&&me(e.components),this._updateTransparency(e)})),this.setNeedsRender())}async updateAllVerticalOffsets(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));null!=r&&this._updateAllVerticalOffsets(r,t)}_updateAllVerticalOffsets(e,t){e.renderables.forEach((e=>{const r=e.components.meta;for(let s=0;s<r.length;s++)e.components.meta[s].verticalOffset=t?.[s]??0;me(e.components)})),this.setNeedsRender()}async updateObjectVisibility(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));r&&(r.renderables.forEach((e=>e.visible=t)),this.setNeedsRender())}render(e,t){if(null==this._componentColorManager)return;this._localOrigins.updateViewMatrices(e.camera.viewMatrix);const r=e.camera.viewInverseTransposeMatrix,s=O(),n=new C;let i=0,o=0;if(this._renderers.forEach((r=>{if(0===r.refCount)return this._renderers.delete(r.key),void r.dispose();let s=!0,n=!0;r.forEachRenderable((t=>{t.visible&&(i+=t.statistics.averageEdgeLength,o++,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===o)return;const a=new F(40*i/o,t);_(s,r[3],r[7],r[11]),n.set(s),b(a.transformWorldFromViewTH,n.high),b(a.transformWorldFromViewTL,n.low),u(a.transformViewFromCameraRelativeRS,e.camera.viewMatrix),m(Oe,a.transformViewFromCameraRelativeRS),g(a.transformNormalViewFromGlobal,Oe),a.transformProjFromView=e.camera.projectionMatrix,this._updateObjectCameraDistances(e),this._renderers.forEach((t=>{ge(t,e,a),fe(t,e,a)}))}_updateTransparency(e){const t=X(e.components.meta),r=Y(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(_(this._tmpModelPosition,r[12],r[13],r[14]));return t.localOrigin=s.origin,D(s.origin.vec3,r),s}_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],i=r.acquireIndex();t.push({index:i,verticalOffset:0,material:s})}const s=new ce(r,t);return me(s),s}_extractEdges(e,t,r,s,n,i,o=i.length){return o<se&&(n=!0),this._worker.process({data:r,indices:i,indicesLength:o,writerSettings:t,skipDeduplicate:s},e,n)}_createRenderable(e,t,r,s,n){const i=t=>new le(new S(this.rctx,V,{vertices:H,instances:t===ee.REGULAR?G.glLayout:N.glLayout},{vertices:this._verticesBufferObject,instances:te.createVertex(this.rctx,re.STATIC_DRAW,t===ee.REGULAR?e.regular.instancesData.buffer:e.silhouette.instancesData.buffer)}),t===ee.REGULAR?e.regular.lodInfo:e.silhouette.lodInfo),o=e.regular.lodInfo.lengths.length>0?i(ee.REGULAR):null,a=e.silhouette.lodInfo.lengths.length>0?i(ee.SILHOUETTE):null,c=(o?.vao.usedMemory??0)+(a?.vao.usedMemory??0);return new he(o,a,{gpuMemoryUsage:c,externalMemoryUsage:n,averageEdgeLength:e.averageEdgeLength},r,X(t.meta),Y(t.meta),t,s)}async _addGeometry(e,t,r,s,n,i){if(r.edgeIndicesLength<=0)return;const o=r.attributes.get(k.POSITION),a=p(),c=this._computeModelTransformWithLocalOrigin(e,r,a),l=new je(o,a,c);return this._addPositionData(t,l,r.edgeIndicesLength,s,n,i)}async _addPositionData(e,t,r,s,n,i=!1){if(null==e.loaded)return;const o=this._createComponentBuffers([s]);if(null==o)return;const a=this._acquireRenderer(s.type,!!n.hasSlicePlane,!0),{modelTransform:c,origin:l}=t,d=t.position.indices,h=t.position,u=h.data.length/h.size,m=B.createBuffer(u);for(let p=0;p<u;p++)m.position.set(p,0,h.data[p*h.size]),m.position.set(p,1,h.data[p*h.size+1]),m.position.set(p,2,h.data[p*h.size+2]);Z(o.meta,[0,m.componentIndex.count],m.componentIndex);const g=await this._updatingHandles.addPromise(this._extractEdges(e.abort?.signal||this._workerAbort.signal,a.writerSettings,m,!1,i,d,r));if(null==e.loaded)return;const f=this._createRenderable(g,o,new de(c,l),a.key,!1);e.renderables.push(f),a.addRenderable(f),this._gpuMemoryUsage+=f.statistics.gpuMemoryUsage}async _addComponentGeometry(e,t,r,s,n,i,o,a){if(null==t.loaded)return 0;const c=this._createComponentBuffers(i);if(null==c)return 0;const l=Q(i),d=this._acquireRenderer(l,o.hasSlicePlane||!1,!1),h=B.createBuffer(r.length/3);R(h.position.typedBuffer,r,h.position.typedBufferStride,3),Z(c.meta,n,h.componentIndex,s);const u=!0,m=d.writerSettings,g=await this._updatingHandles.addPromise(this._extractEdges(this._workerAbort.signal,m,h,u,!1,s));if(null==t.loaded)return 0;const f=this._createRenderable(g,c,e,d.key,!0);return t.renderables.push(f),d.addRenderable(f),this._updateAllVerticalOffsets(t,a),f.statistics.gpuMemoryUsage}async _addObjectMergedGeometries(e,t,r,s,n){const i=new Map;let o=0,a=0,c=null;const l=e.geometries.filter((e=>{if(e.edgeIndicesLength<=0||!e.material.supportsEdges)return!1;!c&&e.localOrigin&&(c=e);const t=e.attributes.get(k.POSITION);return a+=t.data.length/t.size,o+=e.edgeIndicesLength,!0}));if(0===l.length)return;const d=a>=65536?Uint32Array:Uint16Array,h=o?new d(o):null,u=[];let m=0;l.forEach((e=>{const t=e.attributes.get(k.POSITION),r=t.indices;let s=i.get(t.data);if(null==s){s=u.length/3;for(let e=0;e<t.data.length;e+=t.size)u.push(t.data[e]),u.push(t.data[e+1]),u.push(t.data[e+2]);i.set(t.data,s)}for(let n=0;n<e.edgeIndicesLength;n++)h[m++]=s+r[n]}));const g=c||e.geometries[0],f=p(),_=this._computeModelTransformWithLocalOrigin(e,g,f);for(let p=0;p<e.geometries.length;p++)e.geometries[p].localOrigin=_.origin;const b=new je(new A(u,h,3),f,_);await this._updatingHandles.addPromise(this._addPositionData(t,b,h.length,r[0],s,n))}_acquireRenderer(e,t,r){const s=W.getKey(e,t,r);let n=this._renderers.get(s);return null==this._strokesTexture&&(this._strokesTexture=J(this.rctx)),n||(n=new W(this.rctx,this.techniques,{type:e,hasSlicePlane:t,strokesTexture:this._strokesTexture,legacy:r,spherical:this.viewingMode===M.Global}),this._renderers.set(s,n)),++n.refCount,n}_removeRenderable(e){ie(e.regular),ie(e.silhouette);const t=this._renderers.get(e.rendererKey);if(t){t.removeRenderable(e),--t.refCount,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=O(),n=e=>{y(s,e.center,t);const n=j(s,r),i=e.radius,o=n<-i?1/0:n<i?0:n-i;e.renderables.forEach((e=>e.distanceToCamera=o))};this._objectEntries.forEach(n),this._pendingDeletions.forEach(n)}get test(){}};function ie(e){e?.vao&&(e.vao.vertexBuffers.instances.dispose(),e.vao.disposeVAOOnly(),e.vao=null)}function oe(e){let t=null,s=null;for(const n of e.geometries){if(n.material.supportsEdges){if(t){if(!r(t,n.transformation))return!1}else t=n.transformation;if(s||null==n.localOrigin){if(null!=s?.localOrigin&&null!=n.localOrigin&&s.localOrigin.id!==n.localOrigin.id)return!1}else s=n}}return!0}e([d({constructOnly:!0})],ne.prototype,"rctx",void 0),e([d({constructOnly:!0})],ne.prototype,"renderSR",void 0),e([d({constructOnly:!0})],ne.prototype,"viewingMode",void 0),e([d({constructOnly:!0})],ne.prototype,"techniques",void 0),e([d({constructOnly:!0})],ne.prototype,"setNeedsRender",void 0),e([d({constructOnly:!0})],ne.prototype,"schedule",void 0),e([d({readOnly:!0})],ne.prototype,"_updatingHandles",void 0),e([d({readOnly:!0})],ne.prototype,"updating",null),ne=e([h("esri.views.3d.webgl-engine.lib.edgeRendering.EdgeView")],ne);class ae{constructor(e,t,r,s){this.abort=e,this.radius=s,this.renderables=new Array;const n=e?l(e.signal,(()=>e.abort())):null;this.loaded=t,this.loaded.then((()=>{null!=this.loaded&&(this.loaded=!0),this.abort=null,n?.remove()})),this.center=w(r)}}class ce{constructor(e,t){this.buffer=e,this.meta=t}}class le{constructor(e,t){this.vao=e,this.lod=t}}class de{constructor(e,t){this.modelMatrix=e,this.origin=t}}class he{constructor(e,t,r,s,n,i,o,a){this.regular=e,this.silhouette=t,this.statistics=r,this.transform=s,this.edgeTransparency=n,this.objectTransparency=i,this.components=o,this.rendererKey=a,this.distanceToCamera=0,this.visible=!0}}class ue extends he{}function me(e){const{meta:t,buffer:r}=e,s=new Uint8Array(4);for(let n=0;n<t.length;n++){const e=t[n].material,o=t[n].index,a=i(Math.round(e.size*q),0,255),c=i(e.extensionLength,-z,255-z)+z,l=255*e.opacity,d=e.color,h=255*d[0],u=255*d[1],m=255*d[2],g=255*d[3];r.textureBuffer.setData(o,0,h,u,m,g),r.textureBuffer.setData(o,1,a,c,e.type,l),T(t[n].verticalOffset,s),r.textureBuffer.setData(o,2,s[0],s[1],s[2],s[3])}}function ge(e,t,r){const s=e.bindRegularEdges(r,t),n=r.transparency,i=t.camera.perScreenPixelRatio;e.forEachRenderable((n=>{if(!pe(n)||!n.visible)return;const o=ye(n.regular.lod.lengths,n.distanceToCamera,i);e.renderRegularEdges(s,n,r,t,o)}),n)}function fe(e,t,r){const s=e.bindSilhouetteEdges(r,t),n=r.transparency,i=t.camera.perScreenPixelRatio;e.forEachRenderable((n=>{if(!be(n)||!n.visible)return;const o=ye(n.silhouette.lod.lengths,n.distanceToCamera,i);e.renderSilhouetteEdges(s,n,r,t,o)}),n)}function pe(e){return null!=e.regular}class _e extends he{}function be(e){return null!=e.silhouette}function ye(e,t,r){const n=t*r,i=s(e,n,!0);return-1===i?n<e[0]?e.length:0:e.length-i}class je{constructor(e,t,r){this.position=e,this.modelTransform=t,this.origin=r}}const Oe=f(),we=()=>Promise.reject();export{ne as EdgeView,de as LegacyTransform,ue as RegularRenderable,he as Renderable,_e 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"../../../../../core/has.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{isAbortError as c,onAbortOrThrow as l}from"../../../../../core/promiseUtils.js";import{property as d}from"../../../../../core/accessorSupport/decorators/property.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as u,transpose as m,invert as g}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as f}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as p}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as _,c as b,z as y,m as j}from"../../../../../chunks/vec32.js";import{create as O,clone as w}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as E}from"../../../../../core/support/UpdatingHandles.js";import{g as v,b as x}from"../../../../../chunks/sphere.js";import{c as R}from"../../../../../chunks/vec33.js";import{ViewingMode as M}from"../../../../ViewingMode.js";import{encodeElevationOffset as T}from"../../collections/Component/Material/shader/ComponentData.glsl.js";import{TwoVectorPosition as A}from"../../core/util/TwoVectorPosition.js";import{Attribute as C}from"../Attribute.js";import{GridLocalOriginFactory as D}from"../GridLocalOriginFactory.js";import{applyToModelMatrix as P}from"../localOriginHelper.js";import{LocalOriginManager as U}from"../LocalOriginManager.js";import{Object3D as L}from"../Object3D.js";import{VertexArrayObject as k}from"../VertexArrayObject.js";import{VertexAttribute as I}from"../VertexAttribute.js";import{VertexLayout as S,EdgeInputBufferLayout as B,EdgeShaderAttributeLocations as V,glVertexLayout as H}from"./bufferLayouts.js";import{RegularEdgeBufferWriter as G,SilhouetteEdgeBufferWriter as N}from"./edgeBufferWriters.js";import{EdgeRenderer as W,lineWidthFractionFactor as q,extensionLengthOffset as z}from"./EdgeRenderer.js";import{EdgePassParameters as F}from"./EdgeShaderParameters.js";import{EdgeWorkerHandle as K}from"./EdgeWorkerHandle.js";import"./interfaces.js";import{generateStrokesTexture as J}from"./strokes.js";import{determineRendererType as Q,determineEdgeTransparency as X,determineObjectTransparency as Y,fillComponentBufferIndices as Z}from"./util.js";import{BufferManager as $}from"../TextureBackedBuffer/BufferManager.js";import{EdgeSilhouette as ee}from"../../shaders/sources/edgeRenderer/EdgeUtil.glsl.js";import{BufferObject as te}from"../../../../webgl/BufferObject.js";import{Usage as re}from"../../../../webgl/enums.js";const se=128;let ne=class extends t{constructor(e){super(e),this._updatingHandles=new E,this._objectEntries=new Map,this._pendingDeletions=new Map,this._renderers=new Map,this._gpuMemoryUsage=0,this._workerAbort=new AbortController,this._tmpModelPosition=O(),this._localOrigins=new U(new D(e.renderSR));const t=S.createBuffer(4);for(let r=0;r<4;r++)t.sideness.set(r,0,0===r||3===r?0:1),t.sideness.set(r,1,0===r||1===r?0:1);this._verticesBufferObject=te.createVertex(e.rctx,re.STATIC_DRAW,t.buffer)}initialize(){this._worker=new K(this.schedule),this._componentColorManager=new $(this.rctx,3)}destroy(){this.destroyed||(this._objectEntries.forEach((e=>this._discardObjectEntry(e))),this._objectEntries.clear(),this._pendingDeletions.forEach((e=>this._discardObjectEntry(e))),this._pendingDeletions.clear(),this._strokesTexture=i(this._strokesTexture),this._componentColorManager=a(this._componentColorManager),this._workerAbort.abort(),this._worker.destroy(),this._verticesBufferObject.dispose(),this._renderers.clear(),this._updatingHandles.destroy(),this._set("schedule",we))}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){if(this.hasObject(e))return this._getObjectMemoryUsage(e);let a;const c=new ae(null,new Promise((e=>a=e)),e.obb.center,e.obb.radius);this._objectEntries.set(e,c);const l=await this._updatingHandles.addPromise(this._addComponentGeometry(e.transform,c,t,r,s,n,o,i));return this.setNeedsRender(),a(),l}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=new AbortController;let i;const a=e.boundingVolumeWorldSpace.bounds,l=new ae(o,new Promise((e=>i=e)),v(a),x(a)),d=this._objectEntries.get(e);d&&(this._pendingDeletions.has(e)?this._discardObjectEntry(d):this._pendingDeletions.set(e,d)),this._objectEntries.set(e,l);try{const n=new Array;if(e.geometries.length>1&&ie(e))n.push(this._addObjectMergedGeometries(e,l,t,r,s));else for(const o of e.geometries)o.material.supportsEdges&&n.push(this._addGeometry(e,l,o,t,r,s));await this._updatingHandles.addPromise(Promise.all(n)),this._removePendingDeletion(e)}catch(h){c(h)?this._discardObjectEntry(l):this._removePendingDeletion(e)}finally{this.setNeedsRender(),i()}}removeObject(e){const t=this._objectEntries.get(e);this._objectEntries.delete(e),this._discardObjectEntry(t),this._removePendingDeletion(e)}_removePendingDeletion(e){const t=this._pendingDeletions.get(e);this._pendingDeletions.delete(e),this._discardObjectEntry(t)}async _getObjectEntry(e){const t=this._objectEntries.get(e);if(!t)throw new Error("no object");return await t.loaded,null==t.loaded?null:t}fastUpdateObject3DEdgesTransform(e){if(this.destroyed)return!1;const t=this._objectEntries.get(e);if(!t)return!1;const{geometries:r}=e,{renderables:s}=t;if(0===r.length||0===s.length)return!0;if(s.length>1)return!1;const[n]=s,o=n.transform;if(!(o instanceof de))return!1;const[i]=r;if(i.localOrigin!==o.origin.origin)return!1;const a=p(),c=this._computeModelTransformWithLocalOrigin(e,i,a);return n.transform=new de(a,c),this.setNeedsRender(),!0}_discardObjectEntry(e){e&&(e.abort?.abort(),e.renderables.length&&(e.renderables.forEach((e=>this._removeRenderable(e))),this.setNeedsRender()),e.loaded=null)}hasObject(e){return this._objectEntries.has(e)}async updateAllComponentOpacities(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));if(null==r)return;const s=Array.isArray(t)?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 t?t.renderables.reduce(((e,t)=>e+t.statistics.gpuMemoryUsage),0):0}async updateAllComponentMaterials(e,t,r,s){const n=e instanceof L,o=Q(t),i=W.getKey(o,r,n),a=await this._updatingHandles.addPromise(this._getObjectEntry(e));null!=a&&(a.renderables.forEach((e=>{if(i!==e.rendererKey){const t=this._renderers.get(e.rendererKey),s=this._acquireRenderer(o,r,n);t.removeRenderable(e),--t.refCount,e.rendererKey=i,s.addRenderable(e)}if(Array.isArray(t))for(let r=0;r<t.length;r++)e.components.meta[r].material=t[r];else e.components.meta[0].material=t;s&&me(e.components),this._updateTransparency(e)})),this.setNeedsRender())}async updateAllVerticalOffsets(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));null!=r&&this._updateAllVerticalOffsets(r,t)}_updateAllVerticalOffsets(e,t){e.renderables.forEach((e=>{const r=e.components.meta;for(let s=0;s<r.length;s++)e.components.meta[s].verticalOffset=t?.[s]??0;me(e.components)})),this.setNeedsRender()}async updateObjectVisibility(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));r&&(r.renderables.forEach((e=>e.visible=t)),this.setNeedsRender())}render(e,t){if(null==this._componentColorManager)return;this._localOrigins.updateViewMatrices(e.camera.viewMatrix);const r=e.camera.viewInverseTransposeMatrix,s=O(),n=new A;let o=0,i=0;if(this._renderers.forEach((r=>{if(0===r.refCount)return this._renderers.delete(r.key),void r.dispose();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 F(40*o/i,t);_(s,r[3],r[7],r[11]),n.set(s),b(a.transformWorldFromViewTH,n.high),b(a.transformWorldFromViewTL,n.low),u(a.transformViewFromCameraRelativeRS,e.camera.viewMatrix),m(Oe,a.transformViewFromCameraRelativeRS),g(a.transformNormalViewFromGlobal,Oe),a.transformProjFromView=e.camera.projectionMatrix,this._updateObjectCameraDistances(e),this._renderers.forEach((t=>{ge(t,e,a),fe(t,e,a)}))}_updateTransparency(e){const t=X(e.components.meta),r=Y(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(_(this._tmpModelPosition,r[12],r[13],r[14]));return t.localOrigin=s.origin,P(s.origin.vec3,r),s}_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 ce(r,t);return me(s),s}_extractEdges(e,t,r,s,n,o,i=o.length){return i<se&&(n=!0),this._worker.process({data:r,indices:o,indicesLength:i,writerSettings:t,skipDeduplicate:s},e,n)}_createRenderable(e,t,r,s,n){const o=t=>new le(new k(this.rctx,V,{vertices:H,instances:t===ee.REGULAR?G.glLayout:N.glLayout},{vertices:this._verticesBufferObject,instances:te.createVertex(this.rctx,re.STATIC_DRAW,t===ee.REGULAR?e.regular.instancesData.buffer:e.silhouette.instancesData.buffer)}),t===ee.REGULAR?e.regular.lodInfo:e.silhouette.lodInfo),i=e.regular.lodInfo.lengths.length>0?o(ee.REGULAR):null,a=e.silhouette.lodInfo.lengths.length>0?o(ee.SILHOUETTE):null,c=(i?.vao.usedMemory??0)+(a?.vao.usedMemory??0);return new he(i,a,{gpuMemoryUsage:c,externalMemoryUsage:n,averageEdgeLength:e.averageEdgeLength},r,X(t.meta),Y(t.meta),t,s)}async _addGeometry(e,t,r,s,n,o){if(r.edgeIndicesLength<=0)return;const i=r.attributes.get(I.POSITION),a=p(),c=this._computeModelTransformWithLocalOrigin(e,r,a),l=new je(i,a,c);return this._addPositionData(t,l,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)return;const a=this._acquireRenderer(s.type,n,!0),{modelTransform:c,origin:l}=t,d=t.position.indices,h=t.position,u=h.data.length/h.size,m=B.createBuffer(u);for(let p=0;p<u;p++)m.position.set(p,0,h.data[p*h.size]),m.position.set(p,1,h.data[p*h.size+1]),m.position.set(p,2,h.data[p*h.size+2]);Z(i.meta,[0,m.componentIndex.count],m.componentIndex);const g=await this._updatingHandles.addPromise(this._extractEdges(e.abort?.signal||this._workerAbort.signal,a.writerSettings,m,!1,o,d,r));if(null==e.loaded)return;const f=this._createRenderable(g,i,new de(c,l),a.key,!1);e.renderables.push(f),a.addRenderable(f),this._gpuMemoryUsage+=f.statistics.gpuMemoryUsage}async _addComponentGeometry(e,t,r,s,n,o,i,a){if(null==t.loaded)return 0;const c=this._createComponentBuffers(o);if(null==c)return 0;const l=Q(o),d=this._acquireRenderer(l,i||!1,!1),h=B.createBuffer(r.length/3);R(h.position.typedBuffer,r,h.position.typedBufferStride,3),Z(c.meta,n,h.componentIndex,s);const u=!0,m=d.writerSettings,g=await this._updatingHandles.addPromise(this._extractEdges(this._workerAbort.signal,m,h,u,!1,s));if(null==t.loaded)return 0;const f=this._createRenderable(g,c,e,d.key,!0);return t.renderables.push(f),d.addRenderable(f),this._updateAllVerticalOffsets(t,a),f.statistics.gpuMemoryUsage}async _addObjectMergedGeometries(e,t,r,s,n){const o=new Map;let i=0,a=0,c=null;const l=e.geometries.filter((e=>{if(e.edgeIndicesLength<=0||!e.material.supportsEdges)return!1;!c&&e.localOrigin&&(c=e);const t=e.attributes.get(I.POSITION);return a+=t.data.length/t.size,i+=e.edgeIndicesLength,!0}));if(0===l.length)return;const d=a>=65536?Uint32Array:Uint16Array,h=i?new d(i):null,u=[];let m=0;l.forEach((e=>{const t=e.attributes.get(I.POSITION),r=t.indices;let s=o.get(t.data);if(null==s){s=u.length/3;for(let e=0;e<t.data.length;e+=t.size)u.push(t.data[e]),u.push(t.data[e+1]),u.push(t.data[e+2]);o.set(t.data,s)}for(let n=0;n<e.edgeIndicesLength;n++)h[m++]=s+r[n]}));const g=c||e.geometries[0],f=p(),_=this._computeModelTransformWithLocalOrigin(e,g,f);for(let p=0;p<e.geometries.length;p++)e.geometries[p].localOrigin=_.origin;const b=new je(new C(u,h,3),f,_);await this._updatingHandles.addPromise(this._addPositionData(t,b,h.length,r,s,n))}_acquireRenderer(e,t,r){const s=W.getKey(e,t,r);let n=this._renderers.get(s);return null==this._strokesTexture&&(this._strokesTexture=J(this.rctx)),n||(n=new W(this.rctx,this.techniques,{type:e,hasSlicePlane:t,strokesTexture:this._strokesTexture,legacy:r,spherical:this.viewingMode===M.Global}),this._renderers.set(s,n)),++n.refCount,n}_removeRenderable(e){oe(e.regular),oe(e.silhouette);const t=this._renderers.get(e.rendererKey);if(t){t.removeRenderable(e),--t.refCount,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=O(),n=e=>{y(s,e.center,t);const n=j(s,r),o=e.radius,i=n<-o?1/0:n<o?0:n-o;e.renderables.forEach((e=>e.distanceToCamera=i))};this._objectEntries.forEach(n),this._pendingDeletions.forEach(n)}get test(){}};function oe(e){e?.vao&&(e.vao.vertexBuffers.instances.dispose(),e.vao.disposeVAOOnly(),e.vao=null)}function ie(e){let t=null,s=null;for(const n of e.geometries){if(n.material.supportsEdges){if(t){if(!r(t,n.transformation))return!1}else t=n.transformation;if(s||null==n.localOrigin){if(null!=s?.localOrigin&&null!=n.localOrigin&&s.localOrigin.id!==n.localOrigin.id)return!1}else s=n}}return!0}e([d({constructOnly:!0})],ne.prototype,"rctx",void 0),e([d({constructOnly:!0})],ne.prototype,"renderSR",void 0),e([d({constructOnly:!0})],ne.prototype,"viewingMode",void 0),e([d({constructOnly:!0})],ne.prototype,"techniques",void 0),e([d({constructOnly:!0})],ne.prototype,"setNeedsRender",void 0),e([d({constructOnly:!0})],ne.prototype,"schedule",void 0),e([d({readOnly:!0})],ne.prototype,"_updatingHandles",void 0),e([d({readOnly:!0})],ne.prototype,"updating",null),ne=e([h("esri.views.3d.webgl-engine.lib.edgeRendering.EdgeView")],ne);class ae{constructor(e,t,r,s){this.abort=e,this.radius=s,this.renderables=new Array;const n=e?l(e.signal,(()=>e.abort())):null;this.loaded=t,this.loaded.then((()=>{null!=this.loaded&&(this.loaded=!0),this.abort=null,n?.remove()})),this.center=w(r)}}class ce{constructor(e,t){this.buffer=e,this.meta=t}}class le{constructor(e,t){this.vao=e,this.lod=t}}class de{constructor(e,t){this.modelMatrix=e,this.origin=t}}class he{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 ue extends he{}function me(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*q),0,255),c=o(e.extensionLength,-z,255-z)+z,l=255*e.opacity,d=e.color,h=255*d[0],u=255*d[1],m=255*d[2],g=255*d[3];r.textureBuffer.setData(i,0,h,u,m,g),r.textureBuffer.setData(i,1,a,c,e.type,l),T(t[n].verticalOffset,s),r.textureBuffer.setData(i,2,s[0],s[1],s[2],s[3])}}function ge(e,t,r){const s=e.bindRegularEdges(r,t),n=r.transparency,o=t.camera.perScreenPixelRatio;e.forEachRenderable((n=>{if(!pe(n)||!n.visible)return;const i=ye(n.regular.lod.lengths,n.distanceToCamera,o);e.renderRegularEdges(s,n,r,t,i)}),n)}function fe(e,t,r){const s=e.bindSilhouetteEdges(r,t),n=r.transparency,o=t.camera.perScreenPixelRatio;e.forEachRenderable((n=>{if(!be(n)||!n.visible)return;const i=ye(n.silhouette.lod.lengths,n.distanceToCamera,o);e.renderSilhouetteEdges(s,n,r,t,i)}),n)}function pe(e){return null!=e.regular}class _e extends he{}function be(e){return null!=e.silhouette}function ye(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 je{constructor(e,t,r){this.position=e,this.modelTransform=t,this.origin=r}}const Oe=f(),we=()=>Promise.reject();export{ne as EdgeView,de as LegacyTransform,ue as RegularRenderable,he as Renderable,_e 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.31/esri/copyright.txt for details.
4
4
  */
5
- var A;!function(A){A[A.INVISIBLE=0]="INVISIBLE",A[A.TRANSPARENT=1]="TRANSPARENT",A[A.OPAQUE=2]="OPAQUE"}(A||(A={}));export{A as Transparency};
5
+ var A;!function(A){A[A.TRANSPARENT=0]="TRANSPARENT",A[A.OPAQUE=1]="OPAQUE"}(A||(A={}));export{A as Transparency};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{Transparency as e}from"./interfaces.js";import{EdgeType as t}from"../../shaders/sources/edgeRenderer/EdgeUtil.glsl.js";function r(e){let r;for(const o of e){const e=o.type;if(c(o))if(null==r)r=e;else if(r!==e)return t.Mixed}return r??t.Mixed}function o(t){let r=e.INVISIBLE;for(const{material:o}of t)if(i(o)){if(o.color[3]*o.opacity<1)return e.TRANSPARENT;r=e.OPAQUE}return r}function n(t){let r=e.INVISIBLE;for(const{material:o}of t)if(i(o)){switch(o.objectTransparency){case e.TRANSPARENT:case e.INVISIBLE:return e.TRANSPARENT;case e.OPAQUE:if(o.opacity<1)return e.TRANSPARENT}r=e.OPAQUE}return r}function i(e){return e.size*e.color[3]*e.opacity>0}function c(e){return e.size*e.color[3]>0}function f(e,t,r,o){for(let n=0;n<e.length;n++){const i=e[n].index,c=t[n],f=t[n+1];if(o)for(let e=c;e<f;e++){const t=o[e];r.set(t,i)}else for(let e=c;e<f;e++)r.set(e,i)}}export{o as determineEdgeTransparency,n as determineObjectTransparency,r as determineRendererType,f as fillComponentBufferIndices};
5
+ import{Transparency as e}from"./interfaces.js";import{EdgeType as r}from"../../shaders/sources/edgeRenderer/EdgeUtil.glsl.js";function t(e){if(!Array.isArray(e))return f(e)?e.type:r.Mixed;let t;for(const o of e){const e=o.type;if(f(o))if(null==t)t=e;else if(t!==e)return r.Mixed}return t??r.Mixed}function o(r){let t=e.TRANSPARENT;for(const{material:o}of r)if(i(o)){if(o.color[3]*o.opacity<1)return e.TRANSPARENT;t=e.OPAQUE}return t}function n(r){let t=e.TRANSPARENT;for(const{material:o}of r)if(i(o)){switch(o.objectTransparency){case e.TRANSPARENT:return e.TRANSPARENT;case e.OPAQUE:if(o.opacity<1)return e.TRANSPARENT}t=e.OPAQUE}return t}function i(e){return e.size*e.color[3]*e.opacity>0}function f(e){return e.size*e.color[3]>0}function c(e,r,t,o){for(let n=0;n<e.length;n++){const i=e[n].index,f=r[n],c=r[n+1];if(o)for(let e=f;e<c;e++){const r=o[e];t.set(r,i)}else for(let e=f;e<c;e++)t.set(e,i)}}export{o as determineEdgeTransparency,n as determineObjectTransparency,t as determineRendererType,c as fillComponentBufferIndices};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import{isSome as t}from"../../../../../core/arrayUtils.js";import{destroyMaybe as r}from"../../../../../core/maybe.js";import{isAborted as a,throwIfAborted as s}from"../../../../../core/promiseUtils.js";import{property as n}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import{subclass as i}from"../../../../../core/accessorSupport/decorators/subclass.js";import{create as o}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{f as l,m as c,h}from"../../../../../chunks/vec32.js";import{create as d}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as u,fromValues as m}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{debugFlags as f}from"../../../support/debugFlags.js";import{glLayout as _}from"../../../support/buffer/glUtil.js";import{newLayout as p}from"../../../support/buffer/InterleavedLayout.js";import g from"../../../webgl/RenderCamera.js";import{ShaderOutput as I}from"../../core/shaderLibrary/ShaderOutput.js";import{ASyncPreparesRenderPlugin as C}from"../../effects/RenderPlugin.js";import{Default3D as y}from"../DefaultVertexAttributeLocations.js";import{IntersectorType as v}from"../IntersectorInterfaces.js";import E from"../Octree.js";import{RenderSlot as A}from"../RenderSlot.js";import{assert as b}from"../Util.js";import{VertexAttribute as D}from"../VertexAttribute.js";import{InstanceData as R,StateFlags as T}from"./InstanceData.js";import{InstanceOctree as L}from"./InstanceOctree.js";import{LevelSelector as S}from"./LevelSelector.js";import{LodLevel as O}from"./LodLevel.js";import{RenderInstanceData as j}from"./RenderInstanceData.js";import{colorMixModes as x}from"../../materials/internal/MaterialUtil.js";import{encodeDoubleVec3 as N}from"../../materials/renderers/utils.js";import{DefaultMaterialDrawParameters as M}from"../../shaders/DefaultMaterialTechnique.js";import{TaskPriority as U,noBudget as w}from"../../../../support/Scheduler.js";import{bindVertexBufferLayout as F,unbindVertexBufferLayout as H}from"../../../../webgl/Util.js";const V=e=>{const t=e.baseBoundingSphere.radius,r=e.levels.map((e=>e.minScreenSpaceRadius));return new S(t,r)};let B=class extends C{constructor(e,t){super(e),this.type=v.LOD,this.isGround=!1,this._levels=[],this._defaultRenderInstanceData=[new Array],this._highlightRenderInstanceData=[new Array],this._allRenderInstanceData=[this._defaultRenderInstanceData[0],this._highlightRenderInstanceData[0]],this._instanceIndex=0,this._cycleStartIndex=0,this._slicePlane=!1,this._camera=new g,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this.produces=new Map([[A.OPAQUE_MATERIAL,e=>this._produces(e)],[A.TRANSPARENT_MATERIAL,e=>!!this._hasTransparentLevels()&&this._produces(e)]]),this._instanceData=new R({shaderTransformation:e.shaderTransformation},e.optionalFields),this.addHandles(t.registerTask(U.LOD_RENDERER,this))}initialize(){this._instanceBufferLayout=q(this.optionalFields),this._glInstanceBufferLayout=_(this._instanceBufferLayout,1),this.addHandles([this._instanceData.events.on("instances-changed",(()=>this._requestUpdateCycle())),this._instanceData.events.on("instance-transform-changed",(({index:e})=>{this._requestUpdateCycle(),this.metadata.notifyGraphicGeometryChanged(e)})),this._instanceData.events.on("instance-visibility-changed",(({index:e})=>{this._requestUpdateCycle(!0),this.metadata.notifyGraphicVisibilityChanged(e)})),this._instanceData.events.on("instance-highlight-changed",(()=>this._requestUpdateCycle(!0)))])}get _enableLevelSelection(){return this.symbol.levels.length>1}get levels(){return this._levels}get baseBoundingBox(){return this._levels[this._levels.length-1].boundingBox}get baseBoundingSphere(){return this._levels[this._levels.length-1].boundingSphere}get baseMaterial(){return this._levels[this._levels.length-1].components[0].material}get slicePlaneEnabled(){return this._slicePlane}set slicePlaneEnabled(e){this._slicePlane=e}get layerUid(){return this.metadata.layerUid}get instanceData(){return this._instanceData}get usedMemory(){return this._allRenderInstanceData.reduce(((e,t)=>t.reduce(((e,t)=>e+t.usedMemory),e)),0)}get renderStats(){const e=this._instanceData.size,t=[];return this._levels.forEach(((e,r)=>{const a=this._allRenderInstanceData[0][r].size+this._allRenderInstanceData[1][r].size,s=e.triangleCount;t.push({renderedInstances:a,renderedTriangles:a*s,trianglesPerInstance:s})})),{totalInstances:e,renderedInstances:t.reduce(((e,t)=>e+t.renderedInstances),0),renderedTriangles:t.reduce(((e,t)=>e+t.renderedTriangles),0),levels:t}}async initializeRenderContext(e,r){this._context=e;const n=e.renderContext.rctx,i=await Promise.allSettled(this.symbol.levels.map((t=>(this._defaultRenderInstanceData[0].push(new j(n,this._instanceBufferLayout)),this._highlightRenderInstanceData[0].push(new j(n,this._instanceBufferLayout)),O.create(e,t,r))))),o=i.map((e=>"fulfilled"===e.status?e.value:null)).filter(t);if(a(r)||o.length!==i.length){o.forEach((e=>e.destroy())),s(r);for(const e of i)if("rejected"===e.status)throw e.reason}this._levels=o,this._levelSelector=V(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach((e=>e.destroy())),this._defaultRenderInstanceData[0].forEach((e=>e.destroy())),this._highlightRenderInstanceData[0].forEach((e=>e.destroy()))}_hasTransparentLevels(){return this._levels.some((e=>e.components.some((e=>{const t=e.material.produces.get(A.TRANSPARENT_MATERIAL);return t?.(I.Color)}))))}hasHighlights(){return this._highlightRenderInstanceData[0].some((e=>e.size>0))}_produces(e){return e!==I.Highlight&&e!==I.ShadowHighlight||this.hasHighlights()}prepareRender(e){if(!f.LOD_INSTANCE_RENDERER_DISABLE_UPDATES){if(this._enableLevelSelection){const t=e.bindParameters.contentCamera.equals(this._camera);this._camera.copyFrom(e.bindParameters.contentCamera),t||this._requestUpdateCycle()}this._needFullCycle&&(this.runTask(w),this._needFullCycle=!1)}}prepareTechniques(e){if(!this.baseMaterial.isVisible()||!this.baseMaterial.isVisibleForOutput(e.output))return null;const t=this._getInstanceDatas(e.output);if(!t)return null;const r=new Array;return t.forEach((t=>this.levels.forEach(((a,s)=>{a.components.forEach((a=>r.push(this._beginComponent(e,t[s],a))))})))),r}renderNode(e,t){const r=this._getInstanceDatas(e.output);if(!r||null==t)return;let a=0;e.rctx.bindVAO(),r.forEach((r=>this.levels.forEach(((s,n)=>{s.components.forEach((s=>this._renderComponent(e,t[a++],r[n],s,n)))}))))}_getInstanceDatas(e){const t=e!==I.Highlight&&e!==I.ShadowHighlight,r=e!==I.ShadowExcludeHighlight;return t&&r?this._allRenderInstanceData:t?this._defaultRenderInstanceData:r?this._highlightRenderInstanceData:null}intersect(e,t,r,a){if(!this.baseMaterial.isVisible()||null==this._octree)return;const s=d();l(s,a,r);const n=s=>{this._instanceData.getCombinedModelTransform(s,W),e.transform.set(W),h(K,r,e.transform.inverse),h(Y,a,e.transform.inverse);const n=this._instanceData.getState(s),i=this._instanceData.getLodLevel(s),o=this._levels.length;b(!!(n&T.ACTIVE),"invalid instance state"),b(i>=0&&i<o,"invaid lod level"),this._levels[i].intersect(e,t,K,Y,s,this.metadata,o)};this.baseMaterial.parameters.verticalOffset?this._octree.forEach(n):this._octree.forEachAlongRay(r,s,n)}notifyShaderTransformationChanged(){this._invalidateOctree(),this._requestUpdateCycle()}get _octree(){if(null==this._octreeCached){const e=this._instanceData,t=e.view?.state;if(!t)return null;this._octreeCached=new L(e,this.baseBoundingSphere);for(let r=0;r<e.capacity;++r)t.get(r)&T.ACTIVE&&this._octreeCached.addInstance(r)}return this._octreeCached}_invalidateOctree(){this._octreeCached=r(this._octreeCached)}queryDepthRange(e){if(null==this._octree)return{near:1/0,far:-1/0};const t=e.viewForward,r=this._octree.findClosest(t,E.DepthOrder.FRONT_TO_BACK,e.frustum),a=this._octree.findClosest(t,E.DepthOrder.BACK_TO_FRONT,e.frustum);if(null==r||null==a)return{near:1/0,far:-1/0};const s=e.eye,n=this._instanceData.view;n.boundingSphere.getVec(r,k),l(k,k,s);const i=c(k,t)-k[3];n.boundingSphere.getVec(a,k),l(k,k,s);const o=c(k,t)+k[3];return{near:Math.max(e.near,i),far:Math.min(e.far,o)}}_requestUpdateCycle(e=!1){this._updateCyclesWithStaticCamera=-1,this._cycleStartIndex=this._instanceIndex,e&&(this._needFullCycle=!0,this._context.requestRender())}_startUpdateCycle(){this._updateCyclesWithStaticCamera++,this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.startUpdateCycle()))))}get running(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}runTask(e){const{_enableLevelSelection:t,_camera:r,_levelSelector:a}=this;this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.beginUpdate()))));const s=this._instanceData,n=s.view;let i=s.size;const o=s.capacity;let l=this._instanceIndex;const c=Math.ceil(o/500);for(let h=0;h<i&&!e.done;++h){l===this._cycleStartIndex&&this._startUpdateCycle();const h=n.state.get(l);let d=0;if(!(h&T.ALLOCATED)){l=l+1===o?0:l+1,i++;continue}const u=n.lodLevel.get(l);if(h&T.DEFAULT_ACTIVE&&this._defaultRenderInstanceData[0][u].freeTail(),h&T.HIGHLIGHT_ACTIVE&&this._highlightRenderInstanceData[0][u].freeTail(),h&T.REMOVE)s.freeInstance(l);else if(h&T.VISIBLE){let e=0;t&&(n.modelOrigin.getVec(l,z),e=a.selectLevel(z,s.getCombinedMedianScaleFactor(l),r)),d=h&~(T.ACTIVE|T.TRANSFORM_CHANGED),e>=0&&(h&T.HIGHLIGHT?(P(this._highlightRenderInstanceData[0][e],n,l),d|=T.HIGHLIGHT_ACTIVE):(P(this._defaultRenderInstanceData[0][e],n,l),d|=T.DEFAULT_ACTIVE)),n.state.set(l,d),n.lodLevel.set(l,e)}else d=h&~(T.ACTIVE|T.TRANSFORM_CHANGED),n.state.set(l,d);if(null!=this._octreeCached){const e=!!(h&T.ACTIVE),t=!!(d&T.ACTIVE);!e&&t?this._octreeCached.addInstance(l):e&&!t?this._octreeCached.removeInstance(l):e&&t&&h&T.TRANSFORM_CHANGED&&(this._octreeCached.removeInstance(l),this._octreeCached.addInstance(l))}l=l+1===o?0:l+1,l%c==0&&e.madeProgress()}this._instanceIndex=l,this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.endUpdate())))),this._context.requestRender()}_beginComponent(e,t,r){if(0===t.size)return null;const a=r.glMaterials.load(e.rctx,e.bindParameters.slot,e.output);return null!=a?a.beginSlot(e.bindParameters):null}_renderComponent(e,t,r,a,s){if(!t)return;const{bindParameters:n,rctx:i}=e;i.runAppleAmdDriverHelper();const o=i.bindTechnique(t,n,a.material.parameters,Q);i.bindVAO(a.vao),t.ensureAttributeLocations(a.vao),f.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&e.output===I.Color&&(o.setUniform4fv("externalColor",J[Math.min(s,J.length-1)]),o.setUniform1i("colorMixMode",x.replace));const l=r.capacity,c=r.headIndex,h=r.tailIndex,d=r.firstIndex,u=this._glInstanceBufferLayout,m=(e,s)=>{F(i,y,r.buffer,u,e),i.drawArraysInstanced(t.primitiveType,0,a.vertexCount,s-e),H(i,y,r.buffer,u)};a.material.parameters.transparent&&null!=d?c>h?(b(d>=h&&d<=c,"invalid firstIndex"),m(d,c),m(h,d)):c<h&&(d<=c?(b(d>=0&&d<=c,"invalid firstIndex"),m(d,c),m(h,l),m(0,d)):(b(d>=h&&d<=l,"invalid firstIndex"),m(d,l),m(0,c),m(h,d))):c>h?m(h,c):c<h&&(m(0,c),m(h,l)),i.bindVAO(null)}};function P(e,t,r){const a=e.allocateHead();G(t,r,e.view,a)}function G(e,t,r,a){N(e.modelOrigin,t,r.modelOriginHi,r.modelOriginLo,a),r.model.copyFrom(a,e.model,t),r.modelNormal.copyFrom(a,e.modelNormal,t),e.color&&r.color&&r.color.copyFrom(a,e.color,t),e.objectAndLayerIdColor&&r.objectAndLayerIdColor&&r.objectAndLayerIdColor.copyFrom(a,e.objectAndLayerIdColor,t),e.featureAttribute&&r.featureAttribute&&r.featureAttribute.copyFrom(a,e.featureAttribute,t)}function q(e){let t=p().vec3f(D.INSTANCEMODELORIGINHI).vec3f(D.INSTANCEMODELORIGINLO).mat3f(D.INSTANCEMODEL).mat3f(D.INSTANCEMODELNORMAL);return null!=e&&e.includes("featureAttribute")&&(t=t.vec4f(D.INSTANCEFEATUREATTRIBUTE)),null!=e&&e.includes("color")&&(t=t.vec4u8(D.INSTANCECOLOR)),null!=e&&e.includes("objectAndLayerIdColor")&&(t=t.vec4u8(D.INSTANCEOBJECTANDLAYERIDCOLOR)),t}e([n({constructOnly:!0})],B.prototype,"symbol",void 0),e([n({constructOnly:!0})],B.prototype,"optionalFields",void 0),e([n({constructOnly:!0})],B.prototype,"metadata",void 0),e([n({constructOnly:!0})],B.prototype,"shaderTransformation",void 0),e([n()],B.prototype,"_instanceData",void 0),e([n()],B.prototype,"_cycleStartIndex",void 0),e([n({readOnly:!0})],B.prototype,"_enableLevelSelection",null),e([n()],B.prototype,"_updateCyclesWithStaticCamera",void 0),e([n({readOnly:!0})],B.prototype,"running",null),B=e([i("esri.views.3d.webgl-engine.lib.lodRendering.LodRenderer")],B);const z=d(),k=u(),W=o(),K=d(),Y=d(),J=[m(1,0,1,1),m(0,0,1,1),m(0,1,0,1),m(1,1,0,1),m(1,0,0,1)],Q=new M;export{B as LodRenderer};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import{isSome as t}from"../../../../../core/arrayUtils.js";import{destroyMaybe as r}from"../../../../../core/maybe.js";import{isAborted as a,throwIfAborted as s}from"../../../../../core/promiseUtils.js";import{property as n}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import{subclass as i}from"../../../../../core/accessorSupport/decorators/subclass.js";import{create as o}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{f as l,m as c,h}from"../../../../../chunks/vec32.js";import{create as d}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as u,fromValues as m}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{debugFlags as f}from"../../../support/debugFlags.js";import{glLayout as _}from"../../../support/buffer/glUtil.js";import{newLayout as p}from"../../../support/buffer/InterleavedLayout.js";import g from"../../../webgl/RenderCamera.js";import{ShaderOutput as I}from"../../core/shaderLibrary/ShaderOutput.js";import{ASyncPreparesRenderPlugin as C}from"../../effects/RenderPlugin.js";import{Default3D as y}from"../DefaultVertexAttributeLocations.js";import{IntersectorType as v}from"../IntersectorInterfaces.js";import E from"../Octree.js";import{RenderSlot as A}from"../RenderSlot.js";import{assert as b}from"../Util.js";import{VertexAttribute as D}from"../VertexAttribute.js";import{InstanceData as R,StateFlags as T}from"./InstanceData.js";import{InstanceOctree as L}from"./InstanceOctree.js";import{LevelSelector as S}from"./LevelSelector.js";import{LodLevel as O}from"./LodLevel.js";import{RenderInstanceData as j}from"./RenderInstanceData.js";import{colorMixModes as x}from"../../materials/internal/MaterialUtil.js";import{encodeDoubleVec3 as N}from"../../materials/renderers/utils.js";import{DefaultMaterialDrawParameters as M}from"../../shaders/DefaultMaterialTechnique.js";import{TaskPriority as U,noBudget as w}from"../../../../support/Scheduler.js";import{bindVertexBufferLayout as F,unbindVertexBufferLayout as H}from"../../../../webgl/Util.js";const V=e=>{const t=e.baseBoundingSphere.radius,r=e.levels.map((e=>e.minScreenSpaceRadius));return new S(t,r)};let B=class extends C{constructor(e,t){super(e),this.type=v.LOD,this.isGround=!1,this._levels=[],this._defaultRenderInstanceData=[new Array],this._highlightRenderInstanceData=[new Array],this._allRenderInstanceData=[this._defaultRenderInstanceData[0],this._highlightRenderInstanceData[0]],this._instanceIndex=0,this._cycleStartIndex=0,this._slicePlane=!1,this._camera=new g,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this.produces=new Map([[A.OPAQUE_MATERIAL,e=>this._produces(e)],[A.TRANSPARENT_MATERIAL,e=>!!this._hasTransparentLevels()&&this._produces(e)]]),this._instanceData=new R({shaderTransformation:e.shaderTransformation},e.optionalFields),this.addHandles(t.registerTask(U.LOD_RENDERER,this))}initialize(){this._instanceBufferLayout=q(this.optionalFields),this._glInstanceBufferLayout=_(this._instanceBufferLayout,1),this.addHandles([this._instanceData.events.on("instances-changed",(()=>this._requestUpdateCycle())),this._instanceData.events.on("instance-transform-changed",(({index:e})=>{this._requestUpdateCycle(),this.metadata.notifyGraphicGeometryChanged(e)})),this._instanceData.events.on("instance-visibility-changed",(({index:e})=>{this._requestUpdateCycle(!0),this.metadata.notifyGraphicVisibilityChanged(e)})),this._instanceData.events.on("instance-highlight-changed",(()=>this._requestUpdateCycle(!0)))])}get _enableLevelSelection(){return this.symbol.levels.length>1}get levels(){return this._levels}get baseBoundingBox(){return this._levels[this._levels.length-1].boundingBox}get baseBoundingSphere(){return this._levels[this._levels.length-1].boundingSphere}get baseMaterial(){return this._levels[this._levels.length-1].components[0].material}get slicePlaneEnabled(){return this._slicePlane}set slicePlaneEnabled(e){this._slicePlane=e}get layerUid(){return this.metadata.layerUid}get instanceData(){return this._instanceData}get usedMemory(){return this._allRenderInstanceData.reduce(((e,t)=>t.reduce(((e,t)=>e+t.usedMemory),e)),0)}get renderStats(){const e=this._instanceData.size,t=[];return this._levels.forEach(((e,r)=>{const a=this._allRenderInstanceData[0][r].size+this._allRenderInstanceData[1][r].size,s=e.triangleCount;t.push({renderedInstances:a,renderedTriangles:a*s,trianglesPerInstance:s})})),{totalInstances:e,renderedInstances:t.reduce(((e,t)=>e+t.renderedInstances),0),renderedTriangles:t.reduce(((e,t)=>e+t.renderedTriangles),0),levels:t}}async initializeRenderContext(e,r){this._context=e;const n=e.renderContext.rctx,i=await Promise.allSettled(this.symbol.levels.map((t=>(this._defaultRenderInstanceData[0].push(new j(n,this._instanceBufferLayout)),this._highlightRenderInstanceData[0].push(new j(n,this._instanceBufferLayout)),O.create(e,t,r))))),o=i.map((e=>"fulfilled"===e.status?e.value:null)).filter(t);if(a(r)||o.length!==i.length){o.forEach((e=>e.destroy())),s(r);for(const e of i)if("rejected"===e.status)throw e.reason}this._levels=o,this._levelSelector=V(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach((e=>e.destroy())),this._defaultRenderInstanceData[0].forEach((e=>e.destroy())),this._highlightRenderInstanceData[0].forEach((e=>e.destroy()))}_hasTransparentLevels(){return this._levels.some((e=>e.components.some((e=>{const t=e.material.produces.get(A.TRANSPARENT_MATERIAL);return t?.(I.Color)}))))}hasHighlights(){return this._highlightRenderInstanceData[0].some((e=>e.size>0))}_produces(e){return e!==I.Highlight&&e!==I.ShadowHighlight||this.hasHighlights()}prepareRender(e){if(!f.LOD_INSTANCE_RENDERER_DISABLE_UPDATES){if(this._enableLevelSelection){const t=e.bindParameters.contentCamera.equals(this._camera);this._camera.copyFrom(e.bindParameters.contentCamera),t||this._requestUpdateCycle()}this._needFullCycle&&(this.runTask(w),this._needFullCycle=!1)}}prepareTechniques(e){if(!this.baseMaterial.visible||!this.baseMaterial.isVisibleForOutput(e.output))return null;const t=this._getInstanceDatas(e.output);if(!t)return null;const r=new Array;return t.forEach((t=>this.levels.forEach(((a,s)=>{a.components.forEach((a=>r.push(this._beginComponent(e,t[s],a))))})))),r}renderNode(e,t){const r=this._getInstanceDatas(e.output);if(!r||null==t)return;let a=0;e.rctx.bindVAO(),r.forEach((r=>this.levels.forEach(((s,n)=>{s.components.forEach((s=>this._renderComponent(e,t[a++],r[n],s,n)))}))))}_getInstanceDatas(e){const t=e!==I.Highlight&&e!==I.ShadowHighlight,r=e!==I.ShadowExcludeHighlight;return t&&r?this._allRenderInstanceData:t?this._defaultRenderInstanceData:r?this._highlightRenderInstanceData:null}intersect(e,t,r,a){if(!this.baseMaterial.visible||null==this._octree)return;const s=d();l(s,a,r);const n=s=>{this._instanceData.getCombinedModelTransform(s,W),e.transform.set(W),h(K,r,e.transform.inverse),h(Y,a,e.transform.inverse);const n=this._instanceData.getState(s),i=this._instanceData.getLodLevel(s),o=this._levels.length;b(!!(n&T.ACTIVE),"invalid instance state"),b(i>=0&&i<o,"invaid lod level"),this._levels[i].intersect(e,t,K,Y,s,this.metadata,o)};this.baseMaterial.parameters.verticalOffset?this._octree.forEach(n):this._octree.forEachAlongRay(r,s,n)}notifyShaderTransformationChanged(){this._invalidateOctree(),this._requestUpdateCycle()}get _octree(){if(null==this._octreeCached){const e=this._instanceData,t=e.view?.state;if(!t)return null;this._octreeCached=new L(e,this.baseBoundingSphere);for(let r=0;r<e.capacity;++r)t.get(r)&T.ACTIVE&&this._octreeCached.addInstance(r)}return this._octreeCached}_invalidateOctree(){this._octreeCached=r(this._octreeCached)}queryDepthRange(e){if(null==this._octree)return{near:1/0,far:-1/0};const t=e.viewForward,r=this._octree.findClosest(t,E.DepthOrder.FRONT_TO_BACK,e.frustum),a=this._octree.findClosest(t,E.DepthOrder.BACK_TO_FRONT,e.frustum);if(null==r||null==a)return{near:1/0,far:-1/0};const s=e.eye,n=this._instanceData.view;n.boundingSphere.getVec(r,k),l(k,k,s);const i=c(k,t)-k[3];n.boundingSphere.getVec(a,k),l(k,k,s);const o=c(k,t)+k[3];return{near:Math.max(e.near,i),far:Math.min(e.far,o)}}_requestUpdateCycle(e=!1){this._updateCyclesWithStaticCamera=-1,this._cycleStartIndex=this._instanceIndex,e&&(this._needFullCycle=!0,this._context.requestRender())}_startUpdateCycle(){this._updateCyclesWithStaticCamera++,this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.startUpdateCycle()))))}get running(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}runTask(e){const{_enableLevelSelection:t,_camera:r,_levelSelector:a}=this;this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.beginUpdate()))));const s=this._instanceData,n=s.view;let i=s.size;const o=s.capacity;let l=this._instanceIndex;const c=Math.ceil(o/500);for(let h=0;h<i&&!e.done;++h){l===this._cycleStartIndex&&this._startUpdateCycle();const h=n.state.get(l);let d=0;if(!(h&T.ALLOCATED)){l=l+1===o?0:l+1,i++;continue}const u=n.lodLevel.get(l);if(h&T.DEFAULT_ACTIVE&&this._defaultRenderInstanceData[0][u].freeTail(),h&T.HIGHLIGHT_ACTIVE&&this._highlightRenderInstanceData[0][u].freeTail(),h&T.REMOVE)s.freeInstance(l);else if(h&T.VISIBLE){let e=0;t&&(n.modelOrigin.getVec(l,z),e=a.selectLevel(z,s.getCombinedMedianScaleFactor(l),r)),d=h&~(T.ACTIVE|T.TRANSFORM_CHANGED),e>=0&&(h&T.HIGHLIGHT?(P(this._highlightRenderInstanceData[0][e],n,l),d|=T.HIGHLIGHT_ACTIVE):(P(this._defaultRenderInstanceData[0][e],n,l),d|=T.DEFAULT_ACTIVE)),n.state.set(l,d),n.lodLevel.set(l,e)}else d=h&~(T.ACTIVE|T.TRANSFORM_CHANGED),n.state.set(l,d);if(null!=this._octreeCached){const e=!!(h&T.ACTIVE),t=!!(d&T.ACTIVE);!e&&t?this._octreeCached.addInstance(l):e&&!t?this._octreeCached.removeInstance(l):e&&t&&h&T.TRANSFORM_CHANGED&&(this._octreeCached.removeInstance(l),this._octreeCached.addInstance(l))}l=l+1===o?0:l+1,l%c==0&&e.madeProgress()}this._instanceIndex=l,this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.endUpdate())))),this._context.requestRender()}_beginComponent(e,t,r){if(0===t.size)return null;const a=r.glMaterials.load(e.rctx,e.bindParameters.slot,e.output);return null!=a?a.beginSlot(e.bindParameters):null}_renderComponent(e,t,r,a,s){if(!t)return;const{bindParameters:n,rctx:i}=e;i.runAppleAmdDriverHelper();const o=i.bindTechnique(t,n,a.material.parameters,Q);i.bindVAO(a.vao),t.ensureAttributeLocations(a.vao),f.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&e.output===I.Color&&(o.setUniform4fv("externalColor",J[Math.min(s,J.length-1)]),o.setUniform1i("colorMixMode",x.replace));const l=r.capacity,c=r.headIndex,h=r.tailIndex,d=r.firstIndex,u=this._glInstanceBufferLayout,m=(e,s)=>{F(i,y,r.buffer,u,e),i.drawArraysInstanced(t.primitiveType,0,a.vertexCount,s-e),H(i,y,r.buffer,u)};a.material.parameters.transparent&&null!=d?c>h?(b(d>=h&&d<=c,"invalid firstIndex"),m(d,c),m(h,d)):c<h&&(d<=c?(b(d>=0&&d<=c,"invalid firstIndex"),m(d,c),m(h,l),m(0,d)):(b(d>=h&&d<=l,"invalid firstIndex"),m(d,l),m(0,c),m(h,d))):c>h?m(h,c):c<h&&(m(0,c),m(h,l)),i.bindVAO(null)}};function P(e,t,r){const a=e.allocateHead();G(t,r,e.view,a)}function G(e,t,r,a){N(e.modelOrigin,t,r.modelOriginHi,r.modelOriginLo,a),r.model.copyFrom(a,e.model,t),r.modelNormal.copyFrom(a,e.modelNormal,t),e.color&&r.color&&r.color.copyFrom(a,e.color,t),e.objectAndLayerIdColor&&r.objectAndLayerIdColor&&r.objectAndLayerIdColor.copyFrom(a,e.objectAndLayerIdColor,t),e.featureAttribute&&r.featureAttribute&&r.featureAttribute.copyFrom(a,e.featureAttribute,t)}function q(e){let t=p().vec3f(D.INSTANCEMODELORIGINHI).vec3f(D.INSTANCEMODELORIGINLO).mat3f(D.INSTANCEMODEL).mat3f(D.INSTANCEMODELNORMAL);return null!=e&&e.includes("featureAttribute")&&(t=t.vec4f(D.INSTANCEFEATUREATTRIBUTE)),null!=e&&e.includes("color")&&(t=t.vec4u8(D.INSTANCECOLOR)),null!=e&&e.includes("objectAndLayerIdColor")&&(t=t.vec4u8(D.INSTANCEOBJECTANDLAYERIDCOLOR)),t}e([n({constructOnly:!0})],B.prototype,"symbol",void 0),e([n({constructOnly:!0})],B.prototype,"optionalFields",void 0),e([n({constructOnly:!0})],B.prototype,"metadata",void 0),e([n({constructOnly:!0})],B.prototype,"shaderTransformation",void 0),e([n()],B.prototype,"_instanceData",void 0),e([n()],B.prototype,"_cycleStartIndex",void 0),e([n({readOnly:!0})],B.prototype,"_enableLevelSelection",null),e([n()],B.prototype,"_updateCyclesWithStaticCamera",void 0),e([n({readOnly:!0})],B.prototype,"running",null),B=e([i("esri.views.3d.webgl-engine.lib.lodRendering.LodRenderer")],B);const z=d(),k=u(),W=o(),K=d(),Y=d(),J=[m(1,0,1,1),m(0,0,1,1),m(0,1,0,1),m(1,1,0,1),m(1,0,0,1)],Q=new M;export{B as LodRenderer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{fromValues as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColor as e}from"../core/shaderLibrary/ShaderOutput.js";import s from"../lib/GLMaterial.js";import{MaterialParameters as i}from"../lib/Material.js";import{RenderSlot as a}from"../lib/RenderSlot.js";import{DefaultBufferWriter as o}from"./DefaultBufferWriter.js";import{PositionUVLayout as n}from"./DefaultLayouts.js";import{TriangleMaterial as p}from"./TriangleMaterial.js";import{CheckerBoardTechnique as f}from"../shaders/CheckerBoardTechnique.js";import{CheckerBoardTechniqueConfiguration as h}from"../shaders/CheckerBoardTechniqueConfiguration.js";class u extends p{constructor(r){super(r,new m),this.produces=new Map([[a.OPAQUE_MATERIAL,r=>e(r)&&!this.parameters.transparent],[a.TRANSPARENT_MATERIAL,r=>e(r)&&this.parameters.transparent&&this.parameters.writeDepth],[a.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,r=>e(r)&&this.parameters.transparent&&!this.parameters.writeDepth]]),this._configuration=new h}getConfiguration(r,t){return this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}createGLMaterial(r){return new c(r)}createBufferWriter(){return new o(n)}}class c extends s{beginSlot(r){return this.ensureTechnique(f,r)}}class m extends i{constructor(){super(...arguments),this.size=r(1,1),this.color1=t(.75,.75,.75,1),this.color2=t(.5,.5,.5,1),this.transparent=!1,this.writeDepth=!0,this.polygonOffset=!1}}export{u as CheckerBoardMaterial,m as Parameters};
5
+ import{fromValues as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColor as e}from"../core/shaderLibrary/ShaderOutput.js";import s from"../lib/GLMaterial.js";import{MaterialParameters as i}from"../lib/Material.js";import{RenderSlot as a}from"../lib/RenderSlot.js";import{DefaultBufferWriter as o}from"./DefaultBufferWriter.js";import{PositionUVLayout as n}from"./DefaultLayouts.js";import{TriangleMaterial as p}from"./TriangleMaterial.js";import{CheckerBoardTechnique as f}from"../shaders/CheckerBoardTechnique.js";import{CheckerBoardTechniqueConfiguration as h}from"../shaders/CheckerBoardTechniqueConfiguration.js";class u extends p{constructor(r){super(r,new m),this._configuration=new h,this.produces=new Map([[a.OPAQUE_MATERIAL,r=>e(r)&&!this.parameters.transparent],[a.TRANSPARENT_MATERIAL,r=>e(r)&&this.parameters.transparent&&this.parameters.writeDepth],[a.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,r=>e(r)&&this.parameters.transparent&&!this.parameters.writeDepth]])}getConfiguration(r,t){return this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}createGLMaterial(r){return new c(r)}createBufferWriter(){return new o(n)}}class c extends s{beginSlot(r){return this.ensureTechnique(f,r)}}class m extends i{constructor(){super(...arguments),this.size=r(1,1),this.color1=t(.75,.75,.75,1),this.color2=t(.5,.5,.5,1),this.transparent=!1,this.writeDepth=!0,this.polygonOffset=!1}}export{u as CheckerBoardMaterial,m 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.31/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import{ZEROS as e}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{newLayout as r}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as t,isColorOrOID as s,isDepth as a,is2DGeometryOutput as i}from"../core/shaderLibrary/ShaderOutput.js";import{CullFaceOptions as o}from"../lib/basicInterfaces.js";import n from"../lib/GLMaterial.js";import{OITPolygonOffsetLimit as h}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as p}from"../lib/RenderSlot.js";import{VertexAttribute as c}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as l}from"./DefaultBufferWriter.js";import{TriangleMaterial as u}from"./TriangleMaterial.js";import{VisualVariablePassParameters as m}from"./VisualVariablePassParameters.js";import{ColorMaterialTechnique as f}from"../shaders/ColorMaterialTechnique.js";import{ColorMaterialTechniqueConfiguration as _}from"../shaders/ColorMaterialTechniqueConfiguration.js";class d extends u{constructor(e){super(e,new g),this.supportsEdges=!0,this.produces=new Map([[p.OPAQUE_MATERIAL,e=>e===t.Highlight||s(e)&&!this._isTransparent],[p.OPAQUE_NO_SSAO_DEPTH,e=>a(e)&&this.parameters.writeLinearDepth&&!this._isTransparent],[p.TRANSPARENT_MATERIAL,e=>s(e)&&this._isTransparent&&this.parameters.writeDepth],[p.TRANSPARENT_NO_SSAO_DEPTH,e=>a(e)&&this.parameters.writeLinearDepth&&this._isTransparent&&this.parameters.writeDepth],[p.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,e=>(s(e)||a(e)&&this.parameters.writeLinearDepth)&&this._isTransparent&&!this.parameters.writeDepth],[p.DRAPED_MATERIAL,e=>i(e)]]),this._configuration=new _}getConfiguration(e,r){return this._configuration.output=e,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasVertexColors=this.parameters.hasVertexColors&&!this.parameters.vvColor,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this._isTransparent,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.transparencyPassType=r.transparencyPassType,this._configuration.enableOffset=r.camera.relativeElevation<h,this._configuration.multipassEnabled=r.multipassEnabled,this._configuration.cullAboveGround=r.multipassTerrain.cullAboveGround,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.draped=this.parameters.draped,this._configuration}createGLMaterial(e){return new T(e)}createBufferWriter(){const e=r().vec3f(c.POSITION);return has("enable-feature:objectAndLayerId-rendering")&&e.vec4u8(c.OBJECTANDLAYERIDCOLOR),this.parameters.vvColor?e.f32(c.COLORFEATUREATTRIBUTE):e.vec4u8(c.COLOR),new l(e)}get _isTransparent(){return this.parameters.color[3]<1||this.parameters.forceTransparentMode}}class T extends n{_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){return this._output===t.Color&&this._updateOccludeeState(e),this.ensureTechnique(f,e)}}class g extends m{constructor(){super(...arguments),this.color=e,this.forceTransparentMode=!1,this.writeDepth=!0,this.writeLinearDepth=!1,this.hasVertexColors=!1,this.polygonOffset=!1,this.hasSlicePlane=!1,this.cullFace=o.None,this.hasOccludees=!1,this.draped=!1}}export{d as ColorMaterial,g as Parameters};
5
+ import has from"../../../../core/has.js";import{ZEROS as e}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{newLayout as r}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as t,isColorOrOID as s,isDepth as a,is2DGeometryOutput as i}from"../core/shaderLibrary/ShaderOutput.js";import{CullFaceOptions as o}from"../lib/basicInterfaces.js";import n from"../lib/GLMaterial.js";import{OITPolygonOffsetLimit as h}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as p}from"../lib/RenderSlot.js";import{VertexAttribute as c}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as l}from"./DefaultBufferWriter.js";import{TriangleMaterial as u}from"./TriangleMaterial.js";import{VisualVariablePassParameters as m}from"./VisualVariablePassParameters.js";import{ColorMaterialTechnique as f}from"../shaders/ColorMaterialTechnique.js";import{ColorMaterialTechniqueConfiguration as _}from"../shaders/ColorMaterialTechniqueConfiguration.js";class d extends u{constructor(e){super(e,new g),this._configuration=new _,this.supportsEdges=!0,this.produces=new Map([[p.OPAQUE_MATERIAL,e=>e===t.Highlight||s(e)&&!this._isTransparent],[p.OPAQUE_NO_SSAO_DEPTH,e=>a(e)&&this.parameters.writeLinearDepth&&!this._isTransparent],[p.TRANSPARENT_MATERIAL,e=>s(e)&&this._isTransparent&&this.parameters.writeDepth],[p.TRANSPARENT_NO_SSAO_DEPTH,e=>a(e)&&this.parameters.writeLinearDepth&&this._isTransparent&&this.parameters.writeDepth],[p.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,e=>(s(e)||a(e)&&this.parameters.writeLinearDepth)&&this._isTransparent&&!this.parameters.writeDepth],[p.DRAPED_MATERIAL,e=>i(e)]])}getConfiguration(e,r){return this._configuration.output=e,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasVertexColors=this.parameters.hasVertexColors&&!this.parameters.vvColor,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this._isTransparent,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.transparencyPassType=r.transparencyPassType,this._configuration.enableOffset=r.camera.relativeElevation<h,this._configuration.multipassEnabled=r.multipassEnabled,this._configuration.cullAboveGround=r.multipassTerrain.cullAboveGround,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.draped=this.parameters.draped,this._configuration}createGLMaterial(e){return new T(e)}createBufferWriter(){const e=r().vec3f(c.POSITION);return has("enable-feature:objectAndLayerId-rendering")&&e.vec4u8(c.OBJECTANDLAYERIDCOLOR),this.parameters.vvColor?e.f32(c.COLORFEATUREATTRIBUTE):e.vec4u8(c.COLOR),new l(e)}get _isTransparent(){return this.parameters.color[3]<1||this.parameters.forceTransparentMode}}class T extends n{_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){return this._output===t.Color&&this._updateOccludeeState(e),this.ensureTechnique(f,e)}}class g extends m{constructor(){super(...arguments),this.color=e,this.forceTransparentMode=!1,this.writeDepth=!0,this.writeLinearDepth=!1,this.hasVertexColors=!1,this.polygonOffset=!1,this.hasSlicePlane=!1,this.cullFace=o.None,this.hasOccludees=!1,this.draped=!1}}export{d as ColorMaterial,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.31/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import{s as e,c as t,n as r,f as s,l as a,j as i,m as o,t as n}from"../../../../chunks/vec32.js";import{create as h,fromValues as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ViewingMode as c}from"../../../ViewingMode.js";import{newLayout as u}from"../../support/buffer/InterleavedLayout.js";import{is3DGeometryOutput as m,isShadowRelatedOutput as p,ShaderOutput as f}from"../core/shaderLibrary/ShaderOutput.js";import{NormalType as d}from"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{NormalsDoubleSidedMode as g}from"../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as T}from"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{CullFaceOptions as _}from"../lib/basicInterfaces.js";import{GLTextureMaterial as x}from"../lib/GLTextureMaterial.js";import{Material as b}from"../lib/Material.js";import{OITPolygonOffsetLimit as v}from"../lib/OrderIndependentTransparency.js";import{intersectTriangleGeometry as S}from"../lib/RayIntersections.js";import{RenderSlot as O}from"../lib/RenderSlot.js";import{VertexAttribute as w}from"../lib/VertexAttribute.js";import{getVerticalOffsetObject3D as M}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as C}from"./DefaultBufferWriter.js";import{verticalOffsetAtDistance as y}from"./internal/MaterialUtil.js";import{DefaultMaterialTechnique as R,DefaultMaterialPassParameters as I}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as A}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as P}from"../shaders/RealisticTreeTechnique.js";class j extends b{constructor(e){super(e,D),this.supportsEdges=!0,this.produces=new Map([[O.OPAQUE_MATERIAL,e=>(m(e)||p(e))&&!this.parameters.transparent],[O.TRANSPARENT_MATERIAL,e=>(m(e)||p(e))&&this.parameters.transparent&&this.parameters.writeDepth],[O.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,e=>(m(e)||p(e))&&this.parameters.transparent&&!this.parameters.writeDepth]]),this._configuration=new A,this._vertexBufferLayout=N(this.parameters)}isVisibleForOutput(e){return e!==f.Shadow&&e!==f.ShadowExcludeHighlight&&e!==f.ShadowHighlight||this.parameters.castShadows}isVisible(){const e=this.parameters;if(!super.isVisible()||0===e.layerOpacity)return!1;const{hasInstancedColor:t,hasVertexColors:r,hasSymbolColors:s,vvColor:a}=e,i="replace"===e.colorMixMode,o=e.opacity>0,n=e.externalColor&&e.externalColor[3]>0,h=t||a||s;return r&&h?i||o:r?i?n:o:h?i||o:i?n:o}getConfiguration(e,t){return this._configuration.output=e,this._configuration.hasNormalTexture=!!this.parameters.normalTextureId,this._configuration.hasColorTexture=!!this.parameters.textureId,this._configuration.hasVertexTangents=this.parameters.hasVertexTangents,this._configuration.instanced=this.parameters.isInstanced,this._configuration.instancedDoublePrecision=this.parameters.instancedDoublePrecision,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.hasVerticalOffset=null!=this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasSliceHighlight=this.parameters.hasSliceHighlight,this._configuration.alphaDiscardMode=this.parameters.textureAlphaMode,this._configuration.normalType=this.parameters.normalType,this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,null!=this.parameters.customDepthTest&&(this._configuration.customDepthTest=this.parameters.customDepthTest),this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.cullFace=this.parameters.hasSlicePlane?_.None:this.parameters.cullFace,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration.hasModelTransformation=null!=this.parameters.modelTransformation,e===f.Color&&(this._configuration.hasVertexColors=this.parameters.hasVertexColors,this._configuration.hasSymbolColors=this.parameters.hasSymbolColors,this.parameters.treeRendering?this._configuration.doubleSidedMode=g.WindingOrder:this._configuration.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?g.View:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?g.WindingOrder:g.None,this._configuration.instancedColor=this.parameters.hasInstancedColor,this._configuration.receiveShadows=this.parameters.receiveShadows&&this.parameters.shadowMappingEnabled,this._configuration.receiveAmbientOcclusion=this.parameters.receiveAmbientOcclusion&&null!=t.ssao,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.textureAlphaPremultiplied=!!this.parameters.textureAlphaPremultiplied,this._configuration.pbrMode=this.parameters.usePBR?this.parameters.isSchematic?T.Schematic:T.Normal:T.Disabled,this._configuration.hasMetallicRoughnessTexture=!!this.parameters.metallicRoughnessTextureId,this._configuration.hasEmissionTexture=!!this.parameters.emissiveTextureId,this._configuration.hasOcclusionTexture=!!this.parameters.occlusionTextureId,this._configuration.offsetBackfaces=!(!this.parameters.transparent||!this.parameters.offsetTransparentBackfaces),this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.enableOffset=t.camera.relativeElevation<v,this._configuration.snowCover=this.hasSnowCover(t),this._configuration.hasColorTextureTransform=!!this.parameters.colorTextureTransformMatrix,this._configuration.hasNormalTextureTransform=!!this.parameters.normalTextureTransformMatrix,this._configuration.hasEmissionTextureTransform=!!this.parameters.emissiveTextureTransformMatrix,this._configuration.hasOcclusionTextureTransform=!!this.parameters.occlusionTextureTransformMatrix,this._configuration.hasMetallicRoughnessTextureTransform=!!this.parameters.metallicRoughnessTextureTransformMatrix),this._configuration}hasSnowCover(e){return null!=e.weather&&e.weatherVisible&&"snowy"===e.weather.type&&"enabled"===e.weather.snowCover}intersect(h,l,u,m,p,f){if(null!=this.parameters.verticalOffset){const h=u.camera;e(W,l[12],l[13],l[14]);let f=null;switch(u.viewingMode){case c.Global:f=r(G,W);break;case c.Local:f=t(G,z)}let d=0;const g=s(k,W,h.eye),T=a(g),_=i(g,g,1/T);let x=null;this.parameters.screenSizePerspective&&(x=o(f,_)),d+=y(h,T,this.parameters.verticalOffset,x??0,this.parameters.screenSizePerspective),i(f,f,d),n(H,f,u.transform.inverseRotation),m=s(V,m,H),p=s(B,p,H)}S(h,u,m,p,M(u.verticalOffset),f)}createGLMaterial(e){return new E(e)}createBufferWriter(){return new C(this._vertexBufferLayout)}}class E extends x{constructor(e){super({...e,...e.material.parameters})}_updateShadowState(e){e.shadowMap.enabled!==this._material.parameters.shadowMappingEnabled&&this._material.setParameters({shadowMappingEnabled:e.shadowMap.enabled})}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(t){this._output===f.Color&&(this._updateShadowState(t),this._updateOccludeeState(t));const r=this._material.parameters;this.updateTexture(r.textureId);const s=t.camera.viewInverseTransposeMatrix;return e(r.origin,s[3],s[7],s[11]),this._material.setParameters(this.textureBindParameters),this.ensureTechnique(r.treeRendering?P:R,t)}}class L extends I{constructor(){super(...arguments),this.initTextureTransparent=!1,this.treeRendering=!1,this.hasVertexTangents=!1}}const D=new L;function N(e){const t=u().vec3f(w.POSITION);e.normalType===d.Compressed?t.vec2i16(w.NORMALCOMPRESSED,{glNormalized:!0}):t.vec3f(w.NORMAL),e.hasVertexTangents&&t.vec4f(w.TANGENT);return(e.textureId||e.normalTextureId||e.metallicRoughnessTextureId||e.emissiveTextureId||e.occlusionTextureId)&&t.vec2f(w.UV0),e.hasVertexColors&&t.vec4u8(w.COLOR),e.hasSymbolColors&&t.vec4u8(w.SYMBOLCOLOR),has("enable-feature:objectAndLayerId-rendering")&&t.vec4u8(w.OBJECTANDLAYERIDCOLOR),t}const V=h(),B=h(),z=l(0,0,1),G=h(),H=h(),W=h(),k=h();export{E as DefaultGLMaterial,j as DefaultMaterial,L as DefaultMaterialParameters};
5
+ import has from"../../../../core/has.js";import{s as e,c as t,n as r,f as s,l as a,j as i,m as o,t as n}from"../../../../chunks/vec32.js";import{create as h,fromValues as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ViewingMode as c}from"../../../ViewingMode.js";import{newLayout as u}from"../../support/buffer/InterleavedLayout.js";import{is3DGeometryOutput as m,isShadowRelatedOutput as p,ShaderOutput as f}from"../core/shaderLibrary/ShaderOutput.js";import{NormalType as d}from"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{NormalsDoubleSidedMode as g}from"../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as T}from"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{CullFaceOptions as _}from"../lib/basicInterfaces.js";import{GLTextureMaterial as x}from"../lib/GLTextureMaterial.js";import{Material as b}from"../lib/Material.js";import{OITPolygonOffsetLimit as v}from"../lib/OrderIndependentTransparency.js";import{intersectTriangleGeometry as S}from"../lib/RayIntersections.js";import{RenderSlot as O}from"../lib/RenderSlot.js";import{VertexAttribute as w}from"../lib/VertexAttribute.js";import{getVerticalOffsetObject3D as M}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as C}from"./DefaultBufferWriter.js";import{verticalOffsetAtDistance as y}from"./internal/MaterialUtil.js";import{DefaultMaterialTechnique as R,DefaultMaterialPassParameters as I}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as A}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as P}from"../shaders/RealisticTreeTechnique.js";class j extends b{constructor(e){super(e,D),this._configuration=new A,this.supportsEdges=!0,this.produces=new Map([[O.OPAQUE_MATERIAL,e=>(m(e)||p(e))&&!this.parameters.transparent],[O.TRANSPARENT_MATERIAL,e=>(m(e)||p(e))&&this.parameters.transparent&&this.parameters.writeDepth],[O.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,e=>(m(e)||p(e))&&this.parameters.transparent&&!this.parameters.writeDepth]]),this._vertexBufferLayout=N(this.parameters)}isVisibleForOutput(e){return e!==f.Shadow&&e!==f.ShadowExcludeHighlight&&e!==f.ShadowHighlight||this.parameters.castShadows}get visible(){const e=this.parameters;if(0===e.layerOpacity)return!1;const{hasInstancedColor:t,hasVertexColors:r,hasSymbolColors:s,vvColor:a}=e,i="replace"===e.colorMixMode,o=e.opacity>0,n=e.externalColor&&e.externalColor[3]>0,h=t||a||s;return r&&h?i||o:r?i?n:o:h?i||o:i?n:o}getConfiguration(e,t){return this._configuration.output=e,this._configuration.hasNormalTexture=!!this.parameters.normalTextureId,this._configuration.hasColorTexture=!!this.parameters.textureId,this._configuration.hasVertexTangents=this.parameters.hasVertexTangents,this._configuration.instanced=this.parameters.isInstanced,this._configuration.instancedDoublePrecision=this.parameters.instancedDoublePrecision,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.hasVerticalOffset=null!=this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasSliceHighlight=this.parameters.hasSliceHighlight,this._configuration.alphaDiscardMode=this.parameters.textureAlphaMode,this._configuration.normalType=this.parameters.normalType,this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,null!=this.parameters.customDepthTest&&(this._configuration.customDepthTest=this.parameters.customDepthTest),this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.cullFace=this.parameters.hasSlicePlane?_.None:this.parameters.cullFace,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration.hasModelTransformation=null!=this.parameters.modelTransformation,e===f.Color&&(this._configuration.hasVertexColors=this.parameters.hasVertexColors,this._configuration.hasSymbolColors=this.parameters.hasSymbolColors,this.parameters.treeRendering?this._configuration.doubleSidedMode=g.WindingOrder:this._configuration.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?g.View:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?g.WindingOrder:g.None,this._configuration.instancedColor=this.parameters.hasInstancedColor,this._configuration.receiveShadows=this.parameters.receiveShadows&&this.parameters.shadowMappingEnabled,this._configuration.receiveAmbientOcclusion=this.parameters.receiveAmbientOcclusion&&null!=t.ssao,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.textureAlphaPremultiplied=!!this.parameters.textureAlphaPremultiplied,this._configuration.pbrMode=this.parameters.usePBR?this.parameters.isSchematic?T.Schematic:T.Normal:T.Disabled,this._configuration.hasMetallicRoughnessTexture=!!this.parameters.metallicRoughnessTextureId,this._configuration.hasEmissionTexture=!!this.parameters.emissiveTextureId,this._configuration.hasOcclusionTexture=!!this.parameters.occlusionTextureId,this._configuration.offsetBackfaces=!(!this.parameters.transparent||!this.parameters.offsetTransparentBackfaces),this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.enableOffset=t.camera.relativeElevation<v,this._configuration.snowCover=this.hasSnowCover(t),this._configuration.hasColorTextureTransform=!!this.parameters.colorTextureTransformMatrix,this._configuration.hasNormalTextureTransform=!!this.parameters.normalTextureTransformMatrix,this._configuration.hasEmissionTextureTransform=!!this.parameters.emissiveTextureTransformMatrix,this._configuration.hasOcclusionTextureTransform=!!this.parameters.occlusionTextureTransformMatrix,this._configuration.hasMetallicRoughnessTextureTransform=!!this.parameters.metallicRoughnessTextureTransformMatrix),this._configuration}hasSnowCover(e){return null!=e.weather&&e.weatherVisible&&"snowy"===e.weather.type&&"enabled"===e.weather.snowCover}intersect(h,l,u,m,p,f){if(null!=this.parameters.verticalOffset){const h=u.camera;e(W,l[12],l[13],l[14]);let f=null;switch(u.viewingMode){case c.Global:f=r(G,W);break;case c.Local:f=t(G,z)}let d=0;const g=s(k,W,h.eye),T=a(g),_=i(g,g,1/T);let x=null;this.parameters.screenSizePerspective&&(x=o(f,_)),d+=y(h,T,this.parameters.verticalOffset,x??0,this.parameters.screenSizePerspective),i(f,f,d),n(H,f,u.transform.inverseRotation),m=s(V,m,H),p=s(B,p,H)}S(h,u,m,p,M(u.verticalOffset),f)}createGLMaterial(e){return new E(e)}createBufferWriter(){return new C(this._vertexBufferLayout)}}class E extends x{constructor(e){super({...e,...e.material.parameters})}_updateShadowState(e){e.shadowMap.enabled!==this._material.parameters.shadowMappingEnabled&&this._material.setParameters({shadowMappingEnabled:e.shadowMap.enabled})}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(t){this._output===f.Color&&(this._updateShadowState(t),this._updateOccludeeState(t));const r=this._material.parameters;this.updateTexture(r.textureId);const s=t.camera.viewInverseTransposeMatrix;return e(r.origin,s[3],s[7],s[11]),this._material.setParameters(this.textureBindParameters),this.ensureTechnique(r.treeRendering?P:R,t)}}class L extends I{constructor(){super(...arguments),this.initTextureTransparent=!1,this.treeRendering=!1,this.hasVertexTangents=!1}}const D=new L;function N(e){const t=u().vec3f(w.POSITION);e.normalType===d.Compressed?t.vec2i16(w.NORMALCOMPRESSED,{glNormalized:!0}):t.vec3f(w.NORMAL),e.hasVertexTangents&&t.vec4f(w.TANGENT);return(e.textureId||e.normalTextureId||e.metallicRoughnessTextureId||e.emissiveTextureId||e.occlusionTextureId)&&t.vec2f(w.UV0),e.hasVertexColors&&t.vec4u8(w.COLOR),e.hasSymbolColors&&t.vec4u8(w.SYMBOLCOLOR),has("enable-feature:objectAndLayerId-rendering")&&t.vec4u8(w.OBJECTANDLAYERIDCOLOR),t}const V=h(),B=h(),z=l(0,0,1),G=h(),H=h(),W=h(),k=h();export{E as DefaultGLMaterial,j as DefaultMaterial,L as DefaultMaterialParameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import{clamp as e}from"../../../../core/mathUtils.js";import{fromMat4 as t}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as s}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{s as n,h as o,n as c,f as l,j as f,c as p,l as u,p as m,g as h,t as d,m as g}from"../../../../chunks/vec32.js";import{create as S,fromValues as O}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromArray as b,create as T,fromValues as A}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMat4 as v}from"../../../../core/libs/gl-matrix-2/types/mat4.js";import{create as E}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec4u8 as I}from"../../../../geometry/support/buffer/BufferView.js";import{evaluateModelTransformScale as _}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as y}from"../../support/debugFlags.js";import{newLayout as x}from"../../support/buffer/InterleavedLayout.js";import{isColorHighlightOrOID as P,ShaderOutput as R}from"../core/shaderLibrary/ShaderOutput.js";import{HUDVerticalPixelOffset as C}from"../core/shaderLibrary/hud/HUD.glsl.js";import{GLTextureMaterial as D,GLTextureMaterialBindParameters as j}from"../lib/GLTextureMaterial.js";import{Material as L,RenderOccludedFlag as N}from"../lib/Material.js";import{RenderSlot as U}from"../lib/RenderSlot.js";import{applyScaleFactor as F,applyPrecomputedScaleFactor as M,precomputeScaleFactor as z}from"../lib/screenSizePerspectiveUtils.js";import{assert as w}from"../lib/Util.js";import{VertexAttribute as V}from"../lib/VertexAttribute.js";import{ScaleInfo as B}from"./ScaleInfo.js";import{writePosition as G,writeNormal as q,writeColor as H,writeBufferVec4 as W,writeBufferVec4Zeros as X,writeObjectAndLayerIdColor as Y}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as Z}from"./internal/MaterialUtil.js";import{c as k}from"../../../../chunks/HUDMaterial.glsl.js";import{HUDMaterialTechnique as J}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as K}from"../shaders/HUDMaterialTechniqueConfiguration.js";class Q extends L{constructor(e){super(e,new Ae),this._configuration=new K,this.produces=new Map([[U.HUD_MATERIAL,e=>P(e)&&!this.parameters.drawInSecondSlot],[U.LABEL_MATERIAL,e=>P(e)&&this.parameters.drawInSecondSlot],[U.OCCLUSION_PIXELS,()=>this.parameters.occlusionTest],[U.DRAPED_MATERIAL,e=>P(e)]])}getConfiguration(e,t){return this._configuration.output=e,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVerticalOffset=!!this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,this._configuration.hasPolygonOffset=this.parameters.polygonOffset,this._configuration.draped=this.parameters.draped,this._configuration.occlusionTestEnabled=this.parameters.occlusionTest,this._configuration.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,this._configuration.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,this._configuration.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.occlusionPass=t.slot===U.OCCLUSION_PIXELS&&this.parameters.occlusionTest,e===R.Color&&(this._configuration.debugDrawLabelBorder=!!y.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,r,i,a,h,d){if(!(i.options.selectionMode&&i.options.hud&&e.visible&&i.point))return;const g=this.parameters,{point:O,camera:b}=i,{scaleX:T,scaleY:A}=this._getScreenScale(e,b.pixelRatio);t(fe,r),e.attributes.has(V.FEATUREATTRIBUTE)&&re(fe);const v=e.attributes.get(V.POSITION),E=e.attributes.get(V.SIZE),I=e.attributes.get(V.NORMAL),_=e.attributes.get(V.CENTEROFFSETANDDISTANCE);w(v.size>=3);const y=k(g),x="screen"===this.parameters.centerOffsetUnits;for(let t=0;t<v.data.length/v.size;t++){const e=t*v.size;n(ae,v.data[e],v.data[e+1],v.data[e+2]),o(ae,ae,r),o(ae,ae,b.viewMatrix);const a=t*_.size;if(n(me,_.data[a],_.data[a+1],_.data[a+2]),!x&&(ae[0]+=me[0],ae[1]+=me[1],0!==me[2])){const e=me[2];c(me,ae),l(ae,ae,f(me,me,e))}const h=t*I.size;if(n(ne,I.data[h],I.data[h+1],I.data[h+2]),te(ne,fe,b,ge),this._applyVerticalOffsetTransformationView(ae,ge,b,ie),b.applyProjection(ae,oe),oe[0]>-1){x&&(me[0]||me[1])&&(oe[0]+=me[0]*b.pixelRatio,0!==me[1]&&(oe[1]+=F(me[1],ie.factorAlignment)*b.pixelRatio),b.unapplyProjection(oe,ae)),oe[0]+=this.parameters.screenOffset[0]*b.pixelRatio,oe[1]+=this.parameters.screenOffset[1]*b.pixelRatio,oe[0]=Math.floor(oe[0]),oe[1]=Math.floor(oe[1]);const e=t*E.size;be[0]=E.data[e]*T,be[1]=E.data[e+1]*A,M(be,ie.factor,be);const r=Se*b.pixelRatio;let a=0;if(g.textureIsSignedDistanceField&&(a=g.outlineSize*b.pixelRatio/2),se(O,oe[0],oe[1],be,r,a,g,y)){const e=i.ray;if(o(le,ae,s(ue,b.viewMatrix)),oe[0]=O[0],oe[1]=O[1],b.unprojectFromRenderScreen(oe,ae)){const t=S();p(t,e.direction);const r=1/u(t);f(t,t,r);d(m(e.origin,ae)*r,t,-1,!0,1,le)}}}}}intersectDraped(e,t,r,s,i,a){const n=e.attributes.get(V.POSITION),o=e.attributes.get(V.SIZE),c=this.parameters,l=k(c),{scaleX:f,scaleY:p}=this._getScreenScale(e,e.screenToWorldRatio),u=Oe*e.screenToWorldRatio;for(let m=0;m<n.data.length/n.size;m++){const t=m*n.size,r=n.data[t],h=n.data[t+1],d=m*o.size;be[0]=o.data[d]*f,be[1]=o.data[d+1]*p;let g=0;c.textureIsSignedDistanceField&&(g=c.outlineSize*e.screenToWorldRatio/2),se(s,r,h,be,u,g,c,l)&&i(a.dist,a.normal,-1,!1)}}createBufferWriter(){return new Ie(this)}_updateScaleInfo(e,t,r){const s=this.parameters;null!=s.screenSizePerspective?z(r,t,s.screenSizePerspective,e.factor):(e.factor.scale=1,e.factor.factor=0,e.factor.minScaleFactor=0),null!=s.screenSizePerspectiveAlignment?z(r,t,s.screenSizePerspectiveAlignment,e.factorAlignment):(e.factorAlignment.factor=e.factor.factor,e.factorAlignment.scale=e.factor.scale,e.factorAlignment.minScaleFactor=e.factor.minScaleFactor)}applyShaderOffsetsView(e,t,r,s,i,a,n){const o=te(t,r,i,ge);return this._applyVerticalGroundOffsetView(e,o,i,n),this._applyVerticalOffsetTransformationView(n,o,i,a),this._applyPolygonOffsetView(n,o,s[3],i,n),this._applyCenterOffsetView(n,s,n),n}applyShaderOffsetsNDC(e,t,r,s,i){return this._applyCenterOffsetNDC(e,t,r,s),null!=i&&p(i,s),this._applyPolygonOffsetNDC(s,t,r,s),s}_applyPolygonOffsetView(t,r,s,i,a){const n=i.aboveGround?1:-1;let o=Math.sign(s);0===o&&(o=n);const c=n*o;if(this.parameters.shaderPolygonOffset<=0)return p(a,t);const l=e(Math.abs(r.cosAngle),.01,1),u=1-Math.sqrt(1-l*l)/l/i.viewport[2];return f(a,t,c>0?u:1/u),a}_applyVerticalGroundOffsetView(e,t,r,s){const i=u(e),a=r.aboveGround?1:-1,n=r.computeRenderPixelSizeAtDist(i)*C,o=f(ae,t.normal,a*n);return h(s,e,o),s}_applyVerticalOffsetTransformationView(e,t,r,s){const i=this.parameters;if(!i.verticalOffset?.screenLength){if(i.screenSizePerspective||i.screenSizePerspectiveAlignment){const r=u(e);this._updateScaleInfo(s,r,t.cosAngle)}else s.factor.scale=1,s.factorAlignment.scale=1;return e}const a=u(e),n=i.screenSizePerspectiveAlignment??i.screenSizePerspective,o=Z(r,a,i.verticalOffset,t.cosAngle,n);return this._updateScaleInfo(s,a,t.cosAngle),f(t.normal,t.normal,o),h(e,e,t.normal)}_applyCenterOffsetView(e,t,r){const s="screen"!==this.parameters.centerOffsetUnits;return r!==e&&p(r,e),s&&(r[0]+=t[0],r[1]+=t[1],t[2]&&(c(ne,r),h(r,r,f(ne,ne,t[2])))),r}_applyCenterOffsetNDC(e,t,r,s){const i="screen"!==this.parameters.centerOffsetUnits;return s!==e&&p(s,e),i||(s[0]+=t[0]/r.fullWidth*2,s[1]+=t[1]/r.fullHeight*2),s}_applyPolygonOffsetNDC(e,t,r,s){const i=this.parameters.shaderPolygonOffset;if(e!==s&&p(s,e),i){const e=r.aboveGround?1:-1,a=e*Math.sign(t[3]);s[2]-=(a||e)*i}return s}createGLMaterial(e){return new $(e)}calculateRelativeScreenBounds(e,t,r=E()){return ee(this.parameters,e,t,r),r[2]=r[0]+e[0],r[3]=r[1]+e[1],r}_getScreenScale(e,t){const r=e.attributes.get(V.FEATUREATTRIBUTE);if(null==r)return{scaleX:t,scaleY:t};const s=b(r.data,de);return _(he,this.parameters,s),{scaleX:he[0]*t,scaleY:he[1]*t}}}class $ extends D{constructor(e){super({...e,...e.material.parameters})}selectProgram(e){return this.ensureTechnique(J,e)}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.selectProgram(e)}}function ee(e,t,r,s){s[0]=e.anchorPosition[0]*-t[0]+e.screenOffset[0]*r,s[1]=e.anchorPosition[1]*-t[1]+e.screenOffset[1]*r}function te(e,r,s,i){return v(r)&&(r=t(pe,r)),d(i.normal,e,r),o(i.normal,i.normal,s.viewInverseTransposeMatrix),i.cosAngle=g(ce,Te),i}function re(e){const t=e[0],r=e[1],s=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+r*r+s*s),p=1/Math.sqrt(i*i+a*a+n*n),u=1/Math.sqrt(o*o+c*c+l*l);return e[0]=t*f,e[1]=r*f,e[2]=s*f,e[3]=i*p,e[4]=a*p,e[5]=n*p,e[6]=o*u,e[7]=c*u,e[8]=l*u,e}function se(e,t,r,s,i,a,n,o){let c=t-i-(o[0]>0?s[0]*o[0]:0),l=c+s[0]+2*i,f=r-i-(o[1]>0?s[1]*o[1]:0),p=f+s[1]+2*i;const u=n.distanceFieldBoundingBox;return n.textureIsSignedDistanceField&&null!=u&&(c+=s[0]*u[0],f+=s[1]*u[1],l-=s[0]*(1-u[2]),p-=s[1]*(1-u[3]),c-=a,l+=a,f-=a,p+=a),e[0]>c&&e[0]<l&&e[1]>f&&e[1]<p}const ie=new B,ae=S(),ne=S(),oe=T(),ce=S(),le=S(),fe=r(),pe=r(),ue=i(),me=S(),he=S(),de=T(),ge={normal:ce,cosAngle:0},Se=1,Oe=2,be=[0,0],Te=O(0,0,1);class Ae extends j{constructor(){super(...arguments),this.renderOccluded=N.Occlude,this.isDecoration=!1,this.color=A(1,1,1,1),this.texCoordScale=[1,1],this.polygonOffset=!1,this.anchorPosition=a(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=A(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.draped=!1}}const ve=x().vec3f(V.POSITION).vec3f(V.NORMAL).vec2f(V.UV0).vec4u8(V.COLOR).vec2f(V.SIZE).vec4f(V.CENTEROFFSETANDDISTANCE).vec4f(V.FEATUREATTRIBUTE),Ee=ve.clone().vec4u8(V.OBJECTANDLAYERIDCOLOR);class Ie{constructor(e){this._material=e,this.vertexBufferLayout=has("enable-feature:objectAndLayerId-rendering")?Ee:ve}elementCount(e){return 6*e.attributes.get(V.POSITION).indices.length}write(e,t,r,s,i){G(r.attributes.get(V.POSITION),e,s.position,i,6),q(r.attributes.get(V.NORMAL),t,s.normal,i,6);const a=r.attributes.get(V.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=r.attributes.get(V.POSITION).indices.length,p=i;const u=s.uv0;for(let g=0;g<f;++g)u.set(p,0,n),u.set(p,1,o),p++,u.set(p,0,c),u.set(p,1,o),p++,u.set(p,0,c),u.set(p,1,l),p++,u.set(p,0,c),u.set(p,1,l),p++,u.set(p,0,n),u.set(p,1,l),p++,u.set(p,0,n),u.set(p,1,o),p++;H(r.attributes.get(V.COLOR),4,s.color,i,6);const{data:m,indices:h}=r.attributes.get(V.SIZE);f=h.length;const d=s.size;p=i;for(let g=0;g<f;++g){const e=m[2*h[g]],t=m[2*h[g]+1];for(let r=0;r<6;++r)d.set(p,0,e),d.set(p,1,t),p++}if(r.attributes.get(V.CENTEROFFSETANDDISTANCE)?W(r.attributes.get(V.CENTEROFFSETANDDISTANCE),s.centerOffsetAndDistance,i,6):X(s.centerOffsetAndDistance,i,6*f),r.attributes.get(V.FEATUREATTRIBUTE)?W(r.attributes.get(V.FEATUREATTRIBUTE),s.featureAttribute,i,6):X(s.featureAttribute,i,6*f),null!=r.objectAndLayerIdColor){const e=r.attributes.get(V.POSITION)?.indices;if(e){const t=e.length,a=s.getField(V.OBJECTANDLAYERIDCOLOR,I);Y(r.objectAndLayerIdColor,a,t,i,6)}}}}export{Q as HUDMaterial,Ae as Parameters};
5
+ import has from"../../../../core/has.js";import{clamp as e}from"../../../../core/mathUtils.js";import{fromMat4 as t}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{s as n,h as o,n as c,f as l,j as f,c as p,l as u,p as m,g as h,t as d,m as g}from"../../../../chunks/vec32.js";import{create as S,fromValues as O}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromArray as b,create as T,fromValues as v}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMat4 as A}from"../../../../core/libs/gl-matrix-2/types/mat4.js";import{create as E}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec4u8 as I}from"../../../../geometry/support/buffer/BufferView.js";import{evaluateModelTransformScale as _}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as y}from"../../support/debugFlags.js";import{newLayout as x}from"../../support/buffer/InterleavedLayout.js";import{isColorHighlightOrOID as P,ShaderOutput as R}from"../core/shaderLibrary/ShaderOutput.js";import{HUDVerticalPixelOffset as C}from"../core/shaderLibrary/hud/HUD.glsl.js";import{GLTextureMaterial as D,GLTextureMaterialBindParameters as j}from"../lib/GLTextureMaterial.js";import{Material as L,RenderOccludedFlag as N}from"../lib/Material.js";import{RenderSlot as U}from"../lib/RenderSlot.js";import{applyScaleFactor as F,applyPrecomputedScaleFactor as M,precomputeScaleFactor as z}from"../lib/screenSizePerspectiveUtils.js";import{assert as w}from"../lib/Util.js";import{VertexAttribute as V}from"../lib/VertexAttribute.js";import{ScaleInfo as B}from"./ScaleInfo.js";import{writePosition as G,writeNormal as q,writeColor as H,writeBufferVec4 as W,writeBufferVec4Zeros as X,writeObjectAndLayerIdColor as Y}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as Z}from"./internal/MaterialUtil.js";import{c as k}from"../../../../chunks/HUDMaterial.glsl.js";import{HUDMaterialTechnique as J}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as K}from"../shaders/HUDMaterialTechniqueConfiguration.js";class Q extends L{constructor(e){super(e,new ve),this._configuration=new K,this.produces=new Map([[U.HUD_MATERIAL,e=>P(e)&&!this.parameters.drawInSecondSlot],[U.LABEL_MATERIAL,e=>P(e)&&this.parameters.drawInSecondSlot],[U.OCCLUSION_PIXELS,()=>this.parameters.occlusionTest],[U.DRAPED_MATERIAL,e=>P(e)]]),this._visible=!0}getConfiguration(e,t){return this._configuration.output=e,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVerticalOffset=!!this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,this._configuration.hasPolygonOffset=this.parameters.polygonOffset,this._configuration.draped=this.parameters.draped,this._configuration.occlusionTestEnabled=this.parameters.occlusionTest,this._configuration.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,this._configuration.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,this._configuration.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.occlusionPass=t.slot===U.OCCLUSION_PIXELS&&this.parameters.occlusionTest,e===R.Color&&(this._configuration.debugDrawLabelBorder=!!y.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,h,d){if(!(i.options.selectionMode&&i.options.hud&&e.visible&&i.point))return;const g=this.parameters,{point:O,camera:b}=i,{scaleX:T,scaleY:v}=this._getScreenScale(e,b.pixelRatio);t(fe,s),e.attributes.has(V.FEATUREATTRIBUTE)&&se(fe);const A=e.attributes.get(V.POSITION),E=e.attributes.get(V.SIZE),I=e.attributes.get(V.NORMAL),_=e.attributes.get(V.CENTEROFFSETANDDISTANCE);w(A.size>=3);const y=k(g),x="screen"===this.parameters.centerOffsetUnits;for(let t=0;t<A.data.length/A.size;t++){const e=t*A.size;n(ae,A.data[e],A.data[e+1],A.data[e+2]),o(ae,ae,s),o(ae,ae,b.viewMatrix);const a=t*_.size;if(n(me,_.data[a],_.data[a+1],_.data[a+2]),!x&&(ae[0]+=me[0],ae[1]+=me[1],0!==me[2])){const e=me[2];c(me,ae),l(ae,ae,f(me,me,e))}const h=t*I.size;if(n(ne,I.data[h],I.data[h+1],I.data[h+2]),te(ne,fe,b,ge),this._applyVerticalOffsetTransformationView(ae,ge,b,ie),b.applyProjection(ae,oe),oe[0]>-1){x&&(me[0]||me[1])&&(oe[0]+=me[0]*b.pixelRatio,0!==me[1]&&(oe[1]+=F(me[1],ie.factorAlignment)*b.pixelRatio),b.unapplyProjection(oe,ae)),oe[0]+=this.parameters.screenOffset[0]*b.pixelRatio,oe[1]+=this.parameters.screenOffset[1]*b.pixelRatio,oe[0]=Math.floor(oe[0]),oe[1]=Math.floor(oe[1]);const e=t*E.size;be[0]=E.data[e]*T,be[1]=E.data[e+1]*v,M(be,ie.factor,be);const s=Se*b.pixelRatio;let a=0;if(g.textureIsSignedDistanceField&&(a=g.outlineSize*b.pixelRatio/2),re(O,oe[0],oe[1],be,s,a,g,y)){const e=i.ray;if(o(le,ae,r(ue,b.viewMatrix)),oe[0]=O[0],oe[1]=O[1],b.unprojectFromRenderScreen(oe,ae)){const t=S();p(t,e.direction);const s=1/u(t);f(t,t,s);d(m(e.origin,ae)*s,t,-1,!0,1,le)}}}}}intersectDraped(e,t,s,r,i,a){const n=e.attributes.get(V.POSITION),o=e.attributes.get(V.SIZE),c=this.parameters,l=k(c),{scaleX:f,scaleY:p}=this._getScreenScale(e,e.screenToWorldRatio),u=Oe*e.screenToWorldRatio;for(let m=0;m<n.data.length/n.size;m++){const t=m*n.size,s=n.data[t],h=n.data[t+1],d=m*o.size;be[0]=o.data[d]*f,be[1]=o.data[d+1]*p;let g=0;c.textureIsSignedDistanceField&&(g=c.outlineSize*e.screenToWorldRatio/2),re(r,s,h,be,u,g,c,l)&&i(a.dist,a.normal,-1,!1)}}createBufferWriter(){return new Ie(this)}_updateScaleInfo(e,t,s){const r=this.parameters;null!=r.screenSizePerspective?z(s,t,r.screenSizePerspective,e.factor):(e.factor.scale=1,e.factor.factor=0,e.factor.minScaleFactor=0),null!=r.screenSizePerspectiveAlignment?z(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=te(t,s,i,ge);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&&p(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 p(a,t);const l=e(Math.abs(s.cosAngle),.01,1),u=1-Math.sqrt(1-l*l)/l/i.viewport[2];return f(a,t,c>0?u:1/u),a}_applyVerticalGroundOffsetView(e,t,s,r){const i=u(e),a=s.aboveGround?1:-1,n=s.computeRenderPixelSizeAtDist(i)*C,o=f(ae,t.normal,a*n);return h(r,e,o),r}_applyVerticalOffsetTransformationView(e,t,s,r){const i=this.parameters;if(!i.verticalOffset?.screenLength){if(i.screenSizePerspective||i.screenSizePerspectiveAlignment){const s=u(e);this._updateScaleInfo(r,s,t.cosAngle)}else r.factor.scale=1,r.factorAlignment.scale=1;return e}const a=u(e),n=i.screenSizePerspectiveAlignment??i.screenSizePerspective,o=Z(s,a,i.verticalOffset,t.cosAngle,n);return this._updateScaleInfo(r,a,t.cosAngle),f(t.normal,t.normal,o),h(e,e,t.normal)}_applyCenterOffsetView(e,t,s){const r="screen"!==this.parameters.centerOffsetUnits;return s!==e&&p(s,e),r&&(s[0]+=t[0],s[1]+=t[1],t[2]&&(c(ne,s),h(s,s,f(ne,ne,t[2])))),s}_applyCenterOffsetNDC(e,t,s,r){const i="screen"!==this.parameters.centerOffsetUnits;return r!==e&&p(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&&p(r,e),i){const e=s.aboveGround?1:-1,a=e*Math.sign(t[3]);r[2]-=(a||e)*i}return r}get visible(){return this._visible}set visible(e){this._visible=e}createGLMaterial(e){return new $(e)}calculateRelativeScreenBounds(e,t,s=E()){return ee(this.parameters,e,t,s),s[2]=s[0]+e[0],s[3]=s[1]+e[1],s}_getScreenScale(e,t){const s=e.attributes.get(V.FEATUREATTRIBUTE);if(null==s)return{scaleX:t,scaleY:t};const r=b(s.data,de);return _(he,this.parameters,r),{scaleX:he[0]*t,scaleY:he[1]*t}}}class $ extends D{constructor(e){super({...e,...e.material.parameters})}selectProgram(e){return this.ensureTechnique(J,e)}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.selectProgram(e)}}function ee(e,t,s,r){r[0]=e.anchorPosition[0]*-t[0]+e.screenOffset[0]*s,r[1]=e.anchorPosition[1]*-t[1]+e.screenOffset[1]*s}function te(e,s,r,i){return A(s)&&(s=t(pe,s)),d(i.normal,e,s),o(i.normal,i.normal,r.viewInverseTransposeMatrix),i.cosAngle=g(ce,Te),i}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),p=1/Math.sqrt(i*i+a*a+n*n),u=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*p,e[4]=a*p,e[5]=n*p,e[6]=o*u,e[7]=c*u,e[8]=l*u,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),p=f+r[1]+2*i;const u=n.distanceFieldBoundingBox;return n.textureIsSignedDistanceField&&null!=u&&(c+=r[0]*u[0],f+=r[1]*u[1],l-=r[0]*(1-u[2]),p-=r[1]*(1-u[3]),c-=a,l+=a,f-=a,p+=a),e[0]>c&&e[0]<l&&e[1]>f&&e[1]<p}const ie=new B,ae=S(),ne=S(),oe=T(),ce=S(),le=S(),fe=s(),pe=s(),ue=i(),me=S(),he=S(),de=T(),ge={normal:ce,cosAngle:0},Se=1,Oe=2,be=[0,0],Te=O(0,0,1);class ve extends j{constructor(){super(...arguments),this.renderOccluded=N.Occlude,this.isDecoration=!1,this.color=v(1,1,1,1),this.texCoordScale=[1,1],this.polygonOffset=!1,this.anchorPosition=a(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=v(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.draped=!1}}const Ae=x().vec3f(V.POSITION).vec3f(V.NORMAL).vec2f(V.UV0).vec4u8(V.COLOR).vec2f(V.SIZE).vec4f(V.CENTEROFFSETANDDISTANCE).vec4f(V.FEATUREATTRIBUTE),Ee=Ae.clone().vec4u8(V.OBJECTANDLAYERIDCOLOR);class Ie{constructor(e){this._material=e,this.vertexBufferLayout=has("enable-feature:objectAndLayerId-rendering")?Ee:Ae}elementCount(e){return 6*e.attributes.get(V.POSITION).indices.length}write(e,t,s,r,i){G(s.attributes.get(V.POSITION),e,r.position,i,6),q(s.attributes.get(V.NORMAL),t,r.normal,i,6);const a=s.attributes.get(V.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(V.POSITION).indices.length,p=i;const u=r.uv0;for(let g=0;g<f;++g)u.set(p,0,n),u.set(p,1,o),p++,u.set(p,0,c),u.set(p,1,o),p++,u.set(p,0,c),u.set(p,1,l),p++,u.set(p,0,c),u.set(p,1,l),p++,u.set(p,0,n),u.set(p,1,l),p++,u.set(p,0,n),u.set(p,1,o),p++;H(s.attributes.get(V.COLOR),4,r.color,i,6);const{data:m,indices:h}=s.attributes.get(V.SIZE);f=h.length;const d=r.size;p=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(p,0,e),d.set(p,1,t),p++}if(s.attributes.get(V.CENTEROFFSETANDDISTANCE)?W(s.attributes.get(V.CENTEROFFSETANDDISTANCE),r.centerOffsetAndDistance,i,6):X(r.centerOffsetAndDistance,i,6*f),s.attributes.get(V.FEATUREATTRIBUTE)?W(s.attributes.get(V.FEATUREATTRIBUTE),r.featureAttribute,i,6):X(r.featureAttribute,i,6*f),null!=s.objectAndLayerIdColor){const e=s.attributes.get(V.POSITION)?.indices;if(e){const t=e.length,a=r.getField(V.OBJECTANDLAYERIDCOLOR,I);Y(s.objectAndLayerIdColor,a,t,i,6)}}}}export{Q as HUDMaterial,ve 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.31/esri/copyright.txt for details.
4
4
  */
5
- import{BufferViewFloat as e}from"../../../../geometry/support/buffer/BufferView.js";import{isOIDorHighlight as t,isColor as r,ShaderOutput as s}from"../core/shaderLibrary/ShaderOutput.js";import{CullFaceOptions as a}from"../lib/basicInterfaces.js";import{GLTextureMaterial as i}from"../lib/GLTextureMaterial.js";import{MaterialParameters as n}from"../lib/Material.js";import{OITPolygonOffsetLimit as o}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as p}from"../lib/RenderSlot.js";import{assert as u}from"../lib/Util.js";import{VertexAttribute as c}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as l}from"./DefaultBufferWriter.js";import{PositionUVLayout as h}from"./DefaultLayouts.js";import{TriangleMaterial as m}from"./TriangleMaterial.js";import{writeBufferFloat as f,writeDefaultAttribute as d}from"./internal/bufferWriterUtils.js";import{vertexAttributeLocations as _,ImageMaterialTechniqueConfiguration as E,ImageMaterialTechnique as T}from"../shaders/ImageMaterialTechnique.js";class g extends m{constructor(e){super(e,new P),this.supportsEdges=!0,this.produces=new Map([[p.OPAQUE_MATERIAL,e=>t(e)||r(e)&&!this.parameters.transparent],[p.TRANSPARENT_MATERIAL,e=>r(e)&&this.parameters.transparent&&this.parameters.writeDepth],[p.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,e=>r(e)&&this.parameters.transparent&&!this.parameters.writeDepth],[p.DRAPED_MATERIAL,e=>r(e)||t(e)]]),this._vertexAttributeLocations=_,this._configuration=new E}getConfiguration(e,t){return this._configuration.output=e,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=t.transparencyPassType,this._configuration.enableOffset=t.camera.relativeElevation<o,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration.perspectiveInterpolation=this.parameters.perspectiveInterpolation,this._configuration}createGLMaterial(e){return new I(e)}createBufferWriter(){const e=h.clone();return this.parameters.perspectiveInterpolation&&e.f32(c.PERSPECTIVEDIVIDE),new b(e)}}class I extends i{constructor(e){super({...e,...e.material.parameters})}_updateParameters(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.ensureTechnique(T,e)}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&(this._material.setParameters({hasOccludees:e.hasOccludees}),this._updateParameters(e))}beginSlot(e){return this._output===s.Color&&this._updateOccludeeState(e),this._updateParameters(e)}}class b extends l{write(t,r,s,a,i){for(const n of this.vertexBufferLayout.fields.keys()){const o=s.attributes.get(n);if(o)if(n===c.PERSPECTIVEDIVIDE){u(1===o.size);const t=a.getField(n,e);t&&f(o,t,i)}else d(n,o,t,r,a,i)}}}class P extends n{constructor(){super(...arguments),this.transparent=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.cullFace=a.None,this.hasOccludees=!1,this.opacity=1,this.textureId=null,this.initTextureTransparent=!0,this.perspectiveInterpolation=!1}}export{g as ImageMaterial,P as Parameters};
5
+ import{BufferViewFloat as e}from"../../../../geometry/support/buffer/BufferView.js";import{isOIDorHighlight as t,isColor as r,ShaderOutput as s}from"../core/shaderLibrary/ShaderOutput.js";import{CullFaceOptions as a}from"../lib/basicInterfaces.js";import{GLTextureMaterial as i}from"../lib/GLTextureMaterial.js";import{MaterialParameters as n}from"../lib/Material.js";import{OITPolygonOffsetLimit as o}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as p}from"../lib/RenderSlot.js";import{assert as u}from"../lib/Util.js";import{VertexAttribute as c}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as l}from"./DefaultBufferWriter.js";import{PositionUVLayout as h}from"./DefaultLayouts.js";import{TriangleMaterial as m}from"./TriangleMaterial.js";import{writeBufferFloat as f,writeDefaultAttribute as d}from"./internal/bufferWriterUtils.js";import{ImageMaterialTechniqueConfiguration as _,vertexAttributeLocations as E,ImageMaterialTechnique as T}from"../shaders/ImageMaterialTechnique.js";class g extends m{constructor(e){super(e,new P),this._configuration=new _,this._vertexAttributeLocations=E,this.supportsEdges=!0,this.produces=new Map([[p.OPAQUE_MATERIAL,e=>t(e)||r(e)&&!this.parameters.transparent],[p.TRANSPARENT_MATERIAL,e=>r(e)&&this.parameters.transparent&&this.parameters.writeDepth],[p.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,e=>r(e)&&this.parameters.transparent&&!this.parameters.writeDepth],[p.DRAPED_MATERIAL,e=>r(e)||t(e)]])}getConfiguration(e,t){return this._configuration.output=e,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.enableOffset=t.camera.relativeElevation<o,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration.perspectiveInterpolation=this.parameters.perspectiveInterpolation,this._configuration}createGLMaterial(e){return new I(e)}createBufferWriter(){const e=h.clone();return this.parameters.perspectiveInterpolation&&e.f32(c.PERSPECTIVEDIVIDE),new b(e)}}class I extends i{constructor(e){super({...e,...e.material.parameters})}_updateParameters(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.ensureTechnique(T,e)}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&(this._material.setParameters({hasOccludees:e.hasOccludees}),this._updateParameters(e))}beginSlot(e){return this._output===s.Color&&this._updateOccludeeState(e),this._updateParameters(e)}}class b extends l{write(t,r,s,a,i){for(const n of this.vertexBufferLayout.fields.keys()){const o=s.attributes.get(n);if(o)if(n===c.PERSPECTIVEDIVIDE){u(1===o.size);const t=a.getField(n,e);t&&f(o,t,i)}else d(n,o,t,r,a,i)}}}class P extends n{constructor(){super(...arguments),this.transparent=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.cullFace=a.None,this.hasOccludees=!1,this.opacity=1,this.textureId=null,this.initTextureTransparent=!0,this.perspectiveInterpolation=!1}}export{g as ImageMaterial,P 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.31/esri/copyright.txt for details.
4
4
  */
5
- import{safeToString as e}from"../../../../core/string.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{newLayout as r}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as i}from"../core/shaderLibrary/ShaderOutput.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 l}from"../lib/VertexAttribute.js";import{writePosition as c,writeNormal as u,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.produces=new Map([[o.LINE_CALLOUTS,e=>e===i.Color],[o.LINE_CALLOUTS_HUD_DEPTH,e=>e===i.Color]]),this._configuration=new d,this._uniqueMaterialIdentifier=m.uniqueMaterialIdentifier(this.parameters)}passParameters(){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,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration}intersect(){}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({renderOccluded:t,isDecoration:r,horizontalScreenOffset:i,color:s,size:n,occlusionTest:a,shaderPolygonOffset:o,depthHUDAlignStart:l,centerOffsetUnits:c,hasSlicePlane:u,screenSizePerspective:f,verticalOffset:h,borderColor:d}){return e`${t}:${r}:${i}:[${s}]:${n}:${a}:${o}:${l}:${c}:${u}:${null!=f}:{${h.screenLength}:${h.minWorldLength}:${h.maxWorldLength}}:[${d}]`}}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=r().vec3f(l.POSITION).vec3f(l.NORMAL).vec2f(l.UV0).vec4f(l.CENTEROFFSETANDDISTANCE),S=[t(0,0),t(1,0),t(0,1),t(1,0),t(1,1),t(0,1)];class b{constructor(){this.vertexBufferLayout=O}elementCount(e){return 6*e.attributes.get(l.POSITION).indices.length}write(e,t,r,i,s){c(r.attributes.get(l.POSITION),e,i.position,s,6),u(r.attributes.get(l.NORMAL),t,i.normal,s,6),f(r.attributes.get(l.CENTEROFFSETANDDISTANCE),i.centerOffsetAndDistance,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{safeToString as e}from"../../../../core/string.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{newLayout as r}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as i}from"../core/shaderLibrary/ShaderOutput.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 l}from"../lib/VertexAttribute.js";import{writePosition as c,writeNormal as u,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.produces=new Map([[o.LINE_CALLOUTS,e=>e===i.Color],[o.LINE_CALLOUTS_HUD_DEPTH,e=>e===i.Color]]),this._uniqueMaterialIdentifier=m.uniqueMaterialIdentifier(this.parameters)}passParameters(){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,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration}intersect(){}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({renderOccluded:t,isDecoration:r,horizontalScreenOffset:i,color:s,size:n,occlusionTest:a,shaderPolygonOffset:o,depthHUDAlignStart:l,centerOffsetUnits:c,hasSlicePlane:u,screenSizePerspective:f,verticalOffset:h,borderColor:d}){return e`${t}:${r}:${i}:[${s}]:${n}:${a}:${o}:${l}:${c}:${u}:${null!=f}:{${h.screenLength}:${h.minWorldLength}:${h.maxWorldLength}}:[${d}]`}}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=r().vec3f(l.POSITION).vec3f(l.NORMAL).vec2f(l.UV0).vec4f(l.CENTEROFFSETANDDISTANCE),S=[t(0,0),t(1,0),t(0,1),t(1,0),t(1,1),t(0,1)];class b{constructor(){this.vertexBufferLayout=O}elementCount(e){return 6*e.attributes.get(l.POSITION).indices.length}write(e,t,r,i,s){c(r.attributes.get(l.POSITION),e,i.position,s,6),u(r.attributes.get(l.NORMAL),t,i.normal,s,6),f(r.attributes.get(l.CENTEROFFSETANDDISTANCE),i.centerOffsetAndDistance,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.31/esri/copyright.txt for details.
4
4
  */
5
- import{s as e,G as t,h as r}from"../../../../chunks/vec32.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newLayout as s}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as i,isColor as n,isDepth as o,isColorHighlightOrDepth as h}from"../core/shaderLibrary/ShaderOutput.js";import{GLTextureMaterial as c}from"../lib/GLTextureMaterial.js";import{Material as u,RenderOccludedFlag as l}from"../lib/Material.js";import{RenderSlot as p}from"../lib/RenderSlot.js";import{VertexAttribute as m}from"../lib/VertexAttribute.js";import{VisualVariablePassParameters as d}from"./VisualVariablePassParameters.js";import{vertexAttributeLocations as T,LineMarkerTechnique as _}from"../shaders/LineMarkerTechnique.js";import{LineMarkerTechniqueConfiguration as f,LineMarkerSpace as E,LineMarkerAnchor as A}from"../shaders/LineMarkerTechniqueConfiguration.js";import{CapType as v}from"../shaders/RibbonLineTechniqueConfiguration.js";class O extends u{constructor(e){super(e,new g),this.produces=new Map([[p.OPAQUE_MATERIAL,e=>e===i.Highlight||n(e)&&this.parameters.renderOccluded===l.OccludeAndTransparentStencil],[p.OPAQUE_NO_SSAO_DEPTH,e=>o(e)],[p.OCCLUDER_MATERIAL,e=>h(e)&&this.parameters.renderOccluded===l.OccludeAndTransparentStencil],[p.TRANSPARENT_OCCLUDER_MATERIAL,e=>h(e)&&this.parameters.renderOccluded===l.OccludeAndTransparentStencil],[p.TRANSPARENT_MATERIAL,e=>n(e)&&this.parameters.writeDepth],[p.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,e=>n(e)&&!this.parameters.writeDepth],[p.DRAPED_MATERIAL,e=>e===i.Color||e===i.Highlight]]),this._vertexAttributeLocations=T,this._configuration=new f,this._layout=this.createLayout()}getConfiguration(e,t){return this._configuration.output=e,this._configuration.space=t.slot===p.DRAPED_MATERIAL?E.Draped:this.parameters.worldSpace?E.World:E.Screen,this._configuration.hideOnShortSegments=this.parameters.hideOnShortSegments,this._configuration.hasCap=this.parameters.cap!==v.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===l.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(m.POSITION).vec3f(m.PREVPOSITION).vec2f(m.UV0);return this.parameters.worldSpace&&e.vec3f(m.NORMAL),this.parameters.vvSize?e.f32(m.SIZEFEATUREATTRIBUTE):e.f32(m.SIZE),this.parameters.vvColor?e.f32(m.COLORFEATUREATTRIBUTE):e.vec4f(m.COLOR),this.parameters.vvOpacity&&e.f32(m.OPACITYFEATUREATTRIBUTE),e}createBufferWriter(){return new R(this._layout,this.parameters)}createGLMaterial(e){return new S(e)}}class S extends c{constructor(){super(...arguments),this._markerPrimitive=null}dispose(){super.dispose(),this._markerTextures.release(this._markerPrimitive),this._markerPrimitive=null}_updateParameters(e){const t=this._material.parameters.markerPrimitive;return t!==this._markerPrimitive&&(this._material.setParameters({markerTexture:this._markerTextures.swap(t,this._markerPrimitive)}),this._markerPrimitive=t),this._material.setParameters(this.textureBindParameters),this.ensureTechnique(_,e)}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){return this._output===i.Color&&this._updateOccludeeState(e),this._updateParameters(e)}}class g extends d{constructor(){super(...arguments),this.width=0,this.color=[1,1,1,1],this.markerPrimitive="arrow",this.placement="end",this.cap=v.BUTT,this.anchor=A.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 R{constructor(e,t){this.vertexBufferLayout=e,this._parameters=t}elementCount(){return"begin-end"===this._parameters.placement?12:6}write(a,s,i,n,o){const h=i.attributes.get(m.POSITION).data,c=h.length/3;let u=[1,0,0];const l=i.attributes.get(m.NORMAL);this._parameters.worldSpace&&null!=l&&(u=l.data);let p=1,d=0;this._parameters.vvSize?d=i.attributes.get(m.SIZEFEATUREATTRIBUTE).data[0]:i.attributes.has(m.SIZE)&&(p=i.attributes.get(m.SIZE).data[0]);let T=[1,1,1,1],_=0;this._parameters.vvColor?_=i.attributes.get(m.COLORFEATUREATTRIBUTE).data[0]:i.attributes.has(m.COLOR)&&(T=i.attributes.get(m.COLOR).data);let f=0;this._parameters.vvOpacity&&(f=i.attributes.get(m.OPACITYFEATUREATTRIBUTE).data[0]);const E=new Float32Array(n.buffer);let A=o*(this.vertexBufferLayout.stride/4);const v=(e,t,r,a)=>{if(E[A++]=e[0],E[A++]=e[1],E[A++]=e[2],E[A++]=t[0],E[A++]=t[1],E[A++]=t[2],E[A++]=r[0],E[A++]=r[1],this._parameters.worldSpace&&(E[A++]=u[0],E[A++]=u[1],E[A++]=u[2]),this._parameters.vvSize?E[A++]=d:E[A++]=p,this._parameters.vvColor)E[A++]=_;else{const e=Math.min(4*a,T.length-4);E[A++]=T[e],E[A++]=T[e+1],E[A++]=T[e+2],E[A++]=T[e+3]}this._parameters.vvOpacity&&(E[A++]=f)};let O;!function(e){e[e.ASCENDING=1]="ASCENDING",e[e.DESCENDING=-1]="DESCENDING"}(O||(O={}));const S=(s,i)=>{const n=e(P,h[3*s],h[3*s+1],h[3*s+2]),o=I;let u=s+i;do{e(o,h[3*u],h[3*u+1],h[3*u+2]),u+=i}while(t(n,o)&&u>=0&&u<c);a&&(r(n,n,a),r(o,o,a)),v(n,o,[-1,-1],s),v(n,o,[1,-1],s),v(n,o,[1,1],s),v(n,o,[-1,-1],s),v(n,o,[1,1],s),v(n,o,[-1,1],s)},g=this._parameters.placement;"begin"!==g&&"begin-end"!==g||S(0,O.ASCENDING),"end"!==g&&"begin-end"!==g||S(c-1,O.DESCENDING)}}const P=a(),I=a();export{O as LineMarkerMaterial,g as Parameters};
5
+ import{s as e,G as t,h as r}from"../../../../chunks/vec32.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newLayout as s}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as i,isColor as n,isDepth as o,isColorHighlightOrDepth as h}from"../core/shaderLibrary/ShaderOutput.js";import{GLTextureMaterial as c}from"../lib/GLTextureMaterial.js";import{Material as u,RenderOccludedFlag as l}from"../lib/Material.js";import{RenderSlot as p}from"../lib/RenderSlot.js";import{VertexAttribute as m}from"../lib/VertexAttribute.js";import{VisualVariablePassParameters as d}from"./VisualVariablePassParameters.js";import{vertexAttributeLocations as T,LineMarkerTechnique as _}from"../shaders/LineMarkerTechnique.js";import{LineMarkerTechniqueConfiguration as f,LineMarkerSpace as E,LineMarkerAnchor as A}from"../shaders/LineMarkerTechniqueConfiguration.js";import{CapType as v}from"../shaders/RibbonLineTechniqueConfiguration.js";class O extends u{constructor(e){super(e,new g),this._configuration=new f,this._vertexAttributeLocations=T,this.produces=new Map([[p.OPAQUE_MATERIAL,e=>e===i.Highlight||n(e)&&this.parameters.renderOccluded===l.OccludeAndTransparentStencil],[p.OPAQUE_NO_SSAO_DEPTH,e=>o(e)],[p.OCCLUDER_MATERIAL,e=>h(e)&&this.parameters.renderOccluded===l.OccludeAndTransparentStencil],[p.TRANSPARENT_OCCLUDER_MATERIAL,e=>h(e)&&this.parameters.renderOccluded===l.OccludeAndTransparentStencil],[p.TRANSPARENT_MATERIAL,e=>n(e)&&this.parameters.writeDepth],[p.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,e=>n(e)&&!this.parameters.writeDepth],[p.DRAPED_MATERIAL,e=>e===i.Color||e===i.Highlight]]),this._layout=this.createLayout()}getConfiguration(e,t){return this._configuration.output=e,this._configuration.space=t.slot===p.DRAPED_MATERIAL?E.Draped:this.parameters.worldSpace?E.World:E.Screen,this._configuration.hideOnShortSegments=this.parameters.hideOnShortSegments,this._configuration.hasCap=this.parameters.cap!==v.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===l.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(m.POSITION).vec3f(m.PREVPOSITION).vec2f(m.UV0);return this.parameters.worldSpace&&e.vec3f(m.NORMAL),this.parameters.vvSize?e.f32(m.SIZEFEATUREATTRIBUTE):e.f32(m.SIZE),this.parameters.vvColor?e.f32(m.COLORFEATUREATTRIBUTE):e.vec4f(m.COLOR),this.parameters.vvOpacity&&e.f32(m.OPACITYFEATUREATTRIBUTE),e}createBufferWriter(){return new R(this._layout,this.parameters)}createGLMaterial(e){return new S(e)}}class S extends c{constructor(){super(...arguments),this._markerPrimitive=null}dispose(){super.dispose(),this._markerTextures.release(this._markerPrimitive),this._markerPrimitive=null}_updateParameters(e){const t=this._material.parameters.markerPrimitive;return t!==this._markerPrimitive&&(this._material.setParameters({markerTexture:this._markerTextures.swap(t,this._markerPrimitive)}),this._markerPrimitive=t),this._material.setParameters(this.textureBindParameters),this.ensureTechnique(_,e)}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){return this._output===i.Color&&this._updateOccludeeState(e),this._updateParameters(e)}}class g extends d{constructor(){super(...arguments),this.width=0,this.color=[1,1,1,1],this.markerPrimitive="arrow",this.placement="end",this.cap=v.BUTT,this.anchor=A.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 R{constructor(e,t){this.vertexBufferLayout=e,this._parameters=t}elementCount(){return"begin-end"===this._parameters.placement?12:6}write(a,s,i,n,o){const h=i.attributes.get(m.POSITION).data,c=h.length/3;let u=[1,0,0];const l=i.attributes.get(m.NORMAL);this._parameters.worldSpace&&null!=l&&(u=l.data);let p=1,d=0;this._parameters.vvSize?d=i.attributes.get(m.SIZEFEATUREATTRIBUTE).data[0]:i.attributes.has(m.SIZE)&&(p=i.attributes.get(m.SIZE).data[0]);let T=[1,1,1,1],_=0;this._parameters.vvColor?_=i.attributes.get(m.COLORFEATUREATTRIBUTE).data[0]:i.attributes.has(m.COLOR)&&(T=i.attributes.get(m.COLOR).data);let f=0;this._parameters.vvOpacity&&(f=i.attributes.get(m.OPACITYFEATUREATTRIBUTE).data[0]);const E=new Float32Array(n.buffer);let A=o*(this.vertexBufferLayout.stride/4);const v=(e,t,r,a)=>{if(E[A++]=e[0],E[A++]=e[1],E[A++]=e[2],E[A++]=t[0],E[A++]=t[1],E[A++]=t[2],E[A++]=r[0],E[A++]=r[1],this._parameters.worldSpace&&(E[A++]=u[0],E[A++]=u[1],E[A++]=u[2]),this._parameters.vvSize?E[A++]=d:E[A++]=p,this._parameters.vvColor)E[A++]=_;else{const e=Math.min(4*a,T.length-4);E[A++]=T[e],E[A++]=T[e+1],E[A++]=T[e+2],E[A++]=T[e+3]}this._parameters.vvOpacity&&(E[A++]=f)};let O;!function(e){e[e.ASCENDING=1]="ASCENDING",e[e.DESCENDING=-1]="DESCENDING"}(O||(O={}));const S=(s,i)=>{const n=e(P,h[3*s],h[3*s+1],h[3*s+2]),o=I;let u=s+i;do{e(o,h[3*u],h[3*u+1],h[3*u+2]),u+=i}while(t(n,o)&&u>=0&&u<c);a&&(r(n,n,a),r(o,o,a)),v(n,o,[-1,-1],s),v(n,o,[1,-1],s),v(n,o,[1,1],s),v(n,o,[-1,-1],s),v(n,o,[1,1],s),v(n,o,[-1,1],s)},g=this._parameters.placement;"begin"!==g&&"begin-end"!==g||S(0,O.ASCENDING),"end"!==g&&"begin-end"!==g||S(c-1,O.DESCENDING)}}const P=a(),I=a();export{O as LineMarkerMaterial,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.31/esri/copyright.txt for details.
4
4
  */
5
- import{s as t,n as e,f as r,b as s,p as o,h as i}from"../../../../chunks/vec32.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{newLayout as c}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as l}from"../core/shaderLibrary/ShaderOutput.js";import u from"../lib/GLMaterial.js";import{Material as p,MaterialParameters as f}from"../lib/Material.js";import{RenderSlot as h}from"../lib/RenderSlot.js";import{VertexAttribute as m}from"../lib/VertexAttribute.js";import{MeasurementArrowAttributeLocations as g,MeasurementArrowTechniqueConfiguration as d,MeasurementArrowTechnique as b}from"../shaders/MeasurementArrowTechnique.js";class O extends p{constructor(t){super(t,new A),this._vertexAttributeLocations=g,this.produces=new Map([[h.OPAQUE_MATERIAL,t=>!this._transparent&&t===l.Color],[h.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,t=>this._transparent&&t===l.Color]]),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(){}createGLMaterial(t){return new _(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 _ extends u{beginSlot(t){return this.ensureTechnique(b,t)}}class A extends f{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.LENGTH),L=n(),v=n(),E=n(),I=n(),M=n();class j{constructor(){this.vertexBufferLayout=T}elementCount(t){return 2*(t.attributes.get(m.POSITION).indices.length/2+1)}write(n,a,c,l,u){const{data:p,indices:f}=c.attributes.get(m.POSITION),h=c.attributes.get(m.NORMAL).data,g=p.length/3;f&&f.length!==2*(g-1)&&console.warn("MeasurementArrowMaterial does not support indices");const d=L,b=v,O=E,_=I,A=M,T=l.position,j=l.normal,w=l.uv0;let y=0;for(let m=0;m<g;++m){const c=3*m;if(t(d,p[c],p[c+1],p[c+2]),m<g-1){const o=3*(m+1);t(b,p[o],p[o+1],p[o+2]),t(A,h[o],h[o+1],h[o+2]),e(A,A),r(O,b,d),e(O,O),s(_,A,O),e(_,_)}const l=o(d,b);n&&a&&(i(d,d,n),i(b,b,n),i(_,_,a));const f=u+2*m,L=f+1;T.setVec(f,d),T.setVec(L,d),j.setVec(f,_),j.setVec(L,_),w.set(f,0,y),w.set(f,1,-1),w.set(L,0,y),w.set(L,1,1),m<g-1&&(y+=l)}const C=l.length;for(let t=0;t<2*g;++t)C.set(u+t,y)}}export{O as MeasurementArrowMaterial,A as Parameters};
5
+ import{s as t,n as e,f as r,b as s,p as o,h as i}from"../../../../chunks/vec32.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{newLayout as c}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as l}from"../core/shaderLibrary/ShaderOutput.js";import u from"../lib/GLMaterial.js";import{Material as p,MaterialParameters as f}from"../lib/Material.js";import{RenderSlot as h}from"../lib/RenderSlot.js";import{VertexAttribute as m}from"../lib/VertexAttribute.js";import{MeasurementArrowTechniqueConfiguration as g,MeasurementArrowAttributeLocations as d,MeasurementArrowTechnique as b}from"../shaders/MeasurementArrowTechnique.js";class O extends p{constructor(t){super(t,new A),this._configuration=new g,this._vertexAttributeLocations=d,this.produces=new Map([[h.OPAQUE_MATERIAL,t=>!this._transparent&&t===l.Color],[h.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,t=>this._transparent&&t===l.Color]])}getConfiguration(t,e){return this._configuration.polygonOffsetEnabled=this.parameters.polygonOffset,this._configuration.transparent=this._transparent,this._configuration.transparencyPassType=e.transparencyPassType,this._configuration}intersect(){}createGLMaterial(t){return new _(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 _ extends u{beginSlot(t){return this.ensureTechnique(b,t)}}class A extends f{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.LENGTH),L=n(),v=n(),E=n(),I=n(),M=n();class j{constructor(){this.vertexBufferLayout=T}elementCount(t){return 2*(t.attributes.get(m.POSITION).indices.length/2+1)}write(n,a,c,l,u){const{data:p,indices:f}=c.attributes.get(m.POSITION),h=c.attributes.get(m.NORMAL).data,g=p.length/3;f&&f.length!==2*(g-1)&&console.warn("MeasurementArrowMaterial does not support indices");const d=L,b=v,O=E,_=I,A=M,T=l.position,j=l.normal,w=l.uv0;let y=0;for(let m=0;m<g;++m){const c=3*m;if(t(d,p[c],p[c+1],p[c+2]),m<g-1){const o=3*(m+1);t(b,p[o],p[o+1],p[o+2]),t(A,h[o],h[o+1],h[o+2]),e(A,A),r(O,b,d),e(O,O),s(_,A,O),e(_,_)}const l=o(d,b);n&&a&&(i(d,d,n),i(b,b,n),i(_,_,a));const f=u+2*m,L=f+1;T.setVec(f,d),T.setVec(L,d),j.setVec(f,_),j.setVec(L,_),w.set(f,0,y),w.set(f,1,-1),w.set(L,0,y),w.set(L,1,1),m<g-1&&(y+=l)}const C=l.length;for(let t=0;t<2*g;++t)C.set(u+t,y)}}export{O as MeasurementArrowMaterial,A 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.31/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{copy as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{s as o,f as i,m as a,j as n,g as c,c as l,l as m,p as u}from"../../../../chunks/vec32.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as p}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{PlaneIndex as h}from"../../../../geometry/support/frustum.js";import{create as d,distance2 as g,fromPoints as j,closestLineSegmentPoint as b}from"../../../../geometry/support/lineSegment.js";import{create as S,fromPoints as O,signedDistance as _,getNormal as A}from"../../../../geometry/support/plane.js";import{ShaderOutput as L}from"../core/shaderLibrary/ShaderOutput.js";import x from"../lib/GLMaterial.js";import{Material as y,MaterialParameters as N}from"../lib/Material.js";import{RenderSlot as R}from"../lib/RenderSlot.js";import{isTranslationMatrix as E}from"../lib/Util.js";import{VertexAttribute as M}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as T}from"./DefaultBufferWriter.js";import{PositionColorLayout as v,PositionLayout as w}from"./DefaultLayouts.js";import{NativeLineTechnique as C}from"../shaders/NativeLineTechnique.js";import{NativeLineTechniqueConfiguration as P}from"../shaders/NativeLineTechniqueConfiguration.js";class V extends y{constructor(e){super(e,new U),this._configuration=new P,this.produces=new Map([[R.OPAQUE_MATERIAL,e=>e===L.Color||e===L.Highlight||e===L.ObjectAndLayerIdColor]])}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,p,d,S){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.attributes.get(M.POSITION).data,x=f.camera,y=Z;s(y,f.point);const N=2;o(z[0],y[0]-N,y[1]+N,0),o(z[1],y[0]+N,y[1]+N,0),o(z[2],y[0]+N,y[1]-N,0),o(z[3],y[0]-N,y[1]-N,0);for(let e=0;e<4;e++)if(!x.unprojectFromRenderScreen(z[e],J[e]))return;O(x.eye,J[0],J[1],K),O(x.eye,J[1],J[2],Y),O(x.eye,J[2],J[3],$),O(x.eye,J[3],J[0],ee);let R=Number.MAX_VALUE,T=0;for(let e=0;e<L.length-5;e+=3){if(q[0]=L[e]+r[12],q[1]=L[e+1]+r[13],q[2]=L[e+2]+r[14],B[0]=L[e+3]+r[12],B[1]=L[e+4]+r[13],B[2]=L[e+5]+r[14],_(K,q)<0&&_(K,B)<0||_(Y,q)<0&&_(Y,B)<0||_($,q)<0&&_($,B)<0||_(ee,q)<0&&_(ee,B)<0)continue;if(x.projectToRenderScreen(q,X),x.projectToRenderScreen(B,G),X[2]<0&&G[2]>0){i(D,q,B);const e=x.frustum,t=-_(e[h.NEAR],q)/a(D,A(e[h.NEAR]));n(D,D,t),c(q,q,D),x.projectToRenderScreen(q,X)}else if(X[2]>0&&G[2]<0){i(D,B,q);const e=x.frustum,t=-_(e[h.NEAR],B)/a(D,A(e[h.NEAR]));n(D,D,t),c(B,B,D),x.projectToRenderScreen(B,G)}else if(X[2]<0&&G[2]<0)continue;X[2]=0,G[2]=0;const t=g(j(X,G,H),y);t<R&&(R=t,l(k,q),l(F,B),T=e/3)}const v=f.rayBegin,w=f.rayEnd;if(R<N*N){let e=Number.MAX_VALUE;if(b(j(k,F,H),j(v,w,Q),W)){i(W,W,v);const t=m(W);n(W,W,1/t),e=t/u(v,w)}S(e,W,T,!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),l=c?c.data[0]:0,m=o[0],u=o[1],f=((l+1)/2+4)*e.screenToWorldRatio;let p=Number.MAX_VALUE,h=0;for(let d=0;d<n.length-5;d+=3){const e=n[d],r=n[d+1],s=m-e,o=u-r,i=n[d+3]-e,a=n[d+4]-r,c=t((i*s+a*o)/(i*i+a*a),0,1),l=i*c-s,f=a*c-o,g=l*l+f*f;g<p&&(p=g,h=d/3)}p<f*f&&i(a.dist,a.normal,h,!1)}createGLMaterial(e){return new I(e)}createBufferWriter(){const e=this.parameters.hasVertexColors?v:w;return new T(e)}}class I extends x{_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(C,e)}}class U extends N{constructor(){super(...arguments),this.color=p,this.hasVertexColors=!1,this.hasSlicePlane=!1,this.width=1,this.hasOccludees=!1}}const q=f(),B=f(),D=f(),W=f(),X=r(),G=r(),k=f(),F=f(),H=d(),Q=d(),Z=f(),z=[r(),r(),r(),r()],J=[f(),f(),f(),f()],K=S(),Y=S(),$=S(),ee=S();export{V 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{copy as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{s as o,f as i,m as a,j as n,g as c,c as m,l,p as u}from"../../../../chunks/vec32.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as p}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{PlaneIndex as h}from"../../../../geometry/support/frustum.js";import{create as d,distance2 as g,fromPoints as j,closestLineSegmentPoint as b}from"../../../../geometry/support/lineSegment.js";import{create as S,fromPoints as _,signedDistance as O,getNormal as A}from"../../../../geometry/support/plane.js";import{isColorHighlightOrOID as x,ShaderOutput as L}from"../core/shaderLibrary/ShaderOutput.js";import y from"../lib/GLMaterial.js";import{Material as N,MaterialParameters as R}from"../lib/Material.js";import{RenderSlot as E}from"../lib/RenderSlot.js";import{isTranslationMatrix as M}from"../lib/Util.js";import{VertexAttribute as T}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as v}from"./DefaultBufferWriter.js";import{PositionColorLayout as w,PositionLayout as P}from"./DefaultLayouts.js";import{NativeLineTechnique as V}from"../shaders/NativeLineTechnique.js";import{NativeLineTechniqueConfiguration as C}from"../shaders/NativeLineTechniqueConfiguration.js";class U extends N{constructor(e){super(e,new q),this._configuration=new C,this.produces=new Map([[E.OPAQUE_MATERIAL,e=>x(e)]])}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,p,d,S){if(!f.options.selectionMode||!t.visible)return;if(!M(r))return void e.getLogger("esri.views.3d.webgl-engine.materials.NativeLineMaterial").error("intersection assumes a translation-only matrix");const x=t.attributes.get(T.POSITION).data,L=f.camera,y=H;s(y,f.point);const N=2;o(J[0],y[0]-N,y[1]+N,0),o(J[1],y[0]+N,y[1]+N,0),o(J[2],y[0]+N,y[1]-N,0),o(J[3],y[0]-N,y[1]-N,0);for(let e=0;e<4;e++)if(!L.unprojectFromRenderScreen(J[e],K[e]))return;_(L.eye,K[0],K[1],Y),_(L.eye,K[1],K[2],$),_(L.eye,K[2],K[3],ee),_(L.eye,K[3],K[0],te);let R=Number.MAX_VALUE,E=0;for(let e=0;e<x.length-5;e+=3){if(B[0]=x[e]+r[12],B[1]=x[e+1]+r[13],B[2]=x[e+2]+r[14],D[0]=x[e+3]+r[12],D[1]=x[e+4]+r[13],D[2]=x[e+5]+r[14],O(Y,B)<0&&O(Y,D)<0||O($,B)<0&&O($,D)<0||O(ee,B)<0&&O(ee,D)<0||O(te,B)<0&&O(te,D)<0)continue;if(L.projectToRenderScreen(B,G),L.projectToRenderScreen(D,k),G[2]<0&&k[2]>0){i(W,B,D);const e=L.frustum,t=-O(e[h.NEAR],B)/a(W,A(e[h.NEAR]));n(W,W,t),c(B,B,W),L.projectToRenderScreen(B,G)}else if(G[2]>0&&k[2]<0){i(W,D,B);const e=L.frustum,t=-O(e[h.NEAR],D)/a(W,A(e[h.NEAR]));n(W,W,t),c(D,D,W),L.projectToRenderScreen(D,k)}else if(G[2]<0&&k[2]<0)continue;G[2]=0,k[2]=0;const t=g(j(G,k,Z),y);t<R&&(R=t,m(F,B),m(Q,D),E=e/3)}const v=f.rayBegin,w=f.rayEnd;if(R<N*N){let e=Number.MAX_VALUE;if(b(j(F,Q,Z),j(v,w,z),X)){i(X,X,v);const t=l(X);n(X,X,1/t),e=t/u(v,w)}S(e,X,E,!1)}}intersectDraped(e,r,s,o,i,a){if(!s.options.selectionMode)return;const n=e.attributes.get(T.POSITION).data,c=e.attributes.get(T.SIZE),m=c?c.data[0]:0,l=o[0],u=o[1],f=((m+1)/2+4)*e.screenToWorldRatio;let p=Number.MAX_VALUE,h=0;for(let d=0;d<n.length-5;d+=3){const e=n[d],r=n[d+1],s=l-e,o=u-r,i=n[d+3]-e,a=n[d+4]-r,c=t((i*s+a*o)/(i*i+a*a),0,1),m=i*c-s,f=a*c-o,g=m*m+f*f;g<p&&(p=g,h=d/3)}p<f*f&&i(a.dist,a.normal,h,!1)}createGLMaterial(e){return new I(e)}createBufferWriter(){const e=this.parameters.hasVertexColors?w:P;return new v(e)}}class I extends y{_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(V,e)}}class q extends R{constructor(){super(...arguments),this.color=p,this.hasVertexColors=!1,this.hasSlicePlane=!1,this.width=1,this.hasOccludees=!1}}const B=f(),D=f(),W=f(),X=f(),G=r(),k=r(),F=f(),Q=f(),Z=d(),z=d(),H=f(),J=[r(),r(),r(),r()],K=[f(),f(),f(),f()],Y=S(),$=S(),ee=S(),te=S();export{U as NativeLineMaterial,q as Parameters};