@arcgis/core 5.2.0-next.160 → 5.2.0-next.162

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 (152) hide show
  1. package/arcgisGlobal.d.ts +1 -0
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/{0a5a9885ee6f5b5f99f0.js → 167b057ad50e6aef54de.js} +1 -1
  4. package/assets/esri/core/workers/chunks/17c6d66b47aa690df0d4.js +1 -0
  5. package/assets/esri/core/workers/chunks/{15bcf7cfe603f2ee1a24.js → 28104681ba161967039f.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{842893e75696428d536f.js → 3b0808ee3c4facfaca3d.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{eebbde81e56d69dc602f.js → 44f90e75c1dc3d726a95.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{77ebacfdf8e57f2e03f1.js → 46c5371c7a627537098c.js} +11 -11
  9. package/assets/esri/core/workers/chunks/5daa9429808ca31279f2.js +1 -0
  10. package/assets/esri/core/workers/chunks/{60737732ce495bbdd0fc.js → 5f4feca26102088ea565.js} +1 -1
  11. package/assets/esri/core/workers/chunks/6da7229433105a69eb3f.js +1 -0
  12. package/assets/esri/core/workers/chunks/83f29a159b8b5197e76a.js +1 -0
  13. package/assets/esri/core/workers/chunks/849879c8aed16315194c.js +1 -0
  14. package/assets/esri/core/workers/chunks/{1d77c8c59b0118c7e77b.js → 85bba551057366cd00ae.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{9401cc22373566e1171e.js → 8a7b02037151767542f1.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{4eae066673484986d4c1.js → 8e4a7027d171fb60e51e.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{32b351b047ce1eb58146.js → 9ce8b9b80da146a5bbf5.js} +1 -1
  18. package/assets/esri/core/workers/chunks/a2fcbc494333376192aa.js +1 -0
  19. package/assets/esri/core/workers/chunks/a6f969851d4278865cc5.js +1 -0
  20. package/assets/esri/core/workers/chunks/{f1df76f098a3cc924832.js → b5df193c93e9c19f9700.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{28b74bc77f7c13080074.js → be97a629e2ae4d13ceb3.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{d33360c4f85203edafff.js → bf4d913e523eae2fda28.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{172cfeb5f415e4662432.js → d7429b58c90e015263ad.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{612104dff305ff062dfa.js → dfc81e66196c402f39b4.js} +2 -2
  25. package/assets/esri/core/workers/chunks/{02f8654852d389583891.js → e04fb83ab2634bc15cc7.js} +1 -1
  26. package/assets/esri/core/workers/chunks/f74ae0eff3f08978e607.js +1 -0
  27. package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +2 -5
  28. package/assets/esri/themes/dark/main.css +1 -1
  29. package/assets/esri/themes/light/main.css +1 -1
  30. package/assets/esri/themes/light/view.css +1 -1
  31. package/chunks/DefaultMaterial.glsl.js +1 -1
  32. package/chunks/RealisticTree.glsl.js +1 -1
  33. package/chunks/RibbonLine.glsl.js +125 -133
  34. package/config.d.ts +62 -34
  35. package/config.js +1 -1
  36. package/core/has.js +1 -1
  37. package/core/mapCollectionUtils.js +1 -1
  38. package/core/workers/Connection.d.ts +58 -89
  39. package/core/workers.d.ts +45 -54
  40. package/geometry/support/Indices.js +1 -1
  41. package/geometry/support/aaBoundingRect.js +1 -1
  42. package/geometry/support/ray.js +1 -1
  43. package/kernel.js +1 -1
  44. package/layers/FeatureLayer.d.ts +7 -5
  45. package/layers/FeatureLayer.js +1 -1
  46. package/layers/GeospatialPDFLayer.js +1 -1
  47. package/layers/MapImageLayer.d.ts +9 -3
  48. package/layers/MapNotesLayer.d.ts +2 -2
  49. package/layers/SubtypeGroupLayer.d.ts +1 -1
  50. package/layers/SubtypeGroupLayer.js +1 -1
  51. package/layers/geospatialPDF/GeospatialPDFLayerWorker.js +1 -1
  52. package/layers/graphics/sources/FeatureLayerSource.js +1 -1
  53. package/layers/graphics/sources/support/QueryTask.js +1 -1
  54. package/layers/knowledgeGraph/KnowledgeGraphSublayer.d.ts +16 -16
  55. package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
  56. package/layers/mixins/ArcGISMapService.js +1 -1
  57. package/layers/ogc/ogcFeatureUtils.js +1 -1
  58. package/layers/support/Sublayer.d.ts +29 -15
  59. package/layers/support/Sublayer.js +1 -1
  60. package/layers/support/commonProperties.js +1 -1
  61. package/package.json +2 -2
  62. package/rest/layerSources/DynamicDataLayer.d.ts +4 -2
  63. package/rest/layerSources/DynamicDataLayer.js +1 -1
  64. package/rest/layerSources/DynamicMapLayer.d.ts +1 -1
  65. package/rest/layerSources/DynamicWorkspaceLayer.d.ts +45 -0
  66. package/rest/layerSources/DynamicWorkspaceLayer.js +2 -0
  67. package/rest/layerSources/typeUtils.js +2 -0
  68. package/rest/print.js +1 -1
  69. package/rest/query/operations/queryRelatedRecords.js +1 -1
  70. package/rest/query/operations/queryUtils.js +1 -1
  71. package/rest/support/Query.js +1 -1
  72. package/rest/support/RelationshipQuery.js +1 -1
  73. package/symbols/LineSymbol3D.d.ts +5 -3
  74. package/views/2d/analysis/ElevationProfileAnalysisView2D.d.ts +6 -0
  75. package/views/2d/analysis/ElevationProfileAnalysisView2D.js +1 -1
  76. package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
  77. package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +1 -1
  78. package/views/3d/analysis/Dimension/DimensionVisualization.js +1 -1
  79. package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
  80. package/views/3d/analysis/Dimension/lengthDimensionManipulatorUtils.js +1 -1
  81. package/views/3d/analysis/ElevationProfileAnalysisView3D.d.ts +6 -0
  82. package/views/3d/analysis/ElevationProfileAnalysisView3D.js +1 -1
  83. package/views/3d/analysis/LineOfSight/LineOfSightIntersectionResult.js +1 -1
  84. package/views/3d/analysis/LineOfSight/LineOfSightObserverPlugin.js +1 -1
  85. package/views/3d/analysis/LineOfSight/LineOfSightTargetPlugin.js +1 -1
  86. package/views/3d/analysis/Viewshed/ViewshedFieldOfViewManipulation.js +1 -1
  87. package/views/3d/analysis/Viewshed/ViewshedPlacementPointPlugin.js +1 -1
  88. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  89. package/views/3d/input/SceneInputManager.js +1 -1
  90. package/views/3d/input/handlers/DragZoom.js +1 -1
  91. package/views/3d/input/handlers/MouseWheelFov.js +1 -1
  92. package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
  93. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  94. package/views/3d/interactive/manipulators/ResizeManipulator.js +1 -1
  95. package/views/3d/interactive/manipulators/RotateManipulator.js +1 -1
  96. package/views/3d/interactive/manipulators/ShiftManipulator.js +1 -1
  97. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  98. package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
  99. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  100. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  101. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  102. package/views/3d/layers/FlowSubView3D.js +1 -1
  103. package/views/3d/layers/I3SMeshView3D.js +1 -1
  104. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  105. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  106. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  107. package/views/3d/layers/graphics/extrudePolygon.js +1 -1
  108. package/views/3d/layers/graphics/tessellationUtils.js +1 -1
  109. package/views/3d/state/controllers/FovController.js +1 -1
  110. package/views/3d/state/controllers/GroundNavigationController.js +1 -1
  111. package/views/3d/state/controllers/momentum/GroundNavigationMomentumController.js +1 -1
  112. package/views/3d/state/utils/OffsetCorrectionController.js +1 -1
  113. package/views/3d/support/elevationUpdateUtils.js +1 -1
  114. package/views/3d/terrain/PatchRenderData.js +1 -1
  115. package/views/3d/terrain/TerrainData.js +1 -1
  116. package/views/3d/terrain/TextureReference.js +1 -1
  117. package/views/3d/terrain/terrainUtils.js +1 -1
  118. package/views/3d/webgl-engine/collections/Component/Material/ComponentData.glsl.js +2 -2
  119. package/views/3d/webgl-engine/core/shaderLibrary/attributes/SymbolColor.glsl.js +3 -3
  120. package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialExternalColor.glsl.js +2 -2
  121. package/views/3d/webgl-engine/core/shaderLibrary/output/getEmissions.glsl.js +2 -2
  122. package/views/3d/webgl-engine/lib/GridLocalOriginFactory.js +1 -1
  123. package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
  124. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  125. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  126. package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
  127. package/views/BreakpointsOwner.d.ts +6 -0
  128. package/views/SceneView.js +1 -1
  129. package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
  130. package/views/interactive/editGeometry/EditGeometry.js +1 -1
  131. package/views/interactive/editGeometry/operations/RotateVertex.js +1 -1
  132. package/views/interactive/editGeometry/operations/ScaleVertex.js +1 -1
  133. package/views/interactive/editGeometry/operations/SetAllVertexPositions.js +1 -1
  134. package/views/interactive/snapping/FeatureSnappingEngine.js +1 -1
  135. package/views/types.d.ts +3 -0
  136. package/views/webgl/ShaderBuilder.js +1 -1
  137. package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
  138. package/widgets/Search/LocatorSearchSource.d.ts +22 -1
  139. package/widgets/support/SelectionList/GroupLayerItem.d.ts +2 -0
  140. package/widgets/support/SelectionList/GroupLayerItem.js +1 -1
  141. package/widgets/support/SelectionList/ItemBase.d.ts +2 -0
  142. package/widgets/support/SelectionList/ItemBase.js +1 -1
  143. package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
  144. package/widgets/support/SelectionList.js +1 -1
  145. package/assets/esri/core/workers/chunks/3e3e076fa5e8d5d5f33f.js +0 -1
  146. package/assets/esri/core/workers/chunks/510502a4c9a2ba8d3f7b.js +0 -1
  147. package/assets/esri/core/workers/chunks/7d212c415f2709037408.js +0 -1
  148. package/assets/esri/core/workers/chunks/abb9e820d2871fa7acae.js +0 -1
  149. package/assets/esri/core/workers/chunks/ade5fdcd08dcbac74740.js +0 -1
  150. package/assets/esri/core/workers/chunks/b390b9cde2884755e8be.js +0 -1
  151. package/assets/esri/core/workers/chunks/e8bf653376a607f00897.js +0 -1
  152. package/assets/esri/core/workers/chunks/f4a7aa3cdbc0c429c359.js +0 -1
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{pt2px as e}from"../../../../core/screenUtils.js";import{ZEROS as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromBuffer as n,intersectsClippingArea as r,empty as i,expandWithAABB as a,create as o}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as s,doubleSubArray as c}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as l}from"../../../../geometry/support/FloatArray.js";import{getContinuousIndexArray as u}from"../../../../geometry/support/Indices.js";import{isDrivenOpacityFallbackAlwaysOpaque as d}from"../../../../renderers/visualVariables/support/visualVariableUtils.js";import{elevationModeChangeUpdateType as f,needsElevationUpdates2D as p}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as m}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as h}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as g}from"./Graphics3DSymbolLayer.js";import{mixinColorAndOpacity as _}from"./graphicUtils.js";import{parseCapType as v,computeSymbolLayerIndex as y}from"./lineUtils.js";import{geometryAsPolygon as b,createColorGeometry as x,PolygonCreationDataBase as S}from"./polygonUtils.js";import{initFastSymbolUpdatesState as C,updateFastSymbolUpdatesState as w,getAttributeValue as T,ConvertOptions as E}from"../support/FastSymbolUpdates.js";import{createMaterial as D,uvElevationAligner as O}from"../support/patternUtils.js";import{writeMapSpaceUVCoordsPerConnectedPart as k,writeMapSpaceUVCoordsDraped as A}from"../support/uvUtils.js";import{createGeometry as j}from"../../support/engineContent/line.js";import{loadTessellationUtils as M,preloadedPolygonToRenderInfoElevationAligned as N,preloadedPolygonToRenderInfoDraped as P}from"../../support/renderInfoUtils/polygon.js";import{Object3D as F}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as I}from"../../webgl-engine/lib/RenderGeometry.js";import{isScreenSizePerspectiveEnabled as L}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{getStipplePatternForLinePattern as R}from"../../webgl-engine/materials/lineStippleUtils.js";import{PatternMaterial as z}from"../../webgl-engine/materials/PatternMaterial.js";import{RibbonLineMaterial as B}from"../../webgl-engine/materials/RibbonLineMaterial.js";const V=[`polyline`,`polygon`,`extent`];class H extends g{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,n,r){super(e,t,n,r,d(t)),this._needsUV=!1,this._materials=[]}async doLoad(){this._fastUpdates=C(this._context.renderer,this._vvConvertOptions),await M()}get _materialColor(){return this.symbolLayer.material?.color}get _emissiveStrength(){let e=this.symbolLayer.material?.emissive;return(e?.source===`color`?e?.strength:void 0)??0}_createMaterials(){if(this._materials.length>0)return;let{_materialColor:t,draped:n}=this,r=this._getCombinedOpacityAndColor(t);this._materials[0]=D(this.symbolLayer,{color:r,forceTransparentMode:this.needsDrivenTransparentPass,hasVertexColors:this._drivenProperties.color||this._drivenProperties.opacity,draped:n,hasSlicePlane:this._context.slicePlaneEnabled,emissiveStrength:this._emissiveStrength,...this._fastUpdates?.materialParameters}),this._needsUV=this._materials[0]instanceof z;let i=this.symbolLayer.outline;if(K(i)){let t=R(i.pattern),n=v(i.pattern?i.patternCap||`butt`:`square`);this._materials[1]=new B({width:e(i.size),color:this._getOutlineColor(),polygonOffset:3,polygonOffsetIndex:y(this._renderPriority,this._renderPriorityStep),hasSlicePlane:this._context.slicePlaneEnabled,isClosed:!0,stipplePattern:t,cap:n,screenSizePerspective:this._outlineScreenSizePerspective},this.view.state.isGlobal)}}get _outlineScreenSizePerspective(){return!this.draped&&L(this._context.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}createGraphics3DGraphic(e){let t=e.graphic;if(!this._validateGeometry(t.geometry,V,this.symbolLayer.type))return null;let n=this._getDrivenUInt8Color(e.renderingInfo,this._materialColor,!1),r=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus(r.mode===`on-the-ground`),this._createMaterials(),this.draped?this._createAsOverlay(e.renderingInfo,t,n):this._createAs3DShape(e.renderingInfo,t,n,r)}applyRendererDiff(e,t){for(let n in e.diff)switch(n){case`visualVariables`:if(w(this._fastUpdates,t,this._vvConvertOptions))this._materials[0]?.setParameters(this._fastUpdates.materialParameters);else return 0;break;default:return 0}return 2}layerOpacityChanged(){if(this._materials[0]!=null){let e=this._materials[0].parameters.color,t=this._materialColor,n=this._getCombinedOpacity(t);this._materials[0].setParameters({color:[e[0],e[1],e[2],n],forceTransparentMode:this.needsDrivenTransparentPass})}if(this._materials[1]!=null){let e=this._materials[1].parameters.color;this._materials[1].setParameters({color:[e[0],e[1],e[2],this._getOutlineOpacity()]})}}layerScreenSizePerspectiveChanged(){this._materials[1]?.setParameters({screenSizePerspective:this._outlineScreenSizePerspective})}layerElevationInfoChanged(e,t,n){let r=this._elevationContext.mode,i=f(H.elevationModeChangeTypes,n,r);if(i!==1)return i;let a=p(r);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>a)}slicePlaneEnabledChanged(){if(this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[1]){let e={hasSlicePlane:this._context.slicePlaneEnabled};this._materials[1].setParameters(e)}return!0}physicalBasedRenderingChanged(){return!0}_containsRenderableGeometry(e){return e.polygonIndexCount>0?!0:this._materials[1]==null?!1:e.outline.output===`vertex-data`?e.outline.outlines.length>0:e.outlineIndexCount>0}_createAs3DShape(e,t,n,r){let i=b(t.geometry);if(!i)return null;let a=N(i,this._context.elevationProvider,this._context.renderCoordsHelper,r,{projectIfNearlyVertical:!0,outlineOutput:`vertex-data`,owner:this._context.layer});if(a==null)return null;let o=new W(a,n,this._context.layerViewUid,t.uid),d=o.renderData.vertexCount;if(this._needsUV){o.uvMapSpace=l(d*4,!0),o.textureElementIndices=Array(d),o.boundingRect=s(9*(o.renderData.polygonIndices.length/3));let e=k(o.uvMapSpace,o.boundingRect,o.textureElementIndices,o.renderData.positions,o.renderData.polygonIndices,this._context.renderCoordsHelper);o.boundingRect=c(o.boundingRect,0,9*e),o.boundingRectIndices=u(e)}if(o.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(o),this._createAs3DShapeFill(e,o),this._materials[1]&&this._createAs3DShapeOutline(o),this._logGeometryCreationWarnings(o.renderData,i.rings,`rings`,`FillSymbol3DLayer`),o.outGeometries.length===0)return null;let f=new F({geometries:o.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:t.uid}),m=new h(this,f,null,O,r);return m.alignedSampledElevation=o.renderData.sampledElevation,m.needsElevationUpdates=p(r.mode),m}_createAs3DShapeFill(e,t){let{mapPositions:i,positions:a,polygonIndices:o,polygonIndexCount:s}=t.renderData;if(s===0||this._context.clippingExtent!=null&&(n(i,U),!r(U,this._context.clippingExtent)))return;let c=this._fastUpdates?.visualVariables.color,l=x({material:this._materials[0],indices:o,mapPositions:i,attributeData:{position:a,color:c?null:t.color,colorFeature:c?T(c,e.color):null,uvMapSpace:this._needsUV?t.uvMapSpace:null,boundingRect:this._needsUV?t.boundingRect:null,textureElementIndices:this._needsUV?t.textureElementIndices:null,boundingRectIndices:this._needsUV?t.boundingRectIndices:null,olidColor:t.olidColor}});t.outGeometries.push(l)}_createAs3DShapeOutline(e){if(this._materials[1]==null)return;let{outline:t}=e.renderData;if(t.output!==`vertex-data`)return;let{outlines:i}=t;if(i!=null&&i.length!==0)for(let{mapPositions:t,position:a}of i){if(this._context.clippingExtent!=null&&(n(t,U),!r(U,this._context.clippingExtent)))continue;let i=j(this._materials[1],{overlayInfo:null,removeDuplicateStartEnd:!0,mapPositions:t,attributeData:{position:a}},e.olidColor);e.outGeometries.push(i)}}_createAsOverlay(e,t,n){let r=b(t.geometry);if(r==null)return null;this._materials[0].renderPriority=this._renderPriority+this._renderPriorityStep/2,this._materials[1]!=null&&(this._materials[1].renderPriority=this._renderPriority);let a=P(r,{drapedSpatialReference:this._context.overlaySR,outlineOutput:`vertex-data`,owner:this._context.layer});if(a==null)return null;let o=new G(a,n,this._context.layerViewUid,t.uid);return this._needsUV&&(o.uvMapSpace=l(o.renderData.vertexCount*4,!0),A(o.uvMapSpace,o.renderData.positions,this._context.overlaySR,this._context.graphicsCoreOwner.view.state.viewingMode)),o.outBoundingBox=i(),o.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(o),this._createAsOverlayFill(e,o),this._materials[1]&&this._createAsOverlayOutline(o),this._logGeometryCreationWarnings(o.renderData,r.rings,`rings`,`FillSymbol3DLayer`),new m(this,o.outGeometries,o.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayFill(e,t){let{positions:i,polygonIndices:o,polygonIndexCount:s}=t.renderData;if(s===0)return;let c=n(i,U);if(!r(c,this._context.clippingExtent))return;a(t.outBoundingBox,c);let l=this._fastUpdates?.visualVariables.color,u=x({material:this._materials[0],indices:o,attributeData:{position:i,color:l?null:t.color,colorFeature:l?T(l,e.color):null,uvMapSpace:this._needsUV?t.uvMapSpace:null,olidColor:t.olidColor}});t.outGeometries.push(new I(u,t))}_createAsOverlayOutline(e){if(this._materials[1]==null)return;let{outline:t}=e.renderData;if(t.output!==`vertex-data`)return;let{outlines:i}=t;for(let{position:t}of i){if(n(t,U),!r(U,this._context.clippingExtent))continue;a(e.outBoundingBox,U);let i=j(this._materials[1],{overlayInfo:{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper},removeDuplicateStartEnd:!0,attributeData:{position:t}},e.olidColor);e.outGeometries.push(new I(i,e))}}_getOutlineOpacity(){let e=this.symbolLayer?.outline?.color;return(this.draped?1:this._getLayerOpacity())*(e==null?0:e.a)}_getOutlineColor(){let e=this.symbolLayer?.outline?.color,t=this._getOutlineOpacity();return _(e?.toUnitRGB(),t)}test(){return{...super.test(),createAsOverlay:(e,t,n)=>this._createAsOverlay(e,t,n),createAs3DShape:(e,t,n,r)=>this._createAs3DShape(e,t,n,r)}}get _vvConvertOptions(){return new E({supports:{size:!1,color:!0,rotation:!1,opacity:!1},fallbackColor:this._materialColor?.toUnitRGBA()??t})}}const U=o();class W extends S{constructor(e,t,n,r){super(e,n,r),this.color=t}}class G extends S{constructor(e,t,n,r){super(e,n,r),this.color=t}}function K(e){return e?.size!=null&&e.size>0&&e.color!=null&&(e.pattern==null||e.pattern.type!==`style`||e.pattern.style!==`none`)}export{H as Graphics3DPolygonFillSymbolLayer};
2
+ import{pt2px as e}from"../../../../core/screenUtils.js";import{ZEROS as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromBuffer as n,intersectsClippingArea as r,empty as i,expandWithAABB as a,create as o}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as s,doubleSubArray as c}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as l}from"../../../../geometry/support/FloatArray.js";import{getContinuousIndexArray as u}from"../../../../geometry/support/Indices.js";import{isDrivenOpacityFallbackAlwaysOpaque as d}from"../../../../renderers/visualVariables/support/visualVariableUtils.js";import{elevationModeChangeUpdateType as f,needsElevationUpdates2D as p}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as m}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as h}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as g}from"./Graphics3DSymbolLayer.js";import{mixinColorAndOpacity as _}from"./graphicUtils.js";import{parseCapType as v,computeSymbolLayerIndex as y}from"./lineUtils.js";import{geometryAsPolygon as b,createColorGeometry as x,PolygonCreationDataBase as S}from"./polygonUtils.js";import{initFastSymbolUpdatesState as C,updateFastSymbolUpdatesState as w,getAttributeValue as T,ConvertOptions as E}from"../support/FastSymbolUpdates.js";import{createMaterial as D,uvElevationAligner as O}from"../support/patternUtils.js";import{writeMapSpaceUVCoordsPerConnectedPart as k,writeMapSpaceUVCoordsDraped as A}from"../support/uvUtils.js";import{createGeometry as j}from"../../support/engineContent/line.js";import{loadTessellationUtils as M,preloadedPolygonToRenderInfoElevationAligned as N,preloadedPolygonToRenderInfoDraped as P}from"../../support/renderInfoUtils/polygon.js";import{Object3D as F}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as I}from"../../webgl-engine/lib/RenderGeometry.js";import{isScreenSizePerspectiveEnabled as L}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{getStipplePatternForLinePattern as R}from"../../webgl-engine/materials/lineStippleUtils.js";import{PatternMaterial as z}from"../../webgl-engine/materials/PatternMaterial.js";import{RibbonLineMaterial as B}from"../../webgl-engine/materials/RibbonLineMaterial.js";const V=[`polyline`,`polygon`,`extent`];class H extends g{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,n,r){super(e,t,n,r,d(t)),this._needsUV=!1,this._materials=[]}async doLoad(){this._fastUpdates=C(this._context.renderer,this._vvConvertOptions),await M()}get _materialColor(){return this.symbolLayer.material?.color}get _emissiveStrength(){let e=this.symbolLayer.material?.emissive;return(e?.source===`color`?e?.strength:void 0)??0}_createMaterials(){if(this._materials.length>0)return;let{_materialColor:t,draped:n}=this,r=this._getCombinedOpacityAndColor(t);this._materials[0]=D(this.symbolLayer,{color:r,forceTransparentMode:this.needsDrivenTransparentPass,hasVertexColors:this._drivenProperties.color||this._drivenProperties.opacity,draped:n,hasSlicePlane:this._context.slicePlaneEnabled,emissiveStrength:this._emissiveStrength,...this._fastUpdates?.materialParameters}),this._needsUV=this._materials[0]instanceof z;let i=this.symbolLayer.outline;if(K(i)){let t=R(i.pattern),n=v(i.pattern?i.patternCap||`butt`:`square`);this._materials[1]=new B({width:e(i.size),color:this._getOutlineColor(),polygonOffset:3,polygonOffsetIndex:y(this._renderPriority,this._renderPriorityStep),hasSlicePlane:this._context.slicePlaneEnabled,isClosed:!0,stipplePattern:t,cap:n,screenSizePerspective:this._outlineScreenSizePerspective},this.view)}}get _outlineScreenSizePerspective(){return!this.draped&&L(this._context.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}createGraphics3DGraphic(e){let t=e.graphic;if(!this._validateGeometry(t.geometry,V,this.symbolLayer.type))return null;let n=this._getDrivenUInt8Color(e.renderingInfo,this._materialColor,!1),r=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus(r.mode===`on-the-ground`),this._createMaterials(),this.draped?this._createAsOverlay(e.renderingInfo,t,n):this._createAs3DShape(e.renderingInfo,t,n,r)}applyRendererDiff(e,t){for(let n in e.diff)switch(n){case`visualVariables`:if(w(this._fastUpdates,t,this._vvConvertOptions))this._materials[0]?.setParameters(this._fastUpdates.materialParameters);else return 0;break;default:return 0}return 2}layerOpacityChanged(){if(this._materials[0]!=null){let e=this._materials[0].parameters.color,t=this._materialColor,n=this._getCombinedOpacity(t);this._materials[0].setParameters({color:[e[0],e[1],e[2],n],forceTransparentMode:this.needsDrivenTransparentPass})}if(this._materials[1]!=null){let e=this._materials[1].parameters.color;this._materials[1].setParameters({color:[e[0],e[1],e[2],this._getOutlineOpacity()]})}}layerScreenSizePerspectiveChanged(){this._materials[1]?.setParameters({screenSizePerspective:this._outlineScreenSizePerspective})}layerElevationInfoChanged(e,t,n){let r=this._elevationContext.mode,i=f(H.elevationModeChangeTypes,n,r);if(i!==1)return i;let a=p(r);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>a)}slicePlaneEnabledChanged(){if(this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[1]){let e={hasSlicePlane:this._context.slicePlaneEnabled};this._materials[1].setParameters(e)}return!0}physicalBasedRenderingChanged(){return!0}_containsRenderableGeometry(e){return e.polygonIndexCount>0?!0:this._materials[1]==null?!1:e.outline.output===`vertex-data`?e.outline.outlines.length>0:e.outlineIndexCount>0}_createAs3DShape(e,t,n,r){let i=b(t.geometry);if(!i)return null;let a=N(i,this._context.elevationProvider,this._context.renderCoordsHelper,r,{projectIfNearlyVertical:!0,outlineOutput:`vertex-data`,owner:this._context.layer});if(a==null)return null;let o=new W(a,n,this._context.layerViewUid,t.uid),d=o.renderData.vertexCount;if(this._needsUV){o.uvMapSpace=l(d*4,!0),o.textureElementIndices=Array(d),o.boundingRect=s(9*(o.renderData.polygonIndices.length/3));let e=k(o.uvMapSpace,o.boundingRect,o.textureElementIndices,o.renderData.positions,o.renderData.polygonIndices,this._context.renderCoordsHelper);o.boundingRect=c(o.boundingRect,0,9*e),o.boundingRectIndices=u(e)}if(o.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(o),this._createAs3DShapeFill(e,o),this._materials[1]&&this._createAs3DShapeOutline(o),this._logGeometryCreationWarnings(o.renderData,i.rings,`rings`,`FillSymbol3DLayer`),o.outGeometries.length===0)return null;let f=new F({geometries:o.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:t.uid}),m=new h(this,f,null,O,r);return m.alignedSampledElevation=o.renderData.sampledElevation,m.needsElevationUpdates=p(r.mode),m}_createAs3DShapeFill(e,t){let{mapPositions:i,positions:a,polygonIndices:o,polygonIndexCount:s}=t.renderData;if(s===0||this._context.clippingExtent!=null&&(n(i,U),!r(U,this._context.clippingExtent)))return;let c=this._fastUpdates?.visualVariables.color,l=x({material:this._materials[0],indices:o,mapPositions:i,attributeData:{position:a,color:c?null:t.color,colorFeature:c?T(c,e.color):null,uvMapSpace:this._needsUV?t.uvMapSpace:null,boundingRect:this._needsUV?t.boundingRect:null,textureElementIndices:this._needsUV?t.textureElementIndices:null,boundingRectIndices:this._needsUV?t.boundingRectIndices:null,olidColor:t.olidColor}});t.outGeometries.push(l)}_createAs3DShapeOutline(e){if(this._materials[1]==null)return;let{outline:t}=e.renderData;if(t.output!==`vertex-data`)return;let{outlines:i}=t;if(i!=null&&i.length!==0)for(let{mapPositions:t,position:a}of i){if(this._context.clippingExtent!=null&&(n(t,U),!r(U,this._context.clippingExtent)))continue;let i=j(this._materials[1],{overlayInfo:null,removeDuplicateStartEnd:!0,mapPositions:t,attributeData:{position:a}},e.olidColor);e.outGeometries.push(i)}}_createAsOverlay(e,t,n){let r=b(t.geometry);if(r==null)return null;this._materials[0].renderPriority=this._renderPriority+this._renderPriorityStep/2,this._materials[1]!=null&&(this._materials[1].renderPriority=this._renderPriority);let a=P(r,{drapedSpatialReference:this._context.overlaySR,outlineOutput:`vertex-data`,owner:this._context.layer});if(a==null)return null;let o=new G(a,n,this._context.layerViewUid,t.uid);return this._needsUV&&(o.uvMapSpace=l(o.renderData.vertexCount*4,!0),A(o.uvMapSpace,o.renderData.positions,this._context.overlaySR,this._context.graphicsCoreOwner.view.state.viewingMode)),o.outBoundingBox=i(),o.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(o),this._createAsOverlayFill(e,o),this._materials[1]&&this._createAsOverlayOutline(o),this._logGeometryCreationWarnings(o.renderData,r.rings,`rings`,`FillSymbol3DLayer`),new m(this,o.outGeometries,o.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayFill(e,t){let{positions:i,polygonIndices:o,polygonIndexCount:s}=t.renderData;if(s===0)return;let c=n(i,U);if(!r(c,this._context.clippingExtent))return;a(t.outBoundingBox,c);let l=this._fastUpdates?.visualVariables.color,u=x({material:this._materials[0],indices:o,attributeData:{position:i,color:l?null:t.color,colorFeature:l?T(l,e.color):null,uvMapSpace:this._needsUV?t.uvMapSpace:null,olidColor:t.olidColor}});t.outGeometries.push(new I(u,t))}_createAsOverlayOutline(e){if(this._materials[1]==null)return;let{outline:t}=e.renderData;if(t.output!==`vertex-data`)return;let{outlines:i}=t;for(let{position:t}of i){if(n(t,U),!r(U,this._context.clippingExtent))continue;a(e.outBoundingBox,U);let i=j(this._materials[1],{overlayInfo:{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper},removeDuplicateStartEnd:!0,attributeData:{position:t}},e.olidColor);e.outGeometries.push(new I(i,e))}}_getOutlineOpacity(){let e=this.symbolLayer?.outline?.color;return(this.draped?1:this._getLayerOpacity())*(e==null?0:e.a)}_getOutlineColor(){let e=this.symbolLayer?.outline?.color,t=this._getOutlineOpacity();return _(e?.toUnitRGB(),t)}test(){return{...super.test(),createAsOverlay:(e,t,n)=>this._createAsOverlay(e,t,n),createAs3DShape:(e,t,n,r)=>this._createAs3DShape(e,t,n,r)}}get _vvConvertOptions(){return new E({supports:{size:!1,color:!0,rotation:!1,opacity:!1},fallbackColor:this._materialColor?.toUnitRGBA()??t})}}const U=o();class W extends S{constructor(e,t,n,r){super(e,n,r),this.color=t}}class G extends S{constructor(e,t,n,r){super(e,n,r),this.color=t}}function K(e){return e?.size!=null&&e.size>0&&e.color!=null&&(e.pattern==null||e.pattern.type!==`style`||e.pattern.style!==`none`)}export{H as Graphics3DPolygonFillSymbolLayer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{copy as e,normalize as t,set as n,subtract as r,cross as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newDoubleArray as o}from"../../../../geometry/support/DoubleArray.js";import{newIndexArray as s}from"../../../../geometry/support/Indices.js";function c(n,r){if(!n)return null;let{worldUp:i,height:a,spherical:c,requireElevation:u,requireNormals:d,requireSizes:f}=r;if(u&&!(`mapPositions`in n))return null;let{positions:p,polygonIndices:m,outline:h}=n,g=`mapPositions`in n?n.mapPositions:p;if(h.output!==`tessellated-indices`)return null;let _=0;for(let e=0;e<m.length;++e)_=Math.max(_,m[e]+1);let x=n.vertexCount,S=n.outlineSegmentCount,C=2*x+4*S,w=C*3,T=o(w),E=s(S*6+n.polygonIndexCount,C),D=s(n.polygonIndexCount,C);e(v,i);let O=a*i[0],k=a*i[1],A=a*i[2],j=u?o(w):void 0,M=d?o(w):void 0,N=f?o(w):void 0,P=m.length/3,F=a>0?1:-1,I=0,L=0,R=x;for(let e=0;e<x;++e){let e=p[I],n=p[I+1],r=p[I+2];c&&(v[0]=e,v[1]=n,v[2]=r,t(v,v),O=a*v[0],k=a*v[1],A=a*v[2]);let i=L*3;T[i]=e,T[i+1]=n,T[i+2]=r;let o=g[I],s=g[I+1],l=g[I+2];j!=null&&(j[i]=o,j[i+1]=s,j[i+2]=l),M!=null&&(M[i+0]=-F*v[0],M[i+1]=-F*v[1],M[i+2]=-F*v[2]),N!=null&&(N[L]=0);let u=R*3;T[u]=e+O,T[u+1]=n+k,T[u+2]=r+A,j!=null&&(j[u]=o,j[u+1]=s,j[u+2]=l),N!=null&&(N[R]=a),I+=3,++L,++R}let z=x*2,B=0;for(let e=0;e<h.outlineIndices.length;++e){let t=h.outlineIndices[e],n=t.length-1;n<=0||(l(T,j,N,M,t,n,x,z,E,B,a),z+=n*4,B+=n*2)}let V=B,H=0,U=0,W=V*3,G=a<0?b:y,K=a<0?y:b;for(let e=0;e<P;++e)D[U]=m[H+G[0]],D[U+1]=m[H+G[1]],D[U+2]=m[H+G[2]],E[W]=m[H+K[0]]+x,E[W+1]=m[H+K[1]]+x,E[W+2]=m[H+K[2]]+x,U+=3,W+=3,H+=3;return{vertices:T,indices:E,bottomIndices:D,polygonVertexCount:_,elevation:j,normals:M,sizes:N}}function l(e,t,n,r,i,a,o,s,c,l,p){t??=[],n??=[],r??=[];let m=s,h=s+1,g=s+2*a,_=s+2*a+1,v=l*3;for(let s=0;s<a;++s){let a=i[s],l=i[s+1],y=a+o,b=l+o,x=a,S=l,C=y,w=b;p<0&&(x=b,S=l,C=y,w=a),u(e,x,S,C,f),d(e,t,r,n,f,m,x),d(e,t,r,n,f,h,S),d(e,t,r,n,f,g,C),d(e,t,r,n,f,_,w),c[v]=m,c[v+1]=g,c[v+2]=_,c[v+3]=m,c[v+4]=_,c[v+5]=h,v+=6,m+=2,h+=2,g+=2,_+=2}}function u(e,a,o,s,c){a*=3,o*=3,s*=3,n(p,e[a++],e[a++],e[a++]),n(m,e[o++],e[o++],e[o++]),n(h,e[s++],e[s++],e[s++]),r(g,m,p),r(_,h,p),i(c,_,g),t(c,c)}function d(e,t,n,r,i,a,o){r[a]=r[o],o*=3,a*=3,e[a]=e[o],e[a+1]=e[o+1],e[a+2]=e[o+2],t[a]=t[o],t[a+1]=t[o+1],t[a+2]=t[o+2],n[a]=i[0],n[a+1]=i[1],n[a+2]=i[2]}const f=a(),p=a(),m=a(),h=a(),g=a(),_=a(),v=a(),y=[0,2,1],b=[0,1,2];export{c as extrudePolygon};
2
+ import{copy as e,normalize as t,set as n,subtract as r,cross as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newDoubleArray as o}from"../../../../geometry/support/DoubleArray.js";import{newIndexArray as s}from"../../../../geometry/support/Indices.js";function c(n,r){if(!n)return null;let{worldUp:i,height:a,spherical:c,requireElevation:u,requireNormals:d,requireSizes:f}=r;if(u&&!(`mapPositions`in n))return null;let{positions:p,polygonIndices:m,outline:h}=n,g=`mapPositions`in n?n.mapPositions:p;if(h.output!==`tessellated-indices`)return null;let _=0;for(let e=0;e<m.length;++e)_=Math.max(_,m[e]+1);let x=n.vertexCount,S=n.outlineSegmentCount,C=2*x+4*S,w=C*3,T=o(w),E=s(S*6+n.polygonIndexCount,C),D=s(n.polygonIndexCount,C);e(v,i);let O=a*i[0],k=a*i[1],A=a*i[2],j=u?o(w):void 0,M=d?o(w):void 0,N=f?o(C):void 0,P=m.length/3,F=a>0?1:-1,I=0,L=0,R=x;for(let e=0;e<x;++e){let e=p[I],n=p[I+1],r=p[I+2];c&&(v[0]=e,v[1]=n,v[2]=r,t(v,v),O=a*v[0],k=a*v[1],A=a*v[2]);let i=L*3;T[i]=e,T[i+1]=n,T[i+2]=r;let o=g[I],s=g[I+1],l=g[I+2];j!=null&&(j[i]=o,j[i+1]=s,j[i+2]=l),M!=null&&(M[i+0]=-F*v[0],M[i+1]=-F*v[1],M[i+2]=-F*v[2]),N!=null&&(N[L]=0);let u=R*3;T[u]=e+O,T[u+1]=n+k,T[u+2]=r+A,j!=null&&(j[u]=o,j[u+1]=s,j[u+2]=l),N!=null&&(N[R]=a),I+=3,++L,++R}let z=x*2,B=0;for(let e=0;e<h.outlineIndices.length;++e){let t=h.outlineIndices[e],n=t.length-1;n<=0||(l(T,j,N,M,t,n,x,z,E,B,a),z+=n*4,B+=n*2)}let V=B,H=0,U=0,W=V*3,G=a<0?b:y,K=a<0?y:b;for(let e=0;e<P;++e)D[U]=m[H+G[0]],D[U+1]=m[H+G[1]],D[U+2]=m[H+G[2]],E[W]=m[H+K[0]]+x,E[W+1]=m[H+K[1]]+x,E[W+2]=m[H+K[2]]+x,U+=3,W+=3,H+=3;return{vertices:T,indices:E,bottomIndices:D,polygonVertexCount:_,elevation:j,normals:M,sizes:N}}function l(e,t,n,r,i,a,o,s,c,l,p){t??=[],n??=[],r??=[];let m=s,h=s+1,g=s+2*a,_=s+2*a+1,v=l*3;for(let s=0;s<a;++s){let a=i[s],l=i[s+1],y=a+o,b=l+o,x=a,S=l,C=y,w=b;p<0&&(x=b,S=l,C=y,w=a),u(e,x,S,C,f),d(e,t,r,n,f,m,x),d(e,t,r,n,f,h,S),d(e,t,r,n,f,g,C),d(e,t,r,n,f,_,w),c[v]=m,c[v+1]=g,c[v+2]=_,c[v+3]=m,c[v+4]=_,c[v+5]=h,v+=6,m+=2,h+=2,g+=2,_+=2}}function u(e,a,o,s,c){a*=3,o*=3,s*=3,n(p,e[a++],e[a++],e[a++]),n(m,e[o++],e[o++],e[o++]),n(h,e[s++],e[s++],e[s++]),r(g,m,p),r(_,h,p),i(c,_,g),t(c,c)}function d(e,t,n,r,i,a,o){r[a]=r[o],o*=3,a*=3,e[a]=e[o],e[a+1]=e[o+1],e[a+2]=e[o+2],t[a]=t[o],t[a+1]=t[o+1],t[a+2]=t[o+2],n[a]=i[0],n[a+1]=i[1],n[a+2]=i[2]}const f=a(),p=a(),m=a(),h=a(),g=a(),_=a(),v=a(),y=[0,2,1],b=[0,1,2];export{c as extrudePolygon};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"../../../../core/has.js";import"../../../../core/Logger.js";import{trackAccess as e}from"../../../../core/accessorSupport/tracking.js";import{SimpleObservable as t}from"../../../../core/accessorSupport/tracking/SimpleObservable.js";import{e as n}from"../../../../chunks/earcut.js";import{loadLibtessF64 as r,isLibtessF64Loaded as i,triangulateIndexedF64 as a}from"../../../../geometry/libtess.js";import{isClockwise as o}from"../../../../geometry/support/coordsUtils.js";import{newDoubleArray as s,doubleSubArray as c,concatDoubleArrays as l}from"../../../../geometry/support/DoubleArray.js";import{compactMeshIndices as u,newIndexArray as d,concatIndexArrays as f}from"../../../../geometry/support/Indices.js";import{leastSignificantAxis as p}from"../../../../geometry/support/polygonUtils.js";const m={method:`auto`,projectionAxis:void 0,outlines:void 0,owner:void 0};function h(e,t){let{hasZ:n,ccwRingsAsHoles:r,spatialReference:i}=t,a=t.axis??g(e,n,i),o=e.length,l=[],u=[],d=[],f=[],p=e.reduce((e,t)=>e+t.length,0),m=0,h=s(p*3),v=0,y=r&&e[0]&&_(e[0],n,a);for(let t=o-1;t>=0;t--){let i=e[t],o=N(i,n);if(o<3){o>1&&f.push(i);continue}let s=r?_(i,n,a):!1;if(y?!s:s)l[m++]=i;else{let e=i.length;for(let t=0;t<m;++t)e+=l[t].length;let t={index:v,pathLengths:Array(m+1),count:e,holeIndices:Array(m)};t.pathLengths[0]=i.length,i.length>0&&d.push({index:v,count:i.length}),v=j(i,h,v,i.length,n,y);for(let e=0;e<m;++e){let r=l[e];t.holeIndices[e]=v,t.pathLengths[e+1]=r.length,r.length>0&&d.push({index:v,count:r.length}),v=j(r,h,v,r.length,n,y)}m=0,t.count>0&&u.push(t)}}let b=v;for(let e of f)d.push({index:v,count:e.length}),v=j(e,h,v,e.length,n,y);return{positions:v*3===h.length?h:c(h,0,v*3),polygonVertexCount:b,polygons:u,outlines:d}}function g(e,t,n){if(!t)return 2;let r=null;for(let i of e){let e=N(i,t),a=e<3?2:p(i,e,n);if(r??=a,a!==r)return 2}return r??2}function _(e,t,n){if(!t)return!o(e);if(e.length<3)return!1;switch(n){case 0:return!o(e,1,2);case 1:return!o(e,0,2);case 2:return!o(e,0,1)}}const v=new t;function y(t,n){let r=x(t,n);return r.succeeded||r.message!==`libtess-not-loaded`?r:(e(v),b())}async function b(){try{await r(),v.notify()}catch(e){throw e}}function x(e,t){let n={method:t?.method??m.method,projectionAxis:t?.projectionAxis??m.projectionAxis,outlines:t?.outlines??m.outlines,owner:t?.owner??m.owner},{projectionAxis:r}=n,i=r!=null&&r!==2;i&&D(e.positions,r,2);let a=S(e,n);if(i){let t=a.succeeded?a.positions:null;t!=null&&t!==e.positions&&D(t,2,r),D(e.positions,2,r)}return a}function S(e,t){if(t.method===`libtess`)return T(e,t);let r=w(e,t),i=[],a=0;for(let o of e.polygons){let s=A(e.positions,o),c=(o.holeIndices??[]).map(e=>e-o.index),l=c.length>0?c:null,u=n(s,l,3),d=n.deviation(s,c,3,u);if(r&&d>1e-5)return T(e,t);for(let e=0;e<u.length;e++)i.push(u[e]+o.index);a=Math.max(a,d)}let{outlineIndexBuffer:o,outlineRingLengths:s}=t.outlines==null?{outlineIndexBuffer:void 0,outlineRingLengths:void 0}:O(t.outlines,e.positions);return{succeeded:!0,positions:e.positions,indices:u(i),outlineIndexBuffer:o,outlineRingLengths:s,vertexCount:e.positions.length/3,method:`earcut`,deviation:a}}let C=new WeakSet;function w(e,t){let n=t.owner!=null&&C.has(t.owner);return t.method===`auto`&&!(n&&e.polygonVertexCount>=1e4)}function T(e,t){if(!i())return P(`libtess-not-loaded`);let n=t.outlines!=null,{positions:r,mergedPathLengths:o}=F(e),s=performance.now(),{vertices:c,indices:l,outlineIndices:u,outlineRingLengths:d}=a(r,o,3,n),f=performance.now()-s;if(t.owner!=null&&f>250&&C.add(t.owner),c.length%3!=0)return P(`positions-not-multiple-of-3`);let{positions:p,outlineIndexBuffer:m,mergedOutlineRingLengths:h}=n?E(e,t.outlines,c,u,d):{positions:c,outlineIndexBuffer:void 0,mergedOutlineRingLengths:void 0};return{succeeded:!0,positions:p,indices:l,outlineIndexBuffer:m,outlineRingLengths:h,vertexCount:p.length/3,method:`libtess`}}function E(e,t,n,r,i){let a=e.polygonVertexCount,o=n.length/3,s=(t??[]).values().filter(e=>e.index>=a).map(e=>({index:o+e.index-a,count:e.count})).toArray();if(s.length===0)return{positions:n,outlineIndexBuffer:r,mergedOutlineRingLengths:i};let u=a*3,d=c(e.positions,u,e.positions.length-u),p=l(n,d),{outlineIndexBuffer:m,outlineRingLengths:h}=O(s,p);return{positions:p,outlineIndexBuffer:f(r,m,p.length/3),mergedOutlineRingLengths:f(i,h,i.length+h.length)}}function D(e,t,n){for(let r=0;r<e.length;r+=3){let i=e[r+t];e[r+t]=e[r+n],e[r+n]=i}}function O(e,t){let n=d(e.length),r=0;for(let i=0;i<e.length;i++){let a=e[i],o=a.count;if(o<=0){n[i]=0;continue}let s=a.index*3,c=(a.index+o-1)*3,l=o>1&&t[s]===t[c]&&t[s+1]===t[c+1]&&t[s+2]===t[c+2]?o-1:o,u=l>0?l+1:0;n[i]=u,r+=u}let i=d(r,t.length/3),a=0;for(let t=0;t<e.length;t++){let r=n[t];if(r===0)continue;let o=e[t].index,s=r-1;for(let e=0;e<s;e++)i[a++]=o+e;i[a++]=o}return{outlineIndexBuffer:i,outlineRingLengths:n}}function k(e){let t=e.reduce((e,t)=>e+t.pathLengths.length,0),n=Array(t),r=0;for(let t=0;t<e.length;t++){let i=e[t].pathLengths;for(let e=0;e<i.length;e++)n[r++]=i[e]}return n}function A(e,{index:t,count:n}){let r=t*3,i=n*3;return c(e,r,i)}function j(e,t,n,r,i,a){let o=a?e.length-1:0,s=a?-1:1;n*=3;for(let a=0;a<r;++a){let r=e[o];t[n++]=r[0],t[n++]=r[1],t[n++]=i&&r[2]!=null?r[2]:0,o+=s}return n/3}function M(e,t){let n=e.length;if(n<2)return!1;let r=e[0],i=e[n-1];return r[0]===i[0]&&r[1]===i[1]&&(!t||r[2]===i[2])}function N(e,t){return M(e,t)?e.length-1:e.length}function P(e){return{succeeded:!1,message:e}}function F(e){let t=k(e.polygons),n=e.polygonVertexCount*3;return n===e.positions.length?{positions:e.positions,mergedPathLengths:t}:{positions:c(e.positions,0,n),mergedPathLengths:t}}const I=void 0;export{g as axisFromRings,_ as isCounterClockwise,b as load,h as ringsToOutlinedTessellationInfo,x as tessellate,y as tessellateOrLoad,I as tessellationTestHooks};
2
+ import"../../../../core/has.js";import"../../../../core/Logger.js";import{trackAccess as e}from"../../../../core/accessorSupport/tracking.js";import{SimpleObservable as t}from"../../../../core/accessorSupport/tracking/SimpleObservable.js";import{e as n}from"../../../../chunks/earcut.js";import{loadLibtessF64 as r,isLibtessF64Loaded as i,triangulateIndexedF64 as a}from"../../../../geometry/libtess.js";import{isClockwise as o}from"../../../../geometry/support/coordsUtils.js";import{newDoubleArray as s,doubleSubArray as c,concatDoubleArrays as l}from"../../../../geometry/support/DoubleArray.js";import{newIndexArray as u,compactMeshIndices as d,concatIndexArrays as f}from"../../../../geometry/support/Indices.js";import{leastSignificantAxis as p}from"../../../../geometry/support/polygonUtils.js";const m={method:`auto`,projectionAxis:void 0,outlines:void 0,owner:void 0};function h(e,t){let{hasZ:n,ccwRingsAsHoles:r,spatialReference:i}=t,a=t.axis??g(e,n,i),o=e.length,l=[],u=[],d=[],f=[],p=e.reduce((e,t)=>e+t.length,0),m=0,h=s(p*3),v=0,y=r&&e[0]&&_(e[0],n,a);for(let t=o-1;t>=0;t--){let i=e[t],o=N(i,n);if(o<3){o>1&&f.push(i);continue}let s=r?_(i,n,a):!1;if(y?!s:s)l[m++]=i;else{let e=i.length;for(let t=0;t<m;++t)e+=l[t].length;let t={index:v,pathLengths:Array(m+1),count:e,holeIndices:Array(m)};t.pathLengths[0]=i.length,i.length>0&&d.push({index:v,count:i.length}),v=j(i,h,v,i.length,n,y);for(let e=0;e<m;++e){let r=l[e];t.holeIndices[e]=v,t.pathLengths[e+1]=r.length,r.length>0&&d.push({index:v,count:r.length}),v=j(r,h,v,r.length,n,y)}m=0,t.count>0&&u.push(t)}}let b=v;for(let e of f)d.push({index:v,count:e.length}),v=j(e,h,v,e.length,n,y);return{positions:v*3===h.length?h:c(h,0,v*3),polygonVertexCount:b,polygons:u,outlines:d}}function g(e,t,n){if(!t)return 2;let r=null;for(let i of e){let e=N(i,t),a=e<3?2:p(i,e,n);if(r??=a,a!==r)return 2}return r??2}function _(e,t,n){if(!t)return!o(e);if(e.length<3)return!1;switch(n){case 0:return!o(e,1,2);case 1:return!o(e,0,2);case 2:return!o(e,0,1)}}const v=new t;function y(t,n){let r=x(t,n);return r.succeeded||r.message!==`libtess-not-loaded`?r:(e(v),b())}async function b(){try{await r(),v.notify()}catch(e){throw e}}function x(e,t){let n={method:t?.method??m.method,projectionAxis:t?.projectionAxis??m.projectionAxis,outlines:t?.outlines??m.outlines,owner:t?.owner??m.owner},{projectionAxis:r}=n,i=r!=null&&r!==2;i&&D(e.positions,r,2);let a=S(e,n);if(i){let t=a.succeeded?a.positions:null;t!=null&&t!==e.positions&&D(t,2,r),D(e.positions,2,r)}return a}function S(e,t){if(t.method===`libtess`)return T(e,t);let r=w(e,t),i=[],a=0,o=0;for(let s of e.polygons){let c=A(e.positions,s),l=(s.holeIndices??[]).map(e=>e-s.index),u=l.length>0?l:null,d=n(c,u,3),f=n.deviation(c,l,3,d);if(r&&f>1e-5)return T(e,t);i.push({indices:d,index:s.index}),a+=d.length,o=Math.max(o,f)}let s=u(a,e.positions.length/3),c=0;for(let e of i)for(let t=0;t<e.indices.length;t++)s[c++]=e.indices[t]+e.index;let{outlineIndexBuffer:l,outlineRingLengths:f}=t.outlines==null?{outlineIndexBuffer:void 0,outlineRingLengths:void 0}:O(t.outlines,e.positions);return{succeeded:!0,positions:e.positions,indices:d(s),outlineIndexBuffer:l,outlineRingLengths:f,vertexCount:e.positions.length/3,method:`earcut`,deviation:o}}let C=new WeakSet;function w(e,t){let n=t.owner!=null&&C.has(t.owner);return t.method===`auto`&&!(n&&e.polygonVertexCount>=1e4)}function T(e,t){if(!i())return P(`libtess-not-loaded`);let n=t.outlines!=null,{positions:r,mergedPathLengths:o}=F(e),s=performance.now(),{vertices:c,indices:l,outlineIndices:u,outlineRingLengths:d}=a(r,o,3,n),f=performance.now()-s;if(t.owner!=null&&f>250&&C.add(t.owner),c.length%3!=0)return P(`positions-not-multiple-of-3`);let{positions:p,outlineIndexBuffer:m,mergedOutlineRingLengths:h}=n?E(e,t.outlines,c,u,d):{positions:c,outlineIndexBuffer:void 0,mergedOutlineRingLengths:void 0};return{succeeded:!0,positions:p,indices:l,outlineIndexBuffer:m,outlineRingLengths:h,vertexCount:p.length/3,method:`libtess`}}function E(e,t,n,r,i){let a=e.polygonVertexCount,o=n.length/3,s=(t??[]).values().filter(e=>e.index>=a).map(e=>({index:o+e.index-a,count:e.count})).toArray();if(s.length===0)return{positions:n,outlineIndexBuffer:r,mergedOutlineRingLengths:i};let u=a*3,d=c(e.positions,u,e.positions.length-u),p=l(n,d),{outlineIndexBuffer:m,outlineRingLengths:h}=O(s,p);return{positions:p,outlineIndexBuffer:f(r,m,p.length/3),mergedOutlineRingLengths:f(i,h,i.length+h.length)}}function D(e,t,n){for(let r=0;r<e.length;r+=3){let i=e[r+t];e[r+t]=e[r+n],e[r+n]=i}}function O(e,t){let n=u(e.length),r=0;for(let i=0;i<e.length;i++){let a=e[i],o=a.count;if(o<=0){n[i]=0;continue}let s=a.index*3,c=(a.index+o-1)*3,l=o>1&&t[s]===t[c]&&t[s+1]===t[c+1]&&t[s+2]===t[c+2]?o-1:o,u=l>0?l+1:0;n[i]=u,r+=u}let i=u(r,t.length/3),a=0;for(let t=0;t<e.length;t++){let r=n[t];if(r===0)continue;let o=e[t].index,s=r-1;for(let e=0;e<s;e++)i[a++]=o+e;i[a++]=o}return{outlineIndexBuffer:i,outlineRingLengths:n}}function k(e){let t=e.reduce((e,t)=>e+t.pathLengths.length,0),n=Array(t),r=0;for(let t=0;t<e.length;t++){let i=e[t].pathLengths;for(let e=0;e<i.length;e++)n[r++]=i[e]}return n}function A(e,{index:t,count:n}){let r=t*3,i=n*3;return c(e,r,i)}function j(e,t,n,r,i,a){let o=a?e.length-1:0,s=a?-1:1;n*=3;for(let a=0;a<r;++a){let r=e[o];t[n++]=r[0],t[n++]=r[1],t[n++]=i&&r[2]!=null?r[2]:0,o+=s}return n/3}function M(e,t){let n=e.length;if(n<2)return!1;let r=e[0],i=e[n-1];return r[0]===i[0]&&r[1]===i[1]&&(!t||r[2]===i[2])}function N(e,t){return M(e,t)?e.length-1:e.length}function P(e){return{succeeded:!1,message:e}}function F(e){let t=k(e.polygons),n=e.polygonVertexCount*3;return n===e.positions.length?{positions:e.positions,mergedPathLengths:t}:{positions:c(e.positions,0,n),mergedPathLengths:t}}const I=void 0;export{g as axisFromRings,_ as isCounterClockwise,b as load,h as ringsToOutlinedTessellationInfo,x as tessellate,y as tessellateOrLoad,I as tessellationTestHooks};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../Camera.js";import{deg2rad as n,rad2deg as r,clamp as i}from"../../../../core/mathUtils.js";import{destroyMaybe as a}from"../../../../core/maybe.js";import{property as o,subclass as s}from"../../../../core/accessorSupport/decorators.js";import{add as c,scale as l,copy as u,distance as d}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{pixelDistanceToInteractionFactor as p,applyAll as m}from"../../camera/constraintUtils.js";import{ConstraintOptions as h}from"../../camera/constraintUtils/ConstraintOptions.js";import{InteractiveController as g}from"./InteractiveController.js";import{searchAreaSize as _}from"../utils/navigationUtils.js";import v from"../../../ui/Component.js";import{FovOverlay as y}from"../../../../widgets/FovOverlay.js";let b=class extends g{constructor(e){super(e),this.onStop=null,this._timeOutId=void 0,this._onReset=()=>{this._startSize=this._lastDrag=null,this._setFov(x),this.updateTimeout()},this._center=f(),this._viewForward=f(),this._constraints=new h(15,1)}begin(e){if(T(e)){this._showOverlay().fov=e.fov;return}this._lastDrag=e[1],this._startSize=null,this._ensureStartSize(this.view.state.camera)}updateTimeout(){clearTimeout(this._timeOutId),this._timeOutId=setTimeout(this.onStop,1500)}update(e){if(this._lastDrag==null){this._lastDrag=e[1],this._startSize=null,this._ensureStartSize(this.view.state.camera);return}let t=-(this._lastDrag-e[1])/2;this._lastDrag=e[1],this.step(t)}step(e){if(!this.running){this._startSize=this._lastDrag=null;return}let t=this.view.state,a=this.currentCamera.copyFrom(t.camera),o=r(a.fov)+e,s=n(i(o,S,C));if(s===a.fov){this._showOverlay().fov=a.fov;return}this._setFov(s)}finish(){this.running&&(this._startSize=this._lastDrag=null,this.finishController())}destroy(){this.hideOverlay()}onControllerEnd(e){super.onControllerEnd(e),this._startSize=this._lastDrag=null,this.hideOverlay()}_showOverlay(){return this._overlay||(this._overlay=new v({id:`esri.FovOverlay`,node:new y({onReset:this._onReset})}),this.view.ui.add(this._overlay)),this._overlay.widget}hideOverlay(){this._overlay&&=(this.view.ui.remove(this._overlay),a(this._overlay))}_setFov(e){let t=this.view.state,n=this.currentCamera.copyFrom(t.camera),r=this._ensureStartSize(n)/Math.tan(e/2);n.eye=c(w,this._center,l(w,this._viewForward,-r)),n.fov=e,this._constraints.interactionStartCamera=t.camera,this._constraints.interactionFactor=p(this.currentCamera.height-t.camera.height),m(this.view,this.currentCamera,this._constraints),this.begin(n),this.commitCamera()}_ensureStartSize(e){if(this._startSize==null){u(this._viewForward,e.viewForward);let t=this.view.stage.renderView.getMinimalDepthForArea(null,e.fullWidth/e.pixelRatio*.5,e.fullHeight/e.pixelRatio*.5,e,_),n=d(e.eye,this.view.pointsOfInterest.centerOnContent.renderLocation),r=t??n;c(this._center,e.eye,l(w,this._viewForward,r)),this._startSize=r*Math.tan(e.fov/2)}return this._startSize}};e([o()],b.prototype,`onStop`,void 0),b=e([s(`esri.views.3d.state.controllers.FovController`)],b);const x=n(new t().fov),S=10,C=150,w=f();function T(e){return!Array.isArray(e)}export{b as FovController};
2
+ import{__decorate as e}from"tslib";import t from"../../../../Camera.js";import{deg2rad as n,rad2deg as r,clamp as i}from"../../../../core/mathUtils.js";import{destroyMaybe as a}from"../../../../core/maybe.js";import{property as o,subclass as s}from"../../../../core/accessorSupport/decorators.js";import{add as c,scale as l,copy as u,distance as d}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{pixelDistanceToInteractionFactor as p,applyAll as m}from"../../camera/constraintUtils.js";import{ConstraintOptions as h}from"../../camera/constraintUtils/ConstraintOptions.js";import{InteractiveController as g}from"./InteractiveController.js";import{searchAreaSize as _}from"../utils/navigationUtils.js";import v from"../../../ui/Component.js";import{FovOverlay as y}from"../../../../widgets/FovOverlay.js";let b=class extends g{constructor(e){super(e),this.onStop=null,this.enableDolly=!0,this._timeOutId=void 0,this._onReset=()=>{this._startSize=this._lastDrag=null,this._setFov(x),this.updateTimeout()},this._center=f(),this._viewForward=f(),this._constraints=new h(15,1)}begin(e){if(T(e)){this._showOverlay().fov=e.fov;return}this._lastDrag=e[1],this._startSize=null,this._ensureStartSize(this.view.state.camera)}updateTimeout(){clearTimeout(this._timeOutId),this._timeOutId=setTimeout(this.onStop,1500)}update(e){if(this._lastDrag==null){this._lastDrag=e[1],this._startSize=null,this._ensureStartSize(this.view.state.camera);return}let t=-(this._lastDrag-e[1])/2;this._lastDrag=e[1],this.step(t)}step(e){if(!this.running){this._startSize=this._lastDrag=null;return}let t=this.view.state,a=this.currentCamera.copyFrom(t.camera),o=r(a.fov)+e,s=n(i(o,S,C));if(s===a.fov){this._showOverlay().fov=a.fov;return}this._setFov(s)}finish(){this.running&&(this._startSize=this._lastDrag=null,this.finishController())}destroy(){this.hideOverlay()}onControllerEnd(e){super.onControllerEnd(e),this._startSize=this._lastDrag=null,this.hideOverlay()}_showOverlay(){return this._overlay||(this._overlay=new v({id:`esri.FovOverlay`,node:new y({onReset:this._onReset})}),this.view.ui.add(this._overlay)),this._overlay.widget}hideOverlay(){this._overlay&&=(this.view.ui.remove(this._overlay),a(this._overlay))}_setFov(e){let t=this.view.state,n=this.currentCamera.copyFrom(t.camera);if(this.enableDolly){let t=this._ensureStartSize(n)/Math.tan(e/2);n.eye=c(w,this._center,l(w,this._viewForward,-t))}n.fov=e,this._constraints.interactionStartCamera=t.camera,this._constraints.interactionFactor=p(this.currentCamera.height-t.camera.height),m(this.view,this.currentCamera,this._constraints),this.begin(n),this.commitCamera()}_ensureStartSize(e){if(this._startSize==null){u(this._viewForward,e.viewForward);let t=this.view.stage.renderView.getMinimalDepthForArea(null,e.fullWidth/e.pixelRatio*.5,e.fullHeight/e.pixelRatio*.5,e,_),n=d(e.eye,this.view.pointsOfInterest.centerOnContent.renderLocation),r=t??n;c(this._center,e.eye,l(w,this._viewForward,r)),this._startSize=r*Math.tan(e.fov/2)}return this._startSize}};e([o()],b.prototype,`onStop`,void 0),e([o()],b.prototype,`enableDolly`,void 0),b=e([s(`esri.views.3d.state.controllers.FovController`)],b);const x=n(new t().fov),S=10,C=150,w=f();function T(e){return!Array.isArray(e)}export{b as FovController};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{prefersReducedMotion as t}from"../../../../core/a11yUtils.js";import{createScreenPointArray as n,screenPointObjectToArray as r}from"../../../../core/screenUtils.js";import{subclass as i}from"../../../../core/accessorSupport/decorators.js";import{copy as a,distance as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{scaleAndAdd as s,dot as c,crossAndNormalize as l,scale as u,add as d}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as p}from"../../../../geometry/ellipsoidUtils.js";import{create as m,fromPositionAndNormal as h}from"../../../../geometry/support/plane.js";import{Sphere as g}from"../../../../geometry/support/sphere.js";import{pixelDistanceToInteractionFactor as _}from"../../camera/constraintUtils.js";import{ConstraintOptions as v}from"../../camera/constraintUtils/ConstraintOptions.js";import{InteractiveController as y}from"./InteractiveController.js";import{GroundNavigationMomentumController as b}from"./momentum/GroundNavigationMomentumController.js";import{findSphereHorizonY as x,computeHorizonPaddingLimits as S,findPlaneHorizonY as C,findGroundNavigationGrabLocation as w,groundNavigationConstants as T}from"../utils/groundNavigationUtils.js";import{OffsetCorrectionController as E}from"../utils/OffsetCorrectionController.js";import D from"../../webgl/RenderCamera.js";import{GroundNavigationMomentumEstimator as O}from"../../../navigation/GroundNavigationMomentumEstimator.js";let k=class extends y{constructor(e){super(e),this._drag=null,this._validState=!0,this._adjustedScenePoint=f(),this._momentumEstimator=new O,this._referenceSphere=new g,this._referencePlane=m(),this._tmp3d=f(),this._screenPointArray=n(),this._forwardRopeComponent=f(),this._sidewaysRopeComponent=f(),this._ropeTranslation=f(),this._beginScreenPoint=n(),this._screenPickPoint=n(),this._horizonY=null,this._horizonPadding=null,this._ropeScreenHeight=1,this._ropePlane=m(),this._pointerOverHorizonVelocityAdjustment=1,this._forceStayAboveGround=!1,this._beginCamera=new D,this._constraintOptions=new v(15,6,0,this._beginCamera)}initialize(){this._offsetCorrectionController=new E(this.view)}stepController(e,t){this._drag&&=(this.currentCamera.copyFrom(this.startCamera),this._panningRopePull(this._drag,e),t.copyFrom(this.currentCamera),null)}get isGlobalMode(){return this.view.state.viewingMode===1}get momentumEnabled(){return this.view.navigation.momentumEnabled&&this.view.animationsEnabled&&!t()}begin(e){this.running&&(r(e.center,this._screenPickPoint),Math.abs(this._screenPickPoint[0]-this.view.width/2)<.1&&(this._screenPickPoint[0]+=1),a(this._beginScreenPoint,this._screenPickPoint),this._prepareGroundNavigation(),this._beginCamera.copyFrom(this.startCamera))}update(e){this.running&&this._validState&&(this._drag=e,this.updateInteractive())}end(e){return this.finishController(),this.createMomentum()}_initHorizonValues(){this.isGlobalMode?this._globalInitHorizonValues():this._localInitHorizonValues()}_globalInitHorizonValues(){this._referenceSphere.radius=p(this.view.spatialReference).radius,this._horizonY=x(this.startCamera,this._referenceSphere,this._screenPickPoint),this._horizonPadding=this._horizonY==null?null:S(this.startCamera,this._horizonY)}_localInitHorizonValues(){let e=f();this.view.renderCoordsHelper.worldUpAtPosition(this.startCamera.eye,e);let t=f();s(t,this.startCamera.eye,e,-this.startCamera.relativeElevation),h(t,e,this._referencePlane),this._horizonY=C(this.startCamera,this._referencePlane),this._horizonPadding=S(this.startCamera,this._horizonY)}_prepareGroundNavigation(){if(this._initHorizonValues(),!this._horizonY||!this._horizonPadding)return;if(this._momentumEstimator.reset(),this._ropeScreenHeight=this.startCamera.fullHeight/this.startCamera.pixelRatio,!w({view:this.view,originalScreenPoint:this._beginScreenPoint,horizonY:this._horizonY,horizonPadding:this._horizonPadding,outTranslation:this._ropeTranslation,outGrabLocation:this._adjustedScenePoint})){this._validState=!1;return}let e=f();this.view.renderCoordsHelper.worldUpAtPosition(this.startCamera.eye,e);let t=this.startCamera.viewRight,n=c(this._ropeTranslation,t),r=l(f(),e,t),i=c(this._ropeTranslation,r);u(this._forwardRopeComponent,r,i),u(this._sidewaysRopeComponent,t,n),h(this._adjustedScenePoint,e,this._ropePlane);let a=this._ropeScreenHeight-this._beginScreenPoint[1],o=this._ropeScreenHeight-this._horizonPadding[0];this._pointerOverHorizonVelocityAdjustment=o===0?1:Math.max(a/o,1),this._forceStayAboveGround=this.view.groundView.baseOpacity>0&&this.view.state.camera.relativeElevation>=0&&this.view.navigation.mode.offset!=null}_panningRopePull(e,t){if(!this._horizonY||!this._horizonPadding)return;let n=r(e.center,this._screenPointArray),i=this.startCamera.fullWidth/this.startCamera.pixelRatio*.5,a=(this._ropeScreenHeight-n[1])/(this._ropeScreenHeight-this._beginScreenPoint[1]),c=1-a,l=(n[0]-i)/(this._beginScreenPoint[0]-i),f=c*T.ySpeedMultiplier*this._pointerOverHorizonVelocityAdjustment,p=(c*T.xSpeedMultiplier+a*((1-l)*T.xSpeedMultiplier))*this._pointerOverHorizonVelocityAdjustment;u(this._ropeTranslation,this._forwardRopeComponent,f),s(this._ropeTranslation,this._ropeTranslation,this._sidewaysRopeComponent,p),this.currentCamera.eye=d(this._tmp3d,this.startCamera.eye,this._ropeTranslation),this.currentCamera.center=d(this._tmp3d,this.startCamera.center,this._ropeTranslation),this.momentumEnabled&&this._momentumEstimator.update(n,this._ropeTranslation,e.timestamp*.001),this._constraintOptions.interactionFactor=_(o(this._beginScreenPoint,n)),this._constraintOptions.interactionDirection=this._ropeTranslation,this._offsetCorrectionController.smoothlyCorrectGroundElevation({camera:this.currentCamera,deltaTime:t,constraintOptions:this._constraintOptions,forceStayAboveGround:this._forceStayAboveGround}),this._constraintOptions.interactionDirection=null}createMomentum(){let e=this.momentumEnabled&&this._momentumEstimator.createMomentum();return e?new b({view:this.view,momentum:e,forceStayAboveGround:this._forceStayAboveGround}):null}};k=e([i(`esri.views.3d.state.controllers.GroundNavigationController`)],k);export{k as GroundNavigationController};
2
+ import{__decorate as e}from"tslib";import{prefersReducedMotion as t}from"../../../../core/a11yUtils.js";import{createScreenPointArray as n,screenPointObjectToArray as r}from"../../../../core/screenUtils.js";import{subclass as i}from"../../../../core/accessorSupport/decorators.js";import{copy as a,distance as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{scaleAndAdd as s,dot as c,crossAndNormalize as l,scale as u,add as d}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as p}from"../../../../geometry/ellipsoidUtils.js";import{create as m,fromPositionAndNormal as h}from"../../../../geometry/support/plane.js";import{Sphere as g}from"../../../../geometry/support/sphere.js";import{pixelDistanceToInteractionFactor as _}from"../../camera/constraintUtils.js";import{ConstraintOptions as v}from"../../camera/constraintUtils/ConstraintOptions.js";import{InteractiveController as y}from"./InteractiveController.js";import{GroundNavigationMomentumController as b}from"./momentum/GroundNavigationMomentumController.js";import{findSphereHorizonY as x,computeHorizonPaddingLimits as S,findPlaneHorizonY as C,findGroundNavigationGrabLocation as w,groundNavigationConstants as T}from"../utils/groundNavigationUtils.js";import{OffsetCorrectionController as E}from"../utils/OffsetCorrectionController.js";import D from"../../webgl/RenderCamera.js";import{GroundNavigationMomentumEstimator as O}from"../../../navigation/GroundNavigationMomentumEstimator.js";let k=class extends y{constructor(e){super(e),this._drag=null,this._validState=!0,this._adjustedScenePoint=f(),this._momentumEstimator=new O,this._referenceSphere=new g,this._referencePlane=m(),this._tmp3d=f(),this._screenPointArray=n(),this._forwardRopeComponent=f(),this._sidewaysRopeComponent=f(),this._ropeTranslation=f(),this._beginScreenPoint=n(),this._screenPickPoint=n(),this._horizonY=null,this._horizonPadding=null,this._ropeScreenHeight=1,this._ropePlane=m(),this._pointerOverHorizonVelocityAdjustment=1,this._beginCamera=new D,this._constraintOptions=new v(15,6,0,this._beginCamera)}initialize(){this._offsetCorrectionController=new E(this.view)}stepController(e,t){this._drag&&=(this.currentCamera.copyFrom(this.startCamera),this._panningRopePull(this._drag,e),t.copyFrom(this.currentCamera),null)}get isGlobalMode(){return this.view.state.viewingMode===1}get momentumEnabled(){return this.view.navigation.momentumEnabled&&this.view.animationsEnabled&&!t()}begin(e){this.running&&(r(e.center,this._screenPickPoint),Math.abs(this._screenPickPoint[0]-this.view.width/2)<.1&&(this._screenPickPoint[0]+=1),a(this._beginScreenPoint,this._screenPickPoint),this._prepareGroundNavigation(),this._beginCamera.copyFrom(this.startCamera))}update(e){this.running&&this._validState&&(this._drag=e,this.updateInteractive())}end(e){return this.finishController(),this.createMomentum()}_initHorizonValues(){this.isGlobalMode?this._globalInitHorizonValues():this._localInitHorizonValues()}_globalInitHorizonValues(){this._referenceSphere.radius=p(this.view.spatialReference).radius,this._horizonY=x(this.startCamera,this._referenceSphere,this._screenPickPoint),this._horizonPadding=this._horizonY==null?null:S(this.startCamera,this._horizonY)}_localInitHorizonValues(){let e=f();this.view.renderCoordsHelper.worldUpAtPosition(this.startCamera.eye,e);let t=f();s(t,this.startCamera.eye,e,-this.startCamera.relativeElevation),h(t,e,this._referencePlane),this._horizonY=C(this.startCamera,this._referencePlane),this._horizonPadding=S(this.startCamera,this._horizonY)}_prepareGroundNavigation(){if(this._initHorizonValues(),!this._horizonY||!this._horizonPadding)return;if(this._momentumEstimator.reset(),this._ropeScreenHeight=this.startCamera.fullHeight/this.startCamera.pixelRatio,!w({view:this.view,originalScreenPoint:this._beginScreenPoint,horizonY:this._horizonY,horizonPadding:this._horizonPadding,outTranslation:this._ropeTranslation,outGrabLocation:this._adjustedScenePoint})){this._validState=!1;return}let e=f();this.view.renderCoordsHelper.worldUpAtPosition(this.startCamera.eye,e);let t=this.startCamera.viewRight,n=c(this._ropeTranslation,t),r=l(f(),e,t),i=c(this._ropeTranslation,r);u(this._forwardRopeComponent,r,i),u(this._sidewaysRopeComponent,t,n),h(this._adjustedScenePoint,e,this._ropePlane);let a=this._ropeScreenHeight-this._beginScreenPoint[1],o=this._ropeScreenHeight-this._horizonPadding[0];this._pointerOverHorizonVelocityAdjustment=o===0?1:Math.max(a/o,1)}_panningRopePull(e,t){if(!this._horizonY||!this._horizonPadding)return;let n=r(e.center,this._screenPointArray),i=this.startCamera.fullWidth/this.startCamera.pixelRatio*.5,a=(this._ropeScreenHeight-n[1])/(this._ropeScreenHeight-this._beginScreenPoint[1]),c=1-a,l=(n[0]-i)/(this._beginScreenPoint[0]-i),f=c*T.ySpeedMultiplier*this._pointerOverHorizonVelocityAdjustment,p=(c*T.xSpeedMultiplier+a*((1-l)*T.xSpeedMultiplier))*this._pointerOverHorizonVelocityAdjustment;u(this._ropeTranslation,this._forwardRopeComponent,f),s(this._ropeTranslation,this._ropeTranslation,this._sidewaysRopeComponent,p),this.currentCamera.eye=d(this._tmp3d,this.startCamera.eye,this._ropeTranslation),this.currentCamera.center=d(this._tmp3d,this.startCamera.center,this._ropeTranslation),this.momentumEnabled&&this._momentumEstimator.update(n,this._ropeTranslation,e.timestamp*.001),this._constraintOptions.interactionFactor=_(o(this._beginScreenPoint,n)),this._constraintOptions.interactionDirection=this._ropeTranslation,this._offsetCorrectionController.smoothlyCorrectGroundElevation({camera:this.currentCamera,deltaTime:t,constraintOptions:this._constraintOptions}),this._constraintOptions.interactionDirection=null}createMomentum(){let e=this.momentumEnabled&&this._momentumEstimator.createMomentum();return e?new b({view:this.view,momentum:e}):null}};k=e([i(`esri.views.3d.state.controllers.GroundNavigationController`)],k);export{k as GroundNavigationController};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{Seconds as t}from"../../../../../core/time.js";import{property as n,subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{scale as i,add as a}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as o}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{MomentumController as s}from"./MomentumController.js";import{OffsetCorrectionController as c}from"../../utils/OffsetCorrectionController.js";let l=class extends s{constructor(e){super(e),this.forceStayAboveGround=!1,this.interactionType=6,this._tmpPan=o(),this._lastUpdateTime=0,this._remainingGroundCorrection=0}initialize(){this._offsetCorrectionController=new c(this.view)}momentumStep(e,n){let r=this.momentum.value(e);i(this._tmpPan,this.momentum.direction,r),n.eye=a(u,n.eye,this._tmpPan),n.center=a(u,n.center,this._tmpPan);let o=t(e-this._lastUpdateTime);this.constraintOptions.interactionDirection=this._tmpPan,this._remainingGroundCorrection=this._offsetCorrectionController.smoothlyCorrectGroundElevation({camera:n,deltaTime:o,forceStayAboveGround:this.forceStayAboveGround}),this._lastUpdateTime=e}get finished(){return super.finished&&this._remainingGroundCorrection<=.01}};e([n({constructOnly:!0})],l.prototype,`momentum`,void 0),e([n()],l.prototype,`forceStayAboveGround`,void 0),l=e([r(`esri.views.3d.state.controllers.momentum.GroundNavigationMomentumController`)],l);const u=o();export{l as GroundNavigationMomentumController};
2
+ import{__decorate as e}from"tslib";import{Seconds as t}from"../../../../../core/time.js";import{property as n,subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{scale as i,add as a}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as o}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{MomentumController as s}from"./MomentumController.js";import{OffsetCorrectionController as c}from"../../utils/OffsetCorrectionController.js";let l=class extends s{constructor(e){super(e),this.interactionType=6,this._tmpPan=o(),this._lastUpdateTime=0,this._remainingGroundCorrection=0}initialize(){this._offsetCorrectionController=new c(this.view)}momentumStep(e,n){let r=this.momentum.value(e);i(this._tmpPan,this.momentum.direction,r),n.eye=a(u,n.eye,this._tmpPan),n.center=a(u,n.center,this._tmpPan);let o=t(e-this._lastUpdateTime);this.constraintOptions.interactionDirection=this._tmpPan,this._remainingGroundCorrection=this._offsetCorrectionController.smoothlyCorrectGroundElevation({camera:n,deltaTime:o}),this._lastUpdateTime=e}get finished(){return super.finished&&this._remainingGroundCorrection<=.01}};e([n({constructOnly:!0})],l.prototype,`momentum`,void 0),l=e([r(`esri.views.3d.state.controllers.momentum.GroundNavigationMomentumController`)],l);const u=o();export{l as GroundNavigationMomentumController};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{clamp as e}from"../../../../core/mathUtils.js";import{dot as t,distance as n,subtract as r,scale as i,add as a,copy as o,normalize as s,cross as c,scaleAndAdd as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u,clone as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as f}from"../../../../geometry/support/ray.js";import p from"../../../../ground/NavigationConstraint.js";import{applyConstraintsAndUpdateCenterRenderCamera as m}from"../../camera/constraintUtils.js";import{Intersector as h}from"../../webgl-engine/lib/Intersector.js";const g=.5,_=new Set([0,2,8]),v=new Set(_).add(7);class y{constructor(e){this._view=e,this._tmpRay=f(),this._tmpWorldUp=u(),this._tmpScaledUp=u(),this._tmpCorrectionOffset=u(),this._tmpUpdatedCameraPos=u(),this._tmpCenterDiff=u(),this._tmpMovementDelta=u(),this._tmpPerpendicularMovementDelta=u(),this._tmpGroundIntersections=[u(),u(),u()],this._tmpGroundIntersectionHits=[!1,!1,!1],this._tmpRayOrigins=[u(),u(),u()],this._tmpRayDirection=u(),this._previousCameraPosition=null,this._intersector=new h(this._view.state.viewingMode),this._intersector.options.invisibleTerrain=!0}smoothlyCorrectGroundElevation(e){let{camera:n,deltaTime:r,constraintOptions:i,navigationModeOverride:a,forceStayAboveGround:o}=e,s=this._prepareMode(a);if(!s||!r)return 0;let c=this._view.renderCoordsHelper.worldUpAtPosition(n.eye,this._tmpWorldUp),l=this._prepareCameraAndPreviousIterationPosition(n,c,this._previousCameraPosition),u=this._prepareRays(n,c,l),f=this._intersectRays(s,c,u);if(!f.hasIntersection){let e=this._adjustCameraElevation(n,c,0,o,i);return this._previousCameraPosition=d(e),0}let p=this._filterRayResults(c,l,f),m=this._getSmoothedElevationCorrection(s,p,n,c,l,r),h=this._adjustCameraElevation(n,c,m,o,i);return this._previousCameraPosition=d(h),Math.abs(p-t(h,c))}immediatelyCorrectGroundElevation(e){let{camera:i,constraintOptions:a,navigationModeOverride:o,correctionLimit:s}=e,c=this._prepareMode(o);if(!c)return;let l=this._view.renderCoordsHelper.worldUpAtPosition(i.eye,this._tmpWorldUp),u=this._prepareRays(i,l),d=this._intersectRays(c,l,u),f=d.intersections[0];if(!d.hasIntersection||n(i.eye,f)>(s??1/0)){this._adjustCameraElevation(i,l,0,!1,a);return}this._adjustCameraElevation(i,l,t(l,r(this._tmpCorrectionOffset,f,i.eye)),!1,a)}_prepareMode(e){let t=e??this._view.navigation.mode;return t.type!==`ground`||!t.offset?null:t}_prepareCameraAndPreviousIterationPosition(e,n,r){if(r){let o=t(n,e.eye),s=t(n,r);return i(this._tmpCorrectionOffset,n,s-o),e.eye=a(this._tmpUpdatedCameraPos,e.eye,this._tmpCorrectionOffset),e.center=a(this._tmpUpdatedCameraPos,e.center,this._tmpCorrectionOffset),r}return e.eye}_prepareRays(e,t,n){let r=i(this._tmpRayDirection,t,-1e5);if(o(this._tmpRayOrigins[0],e.eye),!n)return{origins:this._tmpRayOrigins,direction:r,count:1};let{forwardMovementDirection:a,rightMovementDirection:s}=this._getMovementDirections(e.eye,n,t);return this._getLeftRayOrigin(e.eye,a,s,this._tmpRayOrigins[1]),this._getRightRayOrigin(e.eye,a,s,this._tmpRayOrigins[2]),{origins:this._tmpRayOrigins,direction:r,count:this._tmpRayOrigins.length}}_getMovementDirections(e,n,a){let o=r(this._tmpMovementDelta,e,n);return r(o,o,i(this._tmpScaledUp,a,t(a,o))),s(o,o),{forwardMovementDirection:o,rightMovementDirection:c(this._tmpPerpendicularMovementDelta,o,a)}}_getLeftRayOrigin(e,t,n,r){return l(r,e,t,g),l(r,r,n,-.5),r}_getRightRayOrigin(e,t,n,r){return l(r,e,t,g),l(r,r,n,g),r}_intersectRays(e,t,r){let i=e.offset,a=this._view.sceneIntersectionHelper,s=b(e,this._view.groundView.baseOpacity===0);o(this._tmpRay.direction,r.direction);for(let e=0;e<r.count;e++)o(this._tmpRay.origin,r.origins[e]),this._tmpGroundIntersectionHits[e]=a.intersectRay(this._tmpRay,this._intersector,this._tmpGroundIntersections[e],s),this._tmpGroundIntersectionHits[e]&&n(this._tmpGroundIntersections[e],this._tmpRay.origin)>1e5&&(this._tmpGroundIntersectionHits[e]=!1),this._tmpGroundIntersectionHits[e]&&l(this._tmpGroundIntersections[e],this._tmpGroundIntersections[e],t,i);let c=this._tmpGroundIntersectionHits.some((e,t)=>t<r.count&&e);return{intersections:this._tmpGroundIntersections,hits:this._tmpGroundIntersectionHits,count:r.count,hasIntersection:c}}_filterRayResults(e,n,r){let i=t(n,e),a=null;for(let n=0;n<r.count;n++){if(!r.hits[n])continue;let o=r.intersections[n],s=t(o,e);(a==null||Math.abs(s-i)<Math.abs(a-i))&&(a=s)}return a}_getSmoothedElevationCorrection(r,i,a,o,s,c){let l=n(a.eye,s)/c,u=1+Math.max(0,(l-5)*.03),d=(u*1e-5)**c,f=t(s,o)*d+i*(1-d),p=t(a.eye,o),m=u*5*c*(r.offset??0),h=f-p;return e(h,-m,m)}_adjustCameraElevation(e,t,n,i,o){n!==0&&(l(this._tmpUpdatedCameraPos,e.eye,t,n),r(this._tmpCenterDiff,e.center,e.eye),e.eye=this._tmpUpdatedCameraPos,e.center=a(this._tmpUpdatedCameraPos,this._tmpUpdatedCameraPos,this._tmpCenterDiff));let s=this._view.map.ground.navigationConstraint;return i&&s?.type!==`stay-above`?(this._view.map.ground.navigationConstraint=new p({type:`stay-above`}),m(this._view,e,o),this._view.map.ground.navigationConstraint=s):m(this._view,e,o),e.eye}}function b(e,t){return x(e.include)?{include:e.include,exclude:e.exclude}:{exclude:e.exclude,objectFilter:e=>!!e.lastValidElevationBB,allowedIntersectorTypes:t?_:v}}function x(e){return e!=null&&e.size>0}export{y as OffsetCorrectionController};
2
+ import{clamp as e}from"../../../../core/mathUtils.js";import{dot as t,distance as n,subtract as r,scale as i,add as a,copy as o,normalize as s,cross as c,scaleAndAdd as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u,clone as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as f}from"../../../../geometry/support/ray.js";import{applyConstraintsAndUpdateCenterRenderCamera as p}from"../../camera/constraintUtils.js";import{Intersector as m}from"../../webgl-engine/lib/Intersector.js";const h=.5,g=new Set([0,2,8]),_=new Set(g).add(7);class v{constructor(e){this._view=e,this._tmpRay=f(),this._tmpWorldUp=u(),this._tmpScaledUp=u(),this._tmpCorrectionOffset=u(),this._tmpUpdatedCameraPos=u(),this._tmpCenterDiff=u(),this._tmpMovementDelta=u(),this._tmpPerpendicularMovementDelta=u(),this._tmpGroundIntersections=[u(),u(),u()],this._tmpGroundIntersectionHits=[!1,!1,!1],this._tmpRayOrigins=[u(),u(),u()],this._tmpRayDirection=u(),this._previousCameraPosition=null,this._intersector=new m(this._view.state.viewingMode),this._intersector.options.invisibleTerrain=!0}smoothlyCorrectGroundElevation(e){let{camera:n,deltaTime:r,constraintOptions:i,navigationModeOverride:a}=e,o=this._prepareMode(a);if(!o||!r)return 0;let s=this._view.renderCoordsHelper.worldUpAtPosition(n.eye,this._tmpWorldUp),c=this._prepareCameraAndPreviousIterationPosition(n,s,this._previousCameraPosition),l=this._prepareRays(n,s,c),u=this._intersectRays(o,s,l);if(!u.hasIntersection){let e=this._adjustCameraElevation(n,s,0,i);return this._previousCameraPosition=d(e),0}let f=this._filterRayResults(s,c,u),p=this._getSmoothedElevationCorrection(o,f,n,s,c,r),m=this._adjustCameraElevation(n,s,p,i);return this._previousCameraPosition=d(m),Math.abs(f-t(m,s))}immediatelyCorrectGroundElevation(e){let{camera:i,constraintOptions:a,navigationModeOverride:o,correctionLimit:s}=e,c=this._prepareMode(o);if(!c)return;let l=this._view.renderCoordsHelper.worldUpAtPosition(i.eye,this._tmpWorldUp),u=this._prepareRays(i,l),d=this._intersectRays(c,l,u),f=d.intersections[0];if(!d.hasIntersection||n(i.eye,f)>(s??1/0)){this._adjustCameraElevation(i,l,0,a);return}this._adjustCameraElevation(i,l,t(l,r(this._tmpCorrectionOffset,f,i.eye)),a)}_prepareMode(e){let t=e??this._view.navigation.mode;return t.type!==`ground`||!t.offset?null:t}_prepareCameraAndPreviousIterationPosition(e,n,r){if(r){let o=t(n,e.eye),s=t(n,r);return i(this._tmpCorrectionOffset,n,s-o),e.eye=a(this._tmpUpdatedCameraPos,e.eye,this._tmpCorrectionOffset),e.center=a(this._tmpUpdatedCameraPos,e.center,this._tmpCorrectionOffset),r}return e.eye}_prepareRays(e,t,n){let r=i(this._tmpRayDirection,t,-1e5);if(o(this._tmpRayOrigins[0],e.eye),!n)return{origins:this._tmpRayOrigins,direction:r,count:1};let{forwardMovementDirection:a,rightMovementDirection:s}=this._getMovementDirections(e.eye,n,t);return this._getLeftRayOrigin(e.eye,a,s,this._tmpRayOrigins[1]),this._getRightRayOrigin(e.eye,a,s,this._tmpRayOrigins[2]),{origins:this._tmpRayOrigins,direction:r,count:this._tmpRayOrigins.length}}_getMovementDirections(e,n,a){let o=r(this._tmpMovementDelta,e,n);return r(o,o,i(this._tmpScaledUp,a,t(a,o))),s(o,o),{forwardMovementDirection:o,rightMovementDirection:c(this._tmpPerpendicularMovementDelta,o,a)}}_getLeftRayOrigin(e,t,n,r){return l(r,e,t,h),l(r,r,n,-.5),r}_getRightRayOrigin(e,t,n,r){return l(r,e,t,h),l(r,r,n,h),r}_intersectRays(e,t,r){let i=e.offset,a=this._view.sceneIntersectionHelper,s=y(e,this._view.groundView.baseOpacity===0);o(this._tmpRay.direction,r.direction);for(let e=0;e<r.count;e++)o(this._tmpRay.origin,r.origins[e]),this._tmpGroundIntersectionHits[e]=a.intersectRay(this._tmpRay,this._intersector,this._tmpGroundIntersections[e],s),this._tmpGroundIntersectionHits[e]&&n(this._tmpGroundIntersections[e],this._tmpRay.origin)>1e5&&(this._tmpGroundIntersectionHits[e]=!1),this._tmpGroundIntersectionHits[e]&&l(this._tmpGroundIntersections[e],this._tmpGroundIntersections[e],t,i);let c=this._tmpGroundIntersectionHits.some((e,t)=>t<r.count&&e);return{intersections:this._tmpGroundIntersections,hits:this._tmpGroundIntersectionHits,count:r.count,hasIntersection:c}}_filterRayResults(e,n,r){let i=t(n,e),a=null;for(let n=0;n<r.count;n++){if(!r.hits[n])continue;let o=r.intersections[n],s=t(o,e);(a==null||Math.abs(s-i)<Math.abs(a-i))&&(a=s)}return a}_getSmoothedElevationCorrection(r,i,a,o,s,c){let l=n(a.eye,s)/c,u=1+Math.max(0,(l-5)*.03),d=(u*1e-5)**c,f=t(s,o)*d+i*(1-d),p=t(a.eye,o),m=u*5*c*(r.offset??0),h=f-p;return e(h,-m,m)}_adjustCameraElevation(e,t,n,i){return n!==0&&(l(this._tmpUpdatedCameraPos,e.eye,t,n),r(this._tmpCenterDiff,e.center,e.eye),e.eye=this._tmpUpdatedCameraPos,e.center=a(this._tmpUpdatedCameraPos,this._tmpUpdatedCameraPos,this._tmpCenterDiff)),p(this._view,e,i),e.eye}}function y(e,t){return b(e.include)?{include:e.include,exclude:e.exclude}:{exclude:e.exclude,objectFilter:e=>!!e.lastValidElevationBB,allowedIntersectorTypes:t?g:_}}function b(e){return e!=null&&e.size>0}export{v as OffsetCorrectionController};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{handlesGroup as e}from"../../../core/handleUtils.js";import{watch as t,initial as n}from"../../../core/reactiveUtils.js";import r from"../../../geometry/Extent.js";import{projectOrLoad as i}from"../../../geometry/projectionUtils.js";import{projectBoundingRect as a}from"../../../geometry/projection/projectBoundingRect.js";import{intersects as o,fromExtent as s,empty as c}from"../../../geometry/support/aaBoundingRect.js";function l(c){let l=!1,p=(e,t,n)=>{if(l||u(e,n)||t==null)return;let m=i(t,c.view.spatialReference);if(m.pending!=null){l=!0,m.pending.finally(()=>{l=!1,p(e,t,n)});return}let h=m.geometry;if(h==null)return;let g=h.type===`point`?r.fromPoint(h):h.extent;g!=null&&a(e.extent,e.spatialReference,d,c.view.spatialReference)&&o(d,s(g,f))&&c.onElevationChanges()},m,h=t(()=>({elevationMode:c.elevationInfo?.mode,geometry:c.geometry}),({elevationMode:e,geometry:t})=>{m?.remove(),e!==`absolute-height`&&(m=c.view.elevationProvider.on(`elevation-change`,n=>p(n,t,e)))},n);return e([h,m])}function u({context:e},t){return t==null?!1:t===`absolute-height`||e===`scene`&&t!==`relative-to-scene`}const d=c(),f=c();export{l as createElevationUpdateHandle};
2
+ import{handlesGroup as e,refHandle as t}from"../../../core/handleUtils.js";import{watch as n,initial as r}from"../../../core/reactiveUtils.js";import i from"../../../geometry/Extent.js";import{projectOrLoad as a}from"../../../geometry/projectionUtils.js";import{projectBoundingRect as o}from"../../../geometry/projection/projectBoundingRect.js";import{intersects as s,fromExtent as c,empty as l}from"../../../geometry/support/aaBoundingRect.js";function u(l){let u=!1,m=(e,t,n)=>{if(u||d(e,n)||t==null)return;let r=a(t,l.view.spatialReference);if(r.pending!=null){u=!0,r.pending.finally(()=>{u=!1,m(e,t,n)});return}let h=r.geometry;if(h==null)return;let g=h.type===`point`?i.fromPoint(h):h.extent;g!=null&&o(e.extent,e.spatialReference,f,l.view.spatialReference)&&s(f,c(g,p))&&l.onElevationChanges()},h,g=n(()=>({elevationMode:l.elevationInfo?.mode,geometry:l.geometry()}),({elevationMode:e,geometry:t})=>{h?.remove(),e!==`absolute-height`&&(h=l.view.elevationProvider.on(`elevation-change`,n=>m(n,t,e)))},r);return e([g,t(()=>h)])}function d({context:e},t){return t==null?!1:t===`absolute-height`||e===`scene`&&t!==`relative-to-scene`}const f=l(),p=l();export{u as createElevationUpdateHandle};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{equals as e}from"../../../core/arrayUtils.js";import"../../../core/has.js";import{isPowerOfTwo as t}from"../../../core/mathUtils.js";import{disposeMaybe as n,releaseMaybe as r}from"../../../core/maybe.js";import{glLayout as i}from"../support/buffer/glUtil.js";import{GeometryState as a}from"./GeometryState.js";import{PatchGeometry as o}from"./PatchGeometry.js";import"../../../geometry/Extent.js";import"../../../geometry/support/Ellipsoid.js";import{internalAssert as s,neighborEdgeIndices as c,oppositeEdge as l,neighborCornerIndices as u,enableTerrainInternalChecks as d}from"./terrainUtils.js";import{maxTileNeighborLevelDelta as f}from"./TerrainConst.js";import{TextureFader as p}from"./TextureFader.js";import{TextureReference as m}from"./TextureReference.js";import h from"./TileOverlayData.js";import{fallsWithinLayerView as g}from"./tileUtils.js";import{VertexArrayObject as _}from"../webgl-engine/lib/VertexArrayObject.js";import{BufferObject as v}from"../../webgl/BufferObject.js";import{VertexBuffer as y}from"../../webgl/VertexBuffer.js";class b{constructor(){this.geometry=new o,this.geometryState=null,this._texture=null,this._textureOpacity=1,this._textureFader=new p(()=>this._tile.surface.fadeDuration),this.overlay=new h,this._localOrigin=null,this._geometryStateChangedSinceLastUpdate=!0,this._hasGeometry=!1,this._modifiedFlags=0}get tile(){return this._tile}get localOrigin(){return this._localOrigin}init(e,t){this.clear(),this._tile=e,this.geometry.reset(),this.intersectionData=null,this.geometryState=new a,this._localOrigin=t,this.overlay.clear()}clear(){this.releaseGeometry(),this.releaseTexture(),this._textureFader.clear(),this._tile=null,this.intersectionData=null,this.geometryState=null}updateGeometryIfNeeded(e){if(this._tile&&this.geometryState&&((!this._vao||this._geometryStateChangedSinceLastUpdate||this.wireframeChanged||this.clippingAreaChanged||this.samplerDataChanged||this.numVerticesPerSideChanged||this.dirtyCorners||this.dirtyEdgeResolutions||this.dirtyEdges)&&(this._updateGeometry(e),this._geometryStateChangedSinceLastUpdate=!1),d&&this.tile.intersectsClippingArea))for(let e=0;e<A;++e)s(this.geometry.getEdgeCount(e)===this.geometryState.edgeResolutions[e]+1)}_calculateEdgeResolution(e,t){let n=this.tile,r=this.geometryState.numVerticesPerSide-1;if(!n.surface.isGlobal){let t=n.surface.groundExtent;if(t!=null&&(e===0&&n.extent[3]>t[3]||e===1&&n.extent[2]>t[2]||e===2&&n.extent[1]<t[1]||e===3&&n.extent[0]<t[0]))return r}let i=n.level,a=c[e];if(!t)return s(n.surface?.rootTiles==null||n.surface.updatingRootTiles||!n.shouldHaveNeighbor(a)),r;if(t.loaded){let n=t,a=n.renderData?.geometryState;if(!a)return r;let o=i-n.level;if(s(o>=0),o===0){let e=a.numVerticesPerSide-1;return Math.max(e,r)}let c=2**o,l=a.edgeResolutions[(e+2)%4]/c;return Math.max(1,l)}s(!t.leaf);let o=r;return t.forAllSubtreeOnSide(l(a),e=>e===n?!0:e.loaded?(o=Math.max(o,2**(e.level-i)),!0):(s(!e.leaf),!1)),o}updateNeighborData(){let e=this.tile;if(!e.intersectsClippingArea)return;let n=e.renderData.geometryState,r=t=>(t.loaded||t.level===e.level)&&t.intersectsClippingArea,i=n.edgePeerNeighbors,a=n.edgePeerNeighborSamplerVersions;for(let o=0;o<A;++o){let l=e.findNeighborTile(c[o],r),u=S(e,l),p=u?.renderData?.geometryState.samplerDataVersion??-1,m=i[o],h=u!==S(e,m),g=a[o]!==p;d&&l&&(s(e.level>=l.level),s(e.level-l.level<=f)),i[o]=l,(h||g)&&(a[o]=p,this._markEdgeDirty(o));let _=n.edgeResolutions[o],v=this._calculateEdgeResolution(o,l);s(t(v)),s(v>=1),n.edgeResolutions[o]=v,_!==v&&this._markEdgeResolutionDirty(o)}for(let t=0;t<A;++t){let a=e.findNeighborTile(u[t],r);n.cornerPeerNeighbors[t]=a;let o=S(e,i[t]),c=S(e,i[(t+1)%A]),l=S(e,a);x[t]=l,x[(t+1)%A]=c,x[(t+2)%A]=e,x[(t+3)%A]=o,s(x.some(t=>t?.loaded||t===e));let f=x.reduce((e,t)=>Math.min(e,t?.level??1/0),1/0);x.forEach((e,t)=>{e&&e.level>f&&(x[t]=null)}),s(x.some(t=>t?.loaded||t===e));let p=n.cornerNeighborCornerTiles,m=n.cornerNeighborCornerTileSamplerVersions;for(let e=0;e<A;++e){let n=x[e],r=n?.renderData?.geometryState?.samplerDataVersion??-1,i=t*A+e,a=p[i]!==n,o=!a&&m[i]!==r;(a||o)&&(p[i]=n,m[i]=r,this._markCornerDirty(t))}d&&s(j.some(n=>{let r=p[t*A+n];return r?.loaded||r===e}))}d&&s(n.edgeResolutions.every(e=>e>0));for(let e=0;e<A;++e)x[e]=null}_updateGeometry(e){if(!this.tile.intersectsClippingArea)return;d&&s(!this.tile.intersectsClippingArea||this.geometryState.edgeResolutions.every(e=>e>0)),this.intersectionData=null;let{tile:t,_vao:n,geometry:r,geometryState:i}=this,{vertexAttributes:a}=r,o=!n||!a||this.wireframeChanged||this.samplerDataChanged||this.clippingAreaChanged,c=this.dirtyEdgeResolutions!==0,l=i.edgeResolutions.reduce((e,t)=>Math.max(e,t),0)+1,u=c&&l>r.maxEdgeVertexCount,f=o||this.numVerticesPerSideChanged||u,p=!f&&c,m=!p&&this.dirtyEdges!==0,h=!m&&this.dirtyCorners!==0;f?(this.releaseGeometry(),this._createGeometry(e)):p?t.updateEdgeElevationsAndResolutions():m||h?t.updateEdgeElevations():console.warn(`Update for no reason?`),this._modifiedFlags=0}get hasGeometry(){return this._hasGeometry}releaseGeometry(){return this._hasGeometry=!1,this.intersectionData=null,this._vao?(this._vao=n(this._vao),this.geometry.release(),!0):!1}ensureTexture(e,t,n,r){let i=t?6408:6407;return this._texture!=null&&(n===0&&this._tile.surface.fadeDuration>0&&this._isTextureVisible(this._texture)||this._texture.descriptor.width!==e||this._texture.descriptor.pixelFormat!==i)&&this.releaseTexture(),this._texture??(this._texture=r(),this.tile.setMemoryDirty()),this._texture}releaseTexture(){this._texture&&(this._texture=r(this._texture),this.tile.setMemoryDirty())}reuseTexture(e,t){return!e||!this._texture?!1:(e.setTextureReference(new m(this._texture,0,t,this._textureOpacity,0,1)),!0)}get numVerticesPerSideChanged(){return(this._modifiedFlags&C)!==0}get samplerDataChanged(){return(this._modifiedFlags&w)!==0}get clippingAreaChanged(){return(this._modifiedFlags&T)!==0}get wireframeChanged(){return(this._modifiedFlags&E)!==0}get dirtyEdges(){return this._modifiedFlags>>D&15}get dirtyCorners(){return this._modifiedFlags>>O&15}get dirtyEdgeResolutions(){return this._modifiedFlags>>k&15}_markCornerDirty(e){let t=1<<e<<O;this._modifiedFlags|=t}_markEdgeDirty(e){let t=1<<e<<D;this._modifiedFlags|=t,this._markCornerDirty((e+0)%4),this._markCornerDirty((e+3)%4)}_markEdgeResolutionDirty(e){let t=1<<e<<k;this._modifiedFlags|=t,this._markEdgeDirty(e)}_markAllEdgesAndCornersDirty(){this._modifiedFlags|=15<<O|15<<D|15<<k}updateGeometryState(){let t=this._elevationInfo,n=this.tile,r=t.samplerData?n.getElevationVerticesPerSide(t.maxTileLevel):n.minimumVerticesPerSide,i=Math.max(r,5),a=n.clippingArea;(!n.intersectsClippingArea||n.withinClippingArea)&&(a=null);let o=this.geometryState,s=!1;o.numVerticesPerSide!==i&&(this._modifiedFlags|=C,o.numVerticesPerSide=i,o.samplerDataVersion++,s=!0),t.changed&&(this._modifiedFlags|=w,o.samplerData=t.samplerData,o.samplerDataSourceLevels=t.samplerDataSourceLevels,o.samplerDataVersion++,s=!0),e(o.clippingArea,a)||(this._modifiedFlags|=T,o.clippingArea=a,s=!0);let c=n.surface.wireframe;return o.wireframe!==c&&(this._modifiedFlags|=E,o.wireframe=c,s=!0),this._geometryStateChangedSinceLastUpdate||=s,s&&this._markAllEdgesAndCornersDirty(),this._hasGeometry=!0,this._geometryStateChangedSinceLastUpdate}_createGeometry(e){this.tile.createGeometry();let{vertexAttributes:t,indices:n}=this.geometry,r=e.gl;this._vao=new _(e,new y(e,i(t.layout),t.buffer),v.createIndex(e,r.STATIC_DRAW,n)),this._hasGeometry=!0}get vao(){return this._vao}setTextureReference(e,t=0){e?.texture===this._texture?this._textureOpacity=e.opacities[0]:this.releaseTexture(),this._textureFader.push(e,t)}get textureReference(){return this._textureFader.current}get nextTextureReference(){return this._textureFader.next}get textureFadeFactor(){return this._textureFader.fadeFactor}get textureIsFading(){return this._textureFader.isFading}_isTextureVisible(e){return this._textureFader.current?.texture===e||this._textureFader.next?.texture===e&&this._textureFader.fadeFactor<1}get _elevationInfo(){let t=this.geometryState.samplerData,n=this.geometryState.samplerDataSourceLevels,r=this.tile.layerInfo[0],i=r.length,a=Array(i),o=Array(i),s=0,c=0,l=!1;for(let e=0;e<i;e++){let n=r[e],i=n.upsampleInfo?.tile;if(i){let n=i.layerInfo[0][e].data,r=n&&n.samplerData;(!t||t[s]!==r)&&(l=!0),a[s++]=r,o[s-1]=n?.level??i.level,c=Math.max(c,i.lij[0])}else if(n.data){let r=this.tile.surface.layerViewByIndex(e,0);if(g(this.tile,r)){let e=n.data;(!t||t[s]!==e.samplerData)&&(l=!0),a[s++]=e.samplerData,o[s-1]=e.level,c=this.tile.level}}}t!=null&&t.length!==s&&(l=!0);let u=s>0,d=u?a:null,f=u?o:null;return u&&(a.length=s,o.length=s),e(n,f)||(l=!0),{changed:l,samplerData:d,samplerDataSourceLevels:f,maxTileLevel:c}}get estimatedGeometryMemoryUsage(){let e=this.intersectionData?.estimatedMemoryUsage??0;return(this.geometry.indices?.byteLength??0)+(this.geometry.vertexAttributes?.byteLength??0)+e}get texture(){return this._texture}get test(){}checkGeometryWaterproofness(){}}const x=[null,null,null,null];function S(e,t){return t?.loaded||t===e?t:null}const C=1,w=2,T=4,E=8,D=4,O=8,k=12,A=4,j=[0,1,2,3];export{b as PatchRenderData,S as neighborTileIfLoadedOrSelf,j as zeroToFour};
2
+ import{equals as e}from"../../../core/arrayUtils.js";import"../../../core/has.js";import{isPowerOfTwo as t}from"../../../core/mathUtils.js";import{disposeMaybe as n,releaseMaybe as r}from"../../../core/maybe.js";import{equals as i}from"../../../geometry/support/aaBoundingRect.js";import{glLayout as a}from"../support/buffer/glUtil.js";import{GeometryState as o}from"./GeometryState.js";import{PatchGeometry as s}from"./PatchGeometry.js";import"../../../geometry/support/Ellipsoid.js";import{internalAssert as c,neighborEdgeIndices as l,oppositeEdge as u,neighborCornerIndices as d,enableTerrainInternalChecks as f}from"./terrainUtils.js";import{maxTileNeighborLevelDelta as p}from"./TerrainConst.js";import{TextureFader as m}from"./TextureFader.js";import{TextureReference as h}from"./TextureReference.js";import g from"./TileOverlayData.js";import{fallsWithinLayerView as _}from"./tileUtils.js";import{VertexArrayObject as v}from"../webgl-engine/lib/VertexArrayObject.js";import{BufferObject as y}from"../../webgl/BufferObject.js";import{VertexBuffer as b}from"../../webgl/VertexBuffer.js";class x{constructor(){this.geometry=new s,this.geometryState=null,this._texture=null,this._textureOpacity=1,this._textureFader=new m(()=>this._tile.surface.fadeDuration),this.overlay=new g,this._localOrigin=null,this._geometryStateChangedSinceLastUpdate=!0,this._hasGeometry=!1,this._modifiedFlags=0}get tile(){return this._tile}get localOrigin(){return this._localOrigin}init(e,t){this.clear(),this._tile=e,this.geometry.reset(),this.intersectionData=null,this.geometryState=new o,this._localOrigin=t,this.overlay.clear()}clear(){this.releaseGeometry(),this.releaseTexture(),this._textureFader.clear(),this._tile=null,this.intersectionData=null,this.geometryState=null}updateGeometryIfNeeded(e){if(this._tile&&this.geometryState&&((!this._vao||this._geometryStateChangedSinceLastUpdate||this.wireframeChanged||this.clippingAreaChanged||this.samplerDataChanged||this.numVerticesPerSideChanged||this.dirtyCorners||this.dirtyEdgeResolutions||this.dirtyEdges)&&(this._updateGeometry(e),this._geometryStateChangedSinceLastUpdate=!1),f&&this.tile.intersectsClippingArea))for(let e=0;e<j;++e)c(this.geometry.getEdgeCount(e)===this.geometryState.edgeResolutions[e]+1)}_calculateEdgeResolution(e,t){let n=this.tile,r=this.geometryState.numVerticesPerSide-1;if(!n.surface.isGlobal){let t=n.surface.groundExtent;if(t!=null&&(e===0&&n.extent[3]>t[3]||e===1&&n.extent[2]>t[2]||e===2&&n.extent[1]<t[1]||e===3&&n.extent[0]<t[0]))return r}let i=n.level,a=l[e];if(!t)return c(n.surface?.rootTiles==null||n.surface.updatingRootTiles||!n.shouldHaveNeighbor(a)),r;if(t.loaded){let n=t,a=n.renderData?.geometryState;if(!a)return r;let o=i-n.level;if(c(o>=0),o===0){let e=a.numVerticesPerSide-1;return Math.max(e,r)}let s=2**o,l=a.edgeResolutions[(e+2)%4]/s;return Math.max(1,l)}c(!t.leaf);let o=r;return t.forAllSubtreeOnSide(u(a),e=>e===n?!0:e.loaded?(o=Math.max(o,2**(e.level-i)),!0):(c(!e.leaf),!1)),o}updateNeighborData(){let e=this.tile;if(!e.intersectsClippingArea)return;let n=e.renderData.geometryState,r=t=>(t.loaded||t.level===e.level)&&t.intersectsClippingArea,i=n.edgePeerNeighbors,a=n.edgePeerNeighborSamplerVersions;for(let o=0;o<j;++o){let s=e.findNeighborTile(l[o],r),u=C(e,s),d=u?.renderData?.geometryState.samplerDataVersion??-1,m=i[o],h=u!==C(e,m),g=a[o]!==d;f&&s&&(c(e.level>=s.level),c(e.level-s.level<=p)),i[o]=s,(h||g)&&(a[o]=d,this._markEdgeDirty(o));let _=n.edgeResolutions[o],v=this._calculateEdgeResolution(o,s);c(t(v)),c(v>=1),n.edgeResolutions[o]=v,_!==v&&this._markEdgeResolutionDirty(o)}for(let t=0;t<j;++t){let a=e.findNeighborTile(d[t],r);n.cornerPeerNeighbors[t]=a;let o=C(e,i[t]),s=C(e,i[(t+1)%j]),l=C(e,a);S[t]=l,S[(t+1)%j]=s,S[(t+2)%j]=e,S[(t+3)%j]=o,c(S.some(t=>t?.loaded||t===e));let u=S.reduce((e,t)=>Math.min(e,t?.level??1/0),1/0);S.forEach((e,t)=>{e&&e.level>u&&(S[t]=null)}),c(S.some(t=>t?.loaded||t===e));let p=n.cornerNeighborCornerTiles,m=n.cornerNeighborCornerTileSamplerVersions;for(let e=0;e<j;++e){let n=S[e],r=n?.renderData?.geometryState?.samplerDataVersion??-1,i=t*j+e,a=p[i]!==n,o=!a&&m[i]!==r;(a||o)&&(p[i]=n,m[i]=r,this._markCornerDirty(t))}f&&c(M.some(n=>{let r=p[t*j+n];return r?.loaded||r===e}))}f&&c(n.edgeResolutions.every(e=>e>0));for(let e=0;e<j;++e)S[e]=null}_updateGeometry(e){if(!this.tile.intersectsClippingArea)return;f&&c(!this.tile.intersectsClippingArea||this.geometryState.edgeResolutions.every(e=>e>0)),this.intersectionData=null;let{tile:t,_vao:n,geometry:r,geometryState:i}=this,{vertexAttributes:a}=r,o=!n||!a||this.wireframeChanged||this.samplerDataChanged||this.clippingAreaChanged,s=this.dirtyEdgeResolutions!==0,l=i.edgeResolutions.reduce((e,t)=>Math.max(e,t),0)+1,u=s&&l>r.maxEdgeVertexCount,d=o||this.numVerticesPerSideChanged||u,p=!d&&s,m=!p&&this.dirtyEdges!==0,h=!m&&this.dirtyCorners!==0;d?(this.releaseGeometry(),this._createGeometry(e)):p?t.updateEdgeElevationsAndResolutions():m||h?t.updateEdgeElevations():console.warn(`Update for no reason?`),this._modifiedFlags=0}get hasGeometry(){return this._hasGeometry}releaseGeometry(){return this._hasGeometry=!1,this.intersectionData=null,this._vao?(this._vao=n(this._vao),this.geometry.release(),!0):!1}ensureTexture(e,t,n,r){let i=t?6408:6407;return this._texture!=null&&(n===0&&this._tile.surface.fadeDuration>0&&this._isTextureVisible(this._texture)||this._texture.descriptor.width!==e||this._texture.descriptor.pixelFormat!==i)&&this.releaseTexture(),this._texture??(this._texture=r(),this.tile.setMemoryDirty()),this._texture}releaseTexture(){this._texture&&(this._texture=r(this._texture),this.tile.setMemoryDirty())}reuseTexture(e,t){return!e||!this._texture?!1:(e.setTextureReference(new h(this._texture,0,t,this._textureOpacity,0,1)),!0)}get numVerticesPerSideChanged(){return(this._modifiedFlags&w)!==0}get samplerDataChanged(){return(this._modifiedFlags&T)!==0}get clippingAreaChanged(){return(this._modifiedFlags&E)!==0}get wireframeChanged(){return(this._modifiedFlags&D)!==0}get dirtyEdges(){return this._modifiedFlags>>O&15}get dirtyCorners(){return this._modifiedFlags>>k&15}get dirtyEdgeResolutions(){return this._modifiedFlags>>A&15}_markCornerDirty(e){let t=1<<e<<k;this._modifiedFlags|=t}_markEdgeDirty(e){let t=1<<e<<O;this._modifiedFlags|=t,this._markCornerDirty((e+0)%4),this._markCornerDirty((e+3)%4)}_markEdgeResolutionDirty(e){let t=1<<e<<A;this._modifiedFlags|=t,this._markEdgeDirty(e)}_markAllEdgesAndCornersDirty(){this._modifiedFlags|=15<<k|15<<O|15<<A}updateGeometryState(){let e=this._elevationInfo,t=this.tile,n=e.samplerData?t.getElevationVerticesPerSide(e.maxTileLevel):t.minimumVerticesPerSide,r=Math.max(n,5),a=t.clippingArea;(!t.intersectsClippingArea||t.withinClippingArea)&&(a=null);let o=this.geometryState,s=!1;o.numVerticesPerSide!==r&&(this._modifiedFlags|=w,o.numVerticesPerSide=r,o.samplerDataVersion++,s=!0),e.changed&&(this._modifiedFlags|=T,o.samplerData=e.samplerData,o.samplerDataSourceLevels=e.samplerDataSourceLevels,o.samplerDataVersion++,s=!0),i(o.clippingArea,a)||(this._modifiedFlags|=E,o.clippingArea=a,s=!0);let c=t.surface.wireframe;return o.wireframe!==c&&(this._modifiedFlags|=D,o.wireframe=c,s=!0),this._geometryStateChangedSinceLastUpdate||=s,s&&this._markAllEdgesAndCornersDirty(),this._hasGeometry=!0,this._geometryStateChangedSinceLastUpdate}_createGeometry(e){this.tile.createGeometry();let{vertexAttributes:t,indices:n}=this.geometry,r=e.gl;this._vao=new v(e,new b(e,a(t.layout),t.buffer),y.createIndex(e,r.STATIC_DRAW,n)),this._hasGeometry=!0}get vao(){return this._vao}setTextureReference(e,t=0){e?.texture===this._texture?this._textureOpacity=e.opacities[0]:this.releaseTexture(),this._textureFader.push(e,t)}get textureReference(){return this._textureFader.current}get nextTextureReference(){return this._textureFader.next}get textureFadeFactor(){return this._textureFader.fadeFactor}get textureIsFading(){return this._textureFader.isFading}_isTextureVisible(e){return this._textureFader.current?.texture===e||this._textureFader.next?.texture===e&&this._textureFader.fadeFactor<1}get _elevationInfo(){let t=this.geometryState.samplerData,n=this.geometryState.samplerDataSourceLevels,r=this.tile.layerInfo[0],i=r.length,a=Array(i),o=Array(i),s=0,c=0,l=!1;for(let e=0;e<i;e++){let n=r[e],i=n.upsampleInfo?.tile;if(i){let n=i.layerInfo[0][e].data,r=n&&n.samplerData;(!t||t[s]!==r)&&(l=!0),a[s++]=r,o[s-1]=n?.level??i.level,c=Math.max(c,i.lij[0])}else if(n.data){let r=this.tile.surface.layerViewByIndex(e,0);if(_(this.tile,r)){let e=n.data;(!t||t[s]!==e.samplerData)&&(l=!0),a[s++]=e.samplerData,o[s-1]=e.level,c=this.tile.level}}}t!=null&&t.length!==s&&(l=!0);let u=s>0,d=u?a:null,f=u?o:null;return u&&(a.length=s,o.length=s),e(n,f)||(l=!0),{changed:l,samplerData:d,samplerDataSourceLevels:f,maxTileLevel:c}}get estimatedGeometryMemoryUsage(){let e=this.intersectionData?.estimatedMemoryUsage??0;return(this.geometry.indices?.byteLength??0)+(this.geometry.vertexAttributes?.byteLength??0)+e}get texture(){return this._texture}get test(){}checkGeometryWaterproofness(){}}const S=[null,null,null,null];function C(e,t){return t?.loaded||t===e?t:null}const w=1,T=2,E=4,D=8,O=4,k=8,A=12,j=4,M=[0,1,2,3];export{x as PatchRenderData,C as neighborTileIfLoadedOrSelf,M as zeroToFour};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- const e={type:`empty-tile`};function t(e){return e!=null&&`type`in e&&e.type===`vector-tile`}function n(e){return e!=null&&`type`in e&&e.type===`raster-tile`}function r(e){return e!=null&&`type`in e&&e.type===`tile-texture`}function i(e){return e==null||`type`in e&&e.type===`empty-tile`}function a(e){return e!=null&&`type`in e&&`bitmap`in e}export{e as emptyTile,a as isCreateBitmapResult,i as isEmptyTile,n as isRasterTile,r as isTileTexture,t as isVectorTile};
2
+ const e={type:`empty-tile`};function t(e){return e!=null&&`type`in e&&e.type===`vector-tile`}function n(e){return e!=null&&`type`in e&&e.type===`raster-tile`}function r(e){return e!=null&&`type`in e&&e.type===`tile-texture`}function i(e){return e!=null&&`type`in e&&e.type===`empty-tile`}function a(e){return e!=null&&`type`in e&&`bitmap`in e}export{e as emptyTile,a as isCreateBitmapResult,i as isEmptyTile,n as isRasterTile,r as isTileTexture,t as isVectorTile};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{equals as e}from"../../../core/arrayUtils.js";import{fromValues as t}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";class n{constructor(e,n,r,i,a,o){this.texture=e,this.type=n,this.offsetAndScale=r,e.retain(),this.opacities=t(i,a,o)}destroy(){this.texture.release()}equals(t){return t!=null&&this.texture===t.texture&&e(this.offsetAndScale,t.offsetAndScale)&&e(this.opacities,t.opacities)}}export{n as TextureReference};
2
+ import{exactEquals as e}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as t}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{exactEquals as n}from"../../../core/libs/gl-matrix-2/math/vec4.js";class r{constructor(e,n,r,i,a,o){this.texture=e,this.type=n,this.offsetAndScale=r,e.retain(),this.opacities=t(i,a,o)}destroy(){this.texture.release()}equals(t){return t!=null&&this.texture===t.texture&&n(this.offsetAndScale,t.offsetAndScale)&&e(this.opacities,t.opacities)}}export{r as TextureReference};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../core/Collection.js";import{isEarth as t}from"../../../geometry/ellipsoidUtils.js";import{isCGCS2000 as n}from"../../../geometry/support/spatialReferenceUtils.js";import{getTileMaxtrixSetFromActiveLayer as r}from"../../../layers/support/layerUtils.js";import{isRasterTile as i,isCreateBitmapResult as a,isTileTexture as o,isVectorTile as s}from"./TerrainData.js";import{t as c}from"../../../chunks/terrainUtilsPlanar.js";import{t as l}from"../../../chunks/terrainUtilsSpherical.js";const u={1:l,2:c};function d(e,t){e||console.warn(`Terrain: `+t)}let f=!1,p=!1;function m(e){p=e,f||=e}function h(e){f=e}function g(e,t){if(f&&!e){let e=Error().stack?.slice(5);throw console.warn(`Terrain internal: `+(t??``)+` at `+e),Error(`Assertion failed`+(t?`: `+t:``))}}function _(e){return e?.type===`imagery-tile`||e?.type===`wcs`}function v(e){return e?.type===`imagery-tile-3d`}function y(e){return e?.type===`tile-3d`}function b(e){return e?.type===`vector-tile-3d`}function x(e){return e?.type===`wmts-3d`}function S(e){return e?.type===`elevation-3d`}function C(e){return e?.type===`group`}function w(e){return e&&(y(e)||x(e)||v(e)||b(e))}function T(e){return e&&(y(e)||v(e)||b(e)||x(e))}function E(e){return T(e)||S(e)}function D(e){return i(e?.sourceLayerInfo?.data)}function O(e){return e?.sourceLayerInfo?.data!=null&&j(e.sourceLayerInfo)||!!e?.isVTLBackground}function k(e){return o(e?.sourceLayerInfo?.data)}function A(e){let t=e?.sourceLayerInfo?.data;return a(t)}function j(e){return s(e?.data)}function M(e){return e!=null&&`release`in e&&e.release(),null}function N(e,t,n,r,i){return u[r].checkIfTileInfoSupportedForViewSR(e,n,t,i)}function P(e,t,n){let r=null,i=null;if(e?.type===`wmts`){let a=F(e,t,n);r=a.tileInfo,i=a.fullExtent}else{i=_(e)?e.getCompatibleFullExtent(t):e.fullExtent;let a=n===2;r=_(e)?e.getCompatibleTileInfo(t,i,a):e?.type===`vector-tile`?a&&!I(t)||L.force512VTL?e.tileInfo:e.tileInfo.getCompatibleForVTL(256):e.tileInfo}let a=`tilemapCache`in e?e.tilemapCache?.effectiveMaxLOD:void 0;return r!=null&&i!=null&&N(r,i,t,n,a)==null?{tileInfo:r,fullExtent:i}:null}function F(t,n,i){let a=r(t);if(a!=null){if(e.isCollection(a)){let e=a.find(e=>N(e.tileInfo,e.fullExtent,n,i)==null);if(e)return{tileInfo:e.tileInfo,fullExtent:e.fullExtent}}else return{tileInfo:a.tileInfo,fullExtent:a.fullExtent}}return{tileInfo:null,fullExtent:null}}function I(e){return e.isWGS84||e.isWebMercator||n(e)||!t(e)}const L={force512VTL:!1};function R(e){return`[`+e[0]+`,`+e[1]+`,`+e[2]+`]`}function z(e){return`(`+e[0]+`,`+e[1]+`,`+e[2]+`)`}function B(e,t,n=Z){return Math.abs(e-t)<n}function V(e){return e===1?5:e===7?3:e===5?1:7}function H(e){return e===0?4:e===2?6:e===4?0:2}function U(e){return e===7||e===5}function W(e){return e===7||e===1}function G(e){return e===7||e===6||e===5}function K(e){return e===1||e===2||e===3}function q(e){return e===3||e===4||e===5}function J(e){return e===1||e===0||e===7}const Y=[0,2,4,6],X=[1,3,5,7],Z=1e-5;export{B as almostEquals,N as checkIfTileInfoSupportedForView,h as enableInternalTerrainChecks,f as enableTerrainInternalChecks,m as enableTerrainWaterproofChecks,p as enableWaterproofTests,Z as eps,F as getTileInfoAndExtentFromWMTSLayer,P as getTiledLayerInfo,g as internalAssert,w as isBlendableLayerView,K as isEast,S as isElevationLayerView,C as isGroupLayerView,A as isImageSourceRenderInfo,v as isImageryTileLayerView,D as isImageryTileRenderInfo,T as isMapTileLayerView,J as isNorth,W as isNorthCorner,_ as isProjectableRasterLayer,q as isSouth,E as isSurfaceLayerView,k as isTextureTileRenderInfo,y as isTileLayerView,b as isVectorTileLayerView,j as isVectorTilePerLayerInfo,O as isVectorTileRenderInfo,x as isWMTSLayerView,G as isWest,U as isWestCorner,R as lij2s,X as neighborCornerIndices,Y as neighborEdgeIndices,V as oppositeCorner,H as oppositeEdge,M as releaseTerrainData,L as test,z as v32s,I as vtlAssumes256PixelSizeAsDefault,d as weakAssert};
2
+ import e from"../../../core/Collection.js";import{isEarth as t}from"../../../geometry/ellipsoidUtils.js";import{isCGCS2000 as n}from"../../../geometry/support/spatialReferenceUtils.js";import{getTileMaxtrixSetFromActiveLayer as r}from"../../../layers/support/layerUtils.js";import{isRasterTile as i,isCreateBitmapResult as a,isTileTexture as o,isVectorTile as s}from"./TerrainData.js";import{t as c}from"../../../chunks/terrainUtilsPlanar.js";import{t as l}from"../../../chunks/terrainUtilsSpherical.js";const u={1:l,2:c};function d(e,t){e||console.warn(`Terrain: `+t)}let f=!1,p=!1;function m(e){p=e,f||=e}function h(e){f=e}function g(e,t){if(f&&!e){let e=Error().stack?.slice(5);throw console.warn(`Terrain internal: `+(t??``)+` at `+e),Error(`Assertion failed`+(t?`: `+t:``))}}function _(e){return e?.type===`imagery-tile`||e?.type===`wcs`}function v(e){return e?.type===`imagery-tile-3d`}function y(e){return e?.type===`tile-3d`}function b(e){return e?.type===`vector-tile-3d`}function x(e){return e?.type===`wmts-3d`}function S(e){return e?.type===`elevation-3d`}function C(e){return e?.type===`group`}function w(e){return e&&(y(e)||x(e)||v(e)||b(e))}function T(e){return e&&(y(e)||v(e)||b(e)||x(e))}function E(e){return T(e)||S(e)}function D(e){return i(e?.sourceLayerInfo?.data)}function O(e){return j(e?.sourceLayerInfo)||!!e?.isVTLBackground}function k(e){return o(e?.sourceLayerInfo?.data)}function A(e){let t=e?.sourceLayerInfo?.data;return a(t)}function j(e){return s(e?.data)}function M(e){return e!=null&&`release`in e&&e.release(),null}function N(e,t,n,r,i){return u[r].checkIfTileInfoSupportedForViewSR(e,n,t,i)}function P(e,t,n){let r=null,i=null;if(e?.type===`wmts`){let a=F(e,t,n);r=a.tileInfo,i=a.fullExtent}else{i=_(e)?e.getCompatibleFullExtent(t):e.fullExtent;let a=n===2;r=_(e)?e.getCompatibleTileInfo(t,i,a):e?.type===`vector-tile`?a&&!I(t)||L.force512VTL?e.tileInfo:e.tileInfo.getCompatibleForVTL(256):e.tileInfo}let a=`tilemapCache`in e?e.tilemapCache?.effectiveMaxLOD:void 0;return r!=null&&i!=null&&N(r,i,t,n,a)==null?{tileInfo:r,fullExtent:i}:null}function F(t,n,i){let a=r(t);if(a!=null){if(e.isCollection(a)){let e=a.find(e=>N(e.tileInfo,e.fullExtent,n,i)==null);if(e)return{tileInfo:e.tileInfo,fullExtent:e.fullExtent}}else return{tileInfo:a.tileInfo,fullExtent:a.fullExtent}}return{tileInfo:null,fullExtent:null}}function I(e){return e.isWGS84||e.isWebMercator||n(e)||!t(e)}const L={force512VTL:!1};function R(e){return`[`+e[0]+`,`+e[1]+`,`+e[2]+`]`}function z(e){return`(`+e[0]+`,`+e[1]+`,`+e[2]+`)`}function B(e,t,n=Z){return Math.abs(e-t)<n}function V(e){return e===1?5:e===7?3:e===5?1:7}function H(e){return e===0?4:e===2?6:e===4?0:2}function U(e){return e===7||e===5}function W(e){return e===7||e===1}function G(e){return e===7||e===6||e===5}function K(e){return e===1||e===2||e===3}function q(e){return e===3||e===4||e===5}function J(e){return e===1||e===0||e===7}const Y=[0,2,4,6],X=[1,3,5,7],Z=1e-5;export{B as almostEquals,N as checkIfTileInfoSupportedForView,h as enableInternalTerrainChecks,f as enableTerrainInternalChecks,m as enableTerrainWaterproofChecks,p as enableWaterproofTests,Z as eps,F as getTileInfoAndExtentFromWMTSLayer,P as getTiledLayerInfo,g as internalAssert,w as isBlendableLayerView,K as isEast,S as isElevationLayerView,C as isGroupLayerView,A as isImageSourceRenderInfo,v as isImageryTileLayerView,D as isImageryTileRenderInfo,T as isMapTileLayerView,J as isNorth,W as isNorthCorner,_ as isProjectableRasterLayer,q as isSouth,E as isSurfaceLayerView,k as isTextureTileRenderInfo,y as isTileLayerView,b as isVectorTileLayerView,j as isVectorTilePerLayerInfo,O as isVectorTileRenderInfo,x as isWMTSLayerView,G as isWest,U as isWestCorner,R as lij2s,X as neighborCornerIndices,Y as neighborEdgeIndices,V as oppositeCorner,H as oppositeEdge,M as releaseTerrainData,L as test,z as v32s,I as vtlAssumes256PixelSizeAsDefault,d as weakAssert};
@@ -1,12 +1,12 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{DecodeSymbolColor as t}from"./DecodeSymbolColor.glsl.js";import{TextureBackedBufferModule as n}from"../../../core/shaderLibrary/TextureBackedBuffer.glsl.js";import{EmissionsConfiguration as r,hasEmissiveStrengthFromUniform as i}from"../../../core/shaderLibrary/output/getEmissions.glsl.js";import{Float4DrawUniform as a}from"../../../core/shaderModules/Float4DrawUniform.js";import{FloatDrawUniform as o}from"../../../core/shaderModules/FloatDrawUniform.js";import{glsl as s,If as c}from"../../../core/shaderModules/glsl.js";import{IntegerDrawUniform as l}from"../../../core/shaderModules/IntegerDrawUniform.js";import{Texture2DUintDrawUniform as u}from"../../../core/shaderModules/Texture2DUintDrawUniform.js";import{parameter as d}from"../../../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{olidEnabled as f}from"../../../effects/geometry/olidUtils.js";import{componentDataLayout as p,componentDataOlidLayout as m}from"../../../materials/DefaultLayouts.js";import{floatBlendScale as h}from"../../../shaders/floatBlendScale.glsl.js";class g extends r{constructor(){super(...arguments),this.componentDataType=0}}e([d({count:2})],g.prototype,`componentDataType`,void 0);function _(e,t){switch(t.componentDataType){case 1:return S(e,t);case 0:case 2:return C(e,t);default:t.componentDataType}}const v=new u(`componentTextureBuffer`,e=>e.textureBackedBuffer?.texture),y=new n({layout:p,itemIndexExpression:`componentIndex`,bufferUniform:v}),b=new n({layout:m,itemIndexExpression:`componentIndex`,bufferUniform:v});function x(){return f()?b:y}function S(e,n){let{vertex:r,fragment:a}=e,{output:o,hasEmission:l}=n,u=o===11,d=x().createBuilder(e,n);e.attributes.add(`componentIndex`,`uint`),e.varyings.add(`vExternalColorMixMode`,`mediump float`),e.varyings.add(`vExternalColor`,`vec4`),u&&e.varyings.add(`vObjectAndLayerIdColor`,`vec4`);let f=l&&!i(n);f&&(e.varyings.add(`emissiveStrength`,`float`),e.varyings.add(`emissiveSource`,`int`)),e.include(t),r.include(h,n),r.code.add(s`
2
+ import{__decorate as e}from"tslib";import{DecodeSymbolColor as t}from"./DecodeSymbolColor.glsl.js";import{TextureBackedBufferModule as n}from"../../../core/shaderLibrary/TextureBackedBuffer.glsl.js";import{EmissionsConfiguration as r,hasEmissiveStrengthFromUniform as i}from"../../../core/shaderLibrary/output/getEmissions.glsl.js";import{Float4DrawUniform as a}from"../../../core/shaderModules/Float4DrawUniform.js";import{FloatDrawUniform as o}from"../../../core/shaderModules/FloatDrawUniform.js";import{glsl as s,If as c}from"../../../core/shaderModules/glsl.js";import{IntegerDrawUniform as l}from"../../../core/shaderModules/IntegerDrawUniform.js";import{Texture2DUintDrawUniform as u}from"../../../core/shaderModules/Texture2DUintDrawUniform.js";import{parameter as d}from"../../../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{olidEnabled as f}from"../../../effects/geometry/olidUtils.js";import{componentDataLayout as p,componentDataOlidLayout as m}from"../../../materials/DefaultLayouts.js";import{floatBlendScale as h}from"../../../shaders/floatBlendScale.glsl.js";class g extends r{constructor(){super(...arguments),this.componentDataType=0}}e([d({count:2})],g.prototype,`componentDataType`,void 0);function _(e,t){switch(t.componentDataType){case 1:return S(e,t);case 0:case 2:return C(e,t);default:t.componentDataType}}const v=new u(`componentTextureBuffer`,e=>e.textureBackedBuffer?.texture),y=new n({layout:p,itemIndexExpression:`componentIndex`,bufferUniform:v}),b=new n({layout:m,itemIndexExpression:`componentIndex`,bufferUniform:v});function x(){return f()?b:y}function S(e,n){let{vertex:r,fragment:a}=e,{output:o,hasEmission:l}=n,u=o===11,d=x().createBuilder(e,n);e.attributes.add(`componentIndex`,`uint`),e.varyings.add(`vExternalColorMixMode`,`mediump float`),e.varyings.add(`vExternalColor`,`vec4`),u&&e.varyings.add(`vObjectAndLayerIdColor`,`vec4`);let f=l&&!i(n);f&&(e.varyings.add(`emissiveStrength`,`float`),e.varyings.add(`emissiveSource`,`float`)),e.include(t),r.include(h,n),r.code.add(s`
3
3
  float readElevationOffset() {
4
4
  return ${d.getTextureAttribute(`elevationOffset`)};
5
5
  }
6
6
 
7
7
  void forwardEmissiveStrength() {
8
8
  ${c(f,s`emissiveStrength = clamp(${d.getTextureAttribute(`emissiveStrength`)}, 0.0, maxEmissiveStrength);
9
- emissiveSource = ${d.getTextureAttribute(`emissiveSourceMode`)} == 0u ? 0 : 1;`)}
9
+ emissiveSource = ${d.getTextureAttribute(`emissiveSourceMode`)} == 0u ? 0.0 : 1.0;`)}
10
10
  }
11
11
 
12
12
  void forwardObjectAndLayerIdColor() {
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{MaskedColorDefinition as e,CreateMaskedFromUInt8NaNColor as t,MultiplyMaskedColors as n}from"./MaskedColor.glsl.js";import{glsl as r}from"../../shaderModules/glsl.js";import{IntegerPassUniform as i}from"../../shaderModules/IntegerPassUniform.js";import{colorMixModes as a}from"../../../materials/internal/MaterialUtil.js";function o(o,s){o.varyings.add(`colorMixMode`,`int`),o.varyings.add(`opacityMixMode`,`int`),o.vertex.uniforms.add(new i(`symbolColorMixMode`,e=>a[e.colorMixMode])),s.hasSymbolColors?(o.vertex.include(e),o.vertex.include(t),o.vertex.include(n),o.attributes.add(`symbolColor`,`vec4`),o.vertex.code.add(r`
2
+ import{MaskedColorDefinition as e,CreateMaskedFromUInt8NaNColor as t,MultiplyMaskedColors as n}from"./MaskedColor.glsl.js";import{glsl as r}from"../../shaderModules/glsl.js";import{IntegerPassUniform as i}from"../../shaderModules/IntegerPassUniform.js";import{colorMixModes as a}from"../../../materials/internal/MaterialUtil.js";function o(o,s){o.varyings.add(`colorMixMode`,`float`),o.varyings.add(`opacityMixMode`,`float`),o.vertex.uniforms.add(new i(`symbolColorMixMode`,e=>a[e.colorMixMode])),s.hasSymbolColors?(o.vertex.include(e),o.vertex.include(t),o.vertex.include(n),o.attributes.add(`symbolColor`,`vec4`),o.vertex.code.add(r`
3
3
  MaskedColor applySymbolColor(MaskedColor color) {
4
4
  return multiplyMaskedColors(color, createMaskedFromUInt8NaNColor(${`symbolColor`}));
5
5
  }
@@ -7,7 +7,7 @@ import{MaskedColorDefinition as e,CreateMaskedFromUInt8NaNColor as t,MultiplyMas
7
7
  return color;
8
8
  }`),o.vertex.code.add(r`
9
9
  void forwardColorMixMode(bvec4 mask) {
10
- colorMixMode = mask.r ? ${r.int(a.ignore)} : symbolColorMixMode;
11
- opacityMixMode = mask.a ? ${r.int(a.ignore)} : symbolColorMixMode;
10
+ colorMixMode = float(mask.r ? ${r.int(a.ignore)} : symbolColorMixMode) + 0.5;
11
+ opacityMixMode = float(mask.a ? ${r.int(a.ignore)} : symbolColorMixMode) + 0.5;
12
12
  }
13
13
  `)}export{o as SymbolColor};
@@ -11,7 +11,7 @@ import{InstanceColor as e}from"../attributes/InstanceColor.glsl.js";import{Maske
11
11
  }
12
12
 
13
13
  bool shouldCullByOpacity() {
14
- return opacityMixMode != ${c.int(u.ignore)} && vExternalColor.a < alphaCutoff;
14
+ return int(opacityMixMode) != ${c.int(u.ignore)} && vExternalColor.a < alphaCutoff;
15
15
  }
16
16
  `),h.include(a),h.uniforms.add(new s(`opacity`,e=>e.opacity),new s(`layerOpacity`,e=>e.layerOpacity)),h.code.add(c`
17
17
  float getDefaultMaterialOpacity(float textureOpacity) {
@@ -19,7 +19,7 @@ import{InstanceColor as e}from"../attributes/InstanceColor.glsl.js";import{Maske
19
19
  ${l(p.hasVertexColors,`vColor.a * `)} opacity,
20
20
  textureOpacity,
21
21
  vExternalColor.a,
22
- opacityMixMode
22
+ int(opacityMixMode)
23
23
  );
24
24
  }
25
25
  `)}export{f as DefaultMaterialExternalColor};
@@ -1,7 +1,7 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
2
  import{__decorate as e}from"tslib";import{clamp as t}from"../../../../../../core/mathUtils.js";import{isColor as n}from"../ShaderOutput.js";import{ShaderOutputConfiguration as r}from"../ShaderOutputConfiguration.js";import{VertexTextureCoordinates as i}from"../attributes/VertexTextureCoordinates.glsl.js";import{Gamma as a}from"../shading/Gamma.glsl.js";import{Float3DrawUniform as o}from"../../shaderModules/Float3DrawUniform.js";import{Float3PassUniform as s}from"../../shaderModules/Float3PassUniform.js";import{FloatDrawUniform as c}from"../../shaderModules/FloatDrawUniform.js";import{FloatPassUniform as l}from"../../shaderModules/FloatPassUniform.js";import{glsl as u}from"../../shaderModules/glsl.js";import{Texture2DDrawUniform as d}from"../../shaderModules/Texture2DDrawUniform.js";import{Texture2DPassUniform as f}from"../../shaderModules/Texture2DPassUniform.js";import{parameter as p}from"../../shaderTechnique/ShaderTechniqueConfiguration.js";import{floatBlendReductionFactor as m}from"../../../shaders/floatBlendScale.glsl.js";const h=1;class g extends r{constructor(){super(...arguments),this.emissionSource=0}}e([p({count:8})],g.prototype,`emissionSource`,void 0),e([p()],g.prototype,`hasEmissiveTextureTransform`,void 0);function _(e,r){let{hasEmission:p,emissionSource:h,hasEmissiveTextureTransform:g,bindType:_}=r;if(!n(r.output)||!p)return;let y=e.fragment;if(y.include(a),h===0){y.code.add(`vec4 getEmissions(vec3 symbolColor) { return vec4(0.0);}`);return}let b=h===3||h===4||h===5;b&&(e.include(i,r),y.uniforms.add(_===1?new f(`texEmission`,e=>e.textureEmissive):new d(`texEmission`,e=>e.textureEmissive)));let x=h===2||b;if(x&&y.uniforms.add(_===1?new s(`emissiveBaseColor`,e=>e.emissiveBaseColor):new o(`emissiveBaseColor`,e=>e.emissiveBaseColor)),v(r)){let e=e=>t(e??0,0,m);y.uniforms.add(_===1?new l(`emissiveStrength`,t=>e(t.emissiveStrength)):new c(`emissiveStrength`,t=>e(t.emissiveStrength)))}let S=h===7,C=h===5,w=h===1||h===6||S;y.code.add(u`vec4 getEmissions(vec3 symbolColor) {
3
- vec4 emissions =`),x?C?y.code.add(`emissiveSource == 0 ? vec4(emissiveBaseColor, 1.0): vec4(linearizeGamma(symbolColor), 1.0)`):y.code.add(`vec4(emissiveBaseColor, 1.0)`):w?S?y.code.add(`emissiveSource == 0 ? vec4(0.0): vec4(linearizeGamma(symbolColor), 1.0)`):y.code.add(`vec4(linearizeGamma(symbolColor), 1.0)`):y.code.add(`vec4(0.0)`),y.code.add(`;`),b&&(C?y.code.add(u`
4
- if(emissiveSource == 0) {
3
+ vec4 emissions =`),x?C?y.code.add(`emissiveSource < 0.5 ? vec4(emissiveBaseColor, 1.0): vec4(linearizeGamma(symbolColor), 1.0)`):y.code.add(`vec4(emissiveBaseColor, 1.0)`):w?S?y.code.add(`emissiveSource < 0.5 ? vec4(0.0): vec4(linearizeGamma(symbolColor), 1.0)`):y.code.add(`vec4(linearizeGamma(symbolColor), 1.0)`):y.code.add(`vec4(0.0)`),y.code.add(`;`),b&&(C?y.code.add(u`
4
+ if(emissiveSource < 0.5) {
5
5
  vec4 emissiveFromTex = textureLookup(texEmission, ${g?`emissiveUV`:`vuv0`});
6
6
  emissions *= vec4(linearizeGamma(emissiveFromTex.rgb), emissiveFromTex.a);
7
7
  }
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"../../../../core/has.js";import{generateUID as e}from"../../../../core/uid.js";import{getMetersPerUnitForSR as t}from"../../../../core/units.js";import{subtract as n,distance as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{projectBuffer as o}from"../../../../geometry/projection/projectBuffer.js";import{Attribute as s}from"./Attribute.js";import{Geometry as c}from"./Geometry.js";import{fromValues as l}from"./LocalOriginFactory.js";import{Object3D as u}from"./Object3D.js";import{gridLocalOriginFactory as d}from"./testUtils.js";import{WebGLLayer as f}from"./WebGLLayer.js";import{RibbonLineMaterial as p}from"../materials/RibbonLineMaterial.js";class m{constructor(n){this._originSR=n,this._rootOriginId=`root/`+e(),this._origins=new Map,this._objects=new Map,this._gridSize=5e5,this._originSR?.isGeographic&&(this._gridSize/=t(this._originSR)),this._baselineDistance=this._gridSize*.5;let r=this._baselineDistance*g;this._baselineObjectSize=r/_}getOrigin(e){let t=this._origins.get(this._rootOriginId);if(t==null){let t=d.rootOrigin;if(t!=null)return this._origins.set(this._rootOriginId,l(t[0],t[1],t[2],this._rootOriginId)),this.getOrigin(e);let n=l(e[0],e[1],e[2],this._rootOriginId);return this._origins.set(this._rootOriginId,n),n}let r=this._gridSize,i=Math.round(e[0]/r),a=Math.round(e[1]/r),o=Math.round(e[2]/r),s=`${i}/${a}/${o}`,c=this._origins.get(s),u=r*.5;if(n(h,e,t.vec3),h[0]=Math.abs(h[0]),h[1]=Math.abs(h[1]),h[2]=Math.abs(h[2]),h[0]<u&&h[1]<u&&h[2]<u){if(c){let t=Math.max(...h);if(n(h,e,c.vec3),h[0]=Math.abs(h[0]),h[1]=Math.abs(h[1]),h[2]=Math.abs(h[2]),Math.max(...h)<t)return c}return t}return c||(c=l(i*r,a*r,o*r,s),this._origins.set(s,c)),c}needsOriginUpdate(e,t,n){let i=r(e.vec3,t),a=Math.max(1,n/this._baselineObjectSize);return i>this._baselineDistance*a}_drawOriginBox(e,t=a(1,1,0,1)){let n=window.view,r=n.stage,i=t.toString();if(!this._objects.has(i)){this._material=new p({width:2,color:t},!1);let e=new f(r,{pickable:!1}),n=new u({castShadow:!1});e.add(n),this._objects.set(i,n)}let l=this._objects.get(i),d=[0,1,5,4,0,2,1,7,6,2,0,1,3,7,5,4,6,2,0],m=d.length,h=Array(m*3),g=[],_=this._gridSize*.5;for(let t=0;t<m;t++)h[t*3]=e[0]+(d[t]&1?_:-_),h[t*3+1]=e[1]+(d[t]&2?_:-_),h[t*3+2]=e[2]+(d[t]&4?_:-_),t>0&&g.push(t-1,t);o(h,this._originSR,0,h,n.renderSpatialReference,0,m);let v=new c(this._material,[[`position`,new s(h,g,3,!0)]],null);l.addGeometry(v)}get test(){}}const h=i(),g=2**-23,_=.05;export{m as GridLocalOriginFactory};
2
+ import"../../../../core/has.js";import{generateUID as e}from"../../../../core/uid.js";import{getMetersPerUnitForSR as t}from"../../../../core/units.js";import{subtract as n,distance as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{projectBuffer as o}from"../../../../geometry/projection/projectBuffer.js";import{Attribute as s}from"./Attribute.js";import{Geometry as c}from"./Geometry.js";import{fromValues as l}from"./LocalOriginFactory.js";import{Object3D as u}from"./Object3D.js";import{gridLocalOriginFactory as d}from"./testUtils.js";import{WebGLLayer as f}from"./WebGLLayer.js";import{RibbonLineMaterial as p}from"../materials/RibbonLineMaterial.js";class m{constructor(n){this._originSR=n,this._rootOriginId=`root/`+e(),this._origins=new Map,this._objects=new Map,this._gridSize=5e5,this._originSR?.isGeographic&&(this._gridSize/=t(this._originSR)),this._baselineDistance=this._gridSize*.5;let r=this._baselineDistance*g;this._baselineObjectSize=r/_}getOrigin(e){let t=this._origins.get(this._rootOriginId);if(t==null){let t=d.rootOrigin;if(t!=null)return this._origins.set(this._rootOriginId,l(t[0],t[1],t[2],this._rootOriginId)),this.getOrigin(e);let n=l(e[0],e[1],e[2],this._rootOriginId);return this._origins.set(this._rootOriginId,n),n}let r=this._gridSize,i=Math.round(e[0]/r),a=Math.round(e[1]/r),o=Math.round(e[2]/r),s=`${i}/${a}/${o}`,c=this._origins.get(s),u=r*.5;if(n(h,e,t.vec3),h[0]=Math.abs(h[0]),h[1]=Math.abs(h[1]),h[2]=Math.abs(h[2]),h[0]<u&&h[1]<u&&h[2]<u){if(c){let t=Math.max(...h);if(n(h,e,c.vec3),h[0]=Math.abs(h[0]),h[1]=Math.abs(h[1]),h[2]=Math.abs(h[2]),Math.max(...h)<t)return c}return t}return c||(c=l(i*r,a*r,o*r,s),this._origins.set(s,c)),c}needsOriginUpdate(e,t,n){let i=r(e.vec3,t),a=Math.max(1,n/this._baselineObjectSize);return i>this._baselineDistance*a}_drawOriginBox(e,t=a(1,1,0,1)){let n=window.view,r=n.stage,i=t.toString();if(!this._objects.has(i)){this._material=new p({width:2,color:t},n);let e=new f(r,{pickable:!1}),a=new u({castShadow:!1});e.add(a),this._objects.set(i,a)}let l=this._objects.get(i),d=[0,1,5,4,0,2,1,7,6,2,0,1,3,7,5,4,6,2,0],m=d.length,h=Array(m*3),g=[],_=this._gridSize*.5;for(let t=0;t<m;t++)h[t*3]=e[0]+(d[t]&1?_:-_),h[t*3+1]=e[1]+(d[t]&2?_:-_),h[t*3+2]=e[2]+(d[t]&4?_:-_),t>0&&g.push(t-1,t);o(h,this._originSR,0,h,n.renderSpatialReference,0,m);let v=new c(this._material,[[`position`,new s(h,g,3,!0)]],null);l.addGeometry(v)}get test(){}}const h=i(),g=2**-23,_=.05;export{m as GridLocalOriginFactory};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import has from"../../../../core/has.js";import{disposeMaybe as e}from"../../../../core/maybe.js";import{ScreenSpaceGeometry as t}from"../effects/ScreenSpaceGeometry.js";import{createEmptyTexture as n}from"./glUtil3D.js";import{IndexBufferCache as r}from"../materials/renderers/IndexBufferCache.js";import{TextureBufferCache as i}from"../materials/renderers/TextureBufferCache.js";import{VaoCache as a}from"../materials/renderers/VaoCache.js";import{VboCache as o}from"../materials/renderers/VboCache.js";import{RenderingContext as s}from"../../../webgl/RenderingContext.js";class c extends s{constructor(e,r){super(e,r),this.emptyTexture=n(this),this._vaoCaches=new Map,this._vboCaches=new Map,this._indexBufferCache=null,this._textureBufferCaches=new Map,this.debugBoundTechnique=``,this._refCount=1,this._newCache=r.newCache,this._screen=new t(this)}configure(e){super.configure(e),this._newCache=e.newCache}destroy(){this._vaoCaches.forEach(e=>e.dispose()),this._vaoCaches.clear(),this._vboCaches.forEach(e=>e.dispose()),this._vboCaches.clear(),this._indexBufferCache=e(this._indexBufferCache),this._textureBufferCaches.forEach(e=>e.dispose()),this._textureBufferCaches.clear(),!(--this._refCount>0)&&this.dispose()}ref(){++this._refCount}get refCount(){return this._refCount}dispose(){this.emptyTexture.dispose(),this._screen.destroy(),this._screen=null,super.dispose(),this._vaoCaches.forEach(e=>e.dispose()),this._vaoCaches.clear(),this._vboCaches.forEach(e=>e.dispose()),this._vboCaches.clear(),this._indexBufferCache?.dispose(),this._indexBufferCache=null,this._textureBufferCaches.forEach(e=>e.dispose()),this._textureBufferCaches.clear()}get newCache(){return this._newCache}get screen(){return this._screen}getVaoCache(e){let t=JSON.stringify(e),n=this._vaoCaches.get(t);if(n)return n;let r=new a(this,e);return this._vaoCaches.set(t,r),r}getVboCache(e){let t=JSON.stringify(e),n=this._vboCaches.get(t);if(n)return n;let r=new o(this,e);return this._vboCaches.set(t,r),r}get indexBufferCache(){return this._indexBufferCache??=new r(this),this._indexBufferCache}getTextureBufferCache(e){let t=JSON.stringify(e),n=this._textureBufferCaches.get(t);if(n)return n;let r=new i(this,e);return this._textureBufferCaches.set(t,r),r}bindTechnique(e,t,n,r){return this.debugBoundTechnique=e.declaredClass,this.useProgram(e.program),this.setPipelineState(e.getPipeline(t,n)),e.program.bind(t),e.program.bindPass(t,n),r&&e.program.bindDraw(t,n,r),e.program}get isAssumedMetalDriver(){if(this._isAssumedMetalDriver==null&&(this._isAssumedMetalDriver=!!has(`ios`)||!!has(`safari`),!this._isAssumedMetalDriver&&has(`mac`)&&has(`chrome`))){let e=this.capabilities.rendererInfo?.getUnmaskedRenderer().toLowerCase(),t=e?.includes(`apple`)&&e?.includes(`angle`)&&e?.includes(`metal`);this._isAssumedMetalDriver=t??!0}return this._isAssumedMetalDriver}get test(){}}export{c as RenderingContext};
2
+ import has from"../../../../core/has.js";import{disposeMaybe as e}from"../../../../core/maybe.js";import{ScreenSpaceGeometry as t}from"../effects/ScreenSpaceGeometry.js";import{createEmptyTexture as n}from"./glUtil3D.js";import{IndexBufferCache as r}from"../materials/renderers/IndexBufferCache.js";import{TextureBufferCache as i}from"../materials/renderers/TextureBufferCache.js";import{VaoCache as a}from"../materials/renderers/VaoCache.js";import{VboCache as o}from"../materials/renderers/VboCache.js";import{RenderingContext as s}from"../../../webgl/RenderingContext.js";class c extends s{constructor(e,r){super(e,r),this.emptyTexture=n(this),this._vaoCaches=new Map,this._vboCaches=new Map,this._indexBufferCache=null,this._textureBufferCaches=new Map,this.debugBoundTechnique=``,this._refCount=1,this._newCache=r.newCache,this._screen=new t(this)}configure(e){super.configure(e),this._newCache=e.newCache,this._isAssumedMetalDriver=null}destroy(){this._vaoCaches.forEach(e=>e.dispose()),this._vaoCaches.clear(),this._vboCaches.forEach(e=>e.dispose()),this._vboCaches.clear(),this._indexBufferCache=e(this._indexBufferCache),this._textureBufferCaches.forEach(e=>e.dispose()),this._textureBufferCaches.clear(),!(--this._refCount>0)&&this.dispose()}ref(){++this._refCount}get refCount(){return this._refCount}dispose(){this.emptyTexture.dispose(),this._screen.destroy(),this._screen=null,super.dispose(),this._vaoCaches.forEach(e=>e.dispose()),this._vaoCaches.clear(),this._vboCaches.forEach(e=>e.dispose()),this._vboCaches.clear(),this._indexBufferCache?.dispose(),this._indexBufferCache=null,this._textureBufferCaches.forEach(e=>e.dispose()),this._textureBufferCaches.clear()}get newCache(){return this._newCache}get screen(){return this._screen}getVaoCache(e){let t=JSON.stringify(e),n=this._vaoCaches.get(t);if(n)return n;let r=new a(this,e);return this._vaoCaches.set(t,r),r}getVboCache(e){let t=JSON.stringify(e),n=this._vboCaches.get(t);if(n)return n;let r=new o(this,e);return this._vboCaches.set(t,r),r}get indexBufferCache(){return this._indexBufferCache??=new r(this),this._indexBufferCache}getTextureBufferCache(e){let t=JSON.stringify(e),n=this._textureBufferCaches.get(t);if(n)return n;let r=new i(this,e);return this._textureBufferCaches.set(t,r),r}bindTechnique(e,t,n,r){return this.debugBoundTechnique=e.declaredClass,this.useProgram(e.program),this.setPipelineState(e.getPipeline(t,n)),e.program.bind(t),e.program.bindPass(t,n),r&&e.program.bindDraw(t,n,r),e.program}get isAssumedMetalDriver(){if(this._isAssumedMetalDriver==null&&(this._isAssumedMetalDriver=!!has(`ios`)||!!has(`safari`),!this._isAssumedMetalDriver&&has(`mac`)&&has(`chrome`))){let e=this.capabilities.rendererInfo?.getUnmaskedRenderer().toLowerCase(),t=e?.includes(`angle`)&&e?.includes(`metal`);this._isAssumedMetalDriver=t??!0}return this._isAssumedMetalDriver}get test(){}}export{c as RenderingContext};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{equals as n,binaryIndexOf as r}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import i from"../../../../../core/Logger.js";import{clamp as a}from"../../../../../core/mathUtils.js";import{disposeMaybe as o,destroyMaybe as s}from"../../../../../core/maybe.js";import{isAbortError as c,onAbortOrThrow as l}from"../../../../../core/promiseUtils.js";import{property as u,subclass as d}from"../../../../../core/accessorSupport/decorators.js";import{fromMat4 as f,transpose as p,invert as m}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as h}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as g}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as _,copy as v,sub as ee,dot as y}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as b,clone as te}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as x}from"../../../../../core/support/UpdatingHandles.js";import{c as S}from"../../../../../chunks/vec32.js";import{TwoVectorPosition as C}from"../../core/util/TwoVectorPosition.js";import{Attribute as w}from"../Attribute.js";import{GridLocalOriginFactory as T}from"../GridLocalOriginFactory.js";import{applyToModelMatrix as E}from"../localOriginHelper.js";import{LocalOriginManager as D}from"../LocalOriginManager.js";import{Object3D as O}from"../Object3D.js";import{VertexArrayObject as k}from"../VertexArrayObject.js";import{VertexLayout as ne,glVertexLayout as re,edgeViewTextureLayout as ie,EdgeInputBufferLayout as A,RegularEdgeInstancesGLLayout as ae,SilhouetteEdgeInstancesGLLayout as oe}from"./bufferLayouts.js";import{EdgeRenderer as j,lineWidthFractionFactor as M,extensionLengthOffset as N}from"./EdgeRenderer.js";import{EdgePassParameters as P}from"./EdgeShaderParameters.js";import{EdgeWorkerHandle as F}from"./EdgeWorkerHandle.js";import{LegacyTransform as I,isLegacyTransform as L}from"./LegacyTransform.js";import{generateStrokesTexture as R}from"./strokes.js";import{determineRendererType as z,determineEdgeTransparency as B,determineObjectTransparency as V,fillComponentBufferIndices as H}from"./util.js";import{BufferManager as U}from"../TextureBackedBuffer/BufferManager.js";import{VertexBuffer as W}from"../../../../webgl/VertexBuffer.js";let G=class extends t{constructor(e){super(e),this._updatingHandles=new x,this._objectEntries=new Map,this._pendingDeletions=new Map,this._renderers=new Map,this._gpuMemoryUsage=0,this._workerAbort=new AbortController,this._tmpModelPosition=b(),this._localOrigins=new D(new T(e.renderSR));let t=ne.createBuffer(4);for(let e=0;e<4;e++)t.sideness.set(e,0,e===0||e===3?0:1),t.sideness.set(e,1,e===0||e===1?0:1);this._vertexBuffer=new W(e.rctx,re,t.buffer)}initialize(){this._workerHandle=new F(this.schedule),this._componentColorManager=new U(this.rctx,ie)}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=s(this._componentColorManager),this._workerAbort.abort(),this._workerHandle.destroy(),this._vertexBuffer.dispose(),this._renderers.clear(),this._updatingHandles.destroy(),this._set(`schedule`,he))}get updating(){return this._updatingHandles.updating}get usedMemory(){return this._gpuMemoryUsage}shouldRender(){return this._renderers.size>0}async addComponentObject(e,t,n,r,i,a,o){if(this.hasObject(e))return this._getObjectMemoryUsage(e);let s,c=new q(null,new Promise(e=>s=e),e.obb.getCenter(ge),e.obb.radius);this._objectEntries.set(e,c);let l=await this._updatingHandles.addPromise(this._addComponentGeometry(e.transform,c,t,n,r,i,a,o));return this.setNeedsRender(),s(),l}async addOrUpdateObject3D(e,t,n,r){if(this.destroyed){i.getLogger(this).warn(`Attempt to add an object to a destroyed instance`);return}let a=new AbortController,o,{center:s,radius:l}=e.boundingVolumeWorldSpace.sphere,u=new q(a,new Promise(e=>o=e),s,l),d=this._objectEntries.get(e);d&&(this._pendingDeletions.has(e)?this._discardObjectEntry(d):this._pendingDeletions.set(e,d)),this._objectEntries.set(e,u);try{let i=[];if(e.geometries.length>1&&se(e))i.push(this._addObjectMergedGeometries(e,u,t,n,r));else for(let a of e.geometries)a.material.supportsEdges&&i.push(this._addGeometry(e,u,a,t,n,r));await this._updatingHandles.addPromise(Promise.all(i)),this._removePendingDeletion(e)}catch(t){c(t)?this._discardObjectEntry(u):this._removePendingDeletion(e)}finally{this.setNeedsRender(),o()}}removeObject(e){let t=this._objectEntries.get(e);this._objectEntries.delete(e),this._discardObjectEntry(t),this._removePendingDeletion(e)}_removePendingDeletion(e){let t=this._pendingDeletions.get(e);this._pendingDeletions.delete(e),this._discardObjectEntry(t)}async _getObjectEntry(e){let t=this._objectEntries.get(e);if(!t)throw Error(`no object`);return await t.loaded,t.loaded==null?null:t}fastUpdateObject3DEdgesTransform(e){if(this.destroyed)return!1;let t=this._objectEntries.get(e);if(!t)return!1;let{geometries:n}=e,{renderables:r}=t;if(n.length===0||r.length===0)return!0;if(r.length>1)return!1;let[i]=r,a=i.transform;if(!(a instanceof I))return!1;let[o]=n;if(o.localOrigin!==a.origin.origin)return!1;let s=g(),c=this._computeModelTransformWithLocalOrigin(e,o,s);return i.transform=new I(s,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){let n=await this._updatingHandles.addPromise(this._getObjectEntry(e));if(n==null)return;let r=Array.isArray(t)?e=>t[e]:()=>t;n.renderables.forEach(e=>{let{meta:t,buffer:n}=e.components,i=t.length,a=n.textureBuffer.getScalarField(`opacity`);for(let e=0;e<i;e++){let n=r(e),i=t[e],o=i.index;i.material.opacity=n,a.set(o,n)}this._updateTransparency(e)}),this.setNeedsRender()}async _getObjectMemoryUsage(e){let t=await this._getObjectEntry(e);return t?t.renderables.reduce((e,t)=>e+t.statistics.gpuMemoryUsage,0):0}async updateAllComponentMaterials(e,t,n,r){let i=e instanceof O,a=z(t),o=j.getKey(a,n,i),s=await this._updatingHandles.addPromise(this._getObjectEntry(e));s!=null&&(s.renderables.forEach(e=>{if(o!==e.rendererKey){let t=this._renderers.get(e.rendererKey),r=this._acquireRenderer(a,n,i);t.removeRenderable(e),--t.refCount,e.rendererKey=o,r.addRenderable(e)}if(Array.isArray(t))for(let n=0;n<t.length;n++)e.components.meta[n].material=t[n];else e.components.meta[0].material=t;r&&Y(e.components),this._updateTransparency(e)}),this.setNeedsRender())}async updateAllVerticalOffsets(e,t){let n=await this._updatingHandles.addPromise(this._getObjectEntry(e));n!=null&&this._updateAllVerticalOffsets(n,t)}_updateAllVerticalOffsets(e,t){e.renderables.forEach(e=>{let n=e.components.meta;for(let r=0;r<n.length;r++)e.components.meta[r].verticalOffset=t?.[r]??0;Y(e.components)}),this.setNeedsRender()}async updateObjectVisibility(e,t){let n=await this._updatingHandles.addPromise(this._getObjectEntry(e));n&&(n.renderables.forEach(e=>e.visible=t),this.setNeedsRender())}render(e,t){if(this._componentColorManager==null)return;this._localOrigins.updateViewMatrices(e.camera.viewMatrix);let n=e.camera.viewInverseTransposeMatrix,r=b(),i=new C,a=0,o=0;if(this._renderers.forEach(n=>{if(n.refCount===0){this._renderers.delete(n.key);return}++this.techniques.precompiling,n.forEachRenderable(t=>{t.visible&&(a+=t.statistics.averageEdgeLength,o++,t.regular&&n.acquireTechnique(e,!1),t.silhouette&&n.acquireTechnique(e,!0))},t),--this.techniques.precompiling}),this._componentColorManager.garbageCollect(),this._componentColorManager.updateTextures(),o===0)return;let s=40*a/o,c=new P(s,t);_(r,n[3],n[7],n[11]),i.set(r),v(c.transformWorldFromViewTH,i.high),v(c.transformWorldFromViewTL,i.low),f(c.transformViewFromCameraRelativeRS,e.camera.viewMatrix),p($,c.transformViewFromCameraRelativeRS),m(c.transformNormalViewFromGlobal,$),this._updateObjectCameraDistances(e),this._renderers.forEach(t=>{de(t,e,c),fe(t,e,c)})}_updateTransparency(e){let t=B(e.components.meta),n=V(e.components.meta);(t!==e.edgeTransparency||n!==e.objectTransparency)&&(e.edgeTransparency=t,e.objectTransparency=n,this._renderers.get(e.rendererKey).setRenderablesDirty())}_computeModelTransformWithLocalOrigin(e,t,n){e.getCombinedShaderTransformation(t,n);let r=t.localOrigin==null?this._localOrigins.acquire(_(this._tmpModelPosition,n[12],n[13],n[14])):this._localOrigins.register(t.localOrigin);return t.localOrigin=r.origin,E(r.origin.vec3,n),r}_createComponentBuffers(e){if(this._componentColorManager==null)return null;let t=[],n=this._componentColorManager.getBuffer(e.length),r=n.acquireIndices(e.length);for(let n=0;n<e.length;n++){let i=e[n],a=r[n];t.push({index:a,verticalOffset:0,material:i})}let i=new ce(n,t);return Y(i),i}_extractEdges(e,t,n,r,i,a,o=a.length){return o<128&&(i=!0),this._workerHandle.process({data:n,indices:a,indicesLength:o,writerSettings:t,skipDeduplicate:r},e,i)}_createRenderable(e,t,n,r,i){let a=t=>new le(new k(this.rctx,new Map([[`vertices`,this._vertexBuffer],[`instances`,t===0?new W(this.rctx,ae,e.regular.instancesData.buffer):new W(this.rctx,oe,e.silhouette.instancesData.buffer)]])),t===0?e.regular.lodInfo:e.silhouette.lodInfo),o=e.regular.lodInfo.lengths.length>0?a(0):null,s=e.silhouette.lodInfo.lengths.length>0?a(1):null,c=(o?.vao.usedMemory??0)+(s?.vao.usedMemory??0);return new J(o,s,{gpuMemoryUsage:c,externalMemoryUsage:i,averageEdgeLength:e.averageEdgeLength},n,B(t.meta),V(t.meta),t,r)}async _addGeometry(e,t,n,r,i,a){if(n.edgeIndicesLength<=0)return;let o=n.positionAttribute,s=n.primitivePositionIndices,c=s===o.indices?o:new w(o.data,s,o.size,!1,o.stride),l=g(),u=this._computeModelTransformWithLocalOrigin(e,n,l),d=new Q(c,l,u);return this._addPositionData(t,d,n.edgeIndicesLength,r,i,a)}async _addPositionData(e,t,n,r,i,a=!1){if(e.loaded==null)return;let o=this._createComponentBuffers([r]);if(o==null)return;let s=this._acquireRenderer(r.type,i,!0),{modelTransform:c,origin:l}=t,u=t.position.indices,d=t.position,f=d.data.length/d.size,p=A.createBuffer(f);for(let e=0;e<f;e++)p.position.set(e,0,d.data[e*d.size]),p.position.set(e,1,d.data[e*d.size+1]),p.position.set(e,2,d.data[e*d.size+2]);H(o.meta,[0,p.componentIndex.count],p.componentIndex);let m=await this._updatingHandles.addPromise(this._extractEdges(e.abort?.signal||this._workerAbort.signal,s.writerSettings,p,!1,a,u,n));if(e.loaded==null)return;let h=this._createRenderable(m,o,new I(c,l),s.key,!1);e.renderables.push(h),s.addRenderable(h),this._gpuMemoryUsage+=h.statistics.gpuMemoryUsage}async _addComponentGeometry(e,t,n,r,i,a,o,s){if(t.loaded==null)return 0;let c=this._createComponentBuffers(a);if(c==null)return 0;let l=z(a),u=this._acquireRenderer(l,o||!1,!1),d=A.createBuffer(n.length/3);S(d.position.typedBuffer,n,d.position.typedBufferStride,3),H(c.meta,i,d.componentIndex,r);let f=u.writerSettings,p=await this._updatingHandles.addPromise(this._extractEdges(this._workerAbort.signal,f,d,!0,!1,r));if(t.loaded==null)return 0;let m=this._createRenderable(p,c,e,u.key,!0);return t.renderables.push(m),u.addRenderable(m),this._updateAllVerticalOffsets(t,s),m.statistics.gpuMemoryUsage}async _addObjectMergedGeometries(e,t,n,r,i){let a=new Map,o=0,s=0,c=null,l=e.geometries.filter(e=>{if(e.edgeIndicesLength<=0||!e.material.supportsEdges)return!1;!c&&e.localOrigin&&(c=e);let t=e.positionAttribute;return s+=t.data.length/t.size,o+=e.edgeIndicesLength,!0});if(l.length===0)return;let u=o?new(s>=65536?Uint32Array:Uint16Array)(o):null,d=[],f=0;l.forEach(e=>{let t=e.positionAttribute,n=e.primitivePositionIndices,r=a.get(t.data);if(r==null){r=d.length/3;for(let e=0;e<t.data.length;e+=t.size)d.push(t.data[e]),d.push(t.data[e+1]),d.push(t.data[e+2]);a.set(t.data,r)}for(let t=0;t<e.edgeIndicesLength;t++)u[f++]=r+n[t]});let p=c||e.geometries[0],m=g(),h=this._computeModelTransformWithLocalOrigin(e,p,m);for(let t=0;t<e.geometries.length;t++)e.geometries[t].localOrigin=h.origin;let _=new Q(new w(d,u,3),m,h);await this._updatingHandles.addPromise(this._addPositionData(t,_,u.length,n,r,i))}_acquireRenderer(e,t,n){let r=j.getKey(e,t,n),i=this._renderers.get(r);return this._strokesTexture??=R(this.rctx),i||(i=new j(this.rctx,this.techniques,{type:e,hasSlicePlane:t,strokesTexture:this._strokesTexture,legacy:n,spherical:this.viewingMode===1}),this._renderers.set(r,i)),++i.refCount,i}_removeRenderable(e){K(e.regular),K(e.silhouette);let t=this._renderers.get(e.rendererKey);if(t){t.removeRenderable(e),--t.refCount,L(e.transform)&&this._localOrigins.release(e.transform.origin),this._gpuMemoryUsage-=e.statistics.externalMemoryUsage?0:e.statistics.gpuMemoryUsage;for(let t of e.components.meta)e.components.buffer.releaseIndex(t.index)}}_updateObjectCameraDistances(e){let t=e.camera.eye,n=e.camera.viewForward,r=b(),i=e=>{ee(r,e.center,t);let i=y(r,n),a=e.radius,o=i<-a?1/0:i<a?0:i-a;e.renderables.forEach(e=>e.distanceToCamera=o)};this._objectEntries.forEach(i),this._pendingDeletions.forEach(i)}get test(){}};e([u({constructOnly:!0})],G.prototype,`rctx`,void 0),e([u({constructOnly:!0})],G.prototype,`renderSR`,void 0),e([u({constructOnly:!0})],G.prototype,`viewingMode`,void 0),e([u({constructOnly:!0})],G.prototype,`techniques`,void 0),e([u({constructOnly:!0})],G.prototype,`setNeedsRender`,void 0),e([u({constructOnly:!0})],G.prototype,`schedule`,void 0),e([u({readOnly:!0})],G.prototype,`_updatingHandles`,void 0),e([u({readOnly:!0})],G.prototype,`updating`,null),G=e([d(`esri.views.3d.webgl-engine.lib.edgeRendering.EdgeView`)],G);function K(e){e?.vao&&(e.vao.buffer(`instances`)?.dispose(),e.vao.disposeVAOOnly(),e.vao=null)}function se(e){let t=null,r=null;for(let i of e.geometries)if(i.material.supportsEdges){if(!t)t=i.transformation;else if(!n(t,i.transformation))return!1;if(!r&&i.localOrigin!=null)r=i;else if(r?.localOrigin!=null&&i.localOrigin!=null&&r.localOrigin.id!==i.localOrigin.id)return!1}return!0}class q{constructor(e,t,n,r){this.abort=e,this.radius=r,this.renderables=[];let i=e?l(e.signal,()=>e.abort()):null;this.loaded=t,this.loaded.then(()=>{this.loaded!=null&&(this.loaded=!0),this.abort=null,i?.remove()}),this.center=te(n)}}class ce{constructor(e,t){this.buffer=e,this.meta=t}}class le{constructor(e,t){this.vao=e,this.lod=t}}class J{constructor(e,t,n,r,i,a,o,s){this.regular=e,this.silhouette=t,this.statistics=n,this.transform=r,this.edgeTransparency=i,this.objectTransparency=a,this.components=o,this.rendererKey=s,this.distanceToCamera=0,this.visible=!0}}class ue extends J{}function Y(e){let{meta:t,buffer:n}=e,r=n.textureBuffer,i=r.getVec4Field(`color`),o=r.getScalarField(`lineWidth`),s=r.getScalarField(`extensionLength`),c=r.getScalarField(`materialType`),l=r.getScalarField(`opacity`),u=r.getScalarField(`elevationOffset`);for(let e=0;e<t.length;e++){let n=t[e].material,r=t[e].index,d=a(Math.round(n.size*M),0,255),f=a(n.extensionLength,-N,255-N)+N;i.setArray(r,n.color),o.set(r,d),s.set(r,f),c.set(r,n.type),l.set(r,n.opacity),u.set(r,t[e].verticalOffset)}}function de(e,t,n){let r,i,a=n.transparency;n.strokesTexture=e.strokesTexture;let o=t.camera.screenPixelSizePerDistance;e.forEachRenderable(a=>{if(!X(a)||!a.visible)return;r??=e.acquireTechnique(t,!1),i??=e.rctx.bindTechnique(r,t,n);let s=Z(a.regular.lod.lengths,a.distanceToCamera,o);e.renderRegularEdges(i,a,n,t,s)},a)}function fe(e,t,n){let r,i,a=n.transparency;n.strokesTexture=e.strokesTexture;let o=t.camera.screenPixelSizePerDistance;e.forEachRenderable(a=>{if(!me(a)||!a.visible)return;r??=e.acquireTechnique(t,!0),i??=e.rctx.bindTechnique(r,t,n);let s=Z(a.silhouette.lod.lengths,a.distanceToCamera,o);e.renderSilhouetteEdges(i,a,n,t,s)},a)}function X(e){return e.regular!=null}class pe extends J{}function me(e){return e.silhouette!=null}function Z(e,t,n){let i=t*n,a=r(e,i,!0);return a===-1?i<e[0]?e.length:0:e.length-a}class Q{constructor(e,t,n){this.position=e,this.modelTransform=t,this.origin=n}}const he=()=>Promise.reject(),$=h(),ge=b();export{G as EdgeView,ue as RegularRenderable,J as Renderable,pe as SilhouetteRenderable};
2
+ import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{binaryIndexOf as n}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import r from"../../../../../core/Logger.js";import{clamp as i}from"../../../../../core/mathUtils.js";import{disposeMaybe as a,destroyMaybe as o}from"../../../../../core/maybe.js";import{isAbortError as s,onAbortOrThrow as c}from"../../../../../core/promiseUtils.js";import{property as l,subclass as u}from"../../../../../core/accessorSupport/decorators.js";import{fromMat4 as d,transpose as f,invert as p}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as m}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as h}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as g,copy as _,sub as ee,dot as v}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as y,clone as b}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{exactEquals as x}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{UpdatingHandles as S}from"../../../../../core/support/UpdatingHandles.js";import{c as C}from"../../../../../chunks/vec32.js";import{TwoVectorPosition as w}from"../../core/util/TwoVectorPosition.js";import{Attribute as T}from"../Attribute.js";import{GridLocalOriginFactory as E}from"../GridLocalOriginFactory.js";import{applyToModelMatrix as D}from"../localOriginHelper.js";import{LocalOriginManager as O}from"../LocalOriginManager.js";import{Object3D as k}from"../Object3D.js";import{VertexArrayObject as te}from"../VertexArrayObject.js";import{VertexLayout as ne,glVertexLayout as re,edgeViewTextureLayout as ie,EdgeInputBufferLayout as A,RegularEdgeInstancesGLLayout as ae,SilhouetteEdgeInstancesGLLayout as oe}from"./bufferLayouts.js";import{EdgeRenderer as j,lineWidthFractionFactor as M,extensionLengthOffset as N}from"./EdgeRenderer.js";import{EdgePassParameters as P}from"./EdgeShaderParameters.js";import{EdgeWorkerHandle as F}from"./EdgeWorkerHandle.js";import{LegacyTransform as I,isLegacyTransform as L}from"./LegacyTransform.js";import{generateStrokesTexture as R}from"./strokes.js";import{determineRendererType as z,determineEdgeTransparency as B,determineObjectTransparency as V,fillComponentBufferIndices as H}from"./util.js";import{BufferManager as U}from"../TextureBackedBuffer/BufferManager.js";import{VertexBuffer as W}from"../../../../webgl/VertexBuffer.js";let G=class extends t{constructor(e){super(e),this._updatingHandles=new S,this._objectEntries=new Map,this._pendingDeletions=new Map,this._renderers=new Map,this._gpuMemoryUsage=0,this._workerAbort=new AbortController,this._tmpModelPosition=y(),this._localOrigins=new O(new E(e.renderSR));let t=ne.createBuffer(4);for(let e=0;e<4;e++)t.sideness.set(e,0,e===0||e===3?0:1),t.sideness.set(e,1,e===0||e===1?0:1);this._vertexBuffer=new W(e.rctx,re,t.buffer)}initialize(){this._workerHandle=new F(this.schedule),this._componentColorManager=new U(this.rctx,ie)}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=a(this._strokesTexture),this._componentColorManager=o(this._componentColorManager),this._workerAbort.abort(),this._workerHandle.destroy(),this._vertexBuffer.dispose(),this._renderers.clear(),this._updatingHandles.destroy(),this._set(`schedule`,he))}get updating(){return this._updatingHandles.updating}get usedMemory(){return this._gpuMemoryUsage}shouldRender(){return this._renderers.size>0}async addComponentObject(e,t,n,r,i,a,o){if(this.hasObject(e))return this._getObjectMemoryUsage(e);let s,c=new q(null,new Promise(e=>s=e),e.obb.getCenter(ge),e.obb.radius);this._objectEntries.set(e,c);let l=await this._updatingHandles.addPromise(this._addComponentGeometry(e.transform,c,t,n,r,i,a,o));return this.setNeedsRender(),s(),l}async addOrUpdateObject3D(e,t,n,i){if(this.destroyed){r.getLogger(this).warn(`Attempt to add an object to a destroyed instance`);return}let a=new AbortController,o,{center:c,radius:l}=e.boundingVolumeWorldSpace.sphere,u=new q(a,new Promise(e=>o=e),c,l),d=this._objectEntries.get(e);d&&(this._pendingDeletions.has(e)?this._discardObjectEntry(d):this._pendingDeletions.set(e,d)),this._objectEntries.set(e,u);try{let r=[];if(e.geometries.length>1&&se(e))r.push(this._addObjectMergedGeometries(e,u,t,n,i));else for(let a of e.geometries)a.material.supportsEdges&&r.push(this._addGeometry(e,u,a,t,n,i));await this._updatingHandles.addPromise(Promise.all(r)),this._removePendingDeletion(e)}catch(t){s(t)?this._discardObjectEntry(u):this._removePendingDeletion(e)}finally{this.setNeedsRender(),o()}}removeObject(e){let t=this._objectEntries.get(e);this._objectEntries.delete(e),this._discardObjectEntry(t),this._removePendingDeletion(e)}_removePendingDeletion(e){let t=this._pendingDeletions.get(e);this._pendingDeletions.delete(e),this._discardObjectEntry(t)}async _getObjectEntry(e){let t=this._objectEntries.get(e);if(!t)throw Error(`no object`);return await t.loaded,t.loaded==null?null:t}fastUpdateObject3DEdgesTransform(e){if(this.destroyed)return!1;let t=this._objectEntries.get(e);if(!t)return!1;let{geometries:n}=e,{renderables:r}=t;if(n.length===0||r.length===0)return!0;if(r.length>1)return!1;let[i]=r,a=i.transform;if(!(a instanceof I))return!1;let[o]=n;if(o.localOrigin!==a.origin.origin)return!1;let s=h(),c=this._computeModelTransformWithLocalOrigin(e,o,s);return i.transform=new I(s,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){let n=await this._updatingHandles.addPromise(this._getObjectEntry(e));if(n==null)return;let r=Array.isArray(t)?e=>t[e]:()=>t;n.renderables.forEach(e=>{let{meta:t,buffer:n}=e.components,i=t.length,a=n.textureBuffer.getScalarField(`opacity`);for(let e=0;e<i;e++){let n=r(e),i=t[e],o=i.index;i.material.opacity=n,a.set(o,n)}this._updateTransparency(e)}),this.setNeedsRender()}async _getObjectMemoryUsage(e){let t=await this._getObjectEntry(e);return t?t.renderables.reduce((e,t)=>e+t.statistics.gpuMemoryUsage,0):0}async updateAllComponentMaterials(e,t,n,r){let i=e instanceof k,a=z(t),o=j.getKey(a,n,i),s=await this._updatingHandles.addPromise(this._getObjectEntry(e));s!=null&&(s.renderables.forEach(e=>{if(o!==e.rendererKey){let t=this._renderers.get(e.rendererKey),r=this._acquireRenderer(a,n,i);t.removeRenderable(e),--t.refCount,e.rendererKey=o,r.addRenderable(e)}if(Array.isArray(t))for(let n=0;n<t.length;n++)e.components.meta[n].material=t[n];else e.components.meta[0].material=t;r&&Y(e.components),this._updateTransparency(e)}),this.setNeedsRender())}async updateAllVerticalOffsets(e,t){let n=await this._updatingHandles.addPromise(this._getObjectEntry(e));n!=null&&this._updateAllVerticalOffsets(n,t)}_updateAllVerticalOffsets(e,t){e.renderables.forEach(e=>{let n=e.components.meta;for(let r=0;r<n.length;r++)e.components.meta[r].verticalOffset=t?.[r]??0;Y(e.components)}),this.setNeedsRender()}async updateObjectVisibility(e,t){let n=await this._updatingHandles.addPromise(this._getObjectEntry(e));n&&(n.renderables.forEach(e=>e.visible=t),this.setNeedsRender())}render(e,t){if(this._componentColorManager==null)return;this._localOrigins.updateViewMatrices(e.camera.viewMatrix);let n=e.camera.viewInverseTransposeMatrix,r=y(),i=new w,a=0,o=0;if(this._renderers.forEach(n=>{if(n.refCount===0){this._renderers.delete(n.key);return}++this.techniques.precompiling,n.forEachRenderable(t=>{t.visible&&(a+=t.statistics.averageEdgeLength,o++,t.regular&&n.acquireTechnique(e,!1),t.silhouette&&n.acquireTechnique(e,!0))},t),--this.techniques.precompiling}),this._componentColorManager.garbageCollect(),this._componentColorManager.updateTextures(),o===0)return;let s=40*a/o,c=new P(s,t);g(r,n[3],n[7],n[11]),i.set(r),_(c.transformWorldFromViewTH,i.high),_(c.transformWorldFromViewTL,i.low),d(c.transformViewFromCameraRelativeRS,e.camera.viewMatrix),f($,c.transformViewFromCameraRelativeRS),p(c.transformNormalViewFromGlobal,$),this._updateObjectCameraDistances(e),this._renderers.forEach(t=>{de(t,e,c),fe(t,e,c)})}_updateTransparency(e){let t=B(e.components.meta),n=V(e.components.meta);(t!==e.edgeTransparency||n!==e.objectTransparency)&&(e.edgeTransparency=t,e.objectTransparency=n,this._renderers.get(e.rendererKey).setRenderablesDirty())}_computeModelTransformWithLocalOrigin(e,t,n){e.getCombinedShaderTransformation(t,n);let r=t.localOrigin==null?this._localOrigins.acquire(g(this._tmpModelPosition,n[12],n[13],n[14])):this._localOrigins.register(t.localOrigin);return t.localOrigin=r.origin,D(r.origin.vec3,n),r}_createComponentBuffers(e){if(this._componentColorManager==null)return null;let t=[],n=this._componentColorManager.getBuffer(e.length),r=n.acquireIndices(e.length);for(let n=0;n<e.length;n++){let i=e[n],a=r[n];t.push({index:a,verticalOffset:0,material:i})}let i=new ce(n,t);return Y(i),i}_extractEdges(e,t,n,r,i,a,o=a.length){return o<128&&(i=!0),this._workerHandle.process({data:n,indices:a,indicesLength:o,writerSettings:t,skipDeduplicate:r},e,i)}_createRenderable(e,t,n,r,i){let a=t=>new le(new te(this.rctx,new Map([[`vertices`,this._vertexBuffer],[`instances`,t===0?new W(this.rctx,ae,e.regular.instancesData.buffer):new W(this.rctx,oe,e.silhouette.instancesData.buffer)]])),t===0?e.regular.lodInfo:e.silhouette.lodInfo),o=e.regular.lodInfo.lengths.length>0?a(0):null,s=e.silhouette.lodInfo.lengths.length>0?a(1):null,c=(o?.vao.usedMemory??0)+(s?.vao.usedMemory??0);return new J(o,s,{gpuMemoryUsage:c,externalMemoryUsage:i,averageEdgeLength:e.averageEdgeLength},n,B(t.meta),V(t.meta),t,r)}async _addGeometry(e,t,n,r,i,a){if(n.edgeIndicesLength<=0)return;let o=n.positionAttribute,s=n.primitivePositionIndices,c=s===o.indices?o:new T(o.data,s,o.size,!1,o.stride),l=h(),u=this._computeModelTransformWithLocalOrigin(e,n,l),d=new Q(c,l,u);return this._addPositionData(t,d,n.edgeIndicesLength,r,i,a)}async _addPositionData(e,t,n,r,i,a=!1){if(e.loaded==null)return;let o=this._createComponentBuffers([r]);if(o==null)return;let s=this._acquireRenderer(r.type,i,!0),{modelTransform:c,origin:l}=t,u=t.position.indices,d=t.position,f=d.data.length/d.size,p=A.createBuffer(f);for(let e=0;e<f;e++)p.position.set(e,0,d.data[e*d.size]),p.position.set(e,1,d.data[e*d.size+1]),p.position.set(e,2,d.data[e*d.size+2]);H(o.meta,[0,p.componentIndex.count],p.componentIndex);let m=await this._updatingHandles.addPromise(this._extractEdges(e.abort?.signal||this._workerAbort.signal,s.writerSettings,p,!1,a,u,n));if(e.loaded==null)return;let h=this._createRenderable(m,o,new I(c,l),s.key,!1);e.renderables.push(h),s.addRenderable(h),this._gpuMemoryUsage+=h.statistics.gpuMemoryUsage}async _addComponentGeometry(e,t,n,r,i,a,o,s){if(t.loaded==null)return 0;let c=this._createComponentBuffers(a);if(c==null)return 0;let l=z(a),u=this._acquireRenderer(l,o||!1,!1),d=A.createBuffer(n.length/3);C(d.position.typedBuffer,n,d.position.typedBufferStride,3),H(c.meta,i,d.componentIndex,r);let f=u.writerSettings,p=await this._updatingHandles.addPromise(this._extractEdges(this._workerAbort.signal,f,d,!0,!1,r));if(t.loaded==null)return 0;let m=this._createRenderable(p,c,e,u.key,!0);return t.renderables.push(m),u.addRenderable(m),this._updateAllVerticalOffsets(t,s),m.statistics.gpuMemoryUsage}async _addObjectMergedGeometries(e,t,n,r,i){let a=new Map,o=0,s=0,c=null,l=e.geometries.filter(e=>{if(e.edgeIndicesLength<=0||!e.material.supportsEdges)return!1;!c&&e.localOrigin&&(c=e);let t=e.positionAttribute;return s+=t.data.length/t.size,o+=e.edgeIndicesLength,!0});if(l.length===0)return;let u=o?new(s>=65536?Uint32Array:Uint16Array)(o):null,d=[],f=0;l.forEach(e=>{let t=e.positionAttribute,n=e.primitivePositionIndices,r=a.get(t.data);if(r==null){r=d.length/3;for(let e=0;e<t.data.length;e+=t.size)d.push(t.data[e]),d.push(t.data[e+1]),d.push(t.data[e+2]);a.set(t.data,r)}for(let t=0;t<e.edgeIndicesLength;t++)u[f++]=r+n[t]});let p=c||e.geometries[0],m=h(),g=this._computeModelTransformWithLocalOrigin(e,p,m);for(let t=0;t<e.geometries.length;t++)e.geometries[t].localOrigin=g.origin;let _=new Q(new T(d,u,3),m,g);await this._updatingHandles.addPromise(this._addPositionData(t,_,u.length,n,r,i))}_acquireRenderer(e,t,n){let r=j.getKey(e,t,n),i=this._renderers.get(r);return this._strokesTexture??=R(this.rctx),i||(i=new j(this.rctx,this.techniques,{type:e,hasSlicePlane:t,strokesTexture:this._strokesTexture,legacy:n,spherical:this.viewingMode===1}),this._renderers.set(r,i)),++i.refCount,i}_removeRenderable(e){K(e.regular),K(e.silhouette);let t=this._renderers.get(e.rendererKey);if(t){t.removeRenderable(e),--t.refCount,L(e.transform)&&this._localOrigins.release(e.transform.origin),this._gpuMemoryUsage-=e.statistics.externalMemoryUsage?0:e.statistics.gpuMemoryUsage;for(let t of e.components.meta)e.components.buffer.releaseIndex(t.index)}}_updateObjectCameraDistances(e){let t=e.camera.eye,n=e.camera.viewForward,r=y(),i=e=>{ee(r,e.center,t);let i=v(r,n),a=e.radius,o=i<-a?1/0:i<a?0:i-a;e.renderables.forEach(e=>e.distanceToCamera=o)};this._objectEntries.forEach(i),this._pendingDeletions.forEach(i)}get test(){}};e([l({constructOnly:!0})],G.prototype,`rctx`,void 0),e([l({constructOnly:!0})],G.prototype,`renderSR`,void 0),e([l({constructOnly:!0})],G.prototype,`viewingMode`,void 0),e([l({constructOnly:!0})],G.prototype,`techniques`,void 0),e([l({constructOnly:!0})],G.prototype,`setNeedsRender`,void 0),e([l({constructOnly:!0})],G.prototype,`schedule`,void 0),e([l({readOnly:!0})],G.prototype,`_updatingHandles`,void 0),e([l({readOnly:!0})],G.prototype,`updating`,null),G=e([u(`esri.views.3d.webgl-engine.lib.edgeRendering.EdgeView`)],G);function K(e){e?.vao&&(e.vao.buffer(`instances`)?.dispose(),e.vao.disposeVAOOnly(),e.vao=null)}function se(e){let t=null,n=null;for(let r of e.geometries)if(r.material.supportsEdges){if(!t)t=r.transformation;else if(!x(t,r.transformation))return!1;if(!n&&r.localOrigin!=null)n=r;else if(n?.localOrigin!=null&&r.localOrigin!=null&&n.localOrigin.id!==r.localOrigin.id)return!1}return!0}class q{constructor(e,t,n,r){this.abort=e,this.radius=r,this.renderables=[];let i=e?c(e.signal,()=>e.abort()):null;this.loaded=t,this.loaded.then(()=>{this.loaded!=null&&(this.loaded=!0),this.abort=null,i?.remove()}),this.center=b(n)}}class ce{constructor(e,t){this.buffer=e,this.meta=t}}class le{constructor(e,t){this.vao=e,this.lod=t}}class J{constructor(e,t,n,r,i,a,o,s){this.regular=e,this.silhouette=t,this.statistics=n,this.transform=r,this.edgeTransparency=i,this.objectTransparency=a,this.components=o,this.rendererKey=s,this.distanceToCamera=0,this.visible=!0}}class ue extends J{}function Y(e){let{meta:t,buffer:n}=e,r=n.textureBuffer,a=r.getVec4Field(`color`),o=r.getScalarField(`lineWidth`),s=r.getScalarField(`extensionLength`),c=r.getScalarField(`materialType`),l=r.getScalarField(`opacity`),u=r.getScalarField(`elevationOffset`);for(let e=0;e<t.length;e++){let n=t[e].material,r=t[e].index,d=i(Math.round(n.size*M),0,255),f=i(n.extensionLength,-N,255-N)+N;a.setArray(r,n.color),o.set(r,d),s.set(r,f),c.set(r,n.type),l.set(r,n.opacity),u.set(r,t[e].verticalOffset)}}function de(e,t,n){let r,i,a=n.transparency;n.strokesTexture=e.strokesTexture;let o=t.camera.screenPixelSizePerDistance;e.forEachRenderable(a=>{if(!X(a)||!a.visible)return;r??=e.acquireTechnique(t,!1),i??=e.rctx.bindTechnique(r,t,n);let s=Z(a.regular.lod.lengths,a.distanceToCamera,o);e.renderRegularEdges(i,a,n,t,s)},a)}function fe(e,t,n){let r,i,a=n.transparency;n.strokesTexture=e.strokesTexture;let o=t.camera.screenPixelSizePerDistance;e.forEachRenderable(a=>{if(!me(a)||!a.visible)return;r??=e.acquireTechnique(t,!0),i??=e.rctx.bindTechnique(r,t,n);let s=Z(a.silhouette.lod.lengths,a.distanceToCamera,o);e.renderSilhouetteEdges(i,a,n,t,s)},a)}function X(e){return e.regular!=null}class pe extends J{}function me(e){return e.silhouette!=null}function Z(e,t,r){let i=t*r,a=n(e,i,!0);return a===-1?i<e[0]?e.length:0:e.length-a}class Q{constructor(e,t,n){this.position=e,this.modelTransform=t,this.origin=n}}const he=()=>Promise.reject(),$=m(),ge=y();export{G as EdgeView,ue as RegularRenderable,J as Renderable,pe as SilhouetteRenderable};