@arcgis/core 5.0.0-next.57 → 5.0.0-next.59

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 (351) hide show
  1. package/Graphic.d.ts +2 -2
  2. package/Viewpoint.d.ts +1 -1
  3. package/applications/Components/arcadeFeatureUtils.d.ts +20 -1
  4. package/applications/Components/arcadeFeatureUtils.js +1 -1
  5. package/applications/Urban/meshUtils.d.ts +2 -2
  6. package/arcade.d.ts +1 -1
  7. package/arcade.js +1 -1
  8. package/assets/esri/core/workers/RemoteClient.js +1 -1
  9. package/assets/esri/core/workers/chunks/0bd73a66baea2f52e8a6.js +1 -0
  10. package/assets/esri/core/workers/chunks/18ce7b1559a45d017c45.js +1 -0
  11. package/assets/esri/core/workers/chunks/262c5794650853457acc.js +1 -0
  12. package/assets/esri/core/workers/chunks/3405a23973f9e701a4d6.js +1 -0
  13. package/assets/esri/core/workers/chunks/352c674730c7b7258ae3.js +1 -0
  14. package/assets/esri/core/workers/chunks/55a9ea536c64976c3409.js +1 -0
  15. package/assets/esri/core/workers/chunks/62752cd6821959cf6751.js +1 -0
  16. package/assets/esri/core/workers/chunks/72e3a48aa365542b0689.js +1 -0
  17. package/assets/esri/core/workers/chunks/{5f9e64f00329cb646f0c.js → 741d170187e58e81584d.js} +1 -1
  18. package/assets/esri/core/workers/chunks/a6b1e3ec30f6d641aea9.js +1 -0
  19. package/assets/esri/core/workers/chunks/{da2c41ac0f82f32013c1.js → a7aa87e2c4197ba595ef.js} +10 -10
  20. package/assets/esri/core/workers/chunks/{d76513a6260d9ec4ea25.js → bf82bb1cdd8b31e7f2aa.js} +1 -1
  21. package/assets/esri/layers/raster/formats/lerc-wasm.wasm +0 -0
  22. package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
  23. package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
  24. package/assets/esri/themes/base/widgets/_Attribution.scss +2 -2
  25. package/assets/esri/themes/base/widgets/_FeatureTable.scss +24 -0
  26. package/assets/esri/themes/dark/main.css +1 -1
  27. package/assets/esri/themes/light/main.css +1 -1
  28. package/assets/esri/themes/light/view.css +1 -1
  29. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable.json +1 -1
  30. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ar.json +1 -1
  31. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_bg.json +1 -1
  32. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_bs.json +1 -1
  33. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ca.json +1 -1
  34. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_cs.json +1 -1
  35. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_da.json +1 -1
  36. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_de.json +1 -1
  37. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_el.json +1 -1
  38. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_en.json +1 -1
  39. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_es.json +1 -1
  40. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_et.json +1 -1
  41. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_fi.json +1 -1
  42. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_fr.json +1 -1
  43. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_he.json +1 -1
  44. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_hr.json +1 -1
  45. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_hu.json +1 -1
  46. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_id.json +1 -1
  47. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_it.json +1 -1
  48. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ja.json +1 -1
  49. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ko.json +1 -1
  50. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_lt.json +1 -1
  51. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_lv.json +1 -1
  52. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_nl.json +1 -1
  53. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_no.json +1 -1
  54. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pl.json +1 -1
  55. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pt-BR.json +1 -1
  56. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pt-PT.json +1 -1
  57. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ro.json +1 -1
  58. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ru.json +1 -1
  59. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sk.json +1 -1
  60. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sl.json +1 -1
  61. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sr.json +1 -1
  62. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sv.json +1 -1
  63. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_th.json +1 -1
  64. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_tr.json +1 -1
  65. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_uk.json +1 -1
  66. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_vi.json +1 -1
  67. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-CN.json +1 -1
  68. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-HK.json +1 -1
  69. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-TW.json +1 -1
  70. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_fr.json +1 -1
  71. package/chunks/lerc-wasm.js +1 -1
  72. package/config.js +1 -1
  73. package/core/workers/workerFactory.js +1 -1
  74. package/editing/sharedTemplates/executor/builders/offsetLine.js +1 -1
  75. package/editing/sharedTemplates/executor/builders/offsetPrimaryLine.js +1 -1
  76. package/editing/sharedTemplates/executor/builders/polygonBoundary.js +1 -1
  77. package/editing/sharedTemplates/executor/builders/polygonBoundaryTwoPoint.js +1 -1
  78. package/editing/sharedTemplates/executor/builders/polygonVertices.js +1 -1
  79. package/editing/sharedTemplates/executor/builders/support/builderUtils.js +1 -1
  80. package/editing/sharedTemplates/executor/builders/support/shapeUtils.js +1 -1
  81. package/editing/sharedTemplates/executor/support/createFeatureServiceEdit.js +1 -1
  82. package/editing/sharedTemplates/executor/support/createPresetServiceEdit.js +1 -1
  83. package/geometry/Extent.d.ts +1 -1
  84. package/geometry/Mesh.d.ts +2 -2
  85. package/geometry/SpatialReference.js +1 -1
  86. package/geometry/geometryEngine.d.ts +3 -3
  87. package/geometry/{geometryEngineInterfaces.d.ts → geometryEngineTypes.d.ts} +1 -1
  88. package/geometry/operators/affineTransformOperator.d.ts +3 -3
  89. package/geometry/operators/alphaShapeOperator.d.ts +1 -1
  90. package/geometry/operators/areaOperator.d.ts +1 -1
  91. package/geometry/operators/boundaryOperator.d.ts +3 -3
  92. package/geometry/operators/bufferOperator.d.ts +1 -1
  93. package/geometry/operators/centroidOperator.d.ts +1 -1
  94. package/geometry/operators/clipOperator.d.ts +3 -3
  95. package/geometry/operators/containsOperator.d.ts +1 -1
  96. package/geometry/operators/convexHullOperator.d.ts +3 -3
  97. package/geometry/operators/crossesOperator.d.ts +1 -1
  98. package/geometry/operators/cutOperator.d.ts +2 -2
  99. package/geometry/operators/densifyOperator.d.ts +3 -3
  100. package/geometry/operators/differenceOperator.d.ts +3 -3
  101. package/geometry/operators/disjointOperator.d.ts +1 -1
  102. package/geometry/operators/distanceOperator.d.ts +1 -1
  103. package/geometry/operators/equalsOperator.d.ts +1 -1
  104. package/geometry/operators/generalizeOperator.d.ts +3 -3
  105. package/geometry/operators/geodesicBufferOperator.d.ts +1 -2
  106. package/geometry/operators/geodesicProximityOperator.d.ts +2 -5
  107. package/geometry/operators/geodeticAreaOperator.d.ts +1 -2
  108. package/geometry/operators/geodeticDensifyOperator.d.ts +3 -4
  109. package/geometry/operators/geodeticDistanceOperator.d.ts +1 -2
  110. package/geometry/operators/geodeticLengthOperator.d.ts +1 -2
  111. package/geometry/operators/geodeticUtilsOperator.d.ts +1 -1
  112. package/geometry/operators/graphicBufferOperator.d.ts +1 -1
  113. package/geometry/operators/integrateOperator.d.ts +2 -2
  114. package/geometry/operators/intersectionOperator.d.ts +3 -3
  115. package/geometry/operators/intersectsOperator.d.ts +1 -1
  116. package/geometry/operators/isNearOperator.d.ts +1 -1
  117. package/geometry/operators/labelPointOperator.d.ts +1 -1
  118. package/geometry/operators/lengthOperator.d.ts +1 -1
  119. package/geometry/operators/linesToPolygonsOperator.d.ts +1 -1
  120. package/geometry/operators/locateBetweenOperator.d.ts +2 -2
  121. package/geometry/operators/minimumBoundingCircleOperator.d.ts +1 -1
  122. package/geometry/operators/multiPartToSinglePartOperator.d.ts +2 -2
  123. package/geometry/operators/offsetOperator.d.ts +3 -3
  124. package/geometry/operators/overlapsOperator.d.ts +1 -1
  125. package/geometry/operators/projectOperator.d.ts +4 -6
  126. package/geometry/operators/proximityOperator.d.ts +2 -2
  127. package/geometry/operators/relateOperator.d.ts +1 -1
  128. package/geometry/operators/shapePreservingProjectOperator.d.ts +3 -3
  129. package/geometry/operators/simplifyOGCOperator.d.ts +3 -3
  130. package/geometry/operators/simplifyOperator.d.ts +3 -3
  131. package/geometry/operators/symmetricDifferenceOperator.d.ts +3 -3
  132. package/geometry/operators/touchesOperator.d.ts +1 -1
  133. package/geometry/operators/{support/proximityResult.d.ts → types.d.ts} +18 -3
  134. package/geometry/operators/unionOperator.d.ts +3 -3
  135. package/geometry/operators/withinOperator.d.ts +1 -1
  136. package/geometry/projection/projectBoundingSphere.js +1 -1
  137. package/geometry/support/curves/curveUtils.js +1 -1
  138. package/geometry/support/geodesicUtils.d.ts +15 -2
  139. package/geometry/support/jsonUtils.d.ts +1 -1
  140. package/geometry/support/meshUtils/types.d.ts +34 -0
  141. package/geometry/support/meshUtils.d.ts +4 -7
  142. package/geometry/support/sphere.js +1 -1
  143. package/geometry/support/webMercatorUtils.d.ts +1 -1
  144. package/geometry/types.d.ts +23 -1
  145. package/geometry.d.ts +1 -1
  146. package/interfaces.d.ts +69 -72
  147. package/kernel.js +1 -1
  148. package/layers/CSVLayer.d.ts +0 -2
  149. package/layers/CatalogLayer.d.ts +1 -1
  150. package/layers/FeatureLayer.d.ts +1 -1
  151. package/layers/GeoJSONLayer.d.ts +1 -1
  152. package/layers/KnowledgeGraphLayer.js +1 -1
  153. package/layers/LinkChartLayer.js +1 -1
  154. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  155. package/layers/OGCFeatureLayer.d.ts +1 -1
  156. package/layers/OrientedImageryLayer.d.ts +1 -3
  157. package/layers/ParquetLayer.d.ts +1 -1
  158. package/layers/WFSLayer.d.ts +1 -1
  159. package/layers/catalog/CatalogFootprintLayer.d.ts +1 -1
  160. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  161. package/layers/knowledgeGraph/KnowledgeGraphSublayer.d.ts +3 -3
  162. package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
  163. package/layers/knowledgeGraph/layerUtils.js +1 -1
  164. package/layers/mixins/APIKeyMixin.d.ts +2 -2
  165. package/layers/mixins/ArcGISImageService.d.ts +4 -3
  166. package/layers/mixins/BlendLayer.d.ts +16 -15
  167. package/layers/mixins/DisplayFilteredLayer.d.ts +6 -3
  168. package/layers/mixins/FeatureEffectLayer.d.ts +23 -21
  169. package/layers/mixins/FeatureLayerBase.d.ts +23 -20
  170. package/layers/mixins/ImageryTileMixin.d.ts +5 -5
  171. package/layers/mixins/PortalLayer.d.ts +7 -7
  172. package/layers/mixins/RasterPresetRendererMixin.d.ts +6 -3
  173. package/layers/mixins/SceneService.d.ts +2 -2
  174. package/layers/mixins/TemporalLayer.d.ts +8 -7
  175. package/layers/mixins/TemporalSceneLayer.d.ts +2 -2
  176. package/layers/mixins/TrackableLayer.d.ts +4 -4
  177. package/layers/ogc/wfsUtils.d.ts +1 -1
  178. package/layers/raster/formats/Lerc.js +1 -1
  179. package/layers/raster/functions/creators/createSurfaceFunctions.d.ts +2 -2
  180. package/layers/support/DisplayFilterInfo.d.ts +7 -7
  181. package/layers/support/FeatureReductionCluster.d.ts +5 -5
  182. package/layers/support/FieldsIndex.d.ts +1 -2
  183. package/layers/support/RasterBandInfo.d.ts +1 -1
  184. package/layers/support/RasterInfo.d.ts +2 -2
  185. package/layers/support/RasterSensorInfo.d.ts +1 -1
  186. package/layers/support/Sublayer.d.ts +3 -3
  187. package/layers/support/SubtypeSublayer.d.ts +1 -1
  188. package/layers/support/TrackInfo.d.ts +2 -2
  189. package/layers/support/arcgisLayerUrl.js +1 -1
  190. package/layers/support/fieldUtils.d.ts +0 -1
  191. package/layers/support/source/QueryTableDataSource.d.ts +2 -2
  192. package/layers/support/types.d.ts +2 -2
  193. package/layers/types.d.ts +1 -1
  194. package/package.json +2 -2
  195. package/popup/FieldInfo.d.ts +8 -8
  196. package/popup/content/AttachmentsContent.d.ts +2 -2
  197. package/popup/content/CustomContent.d.ts +1 -1
  198. package/portal/interfaces.d.ts +2 -2
  199. package/portal/support/resourceUtils.d.ts +6 -7
  200. package/rest/featureService/types.d.ts +1 -1
  201. package/rest/geometryService.d.ts +2 -2
  202. package/rest/imageService.d.ts +1 -1
  203. package/rest/knowledgeGraph/GraphAnyValue.d.ts +1 -1
  204. package/rest/query/support/AttachmentInfo.d.ts +1 -1
  205. package/rest/query.d.ts +1 -1
  206. package/rest/support/BufferParameters.d.ts +1 -1
  207. package/rest/support/DataLayer.d.ts +1 -1
  208. package/rest/support/DensifyParameters.d.ts +1 -1
  209. package/rest/support/DistanceParameters.d.ts +1 -1
  210. package/rest/support/FeatureSet.d.ts +2 -2
  211. package/rest/support/FindImagesParameters.d.ts +1 -1
  212. package/rest/support/GeneralizeParameters.d.ts +1 -1
  213. package/rest/support/IdentifyParameters.d.ts +1 -1
  214. package/rest/support/ImageGPSInfoParameters.d.ts +1 -1
  215. package/rest/support/ImageMeasureResultAreaValue.d.ts +1 -1
  216. package/rest/support/ImageToMapMultirayParameters.d.ts +1 -1
  217. package/rest/support/OffsetParameters.d.ts +1 -1
  218. package/rest/support/ProjectParameters.d.ts +1 -1
  219. package/rest/support/Query.d.ts +1 -1
  220. package/rest/support/QueryMixin.d.ts +1 -1
  221. package/rest/support/RelationParameters.d.ts +1 -1
  222. package/rest/support/RelationshipQuery.d.ts +1 -1
  223. package/rest/support/TopFeaturesQuery.d.ts +1 -1
  224. package/smartMapping/labels/bins.d.ts +3 -6
  225. package/smartMapping/labels/clusters.d.ts +2 -2
  226. package/smartMapping/popup/clusters.d.ts +4 -4
  227. package/smartMapping/popup/templates.d.ts +4 -4
  228. package/smartMapping/renderers/color.d.ts +6 -6
  229. package/smartMapping/renderers/size.d.ts +6 -6
  230. package/smartMapping/statistics/support/ageUtils.d.ts +5 -5
  231. package/smartMapping/statistics/types.d.ts +5 -5
  232. package/smartMapping/types.d.ts +9 -1
  233. package/support/revision.js +1 -1
  234. package/unionTypes.d.ts +1 -1
  235. package/views/2d/MapViewConstraints.d.ts +5 -4
  236. package/views/2d/engine/webgl/Painter.js +1 -1
  237. package/views/2d/engine/webgl/shaderGraph/GLSLShaderModule.js +1 -1
  238. package/views/2d/engine/webgl/shaderGraph/GraphShaderModule.js +1 -1
  239. package/views/2d/engine/webgl/shaderGraph/graph/GlslGraphWriter.js +1 -1
  240. package/views/2d/engine/webgl/shaderGraph/graph/ShaderGraphContext.js +1 -1
  241. package/views/2d/engine/webgl/shaderGraph/typed/TypedShaderProgram.js +1 -1
  242. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  243. package/views/2d/layers/features/PipelineConnectionHandlers.js +1 -1
  244. package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
  245. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  246. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  247. package/views/3d/layers/I3SMeshView3D.js +1 -1
  248. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  249. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  250. package/views/3d/layers/i3s/I3SIntersectionHandler.js +1 -1
  251. package/views/3d/layers/i3s/I3SNode.js +1 -1
  252. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  253. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  254. package/views/3d/layers/support/Tiles3DIntersectionHandler.js +1 -1
  255. package/views/3d/support/ElevationRange.js +1 -1
  256. package/views/3d/terrain/TerrainSurface.js +1 -1
  257. package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechniqueConfiguration.js +1 -1
  258. package/views/3d/webgl-engine/lib/Octree.js +1 -1
  259. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  260. package/views/BreakpointsOwner.d.ts +1 -1
  261. package/views/LinkChartView.d.ts +1 -2
  262. package/views/MapView.d.ts +1 -2
  263. package/views/SceneView.d.ts +1 -2
  264. package/views/View.d.ts +1 -1
  265. package/views/Viewport2DMixin.d.ts +1 -1
  266. package/views/draw/MultipointDrawAction.d.ts +1 -1
  267. package/views/draw/MultipointDrawAction.js +1 -1
  268. package/views/draw/PointDrawAction.d.ts +1 -1
  269. package/views/draw/PointDrawAction.js +1 -1
  270. package/views/draw/PolygonDrawAction.d.ts +1 -1
  271. package/views/draw/PolygonDrawAction.js +1 -1
  272. package/views/draw/PolylineDrawAction.d.ts +1 -1
  273. package/views/draw/PolylineDrawAction.js +1 -1
  274. package/views/draw/SegmentDrawAction.d.ts +1 -1
  275. package/views/draw/SegmentDrawAction.js +1 -1
  276. package/views/input/{IViewEvents.js → mouseButtons.js} +1 -1
  277. package/views/input/types.d.ts +602 -1
  278. package/views/layers/BuildingSceneLayerView.d.ts +1 -1
  279. package/views/layers/FeatureLayerViewMixin.d.ts +1 -1
  280. package/views/layers/ImageryLayerViewMixin.d.ts +1 -1
  281. package/views/layers/MediaLayerViewMixin.d.ts +1 -1
  282. package/views/layers/PointCloudLayerView.d.ts +1 -1
  283. package/views/layers/SceneLayerView.d.ts +2 -2
  284. package/views/types.d.ts +148 -2
  285. package/webdoc/geotriggersInfo/FeatureFilter.d.ts +1 -1
  286. package/webscene/support/FeatureReferenceObjectId.d.ts +1 -1
  287. package/widgets/BasemapLayerList/BasemapLayerListViewModel.d.ts +1 -2
  288. package/widgets/BasemapLayerList.d.ts +3 -4
  289. package/widgets/CatalogLayerList/CatalogLayerListViewModel.d.ts +1 -1
  290. package/widgets/CatalogLayerList.d.ts +2 -4
  291. package/widgets/Directions/DirectionsViewModel.d.ts +1 -1
  292. package/widgets/Editor/types.d.ts +1 -1
  293. package/widgets/Feature/support/arcadeFeatureUtils.js +1 -1
  294. package/widgets/FeatureTable/FeatureTableViewModel.d.ts +46 -5
  295. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  296. package/widgets/FeatureTable/FieldColumn.js +1 -1
  297. package/widgets/FeatureTable/Grid/EditorColumn.js +1 -1
  298. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  299. package/widgets/FeatureTable/Grid/GridViewModel.js +1 -1
  300. package/widgets/FeatureTable/VisibleElements.d.ts +30 -9
  301. package/widgets/FeatureTable/VisibleElements.js +1 -1
  302. package/widgets/FeatureTable/support/AttachmentsViewOptions.d.ts +1 -1
  303. package/widgets/FeatureTable/support/FeatureStore.d.ts +1 -0
  304. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  305. package/widgets/FeatureTable/support/interfaces.d.ts +2 -2
  306. package/widgets/FeatureTable.d.ts +46 -5
  307. package/widgets/FeatureTable.js +1 -1
  308. package/widgets/LayerList/LayerListViewModel.d.ts +9 -10
  309. package/widgets/LayerList/ListItem.d.ts +9 -11
  310. package/widgets/LayerList/ListItemPanel.d.ts +1 -1
  311. package/widgets/LayerList.d.ts +7 -4
  312. package/widgets/Legend/LegendViewModel.d.ts +5 -5
  313. package/widgets/Legend/support/ActiveLayerInfo.d.ts +5 -5
  314. package/widgets/Legend.d.ts +4 -4
  315. package/widgets/Popup/types.d.ts +3 -3
  316. package/widgets/Popup.d.ts +3 -3
  317. package/widgets/TableList/TableListViewModel.d.ts +2 -4
  318. package/widgets/TableList.d.ts +1 -1
  319. package/widgets/UtilityNetworkTrace/types.d.ts +1 -1
  320. package/assets/esri/core/workers/chunks/052ded41dc06c93ec0a7.js +0 -1
  321. package/assets/esri/core/workers/chunks/30184e39129d9c66ea54.js +0 -1
  322. package/assets/esri/core/workers/chunks/5340887a4a48bde3407a.js +0 -1
  323. package/assets/esri/core/workers/chunks/537de53ef1e9101468f5.js +0 -1
  324. package/assets/esri/core/workers/chunks/94f02082a006003ef5a9.js +0 -1
  325. package/assets/esri/core/workers/chunks/a1f264abbd6354c333bf.js +0 -1
  326. package/assets/esri/core/workers/chunks/d3db7244fac7398cc700.js +0 -1
  327. package/assets/esri/core/workers/chunks/d94a2ad5a91de7086fbe.js +0 -1
  328. package/assets/esri/core/workers/chunks/ed38c1043e6a83f49f93.js +0 -1
  329. package/geometry/geodesicUtils.d.ts +0 -19
  330. package/geometry/operators/support/geodeticCurveType.d.ts +0 -2
  331. package/geometry/operators/support/projectionTransformation.d.ts +0 -16
  332. package/geometry/support/MeshVertexSpace.d.ts +0 -4
  333. package/geometry/support/meshUtils/elevation.d.ts +0 -16
  334. package/geometry/support/meshUtils/elevationSampler.d.ts +0 -9
  335. package/geometry/support/meshUtils/georeference.d.ts +0 -10
  336. package/geometry/support/typeUtils.d.ts +0 -16
  337. package/smartMapping/popup/support/utils.d.ts +0 -13
  338. package/smartMapping/support/binningUtils.d.ts +0 -11
  339. package/smartMapping/support/clusterUtils.d.ts +0 -11
  340. package/smartMapping/support/utils.d.ts +0 -4
  341. package/views/2d/constraints/GeometryConstraint.d.ts +0 -4
  342. package/views/HitTestItem3D.d.ts +0 -20
  343. package/views/HitTestOptions.d.ts +0 -25
  344. package/views/IBreakpointsOwner.d.ts +0 -55
  345. package/views/IObjectId.d.ts +0 -2
  346. package/views/ISceneView.d.ts +0 -5
  347. package/views/IView.d.ts +0 -43
  348. package/views/input/IViewEvents.d.ts +0 -602
  349. /package/views/draw/input/{CursorUpdateEvents.d.ts → CursorUpdateEvent.d.ts} +0 -0
  350. /package/views/draw/input/{CursorUpdateEvents.js → CursorUpdateEvent.js} +0 -0
  351. /package/views/layers/{HighlightableLayerView.d.ts → types.d.ts} +0 -0
@@ -1,6 +1,7 @@
1
1
  import type Accessor from "../../core/Accessor.js";
2
+ import type Extent from "../../geometry/Extent.js";
3
+ import type Polygon from "../../geometry/Polygon.js";
2
4
  import type LOD from "../../layers/support/LOD.js";
3
- import type { SupportedGeometry } from "./constraints/GeometryConstraint.js";
4
5
  import type { PolygonProperties } from "../../geometry/Polygon.js";
5
6
  import type { ExtentProperties } from "../../geometry/Extent.js";
6
7
  import type { LODProperties } from "../../layers/support/LOD.js";
@@ -11,7 +12,7 @@ export interface MapViewConstraintsProperties extends Partial<Pick<MapViewConstr
11
12
  *
12
13
  * @since 4.17
13
14
  */
14
- geometry?: ((ExtentProperties & { type: "extent" }) | (PolygonProperties & { type: "polygon" })) | null;
15
+ geometry?: (ExtentProperties & { type: "extent" }) | (PolygonProperties & { type: "polygon" }) | null;
15
16
  /**
16
17
  * An array of [LODs](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-LOD.html). If not specified, this value is read from the [Map](https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html). It is possible to generate additional LODs via the
17
18
  * [TileInfo#create()](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-TileInfo.html#create) method. This is useful in cases where the default amount of LODs provided are not sufficient. One example of when
@@ -36,8 +37,8 @@ export default abstract class MapViewConstraints extends Accessor {
36
37
  *
37
38
  * @since 4.17
38
39
  */
39
- get geometry(): SupportedGeometry | null;
40
- set geometry(value: ((ExtentProperties & { type: "extent" }) | (PolygonProperties & { type: "polygon" })) | null);
40
+ get geometry(): Extent | Polygon | null;
41
+ set geometry(value: (ExtentProperties & { type: "extent" }) | (PolygonProperties & { type: "polygon" }) | null);
41
42
  /**
42
43
  * An array of [LODs](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-LOD.html). If not specified, this value is read from the [Map](https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html). It is possible to generate additional LODs via the
43
44
  * [TileInfo#create()](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-TileInfo.html#create) method. This is useful in cases where the default amount of LODs provided are not sufficient. One example of when
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../core/has.js";import{disposeMaybe as e,destroyMaybe as t}from"../../../../core/maybe.js";import{brushes as s}from"../brushes.js";import r from"../vectorTiles/shaders/VTLMaterialManager.js";import{BitBlitRenderer as i}from"./BitBlitRenderer.js";import{backbufferStencilVisible as n}from"./definitions.js";import a from"./MaterialManager.js";import o from"./TextureManager.js";import{TextureUploadManager as l}from"./TextureUploadManager.js";import{WorldExtentRenderer as h}from"./WorldExtentClipRenderer.js";import{BlendEffect as f}from"./effects/BlendEffect.js";import{FeatureEffect as c}from"./effects/FeatureEffect.js";import d from"./effects/HighlightEffect.js";import{HittestEffect as u}from"./effects/HittestEffect.js";import{EffectManager as p}from"./effects/post-processing/EffectManager.js";import{SimpleMesh as b}from"./meshing/SimpleMesh.js";import m from"./painter/RenderPass.js";import{TechniqueProgramCache as _}from"./shaderGraph/techniques/TechniqueProgramCache.js";import{SizedDepthStencilFormat as g}from"../../../webgl/enums.js";import{FramebufferObject as w}from"../../../webgl/FramebufferObject.js";import{Renderbuffer as S}from"../../../webgl/Renderbuffer.js";import{RenderbufferDescriptor as M}from"../../../webgl/RenderbufferDescriptor.js";import{TextureDescriptor as E}from"../../../webgl/TextureDescriptor.js";class P{constructor(e,t){this.context=e,this._currentPipelineStateNeedsUpdate=!1,this._blitRenderer=new i,this._worldExtentRenderer=new h,this._brushCache=new Map,this._lastWidth=null,this._lastHeight=null,this._vtlMaterialManager=new r,this._blendEffect=new f,this._stencilBuf=null,this._prevBeforeLayerFBOStack=[],this._fboPool=[],this.effects={highlight:new d,hittest:new u,insideEffect:new c("inside"),outsideEffect:new c("outside")},this._programCache=new _,this.materialManager=new a(e),this.textureManager=new o(t),this.textureUploadManager=new l(t),this._effectsManager=new p,this._quadMesh=b.fromVertexStream(e,[0,0,1,0,0,1,1,1])}dispose(){if(this._programCache.destroy(),this.materialManager.dispose(),this.textureManager.dispose(),this.textureUploadManager.destroy(),this._blitRenderer=e(this._blitRenderer),this._worldExtentRenderer=e(this._worldExtentRenderer),this._quadMesh=t(this._quadMesh),this._brushCache&&(this._brushCache.forEach(e=>e.dispose()),this._brushCache.clear(),this._brushCache=null),this._fbos){let e;for(e in this._fbos)this._fbos[e]&&this._fbos[e].dispose()}for(const e of this._fboPool)e.dispose();if(this._fboPool.length=0,this.effects){let e;for(e in this.effects)this.effects[e]&&this.effects[e].dispose()}this._effectsManager.dispose(),this._blendEffect.dispose(this.context),this._vtlMaterialManager=e(this._vtlMaterialManager)}clearShaderCache(){this._programCache.destroy(),this._programCache=new _}get blitRenderer(){return this._blitRenderer}get vectorTilesMaterialManager(){return this._vtlMaterialManager}get quadMesh(){return this._quadMesh}getFbos(){if(!this._fbos)throw new Error("InternalError: Painter FBOs not initialized");return this._fbos}acquireFbo(e,t){let s;if(this._fboPool.length>0)s=this._fboPool.pop();else{const r=new E(e,t);r.samplingMode=9728,r.wrapMode=33071,s=new w(this.context,r,this._stencilBuf)}return s.width===e&&s.height===t||s.resize(e,t),s}releaseFbo(e){this._fboPool.push(e)}getSharedStencilBuffer(){return this._stencilBuf}beforeRenderPhases(e,t,s){const{context:r}=e;this._worldExtentRenderer.render(e,t,s);const{width:i,height:n}=r.getViewport();if(this.updateFBOs(i,n),this._prevFBO=r.getBoundFramebufferObject(),r.bindFramebuffer(this.getFbos().output),r.setColorMask(!0,!0,!0,!0),null!=t){const{r:e,g:s,b:i,a:n}=t;r.setClearColor(n*e/255,n*s/255,n*i/255,n)}else r.setClearColor(0,0,0,0);r.setDepthWriteEnabled(!0),r.setClearDepth(1),r.clear(16640),r.setDepthWriteEnabled(!1)}afterRenderPhases(e){const{context:t}=e;t.bindFramebuffer(this._prevFBO),t.setStencilFunction(514,n,255),t.setStencilTestEnabled(!0),t.setDepthTestEnabled(!1),this.blitTexture(t,this.getFbos().output.colorTexture,9728)}beforeRenderLayer(e,t,s){const{context:r,blendMode:i,effects:n,drawPhase:a,requireFBO:o}=e;if(r.setClearColor(0,0,0,0),o||C(a,i,n,s)){const e=r.getBoundFramebufferObject();this._prevBeforeLayerFBOStack.push(e);const{width:t,height:s}=r.getViewport(),i=this.acquireFbo(t,s);r.bindFramebuffer(i),r.setColorMask(!0,!0,!0,!0),r.setClearColor(0,0,0,0),r.setDepthWriteEnabled(!0),r.setClearDepth(1),r.clear(16640),r.setDepthWriteEnabled(!1)}r.setDepthWriteEnabled(!1),r.setDepthTestEnabled(!1),r.setStencilTestEnabled(!0),r.setClearStencil(t),r.setStencilWriteMask(255),r.clear(1024)}afterRenderLayer(e,t){const{context:s,blendMode:r,effects:i,requireFBO:n,drawPhase:a}=e;if(n||C(a,r,i,t)){const n=s.getBoundFramebufferObject();null!=i&&i.length>0&&1===a&&(s.setColorMask(!0,!0,!0,!0),this._applyEffects(e,i,n)),s.bindFramebuffer(this._prevBeforeLayerFBOStack.pop()),s.setStencilTestEnabled(!1),s.setStencilWriteMask(0),s.setBlendingEnabled(!0),s.setBlendFunctionSeparate(1,771,1,771),s.setColorMask(!0,!0,!0,!0);const o=null==r||16===a||2===a?"normal":r;this._blendEffect.draw(e,n.colorTexture,9728,o,t),this.releaseFbo(n)}}renderObject(e,t,r,i){const n=s[r];if(!n)return;let a=this._brushCache.get(n);void 0===a&&(a=new n,this._brushCache.set(n,a)),a.prepareState(e),a.draw(e,t,i)}renderObjects(e,t,r,i){const n=s[r];if(!n)return;let a=this._brushCache.get(n);void 0===a&&(a=new n,this._brushCache.set(n,a)),a.drawMany(e,t,i)}registerRenderPass(e){const t=e.brushes.map(e=>(this._brushCache.has(e)||this._brushCache.set(e,new e),this._brushCache.get(e)));return new m(t,e)}blitTexture(e,t,s,r=1){e.setBlendingEnabled(!0),e.setBlendFunctionSeparate(1,771,1,771),e.setColorMask(!0,!0,!0,!0),this._blitRenderer.render(e,t,s,r),this._currentPipelineStateNeedsUpdate=!0}getPostProcessingEffects(e){return this._effectsManager.getPostProcessingEffects(e)}updateFBOs(e,t){if(e!==this._lastWidth||t!==this._lastHeight){if(this._lastWidth=e,this._lastHeight=t,this._fbos){let s;for(s in this._fbos)this._fbos[s].resize(e,t);return}const s=new E(e,t);s.samplingMode=9728,s.wrapMode=33071;const r=new M(g.DEPTH24_STENCIL8,e,t);this._stencilBuf=new S(this.context,r),this._fbos={output:new w(this.context,s,this._stencilBuf),effect0:new w(this.context,s,this._stencilBuf)}}}_applyEffects(e,t,s){const{context:r}=e,i=this._effectsManager.getPostProcessingEffects(t);for(const{postProcessingTechnique:n,effect:a}of i)r.bindFramebuffer(s),n.render(e,{layerFBO:s,effect:a});this._currentPipelineStateNeedsUpdate=!0}setShader(e){return this._shaderState={shader:e.shader,uniforms:e.uniforms,defines:e.defines,optionalAttributes:e.optionalAttributes,useComputeBuffer:e.useComputeBuffer??!1},this._shaderState}setPipelineState(e){e!==this._currentPipelineState&&(this._currentPipelineState=e,this._currentPipelineStateNeedsUpdate=!0)}submitDraw(e,t,s){let r=s?.stencilRef;if(!this._shaderState)return null;const{shader:i,uniforms:n,defines:a,optionalAttributes:o}=this._shaderState,l=e.context,h=t.getAttributePrecisionPackFactors(),f=this._programCache.getProgram(i,h,n,a??{},o??{});if(f.setUniforms(n),f.bind(l),this.updatePipelineState(l),null==r){const e=t.getStencilReference();null!=e&&(r=e)}return null!=r&&this.setStencilRef(l,r),t.draw(e,i.locationInfo),f.cleanupTemporaryTextures(),{vertexShader:f.vertexShader,fragmentShader:f.fragmentShader}}submitDrawMesh(e,t,s,r){this.submitDrawMeshUntyped(e,t,s,r)}submitDrawMeshUntyped(e,t,s,r){const i=r?.parts,n=r?.stencilRef,{shader:a,uniforms:o,defines:l,optionalAttributes:h}=this.setShader(t),f=this._programCache.getProgram(a,{},o,l??{},h??{});if(f.setUniforms(o),f.bind(e),this.updatePipelineState(e),this.setStencilRef(e,n),i)for(const c of i)s.bind(e,t.shader.locationInfo,c),s.draw(e);else for(let c=0;c<s.parts.length;c++)s.bind(e,t.shader.locationInfo,c),s.draw(e);s.unbind(e),f.cleanupTemporaryTextures()}updatePipelineState(e){this._currentPipelineStateNeedsUpdate&&(this._currentPipelineStateNeedsUpdate=!1,this._updatePipelineState(e))}_updatePipelineState(e){if(null==this._currentPipelineState)throw new Error("Pipeline state not defined. Call setPipelineState before calling submitDraw ");const{color:t,depth:s,stencil:r}=this._currentPipelineState;if(t){const{blendMode:s,write:r}=t;switch(e.setColorMask(...r),e.setBlendingEnabled("none"!==s),e.setBlendEquation(32774),s){case"composite":e.setBlendFunctionSeparate(1,771,1,771);break;case"additive":e.setBlendFunctionSeparate(1,1,1,1);break;case"custom":{const{blendParameters:s}=t,{dstAlpha:r,dstRGB:i,srcAlpha:n,srcRGB:a}=s;e.setBlendFunctionSeparate(a,i,n,r);break}case"delete":e.setBlendEquation(32779),e.setBlendFunctionSeparate(1,771,1,771);break;case"none":e.setBlendingEnabled(!1)}}else e.setColorMask(!1,!1,!1,!1);if(s){const{test:t,write:r}=s;r?(e.setDepthWriteEnabled(!0),e.setDepthRange(r.zNear,r.zFar)):e.setDepthWriteEnabled(!1),t?(e.setDepthTestEnabled(!0),e.setDepthFunction(t)):e.setDepthTestEnabled(!1)}else e.setDepthTestEnabled(!1),e.setDepthWriteEnabled(!1);if(r){const{test:t,write:s}=r;if(t){const{op:s}=t;e.setStencilTestEnabled(!0),e.setStencilOpSeparate(1032,s.fail,s.zFail,s.zPass)}else e.setStencilTestEnabled(!1);if(s){const{mask:t}=s;e.setStencilWriteMask(t)}else e.setStencilWriteMask(0)}else e.setStencilTestEnabled(!1),e.setStencilWriteMask(0)}setStencilRef(e,t){if(null==this._currentPipelineState)throw new Error("Pipeline state not defined. Call setPipelineState before calling submitDraw ");const{stencil:s}=this._currentPipelineState;if(s){const{test:r}=s;if(r){const{compare:s,mask:i}=r;if(null==t)throw new Error("InternalError: Stencil reference expected for target but not defined");e.setStencilFunctionSeparate(1032,s,t,i)}}}}function C(e,t,s,r){return 4!==e&&2!==e&&16!==e&&(1!==r||null!=t&&"normal"!==t||null!=s&&s.length>0)}export{P as default};
5
+ import"../../../../core/has.js";import"../../../../core/Logger.js";import{disposeMaybe as e,destroyMaybe as t}from"../../../../core/maybe.js";import{brushes as s}from"../brushes.js";import r from"../vectorTiles/shaders/VTLMaterialManager.js";import{BitBlitRenderer as i}from"./BitBlitRenderer.js";import{backbufferStencilVisible as n}from"./definitions.js";import a from"./MaterialManager.js";import o from"./TextureManager.js";import{TextureUploadManager as l}from"./TextureUploadManager.js";import{WorldExtentRenderer as h}from"./WorldExtentClipRenderer.js";import{BlendEffect as f}from"./effects/BlendEffect.js";import{FeatureEffect as c}from"./effects/FeatureEffect.js";import d from"./effects/HighlightEffect.js";import{HittestEffect as p}from"./effects/HittestEffect.js";import{EffectManager as u}from"./effects/post-processing/EffectManager.js";import{SimpleMesh as b}from"./meshing/SimpleMesh.js";import m from"./painter/RenderPass.js";import{TechniqueProgramCache as _}from"./shaderGraph/techniques/TechniqueProgramCache.js";import{SizedDepthStencilFormat as g}from"../../../webgl/enums.js";import{FramebufferObject as w}from"../../../webgl/FramebufferObject.js";import{Renderbuffer as S}from"../../../webgl/Renderbuffer.js";import{RenderbufferDescriptor as M}from"../../../webgl/RenderbufferDescriptor.js";import{TextureDescriptor as E}from"../../../webgl/TextureDescriptor.js";class P{constructor(e,t){this.context=e,this._currentPipelineStateNeedsUpdate=!1,this._blitRenderer=new i,this._worldExtentRenderer=new h,this._brushCache=new Map,this._lastWidth=null,this._lastHeight=null,this._vtlMaterialManager=new r,this._blendEffect=new f,this._stencilBuf=null,this._prevBeforeLayerFBOStack=[],this._fboPool=[],this.effects={highlight:new d,hittest:new p,insideEffect:new c("inside"),outsideEffect:new c("outside")},this._programCache=new _,this.materialManager=new a(e),this.textureManager=new o(t),this.textureUploadManager=new l(t),this._effectsManager=new u,this._quadMesh=b.fromVertexStream(e,[0,0,1,0,0,1,1,1])}dispose(){if(this._programCache.destroy(),this.materialManager.dispose(),this.textureManager.dispose(),this.textureUploadManager.destroy(),this._blitRenderer=e(this._blitRenderer),this._worldExtentRenderer=e(this._worldExtentRenderer),this._quadMesh=t(this._quadMesh),this._brushCache&&(this._brushCache.forEach(e=>e.dispose()),this._brushCache.clear(),this._brushCache=null),this._fbos){let e;for(e in this._fbos)this._fbos[e]&&this._fbos[e].dispose()}for(const e of this._fboPool)e.dispose();if(this._fboPool.length=0,this.effects){let e;for(e in this.effects)this.effects[e]&&this.effects[e].dispose()}this._effectsManager.dispose(),this._blendEffect.dispose(this.context),this._vtlMaterialManager=e(this._vtlMaterialManager)}clearShaderCache(){this._programCache.destroy(),this._programCache=new _}get blitRenderer(){return this._blitRenderer}get vectorTilesMaterialManager(){return this._vtlMaterialManager}get quadMesh(){return this._quadMesh}getFbos(){if(!this._fbos)throw new Error("InternalError: Painter FBOs not initialized");return this._fbos}acquireFbo(e,t){let s;if(this._fboPool.length>0)s=this._fboPool.pop();else{const r=new E(e,t);r.samplingMode=9728,r.wrapMode=33071,s=new w(this.context,r,this._stencilBuf)}return s.width===e&&s.height===t||s.resize(e,t),s}releaseFbo(e){this._fboPool.push(e)}getSharedStencilBuffer(){return this._stencilBuf}beforeRenderPhases(e,t,s){const{context:r}=e;this._worldExtentRenderer.render(e,t,s);const{width:i,height:n}=r.getViewport();if(this.updateFBOs(i,n),this._prevFBO=r.getBoundFramebufferObject(),r.bindFramebuffer(this.getFbos().output),r.setColorMask(!0,!0,!0,!0),null!=t){const{r:e,g:s,b:i,a:n}=t;r.setClearColor(n*e/255,n*s/255,n*i/255,n)}else r.setClearColor(0,0,0,0);r.setDepthWriteEnabled(!0),r.setClearDepth(1),r.clear(16640),r.setDepthWriteEnabled(!1)}afterRenderPhases(e){const{context:t}=e;t.bindFramebuffer(this._prevFBO),t.setStencilFunction(514,n,255),t.setStencilTestEnabled(!0),t.setDepthTestEnabled(!1),this.blitTexture(t,this.getFbos().output.colorTexture,9728)}beforeRenderLayer(e,t,s){const{context:r,blendMode:i,effects:n,drawPhase:a,requireFBO:o}=e;if(r.setClearColor(0,0,0,0),o||C(a,i,n,s)){const e=r.getBoundFramebufferObject();this._prevBeforeLayerFBOStack.push(e);const{width:t,height:s}=r.getViewport(),i=this.acquireFbo(t,s);r.bindFramebuffer(i),r.setColorMask(!0,!0,!0,!0),r.setClearColor(0,0,0,0),r.setDepthWriteEnabled(!0),r.setClearDepth(1),r.clear(16640),r.setDepthWriteEnabled(!1)}r.setDepthWriteEnabled(!1),r.setDepthTestEnabled(!1),r.setStencilTestEnabled(!0),r.setClearStencil(t),r.setStencilWriteMask(255),r.clear(1024)}afterRenderLayer(e,t){const{context:s,blendMode:r,effects:i,requireFBO:n,drawPhase:a}=e;if(n||C(a,r,i,t)){const n=s.getBoundFramebufferObject();null!=i&&i.length>0&&1===a&&(s.setColorMask(!0,!0,!0,!0),this._applyEffects(e,i,n)),s.bindFramebuffer(this._prevBeforeLayerFBOStack.pop()),s.setStencilTestEnabled(!1),s.setStencilWriteMask(0),s.setBlendingEnabled(!0),s.setBlendFunctionSeparate(1,771,1,771),s.setColorMask(!0,!0,!0,!0);const o=null==r||16===a||2===a?"normal":r;this._blendEffect.draw(e,n.colorTexture,9728,o,t),this.releaseFbo(n)}}renderObject(e,t,r,i){const n=s[r];if(!n)return;let a=this._brushCache.get(n);void 0===a&&(a=new n,this._brushCache.set(n,a)),a.prepareState(e),a.draw(e,t,i)}renderObjects(e,t,r,i){const n=s[r];if(!n)return;let a=this._brushCache.get(n);void 0===a&&(a=new n,this._brushCache.set(n,a)),a.drawMany(e,t,i)}registerRenderPass(e){const t=e.brushes.map(e=>(this._brushCache.has(e)||this._brushCache.set(e,new e),this._brushCache.get(e)));return new m(t,e)}blitTexture(e,t,s,r=1){e.setBlendingEnabled(!0),e.setBlendFunctionSeparate(1,771,1,771),e.setColorMask(!0,!0,!0,!0),this._blitRenderer.render(e,t,s,r),this._currentPipelineStateNeedsUpdate=!0}getPostProcessingEffects(e){return this._effectsManager.getPostProcessingEffects(e)}updateFBOs(e,t){if(e!==this._lastWidth||t!==this._lastHeight){if(this._lastWidth=e,this._lastHeight=t,this._fbos){let s;for(s in this._fbos)this._fbos[s].resize(e,t);return}const s=new E(e,t);s.samplingMode=9728,s.wrapMode=33071;const r=new M(g.DEPTH24_STENCIL8,e,t);this._stencilBuf=new S(this.context,r),this._fbos={output:new w(this.context,s,this._stencilBuf),effect0:new w(this.context,s,this._stencilBuf)}}}_applyEffects(e,t,s){const{context:r}=e,i=this._effectsManager.getPostProcessingEffects(t);for(const{postProcessingTechnique:n,effect:a}of i)r.bindFramebuffer(s),n.render(e,{layerFBO:s,effect:a});this._currentPipelineStateNeedsUpdate=!0}setShader(e){return this._shaderState={shader:e.shader,uniforms:e.uniforms,defines:e.defines,optionalAttributes:e.optionalAttributes,useComputeBuffer:e.useComputeBuffer??!1},this._shaderState}setPipelineState(e){e!==this._currentPipelineState&&(this._currentPipelineState=e,this._currentPipelineStateNeedsUpdate=!0)}submitDraw(e,t,s){let r=s?.stencilRef;if(!this._shaderState)return null;const{shader:i,uniforms:n,defines:a,optionalAttributes:o}=this._shaderState,l=e.context,h=t.getAttributePrecisionPackFactors(),f=this._programCache.getProgram(i,h,n,a??{},o??{});if(f.setUniforms(n),f.bind(l),this.updatePipelineState(l),null==r){const e=t.getStencilReference();null!=e&&(r=e)}return null!=r&&this.setStencilRef(l,r),t.draw(e,i.locationInfo),f.cleanupTemporaryTextures(),{vertexShader:f.vertexShader,fragmentShader:f.fragmentShader}}submitDrawMesh(e,t,s,r){this.submitDrawMeshUntyped(e,t,s,r)}submitDrawMeshUntyped(e,t,s,r){const i=r?.parts,n=r?.stencilRef,{shader:a,uniforms:o,defines:l,optionalAttributes:h}=this.setShader(t),f=this._programCache.getProgram(a,{},o,l??{},h??{});if(f.setUniforms(o),f.bind(e),this.updatePipelineState(e),this.setStencilRef(e,n),i)for(const c of i)s.bind(e,t.shader.locationInfo,c),s.draw(e);else for(let c=0;c<s.parts.length;c++)s.bind(e,t.shader.locationInfo,c),s.draw(e);s.unbind(e),f.cleanupTemporaryTextures()}updatePipelineState(e){this._currentPipelineStateNeedsUpdate&&(this._currentPipelineStateNeedsUpdate=!1,this._updatePipelineState(e))}_updatePipelineState(e){if(null==this._currentPipelineState)throw new Error("Pipeline state not defined. Call setPipelineState before calling submitDraw ");const{color:t,depth:s,stencil:r}=this._currentPipelineState;if(t){const{blendMode:s,write:r}=t;switch(e.setColorMask(...r),e.setBlendingEnabled("none"!==s),e.setBlendEquation(32774),s){case"composite":e.setBlendFunctionSeparate(1,771,1,771);break;case"additive":e.setBlendFunctionSeparate(1,1,1,1);break;case"custom":{const{blendParameters:s}=t,{dstAlpha:r,dstRGB:i,srcAlpha:n,srcRGB:a}=s;e.setBlendFunctionSeparate(a,i,n,r);break}case"delete":e.setBlendEquation(32779),e.setBlendFunctionSeparate(1,771,1,771);break;case"none":e.setBlendingEnabled(!1)}}else e.setColorMask(!1,!1,!1,!1);if(s){const{test:t,write:r}=s;r?(e.setDepthWriteEnabled(!0),e.setDepthRange(r.zNear,r.zFar)):e.setDepthWriteEnabled(!1),t?(e.setDepthTestEnabled(!0),e.setDepthFunction(t)):e.setDepthTestEnabled(!1)}else e.setDepthTestEnabled(!1),e.setDepthWriteEnabled(!1);if(r){const{test:t,write:s}=r;if(t){const{op:s}=t;e.setStencilTestEnabled(!0),e.setStencilOpSeparate(1032,s.fail,s.zFail,s.zPass)}else e.setStencilTestEnabled(!1);if(s){const{mask:t}=s;e.setStencilWriteMask(t)}else e.setStencilWriteMask(0)}else e.setStencilTestEnabled(!1),e.setStencilWriteMask(0)}setStencilRef(e,t){if(null==this._currentPipelineState)throw new Error("Pipeline state not defined. Call setPipelineState before calling submitDraw ");const{stencil:s}=this._currentPipelineState;if(s){const{test:r}=s;if(r){const{compare:s,mask:i}=r;if(null==t)throw new Error("InternalError: Stencil reference expected for target but not defined");e.setStencilFunctionSeparate(1032,s,t,i)}}}}function C(e,t,s,r){return 4!==e&&2!==e&&16!==e&&(1!==r||null!=t&&"normal"!==t||null!=s&&s.length>0)}export{P as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{TypedShaderProgram as t}from"./typed/TypedShaderProgram.js";class e{constructor(){this.computeAttributes={}}get locationsMap(){const t=new Map;for(const e in this.locations)t.set(e,this.locations[e].index);return t}get optionPropertyKeys(){if(!this._optionPropertyKeys){const t=new Set(Object.keys(this.options));this._optionPropertyKeys=t}return this._optionPropertyKeys}get _transformFeedbackBindings(){return[]}get locationInfo(){if(!this._locationInfo){const t=this.locationsMap,e=Array.from(t.entries()).map(([t,e])=>`${t}.${e}`).join(".");this._locationInfo={stringHash:e,locations:t,computeAttributeMap:this.computeAttributes}}return this._locationInfo}get renamedLocationsMap(){const t=new Map;for(const[e,o]of this.locationsMap.entries())t.set("a_"+e,o);return t}getShaderKey(t,e,o){return`${Object.keys(t).map(e=>`${e}.${t[e]}`).join(".")}.${Object.keys(o).filter(t=>o[t]).map(t=>`${t}_${o[t].toString()}`).join(".")}.${Object.keys(e).filter(t=>this.optionPropertyKeys.has(t)).join(".")}`}getProgram(e,o,n,r){let i="",s="";for(const t in n)if(n[t]){const e="boolean"==typeof n[t]?`#define ${t}\n`:`#define ${t} ${n[t]}\n`;i+=e,s+=e}return i+=this.vertexShader,s+=this.fragmentShader,new t(i,s,this.renamedLocationsMap,this._getUniformBindings(o),this._transformFeedbackBindings)}_getUniformBindings(t){const e=[];for(const r in this.required){const t=this.required[r];e.push({uniformHydrated:null,shaderModulePath:r,uniformName:r,uniformType:t.type,uniformArrayElementType:o(t),uniformArrayLength:n(t)})}for(const r in t){const i=this.options[r];if(t[r])for(const t in i){const s=i[t];e.push({uniformHydrated:null,shaderModulePath:`${r}.${t}`,uniformName:t,uniformType:s.type,uniformArrayElementType:o(s),uniformArrayLength:n(s)})}}return e}}const o=t=>"array"===t.type?t.elementType?.type:void 0,n=t=>"array"===t.type?t.size:void 0;export{e as GLSLShaderModule};
5
+ import{TypedShaderProgram as t}from"./typed/TypedShaderProgram.js";class e{constructor(){this.computeAttributes={}}get locationsMap(){const t=new Map;for(const e in this.locations)t.set(e,this.locations[e].index);return t}get optionPropertyKeys(){if(!this._optionPropertyKeys){const t=new Set(Object.keys(this.options));this._optionPropertyKeys=t}return this._optionPropertyKeys}get _transformFeedbackBindings(){return[]}get locationInfo(){if(!this._locationInfo){const t=this.locationsMap,e=Array.from(t.entries()).map(([t,e])=>`${t}.${e}`).join(".");this._locationInfo={stringHash:e,locations:t,computeAttributeMap:this.computeAttributes}}return this._locationInfo}get renamedLocationsMap(){const t=new Map;for(const[e,o]of this.locationsMap.entries())t.set("a_"+e,o);return t}getShaderKey(t,e,o){return`${Object.keys(t).map(e=>`${e}.${t[e]}`).join(".")}.${Object.keys(o).filter(t=>o[t]).map(t=>`${t}_${o[t].toString()}`).join(".")}.${Object.keys(e).filter(t=>this.optionPropertyKeys.has(t)).join(".")}`}getProgram(e,o,n,r){let i="",s="";for(const t in n)if(n[t]){const e="boolean"==typeof n[t]?`#define ${t}\n`:`#define ${t} ${n[t]}\n`;i+=e,s+=e}return i+=this.vertexShader,s+=this.fragmentShader,new t("glslShaderModule",i,s,this.renamedLocationsMap,this._getUniformBindings(o),this._transformFeedbackBindings)}_getUniformBindings(t){const e=[];for(const r in this.required){const t=this.required[r];e.push({uniformHydrated:null,shaderModulePath:r,uniformName:r,uniformType:t.type,uniformArrayElementType:o(t),uniformArrayLength:n(t)})}for(const r in t){const i=this.options[r];if(t[r])for(const t in i){const s=i[t];e.push({uniformHydrated:null,shaderModulePath:`${r}.${t}`,uniformName:t,uniformType:s.type,uniformArrayElementType:o(s),uniformArrayLength:n(s)})}}return e}}const o=t=>"array"===t.type?t.elementType?.type:void 0,n=t=>"array"===t.type?t.size:void 0;export{e as GLSLShaderModule};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import"../../../../../core/has.js";import e from"../../../../../core/Logger.js";import{Float as r,Int as o,Vec4 as n,Vec2 as s}from"./graph/glsl.js";import{GlslShaderWriter as i}from"./graph/GlslGraphWriter.js";import{ShaderGraphContext as p}from"./graph/ShaderGraphContext.js";import{setReachableUids as a}from"./graph/ShaderGraphNode.js";import{TypedShaderProgram as u}from"./typed/TypedShaderProgram.js";import{ShaderBuilder as c}from"../../../../webgl/ShaderBuilder.js";function y(t){return new t}function d(t,e,r){const o=t.constructor[e]??[];t.constructor.hasOwnProperty(e)||Object.defineProperty(t.constructor,e,{value:o.slice()}),t.constructor[e].push(r)}function f(t,e){return(r,o)=>{d(r,"locations",{typeCtor:e,propertyKey:o,parameterIndex:null,index:t})}}const h=t=>(e,r)=>{d(e,"builtins",{builtin:t,propertyKey:r})},l=t=>(e,r,o)=>{d(e,"inputs",{inputCtor:t,propertyKey:r,parameterIndex:o})},m=t=>(e,r)=>{d(e,"uniforms",{typeCtor:t,propertyKey:r})},g=t=>(e,r)=>{d(e,"options",{typeCtor:t,propertyKey:r})},_=(t,e)=>{d(t,"defines",{propertyKey:e})};function K(t){return(e,r)=>{d(e,"transformFeedbackBindings",{propertyKey:r,parameterIndex:null,index:t})}}const b=(t,e)=>(r,o)=>{r.constructor.builtins.push({builtin:t,propertyKey:o,typeCtor:e})};class C{static{this.builtins=[]}}t([b("gl_VertexID",o)],C.prototype,"glVertexID",void 0);class x{}class I{static{this.builtins=[]}}t([b("gl_FragCoord",n)],I.prototype,"glFragCoord",void 0),t([b("gl_PointCoord",s)],I.prototype,"glPointCoord",void 0);class v{}t([h("gl_FragDepth")],v.prototype,"glFragDepth",void 0);class w{constructor(){this.type="uniform-group"}get _uniforms(){return this.constructor.uniforms??[]}}class P{constructor(){this.logShader=!1,this.computeAttributes={}}get vertexInput(){const t=this._shaderModuleClass.inputs.findLast(t=>"vertex"===t.propertyKey&&0===t.parameterIndex);if(!t)throw new Error("Unable to find vertex input parameter");return t}get computeInput(){return this._shaderModuleClass.inputs.findLast(t=>"vertex"===t.propertyKey&&1===t.parameterIndex)}get fragmentInput(){const t=this._shaderModuleClass.inputs.findLast(t=>"fragment"===t.propertyKey);if(!t)throw new Error("Unable to find fragment input parameter");return t}get transformFeedbackBindings(){return this.fragmentInput.inputCtor.transformFeedbackBindings??[]}get locations(){return[...this.vertexInput.inputCtor.locations,...this.computeInput?.inputCtor.locations??[]]}get locationsMap(){const t=new Map,r=new Set;for(const o of this.locations)r.has(o.index)?e.getLogger("esri.views.2d.engine.webgl.shaderGraph.GraphShaderModule").warnOnce("mapview-rendering",`Unable to assigned attribute ${o.propertyKey} to ${o.index}. Index already in use`,{locationsMap:t}):(t.set(o.propertyKey,o.index),r.add(o.index));return t}get locationInfo(){if(!this._locationInfo){const t=this.locationsMap,e=Array.from(t.entries()).map(([t,e])=>`${t}.${e}`).join("."),r=this.computeAttributes;this._locationInfo={stringHash:e,locations:t,computeAttributeMap:r}}return this._locationInfo}get renamedLocationsMap(){const t=new Map;for(const e of this.locations)t.set("a_"+e.propertyKey,e.index);return t}get optionPropertyKeys(){if(!this._optionPropertyKeys){const t=new Set;for(const e of this._options)t.add(e.propertyKey);this._optionPropertyKeys=t}return this._optionPropertyKeys}get _shaderModuleClass(){return this.constructor}get _defines(){return this._shaderModuleClass.defines??[]}get _options(){return this._shaderModuleClass.options??[]}get _uniforms(){return this._shaderModuleClass.uniforms??[]}getProgram(t,e,r,o){try{const{vertex:n,fragment:s,uniformBindings:i}=this._generateShaders(t,e,r,o);return new u(n,s,this.renamedLocationsMap,i,this.transformFeedbackBindings)}catch(n){return new u("","",this.renamedLocationsMap,[],this.transformFeedbackBindings)}}getDebugUniformClassInfo(t){const e=this._options.find(e=>e.propertyKey===t);if(e)return{type:"option",className:e.typeCtor};const r=this._uniforms.find(e=>e.propertyKey===t);if(!r)throw new Error(`Unable to find uniform class type for property: ${t}`);return{type:"required",className:r.typeCtor}}getShaderKey(t,e,r,o){const n=Object.keys(t).map(e=>`${e}.${t[e]}`).join("."),s=Object.keys(r).map(t=>`${t}.${r[t]}`).join("."),i=Object.keys(o).map(t=>`${t}.${o[t]}`).join("."),p=Object.keys(e).filter(t=>this.optionPropertyKeys.has(t)&&e[t]).join(".");return`${this.type}.${n}.${s}.${i}.${p}`}_generateShaders(t,e,r,o){const n=[];this._setDefines(r),this._setOptionalUniforms(n,e),this._setRequiredUniforms(n);const s=this._hydrateVertexInput(o),u=this._injectPackPrecisionFactor(s,t),c=this._hydrateComputeInput(),y=c&&this._injectComputePackPrecisionFactor(c,t),d=this.vertex(u,y),f=this._hydrateFragmentInput(d),h=this.fragment(f),l=new Set;for(const i in h){const t=h[i];a(l,t)}const m=this._getVertexInputBuiltins(),g={};for(const[i,p]of Object.entries(s))g[i]=p;if(null!=c)for(const[i,p]of Object.entries(c))g[i]=p;const _=p.createVertex(g,d,m,n,this.transformFeedbackBindings,l);(new i).write(_);const K=this._getFragmentInputBuiltins(h);K.set("glPointCoord","gl_PointCoord"),K.set("glFragCoord","gl_FragCoord");const b=p.createFragment(f,h,K,n,_,this.transformFeedbackBindings);(new i).write(b);const C=this._createShaderBuilder(_,b),x=C.generate("vertex"),I=C.generate("fragment");return this.logShader&&(console.log(x),console.log(I)),{vertex:x,fragment:I,uniformBindings:n}}_setDefines(t){for(const e in t)this[e]=t[e]}_setOptionalUniforms(t,e){for(const r of this._options){e[r.propertyKey]?this[r.propertyKey]=this._hydrateUniformGroup(t,r):this[r.propertyKey]=null}}_setRequiredUniforms(t){for(const e of this._uniforms)this[e.propertyKey]=this._hydrateUniformGroup(t,e)}_hydrateUniformGroup(t,e){const r=new(0,e.typeCtor);for(const o of r._uniforms??[]){const n=y(o.typeCtor),s=`u_${e.propertyKey}_${o.propertyKey}`,i=n.type,p=[e.propertyKey,o.propertyKey].join(".");if("type"in o.typeCtor&&"array"===o.typeCtor.type){const e=n;t.push({shaderModulePath:p,uniformName:s,uniformType:i,uniformArrayLength:e.size,uniformArrayElementType:e.elementType.type,uniformHydrated:n})}else if("type"in o.typeCtor&&"array-2d"===o.typeCtor.type){const e=n;t.push({shaderModulePath:p,uniformName:s,uniformType:i,uniformArrayLength:e.size,uniformArrayElementType:e.elementType.type,uniformHydrated:n})}else t.push({shaderModulePath:p,uniformName:s,uniformType:i,uniformHydrated:n});r[o.propertyKey]=n}return r}_hydrateVertexInput(t){const e=this.vertexInput.inputCtor,r=e.locations.reduce((e,r)=>!1===t[r.propertyKey]?e:{...e,[r.propertyKey]:y(r.typeCtor)},{});for(const{propertyKey:o,typeCtor:n}of e.builtins){const t=y(n);r[o]=t}return r}_hydrateComputeInput(){if(null==this.computeInput)return null;return this.computeInput.inputCtor.locations.reduce((t,e)=>({...t,[e.propertyKey]:y(e.typeCtor)}),{})}_injectPackPrecisionFactor(t,e){const o={};for(const n in t){const s=t[n],i=e[n];if(i){if("float"!==s.type&&"vec2"!==s.type&&"vec3"!==s.type&&"vec4"!==s.type)throw new Error(`InternalError: packPrecisionFactor requires GenType, but found ${s.type}`);o[n]=s.divide(new r(i))}else o[n]=s}return o}_injectComputePackPrecisionFactor(t,e){const o={},n=new Map;for(const r in this.computeAttributes)for(const t of this.computeAttributes[r]??[])n.set(t,r);for(const s in t){const i=t[s],p=n.get(s);if(!p)continue;const a=e[p];if(a){if("float"!==i.type&&"vec2"!==i.type&&"vec3"!==i.type&&"vec4"!==i.type)throw new Error(`InternalError: packPrecisionFactor requires GenType, but found ${i.type}`);o[s]=i.divide(new r(a))}else o[s]=i}return o}_hydrateFragmentInput(t){const e={};for(const r in t)e[r]=t[r];for(const{propertyKey:r,typeCtor:o}of I.builtins){const t=y(o);e[r]=t}return e}_getVertexInputBuiltins(){const t=this.vertexInput.inputCtor,e=new Map;for(const{builtin:r,propertyKey:o}of t.builtins)e.set(o,r);return e}_getFragmentInputBuiltins(t){const e=t.constructor,r=new Map;for(const o of e.builtins??[])r.set(o.propertyKey,o.builtin);return r}_createShaderBuilder(t,e){const r=new c;return this._insertDebugInfo(r),t.insertVertexShader(r),e.insertFragmentShader(r),r}_insertDebugInfo(t){t.vertex.code.add("// DEFINES: "),t.vertex.code.add("// --------------------------------------------------------- ");for(const e of this._defines)this[e.propertyKey]?t.vertex.code.add(`// ${e.propertyKey}: true`):t.vertex.code.add(`// ${e.propertyKey}: false`);t.vertex.code.add(""),t.vertex.code.add("// OPTIONS: "),t.vertex.code.add("// --------------------------------------------------------- ");for(const e of this._options)this[e.propertyKey]?t.vertex.code.add(`// ${e.propertyKey}: true`):t.vertex.code.add(`// ${e.propertyKey}: false`)}}export{x as ComputeVertexInput,I as FragmentInput,v as FragmentOutput,P as GraphShaderModule,w as UniformGroup,C as VertexInput,h as builtin,_ as define,l as input,f as location,g as option,K as transformFeedback,m as uniform};
5
+ import{__decorate as t}from"tslib";import"../../../../../core/has.js";import e from"../../../../../core/Logger.js";import{Float as r,Int as o,Vec4 as n,Vec2 as s}from"./graph/glsl.js";import{generateGLSL as i}from"./graph/GlslGraphWriter.js";import{ShaderGraphContext as p}from"./graph/ShaderGraphContext.js";import{setReachableUids as a}from"./graph/ShaderGraphNode.js";import{TypedShaderProgram as u}from"./typed/TypedShaderProgram.js";import{ShaderBuilder as c}from"../../../../webgl/ShaderBuilder.js";function y(t){return new t}function d(t,e,r){const o=t.constructor[e]??[];t.constructor.hasOwnProperty(e)||Object.defineProperty(t.constructor,e,{value:o.slice()}),t.constructor[e].push(r)}function f(t,e){return(r,o)=>{d(r,"locations",{typeCtor:e,propertyKey:o,parameterIndex:null,index:t})}}const h=t=>(e,r)=>{d(e,"builtins",{builtin:t,propertyKey:r})},l=t=>(e,r,o)=>{d(e,"inputs",{inputCtor:t,propertyKey:r,parameterIndex:o})},m=t=>(e,r)=>{d(e,"uniforms",{typeCtor:t,propertyKey:r})},g=t=>(e,r)=>{d(e,"options",{typeCtor:t,propertyKey:r})},_=(t,e)=>{d(t,"defines",{propertyKey:e})};function K(t){return(e,r)=>{d(e,"transformFeedbackBindings",{propertyKey:r,parameterIndex:null,index:t})}}const b=(t,e)=>(r,o)=>{r.constructor.builtins.push({builtin:t,propertyKey:o,typeCtor:e})};class C{static{this.builtins=[]}}t([b("gl_VertexID",o)],C.prototype,"glVertexID",void 0);class x{}class I{static{this.builtins=[]}}t([b("gl_FragCoord",n)],I.prototype,"glFragCoord",void 0),t([b("gl_PointCoord",s)],I.prototype,"glPointCoord",void 0);class v{}t([h("gl_FragDepth")],v.prototype,"glFragDepth",void 0);class w{constructor(){this.type="uniform-group"}get _uniforms(){return this.constructor.uniforms??[]}}class P{constructor(){this.logShader=!1,this.computeAttributes={}}get vertexInput(){const t=this._shaderModuleClass.inputs.findLast(t=>"vertex"===t.propertyKey&&0===t.parameterIndex);if(!t)throw new Error("Unable to find vertex input parameter");return t}get computeInput(){return this._shaderModuleClass.inputs.findLast(t=>"vertex"===t.propertyKey&&1===t.parameterIndex)}get fragmentInput(){const t=this._shaderModuleClass.inputs.findLast(t=>"fragment"===t.propertyKey);if(!t)throw new Error("Unable to find fragment input parameter");return t}get transformFeedbackBindings(){return this.fragmentInput.inputCtor.transformFeedbackBindings??[]}get locations(){return[...this.vertexInput.inputCtor.locations,...this.computeInput?.inputCtor.locations??[]]}get locationsMap(){const t=new Map,r=new Set;for(const o of this.locations)r.has(o.index)?e.getLogger("esri.views.2d.engine.webgl.shaderGraph.GraphShaderModule").warnOnce("mapview-rendering",`Unable to assigned attribute ${o.propertyKey} to ${o.index}. Index already in use`,{locationsMap:t}):(t.set(o.propertyKey,o.index),r.add(o.index));return t}get locationInfo(){if(!this._locationInfo){const t=this.locationsMap,e=Array.from(t.entries()).map(([t,e])=>`${t}.${e}`).join("."),r=this.computeAttributes;this._locationInfo={stringHash:e,locations:t,computeAttributeMap:r}}return this._locationInfo}get renamedLocationsMap(){const t=new Map;for(const e of this.locations)t.set("a_"+e.propertyKey,e.index);return t}get optionPropertyKeys(){if(!this._optionPropertyKeys){const t=new Set;for(const e of this._options)t.add(e.propertyKey);this._optionPropertyKeys=t}return this._optionPropertyKeys}get _shaderModuleClass(){return this.constructor}get _defines(){return this._shaderModuleClass.defines??[]}get _options(){return this._shaderModuleClass.options??[]}get _uniforms(){return this._shaderModuleClass.uniforms??[]}getProgram(t,e,r,o){try{const{vertex:n,fragment:s,uniformBindings:i}=this._generateShaders(t,e,r,o);return new u(this.type,n,s,this.renamedLocationsMap,i,this.transformFeedbackBindings)}catch(n){return new u(this.type,"","",this.renamedLocationsMap,[],this.transformFeedbackBindings)}}getDebugUniformClassInfo(t){const e=this._options.find(e=>e.propertyKey===t);if(e)return{type:"option",className:e.typeCtor};const r=this._uniforms.find(e=>e.propertyKey===t);if(!r)throw new Error(`Unable to find uniform class type for property: ${t}`);return{type:"required",className:r.typeCtor}}getShaderKey(t,e,r,o){const n=Object.keys(t).map(e=>`${e}.${t[e]}`).join("."),s=Object.keys(r).map(t=>`${t}.${r[t]}`).join("."),i=Object.keys(o).map(t=>`${t}.${o[t]}`).join("."),p=Object.keys(e).filter(t=>this.optionPropertyKeys.has(t)&&e[t]).join(".");return`${this.type}.${n}.${s}.${i}.${p}`}_generateShaders(t,e,r,o){const n=[];this._setDefines(r),this._setOptionalUniforms(n,e),this._setRequiredUniforms(n);const s=this._hydrateVertexInput(o),u=this._injectPackPrecisionFactor(s,t),c=this._hydrateComputeInput(),y=c&&this._injectComputePackPrecisionFactor(c,t),d=this.vertex(u,y),f=this._hydrateFragmentInput(d),h=this.fragment(f),l=new Set;for(const i in h){const t=h[i];a(l,t)}const m=this._getVertexInputBuiltins(),g={};for(const[i,p]of Object.entries(s))g[i]=p;if(null!=c)for(const[i,p]of Object.entries(c))g[i]=p;const _=p.createVertex(g,d,m,n,this.transformFeedbackBindings,l);i(_);const K=this._getFragmentInputBuiltins(h);K.set("glPointCoord","gl_PointCoord"),K.set("glFragCoord","gl_FragCoord");const b=p.createFragment(f,h,K,n,_,this.transformFeedbackBindings);i(b);const C=this._createShaderBuilder(_,b),x=C.generate("vertex"),I=C.generate("fragment");return this.logShader&&(console.log(x),console.log(I)),{vertex:x,fragment:I,uniformBindings:n}}_setDefines(t){for(const e in t)this[e]=t[e]}_setOptionalUniforms(t,e){for(const r of this._options){e[r.propertyKey]?this[r.propertyKey]=this._hydrateUniformGroup(t,r):this[r.propertyKey]=null}}_setRequiredUniforms(t){for(const e of this._uniforms)this[e.propertyKey]=this._hydrateUniformGroup(t,e)}_hydrateUniformGroup(t,e){const r=new(0,e.typeCtor);for(const o of r._uniforms??[]){const n=y(o.typeCtor),s=`u_${e.propertyKey}_${o.propertyKey}`,i=n.type,p=[e.propertyKey,o.propertyKey].join(".");if("type"in o.typeCtor&&"array"===o.typeCtor.type){const e=n;t.push({shaderModulePath:p,uniformName:s,uniformType:i,uniformArrayLength:e.size,uniformArrayElementType:e.elementType.type,uniformHydrated:n})}else if("type"in o.typeCtor&&"array-2d"===o.typeCtor.type){const e=n;t.push({shaderModulePath:p,uniformName:s,uniformType:i,uniformArrayLength:e.size,uniformArrayElementType:e.elementType.type,uniformHydrated:n})}else t.push({shaderModulePath:p,uniformName:s,uniformType:i,uniformHydrated:n});r[o.propertyKey]=n}return r}_hydrateVertexInput(t){const e=this.vertexInput.inputCtor,r=e.locations.reduce((e,r)=>!1===t[r.propertyKey]?e:{...e,[r.propertyKey]:y(r.typeCtor)},{});for(const{propertyKey:o,typeCtor:n}of e.builtins){const t=y(n);r[o]=t}return r}_hydrateComputeInput(){if(null==this.computeInput)return null;return this.computeInput.inputCtor.locations.reduce((t,e)=>({...t,[e.propertyKey]:y(e.typeCtor)}),{})}_injectPackPrecisionFactor(t,e){const o={};for(const n in t){const s=t[n],i=e[n];if(i){if("float"!==s.type&&"vec2"!==s.type&&"vec3"!==s.type&&"vec4"!==s.type)throw new Error(`InternalError: packPrecisionFactor requires GenType, but found ${s.type}`);o[n]=s.divide(new r(i))}else o[n]=s}return o}_injectComputePackPrecisionFactor(t,e){const o={},n=new Map;for(const r in this.computeAttributes)for(const t of this.computeAttributes[r]??[])n.set(t,r);for(const s in t){const i=t[s],p=n.get(s);if(!p)continue;const a=e[p];if(a){if("float"!==i.type&&"vec2"!==i.type&&"vec3"!==i.type&&"vec4"!==i.type)throw new Error(`InternalError: packPrecisionFactor requires GenType, but found ${i.type}`);o[s]=i.divide(new r(a))}else o[s]=i}return o}_hydrateFragmentInput(t){const e={};for(const r in t)e[r]=t[r];for(const{propertyKey:r,typeCtor:o}of I.builtins){const t=y(o);e[r]=t}return e}_getVertexInputBuiltins(){const t=this.vertexInput.inputCtor,e=new Map;for(const{builtin:r,propertyKey:o}of t.builtins)e.set(o,r);return e}_getFragmentInputBuiltins(t){const e=t.constructor,r=new Map;for(const o of e.builtins??[])r.set(o.propertyKey,o.builtin);return r}_createShaderBuilder(t,e){const r=new c;return this._insertDebugInfo(r),t.insertVertexShader(r),e.insertFragmentShader(r),r}_insertDebugInfo(t){t.vertex.code.add("// DEFINES: "),t.vertex.code.add("// --------------------------------------------------------- ");for(const e of this._defines)this[e.propertyKey]?t.vertex.code.add(`// ${e.propertyKey}: true`):t.vertex.code.add(`// ${e.propertyKey}: false`);t.vertex.code.add(""),t.vertex.code.add("// OPTIONS: "),t.vertex.code.add("// --------------------------------------------------------- ");for(const e of this._options)this[e.propertyKey]?t.vertex.code.add(`// ${e.propertyKey}: true`):t.vertex.code.add(`// ${e.propertyKey}: false`)}}export{x as ComputeVertexInput,I as FragmentInput,v as FragmentOutput,P as GraphShaderModule,w as UniformGroup,C as VertexInput,h as builtin,_ as define,l as input,f as location,g as option,K as transformFeedback,m as uniform};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- const e=5;function t(e,t,r){const i=t.split("\n");for(const n of i)if(n.trim().length){{let t="";null!=r&&(t+=`/*id:${r??"000"}*/ `),e.body+=t.padEnd(14)}e.body+=" ".repeat(e.indent)+n+"\n"}}class r{write(e){for(const t of e.rootOutputNodes())e.shouldPruneOutputNode(t)||(t.variableName=this._write(e,t.node));return e}_createVarName(e,t){let r="";return"boolean"!=typeof t&&"number"!=typeof t&&t.debugInfo.name&&(r=`${t.debugInfo.name}_`),`${r}v${e.varCount++}`}_write(e,t,r=!1){if("number"==typeof t)return t.toString();if("boolean"==typeof t)return t.toString();let i=e.getEmit(t);if(i)return i;switch(t.shaderType){case"scope-node":i=this._writeScopeNode(e,t);break;case"primitive-node":i=this._writePrimitiveNode(e,t,r);break;case"function-node":i=this._writeFunctionNode(e,t);break;case"property-access-node":i=this._writePropertyAccessNode(e,t);break;case"property-access-2d-node":i=this._writePropertyAccess2DNode(e,t);break;case"text-node":i=t.text;break;case"block-node":i=this._writeBlockNode(e,t);break;case"condition-node":i=this._writeConditionNode(e,t)}return e.setEmit(t,i),i}_writeScopeNode(e,r){const i=new r.child.constructor;i.setDebugName(r.debugInfo.name);const n=this._write(e,i,!0);t(e,`{ /*ScopeStart: ${r.uid} ${r.debugInfo.name}*/`),e.indent+=2;return t(e,`${n} = ${this._write(e,r.child)};`),e.indent-=2,t(e,`} /*ScopeEnd: ${r.uid} ${r.debugInfo.name}*/`),n}_writeConditionNode(e,r){const i=new r.ifTrue.constructor,n=this._write(e,i,!0);t(e,`if (${this._write(e,r.condition)}) {`),e.indent+=2;const o=e.createSubgraphContext(),s=this._write(o,r.ifTrue);if(e.body+=o.body,s&&t(e,`${n} = ${s};`),e.indent-=2,t(e,"}"),r.ifFalse){t(e,"else {"),e.indent+=2;const i=e.createSubgraphContext(),o=this._write(i,r.ifFalse);e.body+=i.body,o&&t(e,`${n} = ${o};`),e.indent-=2,t(e,"}")}return n}_writeBlockNode(e,r){const{captureList:i,generator:n,returnType:o}=r,s={};for(const t in i){if(!i[t])continue;const r=this._write(e,i[t]);s[t]=r}const d=new o,c=this._write(e,d,!0);if(s.out=c,r.subgraph){const t=e.createSubgraphContext(),i=this._write(t,r.subgraph.child),n=t.body;s.subgraph={varName:i,body:n}}const a=n(s);return t(e,"{\n"),e.indent+=2,t(e,a),e.indent-=2,t(e,"}\n"),c}_writePropertyAccessNode(e,t){const r=this._write(e,t.target);if("string"==typeof t.property&&t.property.includes("["))return`${r}${t.property}`;if("string"!=typeof t.property){return`${r}[${this._write(e,t.property)}]`}return`${r}.${t.property}`}_writePropertyAccess2DNode(e,t){return`${this._write(e,t.target)}[${this._write(e,t.x)}][${this._write(e,t.y)}]`}_writeFunctionNode(r,i){const n=i.returnType.type;if(i.isInfix){const[o,s]=i.children.map(e=>this._write(r,e)),d=this._createVarName(r,i);return t(r,`${n.padEnd(e)} ${d} = ${o} ${i.token} ${s};`,i.uid),d}const o=i.children.map(e=>this._write(r,e)).join(", "),s=this._createVarName(r,i);return t(r,`${n.padEnd(e)} ${s} = ${i.token}(${o});`,i.uid),s}_writePrimitiveNode(r,i,n=!1){const o=r.getInput(i);if(o)return o.isUsed=!0,o.variableName;const s=1===i.children.length&&i.children[0]?.type===i.type;if(!i.isMutable&&(i.isImplicit||s))return this._write(r,i.children[0]);const d=this._createVarName(r,i);if(n)return t(r,`${i.type.padEnd(e)} ${d};`,i.uid),d;const c=!i.debugInfo.name&&!i.isMutable;if(c&&"float"===i.type&&"number"==typeof i.children[0])return Number.isInteger(i.children[0])?i.children[0].toFixed(1):i.children[0].toString();if(c&&"int"===i.type&&"number"==typeof i.children[0]&&Number.isInteger(i.children[0]))return i.children[0].toString();const a=i.children.map(e=>this._write(r,e)).join(", ");return"array"===i.type?(t(r,`${i.type.padEnd(e)} ${d} = [${a}];`,i.uid),d):c?`${i.type}(${a})`:(t(r,`${i.type.padEnd(e)} ${d} = ${i.type}(${a});`,i.uid),d)}}export{r as GlslShaderWriter};
5
+ const e=5;function n(e){for(const n of e.rootOutputNodes())e.shouldPruneOutputNode(n)||(n.variableName=r(e,n.node))}function t(e,n){let t="";return"boolean"!=typeof n&&"number"!=typeof n&&n.debugInfo.name&&(t=`${n.debugInfo.name}_`),`${t}v${e.varCount++}`}function r(e,n,t=!1){if("number"==typeof n)return n.toString();if("boolean"==typeof n)return n.toString();let r=e.getEmit(n);if(r)return r;switch(n.shaderType){case"scope-node":r=i(e,n);break;case"primitive-node":r=s(e,n,t);break;case"function-node":r=p(e,n);break;case"property-access-node":r=u(e,n);break;case"property-access-2d-node":r=a(e,n);break;case"text-node":r=n.text;break;case"block-node":r=d(e,n);break;case"condition-node":r=c(e,n)}return e.setEmit(n,r),r}function o(e,n,t){const r=n.split("\n");for(const o of r)if(o.trim().length){{let n="";null!=t&&(n+=`/*id:${t??"000"}*/ `),e.body+=n.padEnd(14)}e.body+=" ".repeat(e.indent)+o+"\n"}}function i(e,n){const t=new n.child.constructor;t.setDebugName(n.debugInfo.name);const i=r(e,t,!0);o(e,`{ /*ScopeStart: ${n.uid} ${n.debugInfo.name}*/`),e.indent+=2;return o(e,`${i} = ${r(e,n.child)};`),e.indent-=2,o(e,`} /*ScopeEnd: ${n.uid} ${n.debugInfo.name}*/`),i}function c(e,n){const t=r(e,new n.ifTrue.constructor,!0);o(e,`if (${r(e,n.condition)}) {`),e.indent+=2;const i=e.createSubgraphContext(),c=r(i,n.ifTrue);if(e.body+=i.body,c&&o(e,`${t} = ${c};`),e.indent-=2,o(e,"}"),n.ifFalse){o(e,"else {"),e.indent+=2;const i=e.createSubgraphContext(),c=r(i,n.ifFalse);e.body+=i.body,c&&o(e,`${t} = ${c};`),e.indent-=2,o(e,"}")}return t}function d(e,n){const{captureList:t,generator:i,returnType:c}=n,d={};for(const o in t){if(!t[o])continue;const n=r(e,t[o]);d[o]=n}const u=r(e,new c,!0);if(d.out=u,n.subgraph){const t=e.createSubgraphContext(),o=r(t,n.subgraph.child),i=t.body;d.subgraph={varName:o,body:i}}const a=i(d);return o(e,"{\n"),e.indent+=2,o(e,a),e.indent-=2,o(e,"}\n"),u}function u(e,n){const t=r(e,n.target);if("string"==typeof n.property&&n.property.includes("["))return`${t}${n.property}`;if("string"!=typeof n.property){return`${t}[${r(e,n.property)}]`}return`${t}.${n.property}`}function a(e,n){return`${r(e,n.target)}[${r(e,n.x)}][${r(e,n.y)}]`}function p(n,i){const c=i.returnType.type;if(i.isInfix){const[d,u]=i.children.map(e=>r(n,e)),a=t(n,i);return o(n,`${c.padEnd(e)} ${a} = ${d} ${i.token} ${u};`,i.uid),a}const d=i.children.map(e=>r(n,e)).join(", "),u=t(n,i);return o(n,`${c.padEnd(e)} ${u} = ${i.token}(${d});`,i.uid),u}function s(n,i,c=!1){const d=n.getInput(i);if(d)return d.isUsed=!0,d.variableName;const u=1===i.children.length&&i.children[0]?.type===i.type;if(!i.isMutable&&(i.isImplicit||u))return r(n,i.children[0]);const a=t(n,i);if(c)return o(n,`${i.type.padEnd(e)} ${a};`,i.uid),a;const p=!i.debugInfo.name&&!i.isMutable;if(p){if("float"===i.type&&"number"==typeof i.children[0])return Number.isInteger(i.children[0])?i.children[0].toFixed(1):i.children[0].toString();if("int"===i.type&&"number"==typeof i.children[0]&&Number.isInteger(i.children[0]))return i.children[0].toString();if("bool"===i.type&&"boolean"==typeof i.children[0])return i.children[0].toString()}const s=i.children.map(e=>r(n,e)).join(", ");return"array"===i.type?(o(n,`${i.type.padEnd(e)} ${a} = [${s}];`,i.uid),a):p?`${i.type}(${s})`:(o(n,`${i.type.padEnd(e)} ${a} = ${i.type}(${s});`,i.uid),a)}export{n as generateGLSL};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{cloneShaderNode as e}from"./ShaderGraphNode.js";class t{constructor(e,t,a,n=[]){this.variableName=e,this.variableInputType=t,this.node=a,this.qualifiers=n,this.type="shader-input",this.isUsed=!1}clone(){return new t(this.variableName,this.variableInputType,e(this.node),[...this.qualifiers])}}class a{constructor(e,t,a,n=[]){this.outVariableName=e,this.outVariableType=t,this.node=a,this.qualifiers=n,this.type="shader-output"}clone(){const t=new a(this.outVariableName,this.outVariableType,e(this.node),[...this.qualifiers]);return t.variableName=this.variableName,t}}class n{static createVertex(e,d,s,i,r,u){const p=[];for(const a in e){const n=e[a],o=s.get(a);o?p.push(new t(o,"builtin",n)):p.push(new t("a_"+a,"in",n))}for(const a of i){const e=a.uniformHydrated;p.push(new t(a.uniformName,"uniform",e))}const c=[];for(const t in d){const e=d[t];if("glPosition"===t)c.push(new a("gl_Position","builtin",e));else if("glPointSize"===t)c.push(new a("gl_PointSize","builtin",e));else{const n=o(e),d=[];n&&d.push(n),c.push(new a("v_"+t,"out",e,d))}}return new n(p,c,r,u)}static createFragment(e,o,d,s,i,r){const u=[],p=Array.from(i.rootOutputNodes());for(const a in e){const n=e[a],o=d.get(a);if(o){u.push(new t(o,"builtin",n));continue}const s=p.find(e=>e.node===n);s&&u.push(new t(s.outVariableName,"in",n))}for(const a of s){const e=a.uniformHydrated;u.push(new t(a.uniformName,"uniform",e))}const c=[];for(const t in o){const e=o[t],n=d.get(t);switch(t){case"discard":c.push(new a(null,"discard",e));break;case"fragData0":c.push(new a("fragData0","fragData0",e));break;case"fragData1":c.push(new a("fragData1","fragData1",e));break;case"fragData2":c.push(new a("fragData2","fragData2",e));break;case"fragData3":c.push(new a("fragData3","fragData3",e));break;default:n?c.push(new a(n,"builtin",e)):c.push(new a(t,"out",e))}}return new n(u,c,r)}constructor(e,t,a,n){this.type="shader-graph-context",this.indent=0,this.body="",this.varCount=0,this._inputShaderTypesByNodeUid=new Map,this._nodeEmitMap=new Map;for(const o of e)this._inputShaderTypesByNodeUid.set(o.node.uid,o);this._outputShaderTypes=t,this._transformFeedbackBindings=a,this._transformFeedbackNames=new Set(a.map(e=>"v_"+e.propertyKey)),this._usedInFragmentShader=n}shouldPruneOutputNode(e){return!!this._usedInFragmentShader&&("builtin"!==e.outVariableType&&(!this._transformFeedbackNames.has(e.outVariableName)&&!this._usedInFragmentShader.has(e.node.uid)))}setEmit(e,t){this._nodeEmitMap.set(e.uid,t)}getEmit(e){return this._nodeEmitMap.get(e.uid)}inputs(){return this._inputShaderTypesByNodeUid.values()}getInput(e){return this._inputShaderTypesByNodeUid.get(e.uid)}*rootOutputNodes(){for(const e of this._outputShaderTypes)yield e}*nodes(){const e=[];for(const t of this._outputShaderTypes.values())e.push(t.node);for(;e.length;){const t=e.pop();"number"!=typeof t&&"boolean"!=typeof t&&e.push(...t.children.filter(Boolean)),yield t}}*nodesOfTypeOrFunction(){for(const e of this.nodes())"number"!=typeof e&&"boolean"!=typeof e&&(yield e)}createSubgraphContext(){const e=this.clone();return e.body="",e.indent=this.indent+2,e._nodeEmitMap=new Map(this._nodeEmitMap),e}clone(){const e=new n([],this._outputShaderTypes,this._transformFeedbackBindings,this._usedInFragmentShader);return e._inputShaderTypesByNodeUid=this._inputShaderTypesByNodeUid,e.indent=this.indent,e.body=this.body,e.varCount=this.varCount,e._nodeEmitMap=this._nodeEmitMap,e}insertVertexShader(e){e.vertex.code.add(""),this._insertInputs(e,"vertex"),e.vertex.code.add(""),e.vertex.code.add("// OUTPUTS: "),e.vertex.code.add("// --------------------------------------------------------- ");for(const t of this.rootOutputNodes()){const a="builtin"===t.outVariableType;if(!this.shouldPruneOutputNode(t))if(a)e.vertex.code.add(`// ${t.outVariableType.padEnd(7)} ${t.node.type.padEnd(9)} ${t.outVariableName};`);else{const a=[...t.qualifiers,t.outVariableType].join(" ");e.vertex.code.add(`${a.padEnd(10)} ${t.node.type.padEnd(9)} ${t.outVariableName};`)}}e.vertex.code.add(""),e.vertex.code.add("void main() {"),e.vertex.code.add(" "+this.body.split("\n").join("\n "));for(const t of this.rootOutputNodes())this.shouldPruneOutputNode(t)||e.vertex.code.add(` ${t.outVariableName} = ${t.variableName};`);e.vertex.code.add("}")}insertFragmentShader(e){this._insertInputs(e,"fragment"),e.fragment.code.add(""),e.fragment.code.add("// OUTPUTS: "),e.fragment.code.add("// --------------------------------------------------------- ");let t=0;for(const a of this.rootOutputNodes()){"builtin"===a.outVariableType?e.fragment.code.add(`// ${a.outVariableType.padEnd(7)} ${a.node.type.padEnd(9)} ${a.outVariableName};`):e.outputs.add(a.outVariableName,a.node.type,t++)}e.fragment.code.add(""),e.fragment.code.add("void main() {"),e.fragment.code.add(" "+this.body.split("\n").join("\n "));for(const a of this.rootOutputNodes())"discard"===a.outVariableType?(e.fragment.code.add(" // TODO: Should ensure codegen for discard appears first in fragment shader"),e.fragment.code.add(` if (${a.variableName}) {`),e.fragment.code.add(" discard;"),e.fragment.code.add(" }"),e.fragment.code.add(" ")):e.fragment.code.add(` ${a.outVariableName} = ${a.variableName};`);e.fragment.code.add("}")}_insertInputs(e,t){e[t].code.add("// INPUTS: "),e[t].code.add("// --------------------------------------------------------- ");for(const a of this.inputs())if(a.isUsed&&"builtin"!==a.variableInputType)if("array"===a.node.type)e[t].code.add(`${a.variableInputType.padEnd(10)} ${a.node.elementType.type.padEnd(9)} ${a.variableName}[${a.node.size}];`);else if("array-2d"===a.node.type)e[t].code.add(`${a.variableInputType.padEnd(10)} ${a.node.elementType.type.padEnd(9)} ${a.variableName}[${a.node.size}]; // Emulated 2D Array. Not supported by ES3.0`);else{const n=[...a.qualifiers,a.variableInputType].join(" ");e[t].code.add(` ${n.padEnd(10)} ${a.node.type.padEnd(9)} ${a.variableName};`)}}}function o(e){switch(e.type){case"float":case"vec2":case"vec3":case"vec4":return null;case"int":case"ivec2":case"ivec3":case"ivec4":case"uint":case"uvec2":case"uvec3":case"uvec4":case"bool":case"bvec2":case"bvec3":case"bvec4":return"flat";case"mat2":case"mat3":case"mat4":case"array":case"sampler2D":case"array-2d":throw new Error(`InternalError: ${e.type} is not a valid output type`)}}export{n as ShaderGraphContext,t as ShaderInput,a as ShaderOutput};
5
+ import{cloneShaderNode as e}from"./ShaderGraphNode.js";class t{constructor(e,t,a,n=[]){this.variableName=e,this.variableInputType=t,this.node=a,this.qualifiers=n,this.type="shader-input",this.isUsed=!1}clone(){return new t(this.variableName,this.variableInputType,e(this.node),[...this.qualifiers])}}class a{constructor(e,t,a,n=[]){this.outVariableName=e,this.outVariableType=t,this.node=a,this.qualifiers=n,this.type="shader-output"}clone(){const t=new a(this.outVariableName,this.outVariableType,e(this.node),[...this.qualifiers]);return t.variableName=this.variableName,t}}class n{static createVertex(e,d,i,s,r,u){const p=[];for(const a in e){const n=e[a],o=i.get(a);o?p.push(new t(o,"builtin",n)):p.push(new t("a_"+a,"in",n))}for(const a of s){const e=a.uniformHydrated;p.push(new t(a.uniformName,"uniform",e))}const c=[];for(const t in d){const e=d[t];if("glPosition"===t)c.push(new a("gl_Position","builtin",e));else if("glPointSize"===t)c.push(new a("gl_PointSize","builtin",e));else{const n=o(e),d=[];n&&d.push(n),c.push(new a("v_"+t,"out",e,d))}}return new n(p,c,r,u)}static createFragment(e,o,d,i,s,r){const u=[],p=Array.from(s.rootOutputNodes());for(const a in e){const n=e[a],o=d.get(a);if(o){u.push(new t(o,"builtin",n));continue}const i=p.find(e=>e.node===n);i&&u.push(new t(i.outVariableName,"in",n))}for(const a of i){const e=a.uniformHydrated;u.push(new t(a.uniformName,"uniform",e))}const c=[];for(const t in o){const e=o[t],n=d.get(t);switch(t){case"discard":c.push(new a(null,"discard",e));break;case"fragData0":c.push(new a("fragData0","fragData0",e));break;case"fragData1":c.push(new a("fragData1","fragData1",e));break;case"fragData2":c.push(new a("fragData2","fragData2",e));break;case"fragData3":c.push(new a("fragData3","fragData3",e));break;default:n?c.push(new a(n,"builtin",e)):c.push(new a(t,"out",e))}}return new n(u,c,r)}constructor(e,t,a,n){this.type="shader-graph-context",this.indent=0,this.body="",this.varCount=0,this._inputShaderTypesByNodeUid=new Map,this._nodeEmitMap=new Map;for(const o of e)this._inputShaderTypesByNodeUid.set(o.node.uid,o);this._outputShaderTypes=t,this._transformFeedbackBindings=a,this._transformFeedbackNames=new Set(a.map(e=>"v_"+e.propertyKey)),this._usedInFragmentShader=n}shouldPruneOutputNode(e){return!!this._usedInFragmentShader&&("builtin"!==e.outVariableType&&(!this._transformFeedbackNames.has(e.outVariableName)&&!this._usedInFragmentShader.has(e.node.uid)))}setEmit(e,t){this._nodeEmitMap.set(e.uid,t)}getEmit(e){return this._nodeEmitMap.get(e.uid)}inputs(){return this._inputShaderTypesByNodeUid.values()}getInput(e){return this._inputShaderTypesByNodeUid.get(e.uid)}*rootOutputNodes(){for(const e of this._outputShaderTypes)yield e}*nodes(){const e=[];for(const t of this._outputShaderTypes.values())e.push(t.node);for(;e.length;){const t=e.pop();"number"!=typeof t&&"boolean"!=typeof t&&e.push(...t.children.filter(Boolean)),yield t}}*nodesOfTypeOrFunction(){for(const e of this.nodes())"number"!=typeof e&&"boolean"!=typeof e&&(yield e)}createSubgraphContext(){const e=this.clone();return e.body="",e.indent=this.indent+2,e._nodeEmitMap=new Map(this._nodeEmitMap),e}clone(){const e=new n([],this._outputShaderTypes,this._transformFeedbackBindings,this._usedInFragmentShader);return e._inputShaderTypesByNodeUid=this._inputShaderTypesByNodeUid,e.indent=this.indent,e.body=this.body,e.varCount=this.varCount,e._nodeEmitMap=this._nodeEmitMap,e}insertVertexShader(e){e.vertex.code.add(""),this._insertInputs(e,"vertex"),e.vertex.code.add(""),e.vertex.code.add("// OUTPUTS: "),e.vertex.code.add("// --------------------------------------------------------- ");for(const t of this.rootOutputNodes()){const a="builtin"===t.outVariableType;if(!this.shouldPruneOutputNode(t))if(a)e.vertex.code.add(`// ${t.outVariableType.padEnd(7)} ${t.node.type.padEnd(9)} ${t.outVariableName};`);else{const a=[...t.qualifiers,t.outVariableType].join(" ");e.vertex.code.add(`${a.padEnd(10)} ${t.node.type.padEnd(9)} ${t.outVariableName};`)}}e.vertex.code.add(""),e.vertex.code.add("void main() {"),e.vertex.code.add(" "+this.body.split("\n").join("\n "));for(const t of this.rootOutputNodes())this.shouldPruneOutputNode(t)||e.vertex.code.add(` ${t.outVariableName} = ${t.variableName};`);e.vertex.code.add("}")}insertFragmentShader(e){this._insertInputs(e,"fragment"),e.fragment.code.add(""),e.fragment.code.add("// OUTPUTS: "),e.fragment.code.add("// --------------------------------------------------------- ");let t=0;for(const d of this.rootOutputNodes())"builtin"===d.outVariableType?e.fragment.code.add(`// ${d.outVariableType.padEnd(7)} ${d.node.type.padEnd(9)} ${d.outVariableName};`):"discard"===d.outVariableType||e.outputs.add(d.outVariableName,d.node.type,t++);e.fragment.code.add(""),e.fragment.code.add("void main() {"),e.fragment.code.add(" "+this.body.split("\n").join("\n "));const a=Array.from(this.rootOutputNodes()),n=a.find(e=>"discard"===e.outVariableType),o=a.filter(e=>"discard"!==e.outVariableType);n&&(e.fragment.code.add(` if (${n.variableName}) {`),e.fragment.code.add(" discard;"),e.fragment.code.add(" }"),e.fragment.code.add(" "));for(const d of o)e.fragment.code.add(` ${d.outVariableName} = ${d.variableName};`);e.fragment.code.add("}")}_insertInputs(e,t){e[t].code.add("// INPUTS: "),e[t].code.add("// --------------------------------------------------------- ");for(const a of this.inputs())if(a.isUsed&&"builtin"!==a.variableInputType)if("array"===a.node.type)e[t].code.add(`${a.variableInputType.padEnd(10)} ${a.node.elementType.type.padEnd(9)} ${a.variableName}[${a.node.size}];`);else if("array-2d"===a.node.type)e[t].code.add(`${a.variableInputType.padEnd(10)} ${a.node.elementType.type.padEnd(9)} ${a.variableName}[${a.node.size}]; // Emulated 2D Array. Not supported by ES3.0`);else{const n=[...a.qualifiers,a.variableInputType].join(" ");e[t].code.add(` ${n.padEnd(10)} ${a.node.type.padEnd(9)} ${a.variableName};`)}}}function o(e){switch(e.type){case"float":case"vec2":case"vec3":case"vec4":return null;case"int":case"ivec2":case"ivec3":case"ivec4":case"uint":case"uvec2":case"uvec3":case"uvec4":case"bool":case"bvec2":case"bvec3":case"bvec4":return"flat";case"mat2":case"mat3":case"mat4":case"array":case"sampler2D":case"array-2d":throw new Error(`InternalError: ${e.type} is not a valid output type`)}}export{n as ShaderGraphContext,t as ShaderInput,a as ShaderOutput};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import r from"../../../../../../core/Error.js";import e from"../../../../../../core/Logger.js";import{disposeMaybe as t}from"../../../../../../core/maybe.js";import{getDeepValue as o}from"../../../../../../core/object.js";import"../../../../../webgl/BufferObject.js";import"../../../../../webgl/FramebufferObject.js";import{Program as i}from"../../../../../webgl/Program.js";import"../../../../../../core/has.js";import"../../../../../webgl/Renderbuffer.js";import"../../../../../webgl/Texture.js";import"../../../../../webgl/enums.js";import"../../../../../webgl/Util.js";import{createTexture as s}from"../../textureUtils.js";const n=()=>e.getLogger("esri.views.2d.engine.webgl.shaderGraph.typed.TypedShaderProgram");function a(e,t,o){const i=t.length;if(i!==o){const s=new r("Invalid Uniform",`Invalid length, expected ${o} but got ${i}`,{uniformName:e,values:t});n().errorOnce(s)}}class f{constructor(r,e,t,o,i){this.vertexShader=r,this.fragmentShader=e,this._locations=t,this._uniformBindings=o,this._transformFeedbackBindings=i,this._vao=null,this._temporaryTextures=[]}destroy(){this._program=t(this._program),this.cleanupTemporaryTextures()}setUniforms(r){this._uniforms=r}cleanupTemporaryTextures(){for(const r of this._temporaryTextures)r.dispose();this._temporaryTextures=[]}bind(r){const e=this._uniforms;if(!this._program){const e=[];for(const r of this._transformFeedbackBindings??[]){const{index:t,propertyKey:o}=r;e[t]=`v_${o}`}this._program=new i(r,this.vertexShader,this.fragmentShader,this._locations,new Map,e)}const t=this._program;r.useProgram(t);for(const i of this._uniformBindings){const{shaderModulePath:n,uniformName:f,uniformType:m,uniformArrayLength:c}=i,u=o(n,e);if(null==u){if("sampler2D"===m)continue;throw new Error(`Failed to find uniform value for ${n}`)}switch("array"===m||"array-2d"===m?i.uniformArrayElementType:m){case"sampler2D":{const{unit:e,texture:o}=u;if(t.setUniform1i(f,e),"type"in o)r.bindTexture(o,e);else{const t=s(r,o.descriptor,o.data);r.bindTexture(t,e)}break}case"int":if(!c){t.setUniform1i(f,u);break}a(i.uniformName,u,c),t.setUniform1iv(f,u);break;case"float":if(!c){t.setUniform1f(f,u);break}a(i.uniformName,u,c),t.setUniform1fv(f,u);break;case"vec2":if(!c){t.setUniform2f(f,u[0],u[1]);break}a(i.uniformName,u,c),t.setUniform2fv(f,u.flat());break;case"vec3":if(!c){t.setUniform3f(f,u[0],u[1],u[2]);break}a(i.uniformName,u,c),t.setUniform3fv(f,u.flat());break;case"vec4":if(!c){t.setUniform4f(f,u[0],u[1],u[2],u[3]);break}a(i.uniformName,u,c),t.setUniform4fv(f,u.flat());break;case"mat3":t.setUniformMatrix3fv(f,u);break;case"mat4":t.setUniformMatrix4fv(f,u);break;default:throw new Error(`Unable to set uniform for type ${m}`)}}}}export{f as TypedShaderProgram};
5
+ import e from"../../../../../../core/Error.js";import r from"../../../../../../core/Logger.js";import{disposeMaybe as t}from"../../../../../../core/maybe.js";import{getDeepValue as o}from"../../../../../../core/object.js";import"../../../../../webgl/BufferObject.js";import"../../../../../webgl/FramebufferObject.js";import{Program as a}from"../../../../../webgl/Program.js";import"../../../../../../core/has.js";import"../../../../../webgl/Renderbuffer.js";import"../../../../../webgl/Texture.js";import"../../../../../webgl/enums.js";import"../../../../../webgl/Util.js";import{createTexture as i}from"../../textureUtils.js";import{transpileShader as n}from"../../../../../webgl/ShaderTranspiler.js";const s=()=>r.getLogger("esri.views.2d.engine.webgl.shaderGraph.typed.TypedShaderProgram");function f(r,t,o){const a=t.length;if(a!==o){const i=new e("Invalid Uniform",`Invalid length, expected ${o} but got ${a}`,{uniformName:r,values:t});s().errorOnce(i)}}class m{constructor(e,r,t,o,a,i){this.debugName=e,this.vertexShader=r,this.fragmentShader=t,this._locations=o,this._uniformBindings=a,this._transformFeedbackBindings=i,this._vao=null,this._temporaryTextures=[]}destroy(){this._program=t(this._program),this.cleanupTemporaryTextures()}[Symbol.dispose](){this.destroy()}setUniforms(e){this._uniforms=e}validate(e){if(!this._validation){const r=this._validateWebGL2(e);"error"===r.type&&(r.error=`Validation failed for ShaderModule '${this.debugName}'\n${r.error}`),this._validation=r}return this._validation}cleanupTemporaryTextures(){for(const e of this._temporaryTextures)e.dispose();this._temporaryTextures=[]}bind(e){const r=this._uniforms;if(!this._program){const r=[];for(const e of this._transformFeedbackBindings??[]){const{index:t,propertyKey:o}=e;r[t]=`v_${o}`}this._program=new a(e,this.vertexShader,this.fragmentShader,this._locations,new Map,r)}const t=this._program;e.useProgram(t);for(const a of this._uniformBindings){const{shaderModulePath:n,uniformName:s,uniformType:m,uniformArrayLength:l}=a,c=o(n,r);if(null==c){if("sampler2D"===m)continue;throw new Error(`Failed to find uniform value for ${n}`)}switch("array"===m||"array-2d"===m?a.uniformArrayElementType:m){case"sampler2D":{const{unit:r,texture:o}=c;if(t.setUniform1i(s,r),"type"in o)e.bindTexture(o,r);else{const t=i(e,o.descriptor,o.data);e.bindTexture(t,r)}break}case"int":if(!l){t.setUniform1i(s,c);break}f(a.uniformName,c,l),t.setUniform1iv(s,c);break;case"float":if(!l){t.setUniform1f(s,c);break}f(a.uniformName,c,l),t.setUniform1fv(s,c);break;case"vec2":if(!l){t.setUniform2f(s,c[0],c[1]);break}f(a.uniformName,c,l),t.setUniform2fv(s,c.flat());break;case"vec3":if(!l){t.setUniform3f(s,c[0],c[1],c[2]);break}f(a.uniformName,c,l),t.setUniform3fv(s,c.flat());break;case"vec4":if(!l){t.setUniform4f(s,c[0],c[1],c[2],c[3]);break}f(a.uniformName,c,l),t.setUniform4fv(s,c.flat());break;case"mat3":t.setUniformMatrix3fv(s,c);break;case"mat4":t.setUniformMatrix4fv(s,c);break;default:throw new Error(`Unable to set uniform for type ${m}`)}}}_validateWebGL2(e){const r=e.gl,t=c(r,35633,this.vertexShader);if("error"===t.type)return t;const o=c(r,35632,this.fragmentShader);if("error"===o.type)return o;const a=t.value,i=o.value,n=r.createProgram();if(r.attachShader(n,a),r.attachShader(n,i),r.linkProgram(n),!r.getProgramParameter(n,r.LINK_STATUS)){return{type:"error",error:`Failed to link shader:\nvalidated: ${r.getProgramParameter(n,r.VALIDATE_STATUS)}, gl error ${r.getError()}, vertex: ${r.getShaderParameter(a,r.COMPILE_STATUS)}, fragment: ${r.getShaderParameter(i,r.COMPILE_STATUS)}, info log: ${r.getProgramInfoLog(n)}, vertex source: ${this.vertexShader}, fragment source: ${this.fragmentShader}`}}return r.deleteProgram(n),{type:"ok",value:null}}}function l(e){const r=e.match(/\d+:(\d+):/);if(void 0!==r?.index&&r?.length>1){const e=r.index+r[0].length;return{lineNumber:parseInt(r[1],10),offset:e}}return null}function c(e,r,t){const o=e.createShader(r),a=n(t,r);if(e.shaderSource(o,a),e.compileShader(o),!e.getShaderParameter(o,e.COMPILE_STATUS)){const a=e.getShaderInfoLog(o)??"";let i="";const n=a.split("\n"),s=new Map,f=[];for(const e of n){const r=l(a);if(!r){f.push(e);continue}let t=s.get(r.lineNumber);t||(t=[],s.set(r.lineNumber,t)),t.push({text:e,offset:r.offset})}const m=Array.from(s.entries()).sort();for(const[e,r]of m){const o=t.split("\n"),a=Math.max(e-2,0),n=Math.min(e+2,o.length);for(let t=a;t!==n;t++){if(i+=`${(t+1).toString().padEnd(4)}${o[t]}\n`,t===e-1){const e=o[t].length;i+=" "+new Array(e).join("^")+"\n";for(const{text:t,offset:o}of r)i+=" "+t.slice(o).trim()+"\n"}}}for(const e of f)i+=e+"\n";const c=`Failed to compile ${35633===r?"vertex":"fragment"} shader:\n\n${i}`;return e.deleteShader(o),{type:"error",error:c}}return{type:"ok",value:o}}export{m as TypedShaderProgram};