@arcgis/core 5.1.0-next.20 → 5.1.0-next.22

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 (356) hide show
  1. package/analysis/VolumeMeasurement/VolumeMeasurementCutFillOptions.d.ts +1 -0
  2. package/analysis/VolumeMeasurement/VolumeMeasurementDisplayUnits.d.ts +1 -0
  3. package/analysis/VolumeMeasurement/VolumeMeasurementInputUnits.d.ts +1 -0
  4. package/analysis/VolumeMeasurementAnalysis.d.ts +3 -2
  5. package/applications/Components/OrientedImageryViewer/galleryUtils.d.ts +45 -15
  6. package/applications/Components/QuantityFormatter.d.ts +11 -11
  7. package/applications/Components/SelectionOperation.d.ts +11 -11
  8. package/applications/Components/SketchTooltipControls.d.ts +9 -9
  9. package/applications/Components/actionUtils.d.ts +2 -1
  10. package/applications/Components/analysisUtils.d.ts +27 -26
  11. package/applications/Components/applySetUtils.d.ts +40 -40
  12. package/applications/Components/arcadeEditorUtils.d.ts +3 -3
  13. package/applications/Components/arcadeFeatureUtils.d.ts +12 -12
  14. package/applications/Components/baUtils.d.ts +8 -8
  15. package/applications/Components/basemapUtils.d.ts +2 -2
  16. package/applications/Components/clipboard.d.ts +14 -14
  17. package/applications/Components/drawUtils.d.ts +3 -3
  18. package/applications/Components/editUtils.d.ts +14 -14
  19. package/applications/Components/featureUtils.d.ts +10 -10
  20. package/applications/Components/fieldFormatUtils.d.ts +2 -2
  21. package/applications/Components/fontUtils.d.ts +2 -2
  22. package/applications/Components/formatUtils.d.ts +2 -2
  23. package/applications/Components/getDefaultUnits.d.ts +2 -2
  24. package/applications/Components/gfxUtils.d.ts +5 -1
  25. package/applications/Components/imageryUtils.d.ts +35 -35
  26. package/applications/Components/layerOriginUtils.d.ts +5 -5
  27. package/applications/Components/layersEffectsJsonUtils.d.ts +2 -2
  28. package/applications/Components/previewSymbol2D.d.ts +2 -2
  29. package/applications/Components/rasterFunctionEditorUtils.d.ts +40 -40
  30. package/applications/Components/reactiveUtils.d.ts +14 -13
  31. package/applications/Components/sanitizerUtils.d.ts +2 -2
  32. package/applications/Components/stringUtils.d.ts +5 -5
  33. package/applications/Components/styleUtils.d.ts +2 -2
  34. package/applications/Components/svgUtils.d.ts +4 -4
  35. package/applications/Components/symbolUtils.d.ts +47 -11
  36. package/applications/Components/templateUtils.d.ts +73 -17
  37. package/applications/Components/templateUtils.js +1 -1
  38. package/applications/Components/testUtils.d.ts +3 -3
  39. package/applications/Components/unitUtils.d.ts +1 -1
  40. package/applications/Components/viewUtils.d.ts +2 -2
  41. package/applications/Components/webStyleSymbolUtils.d.ts +2 -2
  42. package/applications/Excalibur/imageryLayerUtils.d.ts +3 -3
  43. package/applications/Excalibur/videoViewUtils.d.ts +8 -8
  44. package/applications/Excalibur/widgetUtils.d.ts +2 -2
  45. package/applications/ExperienceBuilder/sketchUtils.d.ts +7 -7
  46. package/applications/KnowledgeStudio/dataModelVisualization.d.ts +20 -8
  47. package/applications/KnowledgeStudio/generalSdkInternalAccess.d.ts +21 -21
  48. package/applications/KnowledgeStudio/generalSharedKgUtils.d.ts +35 -35
  49. package/applications/KnowledgeStudio/layerInternalAccessUtils.d.ts +9 -9
  50. package/applications/KnowledgeStudio/reshape.d.ts +40 -40
  51. package/applications/KnowledgeStudio/resourceSerializationUtils.d.ts +11 -11
  52. package/applications/MapViewer/layerUtils.d.ts +2 -2
  53. package/applications/MapViewer/mediaUtils.d.ts +13 -13
  54. package/applications/MapViewer/templateUtils.d.ts +20 -20
  55. package/applications/PortalApp/layerUtils.d.ts +2 -2
  56. package/applications/SceneViewer/colorUtils.d.ts +2 -2
  57. package/applications/SceneViewer/devEnvironmentUtils.d.ts +4 -3
  58. package/applications/SceneViewer/layerUtils.d.ts +3 -3
  59. package/applications/SceneViewer/sceneViewerUtils.d.ts +34 -34
  60. package/applications/SceneViewer/symbolUtils.d.ts +2 -2
  61. package/applications/Urban/LineImagePattern3D.d.ts +3 -2
  62. package/applications/Urban/imagePatternUtils.d.ts +4 -4
  63. package/applications/Urban/meshUtils.d.ts +2 -2
  64. package/applications/WebEditor/sketchUtils.d.ts +8 -8
  65. package/assets/esri/core/workers/RemoteClient.js +1 -1
  66. package/assets/esri/core/workers/chunks/03d11c7056fea763cbac.js +1 -0
  67. package/assets/esri/core/workers/chunks/05e5b9082c0a396df7e5.js +1 -0
  68. package/assets/esri/core/workers/chunks/08445fcba84ed7c23b3f.js +1 -0
  69. package/assets/esri/core/workers/chunks/0c706cdff6eac940eaab.js +1 -0
  70. package/assets/esri/core/workers/chunks/10a8612e7b2c74a8ce9a.js +1 -0
  71. package/assets/esri/core/workers/chunks/{df321c37b61099f6e4c2.js → 11058e660139c427c3e7.js} +1 -1
  72. package/assets/esri/core/workers/chunks/{2ddb8bb00b3af83ebd7c.js → 14792047c5519dd89828.js} +1 -1
  73. package/assets/esri/core/workers/chunks/1a1e57267306c07e5bdb.js +1 -0
  74. package/assets/esri/core/workers/chunks/1bb5aa1e3693e0c68b18.js +1 -0
  75. package/assets/esri/core/workers/chunks/1cd091fa567fc4026356.js +1 -0
  76. package/assets/esri/core/workers/chunks/1dcd057695f8db79eca2.js +1 -0
  77. package/assets/esri/core/workers/chunks/{3ed7f19f77a11fa4d047.js → 2063b49607a03f7718ee.js} +1 -1
  78. package/assets/esri/core/workers/chunks/{74a6d840813ac29b0bda.js → 209acb3ad16c99bb506c.js} +1 -1
  79. package/assets/esri/core/workers/chunks/21decfc1e477fb769204.js +1 -0
  80. package/assets/esri/core/workers/chunks/21e04705cad9fef1b01b.js +1 -0
  81. package/assets/esri/core/workers/chunks/23cb0611abe1031c513c.js +1 -0
  82. package/assets/esri/core/workers/chunks/285f3b07de852bfc1604.js +1 -0
  83. package/assets/esri/core/workers/chunks/2c61a53962093a331225.js +1 -0
  84. package/assets/esri/core/workers/chunks/2ecfd6edab796194bf88.js +1 -0
  85. package/assets/esri/core/workers/chunks/2f23af31b1190754ce13.js +1 -0
  86. package/assets/esri/core/workers/chunks/31eb59eae4c89b76e302.js +1 -0
  87. package/assets/esri/core/workers/chunks/3e61e7805dc6ff284831.js +1 -0
  88. package/assets/esri/core/workers/chunks/4150774059d67a8def74.js +1 -0
  89. package/assets/esri/core/workers/chunks/416c57df61fbd193078b.js +1 -0
  90. package/assets/esri/core/workers/chunks/46d28a0c20263012faff.js +1 -0
  91. package/assets/esri/core/workers/chunks/{43c8b1473695574c663e.js → 4754610760f3f634adf9.js} +2 -2
  92. package/assets/esri/core/workers/chunks/{f5cebeaad3e7d87d7997.js → 4fc6dd1423075e145b29.js} +1 -1
  93. package/assets/esri/core/workers/chunks/{3861644c06cfebe8f40c.js → 527547fa10d52cb3a7b1.js} +2 -2
  94. package/assets/esri/core/workers/chunks/5480d4cc342a2669a8ab.js +1 -0
  95. package/assets/esri/core/workers/chunks/{e8495c655a0a4f534636.js → 551fee27bf3abf0c41fd.js} +1 -1
  96. package/assets/esri/core/workers/chunks/568d32ceee1409809e5a.js +1 -0
  97. package/assets/esri/core/workers/chunks/576995021660e8b34705.js +1 -0
  98. package/assets/esri/core/workers/chunks/57e375d8a8db9fa57193.js +1 -0
  99. package/assets/esri/core/workers/chunks/5cbc12545f42a32fb960.js +1 -0
  100. package/assets/esri/core/workers/chunks/61ebbae0773fccc1f2bf.js +1 -0
  101. package/assets/esri/core/workers/chunks/63c297b6b7438f49e7ee.js +1 -0
  102. package/assets/esri/core/workers/chunks/6b56c8ba978ec6edd6b8.js +1 -0
  103. package/assets/esri/core/workers/chunks/{53f8c1d56ef3b24d2226.js → 6c853fd89f0e9f102c6e.js} +1 -1
  104. package/assets/esri/core/workers/chunks/{946698d9cefffdb63082.js → 6e32e7b2ea2ea1a1fc04.js} +1 -1
  105. package/assets/esri/core/workers/chunks/6f12854c5846edfe3239.js +1 -0
  106. package/assets/esri/core/workers/chunks/{b586f1021a27c5e1551a.js → 7189e03cc24f5c10865a.js} +2 -2
  107. package/assets/esri/core/workers/chunks/7b59ddad3c73f5f44b4d.js +1 -0
  108. package/assets/esri/core/workers/chunks/7c417d2bf432e4055b3d.js +30 -0
  109. package/assets/esri/core/workers/chunks/8021cb732f8136d87048.js +1 -0
  110. package/assets/esri/core/workers/chunks/84124c1a41a96192f81c.js +1 -0
  111. package/assets/esri/core/workers/chunks/845bbd82ddacbb62ad28.js +1 -0
  112. package/assets/esri/core/workers/chunks/868c8a152cb1452b9a94.js +1 -0
  113. package/assets/esri/core/workers/chunks/879ce85c50b0348056b2.js +1 -0
  114. package/assets/esri/core/workers/chunks/87a7d405a0b9a541d7f2.js +1 -0
  115. package/assets/esri/core/workers/chunks/9522430d34d29c1ffb1a.js +1 -0
  116. package/assets/esri/core/workers/chunks/9647f3983f955da21093.js +1 -0
  117. package/assets/esri/core/workers/chunks/9694b4b85168a38ca24b.js +1 -0
  118. package/assets/esri/core/workers/chunks/{83d913dab3c2b0d6a7cc.js → 9736299a4ac0e21f08a7.js} +1 -1
  119. package/assets/esri/core/workers/chunks/{e7bee85f28d7ec03825a.js → 973e3743cb7fdaa27f80.js} +1 -1
  120. package/assets/esri/core/workers/chunks/9b2d0d36ee6c04c347df.js +1 -0
  121. package/assets/esri/core/workers/chunks/{2662750d5761ed2d0eb7.js → 9e7eea56e96f012f9ff4.js} +1 -1
  122. package/assets/esri/core/workers/chunks/{3f812b0a28afb47aaaf0.js → a35d1be700ebd3109397.js} +2 -2
  123. package/assets/esri/core/workers/chunks/a4919dd9963f853a0077.js +1 -0
  124. package/assets/esri/core/workers/chunks/a4a4ce33de6432ba4dc3.js +1 -0
  125. package/assets/esri/core/workers/chunks/{aece665144aed2065ffc.js → a78ac951c00f090d9024.js} +1 -1
  126. package/assets/esri/core/workers/chunks/a7dbd38bc216713044fc.js +1 -0
  127. package/assets/esri/core/workers/chunks/{0debabe324c873066885.js → aa3bdfd00f666c6cc521.js} +1 -1
  128. package/assets/esri/core/workers/chunks/{db5bbc240a1b8cd5af52.js → abc2471cfa9430ca5645.js} +1 -1
  129. package/assets/esri/core/workers/chunks/b2a67fe89f6505498bc3.js +1 -0
  130. package/assets/esri/core/workers/chunks/{b8b2f160518e3a225d99.js → b364ec104dd59faa41b6.js} +1 -1
  131. package/assets/esri/core/workers/chunks/b4254fcb2051c873f2ba.js +1 -0
  132. package/assets/esri/core/workers/chunks/{a53fa34681efff8fc024.js → b859d98fa1c39f8e4099.js} +1 -1
  133. package/assets/esri/core/workers/chunks/c09bc36347e8eb9fff00.js +1 -0
  134. package/assets/esri/core/workers/chunks/c2cda93905f0a49a6931.js +1 -0
  135. package/assets/esri/core/workers/chunks/c3e4f8664988e50bda55.js +1 -0
  136. package/assets/esri/core/workers/chunks/{3d0aa5f2db79c022243e.js → c794f7be868e53ca4a8c.js} +1 -1
  137. package/assets/esri/core/workers/chunks/cada79c174027f7a0df8.js +1 -0
  138. package/assets/esri/core/workers/chunks/cf100c80b75ba74b479c.js +1 -0
  139. package/assets/esri/core/workers/chunks/d10c65cde3565d399275.js +1 -0
  140. package/assets/esri/core/workers/chunks/d44217de4c73475f9c66.js +1 -0
  141. package/assets/esri/core/workers/chunks/d587b7842091affdaac3.js +1 -0
  142. package/assets/esri/core/workers/chunks/d70678598f4080adfb39.js +1 -0
  143. package/assets/esri/core/workers/chunks/dad9c25f1b7cacf7b052.js +1 -0
  144. package/assets/esri/core/workers/chunks/{0facd2c143a04cc7c4ff.js → deee88e3f1641c6ef5db.js} +1 -1
  145. package/assets/esri/core/workers/chunks/e063cce778944fe97dd3.js +1 -0
  146. package/assets/esri/core/workers/chunks/e37e7ae2de974cef9a90.js +1 -0
  147. package/assets/esri/core/workers/chunks/e44ed205f74df34adb8b.js +1 -0
  148. package/assets/esri/core/workers/chunks/e6220c1fa887e21ffbbd.js +1 -0
  149. package/assets/esri/core/workers/chunks/{13d1cb50232ae761425b.js → eaeb95be8d4032513247.js} +2 -2
  150. package/assets/esri/core/workers/chunks/{93515f52d9b5fa12bd04.js → eb4934d3a3b82316c7c6.js} +1 -1
  151. package/assets/esri/core/workers/chunks/{23c856265dd24ce54fdb.js → f1c1f7583fa13dff9b5c.js} +1 -1
  152. package/assets/esri/core/workers/chunks/f27bbb4e26297d3c68de.js +1 -0
  153. package/assets/esri/core/workers/chunks/f4480636a910eaa4c531.js +1 -0
  154. package/assets/esri/core/workers/chunks/{5b991b0d4ca257291cb0.js → f5c5a9e771074f780fc8.js} +1 -1
  155. package/assets/esri/core/workers/chunks/f82a95c46f0d579d5bf5.js +1 -0
  156. package/assets/esri/core/workers/chunks/fb3a42cdd0d3105ec551.js +1 -0
  157. package/chunks/Clouds.glsl.js +1 -1
  158. package/config.js +1 -1
  159. package/core/MultiOriginJSONSupport.d.ts +1 -1
  160. package/core/ReadOnlyMultiOriginJSONSupport.d.ts +5 -4
  161. package/geometry/FlatGeometry.js +1 -1
  162. package/geometry/support/curves/curveUtils.js +1 -1
  163. package/geometry/support/curves/densifyCurvedGeometry.js +1 -1
  164. package/graphic/graphicOriginUtils.js +1 -1
  165. package/kernel.js +1 -1
  166. package/layers/FeatureLayer.d.ts +7 -9
  167. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  168. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  169. package/layers/WMTSLayer.js +1 -1
  170. package/layers/graphics/data/QueryEngineResult.js +1 -1
  171. package/layers/graphics/editingSupport.js +1 -1
  172. package/layers/raster/datasets/MRFRaster.js +1 -1
  173. package/layers/support/SceneModification.js +1 -1
  174. package/layers/support/Sublayer.d.ts +3 -0
  175. package/package.json +2 -2
  176. package/renderers/VectorFieldRenderer.js +1 -1
  177. package/renderers/support/DictionaryControlString.js +1 -1
  178. package/renderers/support/DictionaryLoader.js +1 -1
  179. package/rest/featureService/FeatureService.js +1 -1
  180. package/smartMapping/support/utils.js +1 -1
  181. package/support/revision.js +1 -1
  182. package/symbols/cim/CIMSymbolHelper.js +1 -1
  183. package/symbols/cim/GeometryWalker.js +1 -1
  184. package/symbols/cim/SDFHelper.js +1 -1
  185. package/symbols/cim/animationUtils.js +1 -1
  186. package/symbols/cim/cimAnalyzer.js +1 -1
  187. package/symbols/cim/effects/EffectDashes.js +1 -1
  188. package/symbols/cim/effects/EffectDonut.js +1 -1
  189. package/symbols/cim/effects/EffectOffset.js +1 -1
  190. package/symbols/cim/effects/EffectWave.js +1 -1
  191. package/symbols/cim/placements/PlacementAlongLineSameSize.js +1 -1
  192. package/symbols/cim/placements/PlacementAtExtremities.js +1 -1
  193. package/symbols/cim/placements/PlacementAtRatioPositions.js +1 -1
  194. package/symbols/cim/placements/PlacementOnLine.js +1 -1
  195. package/symbols/cim/rasterizingUtils.js +1 -1
  196. package/symbols/cim/types.d.ts +220 -117
  197. package/views/2d/layers/features/schema/processor/symbols/utils.js +1 -1
  198. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementError.d.ts +1 -0
  199. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementResult.d.ts +1 -0
  200. package/views/3d/analysis/VolumeMeasurementAnalysisView3D.d.ts +1 -0
  201. package/views/3d/environment/CloudsRenderer.js +1 -1
  202. package/views/3d/environment/Fog.js +1 -1
  203. package/views/3d/environment/FogTechnique.js +1 -1
  204. package/views/3d/environment/NoiseTextureAtlas.js +1 -1
  205. package/views/3d/environment/NoiseTextureAtlasTechnique.js +1 -1
  206. package/views/3d/layers/Lyr3DWorker.js +1 -1
  207. package/views/3d/layers/SceneLayerWorkerHandle.js +1 -1
  208. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  209. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  210. package/views/3d/layers/graphics/polygonUtils.js +1 -1
  211. package/views/3d/layers/support/patternUtils.js +1 -1
  212. package/views/3d/support/gaussianSplatting/GaussianSplatTextureAtlas.js +1 -1
  213. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  214. package/views/3d/webgl-engine/core/FBOCacheFormats.js +1 -1
  215. package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorTechnique.js +1 -1
  216. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
  217. package/views/3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js +1 -1
  218. package/views/3d/webgl-engine/lib/CutFillDepth.js +1 -1
  219. package/views/3d/webgl-engine/lib/GPUPointOcclusionQuery.js +1 -1
  220. package/views/3d/webgl-engine/lib/Geometry.js +1 -1
  221. package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
  222. package/views/3d/webgl-engine/lib/Material.js +1 -1
  223. package/views/3d/webgl-engine/lib/RayIntersections.js +1 -1
  224. package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
  225. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  226. package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
  227. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  228. package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
  229. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  230. package/views/3d/webgl-engine/lib/geometryDataUtils.js +1 -1
  231. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  232. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  233. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  234. package/views/3d/webgl-engine/materials/renderers/IndexBufferCache.js +2 -0
  235. package/views/3d/webgl-engine/materials/renderers/IndexLayout.js +2 -0
  236. package/views/3d/webgl-engine/materials/renderers/Instance.js +1 -1
  237. package/views/3d/webgl-engine/materials/renderers/MergedBuffer.js +1 -1
  238. package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
  239. package/views/3d/webgl-engine/materials/renderers/VaoRenderer.js +1 -1
  240. package/views/3d/webgl-engine/materials/renderers/VaoWriter.js +1 -1
  241. package/views/SelectionManager.d.ts +9 -9
  242. package/views/SelectionManager.js +1 -1
  243. package/views/View.d.ts +13 -2
  244. package/views/draw/support/Reshape.js +1 -1
  245. package/views/draw/support/reshapeUtils.js +1 -1
  246. package/views/draw/support/types.d.ts +8 -1
  247. package/views/interactive/support/utils.js +1 -1
  248. package/views/layers/FeatureLikeLayerView.d.ts +24 -24
  249. package/views/webgl/BufferObject.js +1 -1
  250. package/widgets/Attribution/AttributionViewModel.d.ts +3 -1
  251. package/widgets/Attribution/AttributionViewModel.js +1 -1
  252. package/widgets/Attribution.d.ts +1 -1
  253. package/widgets/Attribution.js +1 -1
  254. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  255. package/widgets/Editor/EditorViewModel.d.ts +2 -22
  256. package/widgets/Editor/EditorViewModel.js +1 -1
  257. package/widgets/Editor/SplitFeatureWorkflow.js +1 -1
  258. package/widgets/Editor/UpdateWorkflow.js +1 -1
  259. package/widgets/Editor/Workflow.js +1 -1
  260. package/widgets/Editor/support/SketchController.js +1 -1
  261. package/widgets/Editor/workflowUtils.js +1 -1
  262. package/widgets/Editor.d.ts +10 -15
  263. package/widgets/Editor.js +1 -1
  264. package/widgets/FeatureTable/FeatureTableViewModel.d.ts +0 -15
  265. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  266. package/widgets/FeatureTable/support/types.d.ts +0 -1
  267. package/widgets/FeatureTable.d.ts +1 -19
  268. package/widgets/FeatureTable.js +1 -1
  269. package/widgets/FeatureTemplates.d.ts +1 -1
  270. package/widgets/FeatureTemplates.js +1 -1
  271. package/widgets/HistogramRangeSlider.d.ts +1 -1
  272. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  273. package/widgets/OrientedImageryViewer/adapters/sketch/MeasurementAdapter.js +1 -1
  274. package/widgets/OrientedImageryViewer/adapters/view/MapViewAdapter.js +1 -1
  275. package/widgets/PanoramicVideoViewer.js +1 -1
  276. package/widgets/PanoramicViewer/PanoramicVideoViewerViewModel.js +1 -1
  277. package/widgets/PanoramicViewer/support/PanoramicMedia.js +1 -1
  278. package/widgets/PanoramicViewer/support/PanoramicTileNode.js +1 -1
  279. package/widgets/PanoramicViewer/support/PanoramicTilePyramid.js +1 -1
  280. package/widgets/PanoramicViewer/utils.js +1 -1
  281. package/widgets/Sketch/SketchViewModel.d.ts +4 -22
  282. package/widgets/Sketch/SketchViewModel.js +1 -1
  283. package/widgets/Sketch/support/PluginManager.js +1 -1
  284. package/widgets/Sketch/support/sketchUtils.js +1 -1
  285. package/widgets/Sketch.d.ts +10 -17
  286. package/widgets/Sketch.js +1 -1
  287. package/assets/esri/core/workers/chunks/026c00ee272c64e53daf.js +0 -1
  288. package/assets/esri/core/workers/chunks/0883c4e63424d6746ada.js +0 -1
  289. package/assets/esri/core/workers/chunks/0987cb20148f65222b44.js +0 -1
  290. package/assets/esri/core/workers/chunks/0a1f88cf16bcbb53b371.js +0 -1
  291. package/assets/esri/core/workers/chunks/0bb3beedae1b73beb1fc.js +0 -1
  292. package/assets/esri/core/workers/chunks/0ca405ca26676137a4be.js +0 -1
  293. package/assets/esri/core/workers/chunks/0ce968c89c35535da63e.js +0 -1
  294. package/assets/esri/core/workers/chunks/0d56e3b3265a4470aaa6.js +0 -1
  295. package/assets/esri/core/workers/chunks/144c719d5ba9e3a30961.js +0 -1
  296. package/assets/esri/core/workers/chunks/1503ca177e2466ec0e87.js +0 -1
  297. package/assets/esri/core/workers/chunks/1597d7b380d510ff5252.js +0 -1
  298. package/assets/esri/core/workers/chunks/1880c3b293cdfa804625.js +0 -1
  299. package/assets/esri/core/workers/chunks/1bea32b02d35ddb9b118.js +0 -1
  300. package/assets/esri/core/workers/chunks/1d78ec98eef7fef08f86.js +0 -1
  301. package/assets/esri/core/workers/chunks/1e6271524602e159dbad.js +0 -1
  302. package/assets/esri/core/workers/chunks/1f96d597ba736e088168.js +0 -1
  303. package/assets/esri/core/workers/chunks/26e41b08efe77d247409.js +0 -1
  304. package/assets/esri/core/workers/chunks/297b58f29c496923e1f3.js +0 -1
  305. package/assets/esri/core/workers/chunks/2a2a9fa62969644ea200.js +0 -1
  306. package/assets/esri/core/workers/chunks/2b296378d21e4e3c11d4.js +0 -1
  307. package/assets/esri/core/workers/chunks/2cbcf34cf896a438999b.js +0 -1
  308. package/assets/esri/core/workers/chunks/394b645d51e7bf799382.js +0 -1
  309. package/assets/esri/core/workers/chunks/50ab9a3f8bbb268fae59.js +0 -1
  310. package/assets/esri/core/workers/chunks/5a8b3e5977c233d5c9d0.js +0 -1
  311. package/assets/esri/core/workers/chunks/5b2dd164dd84fd1ca4f7.js +0 -1
  312. package/assets/esri/core/workers/chunks/62c228ca16fdc7a2c695.js +0 -1
  313. package/assets/esri/core/workers/chunks/639202a461b17840a13f.js +0 -1
  314. package/assets/esri/core/workers/chunks/693d269637135047a0c4.js +0 -1
  315. package/assets/esri/core/workers/chunks/6a14ec2d2de6778a4e7a.js +0 -1
  316. package/assets/esri/core/workers/chunks/6d3467997b5d01630b08.js +0 -1
  317. package/assets/esri/core/workers/chunks/6dfcb0c804e63e87e311.js +0 -1
  318. package/assets/esri/core/workers/chunks/778ab9e4c3928b0d7d74.js +0 -1
  319. package/assets/esri/core/workers/chunks/8012fdc49a7a10982f78.js +0 -1
  320. package/assets/esri/core/workers/chunks/85e0fd618625a639387f.js +0 -1
  321. package/assets/esri/core/workers/chunks/86465d4bb185d7460087.js +0 -1
  322. package/assets/esri/core/workers/chunks/87e7378b242debbfd575.js +0 -1
  323. package/assets/esri/core/workers/chunks/90b19e60c056f32623e7.js +0 -1
  324. package/assets/esri/core/workers/chunks/9461f7225c42cf15a114.js +0 -1
  325. package/assets/esri/core/workers/chunks/978649cb6df99ee728be.js +0 -1
  326. package/assets/esri/core/workers/chunks/9f5f4da954228d876219.js +0 -1
  327. package/assets/esri/core/workers/chunks/a2323c957c8b2fe225b4.js +0 -1
  328. package/assets/esri/core/workers/chunks/a36a33f43610c3cd985b.js +0 -1
  329. package/assets/esri/core/workers/chunks/a381932eef77f4d80292.js +0 -1
  330. package/assets/esri/core/workers/chunks/b089947c9a492c96ca27.js +0 -1
  331. package/assets/esri/core/workers/chunks/b6e4c35b76379088035c.js +0 -1
  332. package/assets/esri/core/workers/chunks/bbf2afa05314e267893f.js +0 -1
  333. package/assets/esri/core/workers/chunks/bd2f577cae61facdde4a.js +0 -1
  334. package/assets/esri/core/workers/chunks/bf2bfc0d78be8c185d58.js +0 -1
  335. package/assets/esri/core/workers/chunks/c4a78ab84186c7be599a.js +0 -1
  336. package/assets/esri/core/workers/chunks/c6e0ada6f2ad74fddfec.js +0 -1
  337. package/assets/esri/core/workers/chunks/c9d600dc6b6b5aafff1c.js +0 -1
  338. package/assets/esri/core/workers/chunks/ca33847a997ccfe8ddc2.js +0 -1
  339. package/assets/esri/core/workers/chunks/cca19c9564be2d02a277.js +0 -1
  340. package/assets/esri/core/workers/chunks/ccc2f2b3db008d8a495f.js +0 -1
  341. package/assets/esri/core/workers/chunks/d9f900975ac915a0f24f.js +0 -1
  342. package/assets/esri/core/workers/chunks/dcc8363faa22e6211351.js +0 -1
  343. package/assets/esri/core/workers/chunks/dd5d66f067e2386e0514.js +0 -1
  344. package/assets/esri/core/workers/chunks/e081d6f21a2c01ccaf61.js +0 -1
  345. package/assets/esri/core/workers/chunks/eb4ffb72c9360062141c.js +0 -1
  346. package/assets/esri/core/workers/chunks/ebae903845643d60b44a.js +0 -1
  347. package/assets/esri/core/workers/chunks/ebb0372e8da0f75c09dd.js +0 -1
  348. package/assets/esri/core/workers/chunks/f349f64f683620bdf9b5.js +0 -30
  349. package/assets/esri/core/workers/chunks/f6fb87092bdf6bbf0769.js +0 -1
  350. package/assets/esri/core/workers/chunks/f76c2b09e6ba9d107898.js +0 -1
  351. package/assets/esri/core/workers/chunks/fcf962f3dec6b5440983.js +0 -1
  352. /package/assets/esri/core/workers/chunks/{43c8b1473695574c663e.js.LICENSE.txt → 4754610760f3f634adf9.js.LICENSE.txt} +0 -0
  353. /package/assets/esri/core/workers/chunks/{3861644c06cfebe8f40c.js.LICENSE.txt → 527547fa10d52cb3a7b1.js.LICENSE.txt} +0 -0
  354. /package/assets/esri/core/workers/chunks/{b586f1021a27c5e1551a.js.LICENSE.txt → 7189e03cc24f5c10865a.js.LICENSE.txt} +0 -0
  355. /package/assets/esri/core/workers/chunks/{3f812b0a28afb47aaaf0.js.LICENSE.txt → a35d1be700ebd3109397.js.LICENSE.txt} +0 -0
  356. /package/assets/esri/core/workers/chunks/{13d1cb50232ae761425b.js.LICENSE.txt → eaeb95be8d4032513247.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{generateUID as r}from"../../../../core/uid.js";import{isColor as e}from"../core/shaderLibrary/ShaderOutput.js";import{DefaultTechniqueConfiguration as t}from"../materials/DefaultTechniqueConfiguration.js";import{updateParameters as s}from"../materials/internal/MaterialUtil.js";import{NoParameters as i}from"../../../webgl/NoParameters.js";class a{constructor(e,t){this.id=r(),this.supportsEdges=!1,this._renderPriority=0,this._parameters=new t,s(this._parameters,e),this.validateParameters(this._parameters)}get parameters(){return this._parameters}update(r){return!1}setParameters(r,e=!0){s(this._parameters,r)&&(this.validateParameters(this._parameters),e&&this._parametersChanged())}validateParameters(r){}shouldRender(r){return this.visible&&this.isVisibleForOutput(r.output)&&(!this.parameters.isDecoration||r.bind.decorations)&&0!==(this.parameters.renderOccluded&r.renderOccludedMask)}isVisibleForOutput(r){return!0}get renderPriority(){return this._renderPriority}set renderPriority(r){r!==this._renderPriority&&(this._renderPriority=r,this._parametersChanged())}_parametersChanged(){this.repository?.materialChanged(this)}get renderOccludedFlags(){return this.visible?this.parameters.renderOccluded:0}get testsTransparentRenderOrder(){return this.parameters.testsTransparentRenderOrder}get hasEmissions(){return!1}getConfiguration(r,s,i=new t){return i.output=r,i.hasEmission=s.hasEmission&&e(r),i.oitPass=s.oitPass,i.hasHighlightMixTexture=8===r&&null!=s.highlightMixTexture,i}}class n extends i{constructor(){super(...arguments),this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.isDecoration=!1}}export{a as Material,n as MaterialParameters};
2
+ import{generateUID as r}from"../../../../core/uid.js";import{isColor as e}from"../core/shaderLibrary/ShaderOutput.js";import{DefaultTechniqueConfiguration as t}from"../materials/DefaultTechniqueConfiguration.js";import{updateParameters as s}from"../materials/internal/MaterialUtil.js";import{NoParameters as i}from"../../../webgl/NoParameters.js";class a{constructor(e,t){this.id=r(),this.supportsEdges=!1,this._renderPriority=0,this._parameters=new t,s(this._parameters,e),this.validateParameters(this._parameters)}get useIndexing(){return this.parameters.useIndexing??!1}get parameters(){return this._parameters}update(r){return!1}setParameters(r,e=!0){s(this._parameters,r)&&(this.validateParameters(this._parameters),e&&this._parametersChanged())}validateParameters(r){}shouldRender(r){return this.visible&&this.isVisibleForOutput(r.output)&&(!this.parameters.isDecoration||r.bind.decorations)&&0!==(this.parameters.renderOccluded&r.renderOccludedMask)}isVisibleForOutput(r){return!0}get renderPriority(){return this._renderPriority}set renderPriority(r){r!==this._renderPriority&&(this._renderPriority=r,this._parametersChanged())}_parametersChanged(){this.repository?.materialChanged(this)}get renderOccludedFlags(){return this.visible?this.parameters.renderOccluded:0}get testsTransparentRenderOrder(){return this.parameters.testsTransparentRenderOrder}get hasEmissions(){return!1}getConfiguration(r,s,i=new t){return i.output=r,i.hasEmission=s.hasEmission&&e(r),i.oitPass=s.oitPass,i.hasHighlightMixTexture=8===r&&null!=s.highlightMixTexture,i}}class n extends i{constructor(){super(...arguments),this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.isDecoration=!1}}export{a as Material,n as MaterialParameters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{sub as n,set as t,copy as i,cross as o,normalize as e}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{setMin as s,setMax as f,create as r}from"../../../../geometry/support/aaBoundingBox.js";import{assert as u}from"./Util.js";class a{constructor(n=0,t=!1,i=!0){this.tolerance=n,this.isVerticalRay=t,this.normalRequired=i}}const l=r();function h(t,i,o,e,c,s){if(!t.visible)return;const f=n(F,e,o),r=(n,t,i)=>s(n,i,t),{tolerance:l}=i,h=new a(l,!1,i.options.normalRequired);if(t.boundingInfo)u(0===t.type),p(t.boundingInfo,o,f,l,c,h,r);else{const n=t.positionAttribute,i=n.indices;V(o,f,0,i.length/3,i,n.data,n.stride,c,h,r)}}const m=c();function p(n,t,i,o,e,c,r){if(null==n)return;const u=U(i,m);if(s(l,n.bbMin),f(l,n.bbMax),null!=e&&e.applyToAabb(l),k(l,t,u,o)){const{primitiveIndices:s,position:f}=n,u=s?s.length:f.indices.length/3;if(u>D){const s=n.getChildren();if(void 0!==s){for(const n of s)p(n,t,i,o,e,c,r);return}}T(t,i,0,u,f.indices,f.data,f.stride,s,e,c,r)}}const b=c();function M(t,i,o,e,c,s,f,r,u){const{data:a,stride:l}=s;V(t,n(F,i,t),o,e,c,a,l,f,r,u)}function d(n,t,i,o){if(!i.visible)return;const e=(n,t,i)=>o(n,i,t),{boundingInfo:c}=i;if(c){const{bbMin:i,bbMax:o}=c;if(n<i[0]||n>o[0]||t<i[1]||t>o[1])return}const s=i.positionAttribute,f=s.indices;x(n,t,0,f.length/3,f,s,e)}function x(n,t,i,o,e,c,s){const{data:f,stride:r}=c;for(let u=i;u<o;++u){const i=3*u,o=r*e[i],c=r*e[i+1],a=r*e[i+2],l=f[o+0]-n,h=f[o+1]-t,m=f[c+0]-n,p=f[c+1]-t,b=f[a+0]-n,M=f[a+1]-t,d=b*p-M*m,x=l*M-h*b,g=m*h-p*l;(d<0||x<0||g<0)&&(d>0||x>0||g>0)||s(0,u,null)}}function g(n,t,i,o,e,c,s,f,r,u=null,a=0){const l=n[0],h=n[1],m=n[2],p=t[0],M=t[1],d=t[2];for(let x=i;x<o;++x){const n=a+(u?.[x]??x),t=3*n,i=s*e[t],o=c[i],g=c[i+1],y=c[i+2],q=s*e[t+1],T=c[q],V=c[q+1],v=c[q+2],R=s*e[t+2],j=T-o,A=V-g,B=v-y,w=c[R]-o,C=c[R+1]-g,U=c[R+2]-y,k=M*U-C*d,z=d*w-U*p,D=p*C-w*M,F=j*k+A*z+B*D;if(Math.abs(F)<=E)continue;const G=l-o,H=h-g,J=m-y,K=G*k+H*z+J*D;if(F>0){if(K<0||K>F)continue}else if(K>0||K<F)continue;const L=H*B-A*J,N=J*j-B*G,O=G*A-j*H,P=p*L+M*N+d*O;if(F>0){if(P<0||K+P>F)continue}else if(P>0||K+P<F)continue;const Q=(w*L+C*N+U*O)/F;if(Q>=0){r(Q,n,f?I(j,A,B,w,C,U,b):null)}}}function y(n,t,i,o,e,c,s,f){const r=n[0],u=n[1],a=n[2],l=t[0],h=t[1],m=t[2];for(let p=i;p<o;++p){const n=3*p,t=n+1,i=n+2,o=c*n,M=e[o],d=e[o+1],x=e[o+2],g=c*t,y=c*i,q=e[g]-M,T=e[g+1]-d,V=e[g+2]-x,v=e[y]-M,R=e[y+1]-d,j=e[y+2]-x,A=h*j-R*m,B=m*v-j*l,w=l*R-v*h,C=q*A+T*B+V*w;if(Math.abs(C)<=E)continue;const U=r-M,k=u-d,z=a-x,D=U*A+k*B+z*w;if(C>0){if(D<0||D>C)continue}else if(D>0||D<C)continue;const F=k*V-T*z,G=z*q-V*U,H=U*T-q*k,J=l*F+h*G+m*H;if(C>0){if(J<0||D+J>C)continue}else if(J>0||D+J<C)continue;const K=(v*F+R*G+j*H)/C;if(K>=0){f(K,p,s?I(q,T,V,v,R,j,b):null)}}}function q(n,t,i,o,e,c,s,f,r,u,a,l=null,h=0){const m=n[0],p=n[1],M=n[2],d=t[0],x=t[1],g=t[2];for(let y=i;y<o;++y){const n=h+(l?.[y]??y),t=3*n,i=s*e[t],o=c[i],q=c[i+1],T=c[i+2],V=s*e[t+1],v=c[V],R=c[V+1],j=c[V+2],A=s*e[t+2],B=c[A],w=c[A+1],C=c[A+2],U=T-r,k=f/Math.sqrt(o*o+q*q+U*U),z=o+o*k,D=q+q*k,F=T+U*k,G=j-r,H=f/Math.sqrt(v*v+R*R+G*G),J=v+v*H,K=R+R*H,L=j+G*H,N=C-r,O=f/Math.sqrt(B*B+w*w+N*N),P=J-z,Q=K-D,S=L-F,W=B+B*O-z,X=w+w*O-D,Y=C+N*O-F,Z=x*Y-X*g,$=g*W-Y*d,_=d*X-W*x,nn=P*Z+Q*$+S*_;if(Math.abs(nn)<=E)continue;const tn=m-z,on=p-D,en=M-F,cn=tn*Z+on*$+en*_;if(nn>0){if(cn<0||cn>nn)continue}else if(cn>0||cn<nn)continue;const sn=on*S-Q*en,fn=en*P-S*tn,rn=tn*Q-P*on,un=d*sn+x*fn+g*rn;if(nn>0){if(un<0||cn+un>nn)continue}else if(un>0||cn+un<nn)continue;const an=(W*sn+X*fn+Y*rn)/nn;if(an>=0){a(an,n,u?I(P,Q,S,W,X,Y,b):null)}}}function T(n,t,i,o,e,c,s,f,r,u,a){const l=n[0],h=n[1],m=n[2],p=t[0],M=t[1],d=t[2],{normalRequired:x}=u;for(let g=i;g<o;++g){const n=f[g],t=3*n,i=s*e[t];let o=c[i],u=c[i+1],y=c[i+2];const q=s*e[t+1];let T=c[q],V=c[q+1],v=c[q+2];const R=s*e[t+2];let j=c[R],A=c[R+1],B=c[R+2];null!=r&&([o,u,y]=r.applyToVertex(o,u,y,g),[T,V,v]=r.applyToVertex(T,V,v,g),[j,A,B]=r.applyToVertex(j,A,B,g));const w=T-o,C=V-u,U=v-y,k=j-o,z=A-u,D=B-y,F=M*D-z*d,G=d*k-D*p,H=p*z-k*M,J=w*F+C*G+U*H;if(Math.abs(J)<=E)continue;const K=l-o,L=h-u,N=m-y,O=K*F+L*G+N*H;if(J>0){if(O<0||O>J)continue}else if(O>0||O<J)continue;const P=L*U-C*N,Q=N*w-U*K,S=K*C-w*L,W=p*P+M*Q+d*S;if(J>0){if(W<0||O+W>J)continue}else if(W>0||O+W<J)continue;const X=(k*P+z*Q+D*S)/J;if(X>=0){a(X,n,x?I(w,C,U,k,z,D,b):null)}}}function V(o,e,c,s,f,r,u,a,l,h){const m=e,p=G,b=Math.abs(m[0]),M=Math.abs(m[1]),d=Math.abs(m[2]),x=b>=M?b>=d?0:2:M>=d?1:2,g=x,y=m[g]<0?2:1,q=(x+y)%3,T=(x+(3-y))%3,V=m[q]/m[g],I=m[T]/m[g],B=1/m[g],w=v,C=R,U=j,{normalRequired:k}=l;for(let v=c;v<s;++v){const e=3*v,c=u*f[e];t(p[0],r[c+0],r[c+1],r[c+2]);const s=u*f[e+1];t(p[1],r[s+0],r[s+1],r[s+2]);const l=u*f[e+2];t(p[2],r[l+0],r[l+1],r[l+2]),a&&(i(p[0],a.applyToVertex(p[0][0],p[0][1],p[0][2],v)),i(p[1],a.applyToVertex(p[1][0],p[1][1],p[1][2],v)),i(p[2],a.applyToVertex(p[2][0],p[2][1],p[2][2],v))),n(w,p[0],o),n(C,p[1],o),n(U,p[2],o);const m=w[q]-V*w[g],b=w[T]-I*w[g],M=C[q]-V*C[g],d=C[T]-I*C[g],x=U[q]-V*U[g],y=U[T]-I*U[g],R=x*d-y*M,j=m*y-b*x,z=M*b-d*m;if((R<0||j<0||z<0)&&(R>0||j>0||z>0))continue;const D=R+j+z;if(0===D)continue;const E=R*(B*w[g])+j*(B*C[g])+z*(B*U[g]);if(E*Math.sign(D)<0)continue;const F=E/D;if(F>=0){h(F,v,k?A(p):null)}}}const v=c(),R=c(),j=c();function I(n,i,c,s,f,r,u){return t(B,n,i,c),t(w,s,f,r),o(u,B,w),e(u,u),u}function A(t){return n(B,t[1],t[0]),n(w,t[2],t[0]),o(b,B,w),e(b,b),b}const B=c(),w=c();function C(n,i,o){return t(o,1/(i[0]-n[0]),1/(i[1]-n[1]),1/(i[2]-n[2]))}function U(n,i){return t(i,1/n[0],1/n[1],1/n[2])}function k(n,t,i,o){return z(n,t,i,o,1/0)}function z(n,t,i,o,e){const c=(n[0]-o-t[0])*i[0],s=(n[3]+o-t[0])*i[0];let f=Math.min(c,s),r=Math.max(c,s);const u=(n[1]-o-t[1])*i[1],a=(n[4]+o-t[1])*i[1];if(r=Math.min(r,Math.max(u,a)),r<0)return!1;if(f=Math.max(f,Math.min(u,a)),f>r)return!1;const l=(n[2]-o-t[2])*i[2],h=(n[5]+o-t[2])*i[2];return r=Math.min(r,Math.max(l,h)),!(r<0)&&(f=Math.max(f,Math.min(l,h)),!(f>r)&&f<e)}const D=1e3,E=1e-7,F=c(),G=[c(),c(),c()];export{a as MeshIntersectionOptions,C as computeInvDir,U as computeInvDirFromDirection,I as computeNormalFromBarycentric,k as intersectAabbInvDir,z as intersectAabbInvDirBefore,g as intersectRayTriangles,V as intersectRayTrianglesWithDisplacementWatertight,q as intersectRayTrianglesWithVerticalOffsetENUGlobal,y as intersectRenderGeometryTriangles,h as intersectTriangleGeometry,d as intersectTriangleGeometry2d,M as intersectTriangles,x as intersectTriangles2d,E as triangleRayParallelTolerance};
2
+ import{sub as n,set as t,copy as i,cross as o,normalize as e}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{setMin as s,setMax as r,create as f}from"../../../../geometry/support/aaBoundingBox.js";import{assert as u}from"./Util.js";class a{constructor(n=0,t=!1,i=!0){this.tolerance=n,this.isVerticalRay=t,this.normalRequired=i}}const l=f();function h(t,i,o,e,c,s){if(!t.visible)return;const r=n(E,e,o),f=(n,t,i)=>s(n,i,t),{tolerance:l}=i,h=new a(l,!1,i.options.normalRequired);if(t.boundingInfo)u(0===t.type),p(t.boundingInfo,o,r,l,c,h,f);else{const n=t.positionAttribute,i=t.primitivePositionIndices;T(o,r,0,i.length/3,i,n.data,n.stride,c,h,f)}}const m=c();function p(n,t,i,o,e,c,f){if(null==n)return;const u=C(i,m);if(s(l,n.bbMin),r(l,n.bbMax),null!=e&&e.applyToAabb(l),U(l,t,u,o)){const{primitiveIndices:s,position:r}=n,u=s?s.length:r.indices.length/3;if(u>z){const s=n.getChildren();if(void 0!==s){for(const n of s)p(n,t,i,o,e,c,f);return}}q(t,i,0,u,r.indices,r.data,r.stride,s,e,c,f)}}const b=c();function M(t,i,o,e,c,s,r,f,u){const{data:a,stride:l}=s;T(t,n(E,i,t),o,e,c,a,l,r,f,u)}function d(n,t,i,o){if(!i.visible)return;const e=(n,t,i)=>o(n,i,t),{boundingInfo:c}=i;if(c){const{bbMin:i,bbMax:o}=c;if(n<i[0]||n>o[0]||t<i[1]||t>o[1])return}const s=i.positionAttribute,r=i.primitivePositionIndices;x(n,t,0,r.length/3,r,s,e)}function x(n,t,i,o,e,c,s){const{data:r,stride:f}=c;for(let u=i;u<o;++u){const i=3*u,o=f*e[i],c=f*e[i+1],a=f*e[i+2],l=r[o+0]-n,h=r[o+1]-t,m=r[c+0]-n,p=r[c+1]-t,b=r[a+0]-n,M=r[a+1]-t,d=b*p-M*m,x=l*M-h*b,g=m*h-p*l;(d<0||x<0||g<0)&&(d>0||x>0||g>0)||s(0,u,null)}}function g(n,t,i,o,e,c,s,r,f,u=null,a=0){const l=n[0],h=n[1],m=n[2],p=t[0],M=t[1],d=t[2];for(let x=i;x<o;++x){const n=a+(u?.[x]??x),t=3*n,i=s*e[t],o=c[i],g=c[i+1],y=c[i+2],v=s*e[t+1],q=c[v],T=c[v+1],V=c[v+2],I=s*e[t+2],R=q-o,A=T-g,B=V-y,P=c[I]-o,w=c[I+1]-g,C=c[I+2]-y,U=M*C-w*d,k=d*P-C*p,z=p*w-P*M,E=R*U+A*k+B*z;if(Math.abs(E)<=D)continue;const F=l-o,G=h-g,H=m-y,J=F*U+G*k+H*z;if(E>0){if(J<0||J>E)continue}else if(J>0||J<E)continue;const K=G*B-A*H,L=H*R-B*F,N=F*A-R*G,O=p*K+M*L+d*N;if(E>0){if(O<0||J+O>E)continue}else if(O>0||J+O<E)continue;const Q=(P*K+w*L+C*N)/E;if(Q>=0){f(Q,n,r?j(R,A,B,P,w,C,b):null)}}}function y(n,t,i,o,e,c,s,r){const f=n[0],u=n[1],a=n[2],l=t[0],h=t[1],m=t[2];for(let p=i;p<o;++p){const n=3*p,t=n+1,i=n+2,o=c*n,M=e[o],d=e[o+1],x=e[o+2],g=c*t,y=c*i,v=e[g]-M,q=e[g+1]-d,T=e[g+2]-x,V=e[y]-M,I=e[y+1]-d,R=e[y+2]-x,A=h*R-I*m,B=m*V-R*l,P=l*I-V*h,w=v*A+q*B+T*P;if(Math.abs(w)<=D)continue;const C=f-M,U=u-d,k=a-x,z=C*A+U*B+k*P;if(w>0){if(z<0||z>w)continue}else if(z>0||z<w)continue;const E=U*T-q*k,F=k*v-T*C,G=C*q-v*U,H=l*E+h*F+m*G;if(w>0){if(H<0||z+H>w)continue}else if(H>0||z+H<w)continue;const J=(V*E+I*F+R*G)/w;if(J>=0){r(J,p,s?j(v,q,T,V,I,R,b):null)}}}function v(n,t,i,o,e,c,s,r,f,u,a,l=null,h=0){const m=n[0],p=n[1],M=n[2],d=t[0],x=t[1],g=t[2];for(let y=i;y<o;++y){const n=h+(l?.[y]??y),t=3*n,i=s*e[t],o=c[i],v=c[i+1],q=c[i+2],T=s*e[t+1],V=c[T],I=c[T+1],R=c[T+2],A=s*e[t+2],B=c[A],P=c[A+1],w=c[A+2],C=q-f,U=r/Math.sqrt(o*o+v*v+C*C),k=o+o*U,z=v+v*U,E=q+C*U,F=R-f,G=r/Math.sqrt(V*V+I*I+F*F),H=V+V*G,J=I+I*G,K=R+F*G,L=w-f,N=r/Math.sqrt(B*B+P*P+L*L),O=H-k,Q=J-z,S=K-E,W=B+B*N-k,X=P+P*N-z,Y=w+L*N-E,Z=x*Y-X*g,$=g*W-Y*d,_=d*X-W*x,nn=O*Z+Q*$+S*_;if(Math.abs(nn)<=D)continue;const tn=m-k,on=p-z,en=M-E,cn=tn*Z+on*$+en*_;if(nn>0){if(cn<0||cn>nn)continue}else if(cn>0||cn<nn)continue;const sn=on*S-Q*en,rn=en*O-S*tn,fn=tn*Q-O*on,un=d*sn+x*rn+g*fn;if(nn>0){if(un<0||cn+un>nn)continue}else if(un>0||cn+un<nn)continue;const an=(W*sn+X*rn+Y*fn)/nn;if(an>=0){a(an,n,u?j(O,Q,S,W,X,Y,b):null)}}}function q(n,t,i,o,e,c,s,r,f,u,a){const l=n[0],h=n[1],m=n[2],p=t[0],M=t[1],d=t[2],{normalRequired:x}=u;for(let g=i;g<o;++g){const n=r[g],t=3*n,i=s*e[t];let o=c[i],u=c[i+1],y=c[i+2];const v=s*e[t+1];let q=c[v],T=c[v+1],V=c[v+2];const I=s*e[t+2];let R=c[I],A=c[I+1],B=c[I+2];null!=f&&([o,u,y]=f.applyToVertex(o,u,y,g),[q,T,V]=f.applyToVertex(q,T,V,g),[R,A,B]=f.applyToVertex(R,A,B,g));const P=q-o,w=T-u,C=V-y,U=R-o,k=A-u,z=B-y,E=M*z-k*d,F=d*U-z*p,G=p*k-U*M,H=P*E+w*F+C*G;if(Math.abs(H)<=D)continue;const J=l-o,K=h-u,L=m-y,N=J*E+K*F+L*G;if(H>0){if(N<0||N>H)continue}else if(N>0||N<H)continue;const O=K*C-w*L,Q=L*P-C*J,S=J*w-P*K,W=p*O+M*Q+d*S;if(H>0){if(W<0||N+W>H)continue}else if(W>0||N+W<H)continue;const X=(U*O+k*Q+z*S)/H;if(X>=0){a(X,n,x?j(P,w,C,U,k,z,b):null)}}}function T(o,e,c,s,r,f,u,a,l,h){const m=e,p=F,b=Math.abs(m[0]),M=Math.abs(m[1]),d=Math.abs(m[2]),x=b>=M?b>=d?0:2:M>=d?1:2,g=x,y=m[g]<0?2:1,v=(x+y)%3,q=(x+(3-y))%3,T=m[v]/m[g],j=m[q]/m[g],B=1/m[g],P=V,w=I,C=R,{normalRequired:U}=l;for(let V=c;V<s;++V){const e=3*V,c=u*r[e];t(p[0],f[c+0],f[c+1],f[c+2]);const s=u*r[e+1];t(p[1],f[s+0],f[s+1],f[s+2]);const l=u*r[e+2];t(p[2],f[l+0],f[l+1],f[l+2]),a&&(i(p[0],a.applyToVertex(p[0][0],p[0][1],p[0][2],V)),i(p[1],a.applyToVertex(p[1][0],p[1][1],p[1][2],V)),i(p[2],a.applyToVertex(p[2][0],p[2][1],p[2][2],V))),n(P,p[0],o),n(w,p[1],o),n(C,p[2],o);const m=P[v]-T*P[g],b=P[q]-j*P[g],M=w[v]-T*w[g],d=w[q]-j*w[g],x=C[v]-T*C[g],y=C[q]-j*C[g],I=x*d-y*M,R=m*y-b*x,k=M*b-d*m;if((I<0||R<0||k<0)&&(I>0||R>0||k>0))continue;const z=I+R+k;if(0===z)continue;const D=I*(B*P[g])+R*(B*w[g])+k*(B*C[g]);if(D*Math.sign(z)<0)continue;const E=D/z;if(E>=0){h(E,V,U?A(p):null)}}}const V=c(),I=c(),R=c();function j(n,i,c,s,r,f,u){return t(B,n,i,c),t(P,s,r,f),o(u,B,P),e(u,u),u}function A(t){return n(B,t[1],t[0]),n(P,t[2],t[0]),o(b,B,P),e(b,b),b}const B=c(),P=c();function w(n,i,o){return t(o,1/(i[0]-n[0]),1/(i[1]-n[1]),1/(i[2]-n[2]))}function C(n,i){return t(i,1/n[0],1/n[1],1/n[2])}function U(n,t,i,o){return k(n,t,i,o,1/0)}function k(n,t,i,o,e){const c=(n[0]-o-t[0])*i[0],s=(n[3]+o-t[0])*i[0];let r=Math.min(c,s),f=Math.max(c,s);const u=(n[1]-o-t[1])*i[1],a=(n[4]+o-t[1])*i[1];if(f=Math.min(f,Math.max(u,a)),f<0)return!1;if(r=Math.max(r,Math.min(u,a)),r>f)return!1;const l=(n[2]-o-t[2])*i[2],h=(n[5]+o-t[2])*i[2];return f=Math.min(f,Math.max(l,h)),!(f<0)&&(r=Math.max(r,Math.min(l,h)),!(r>f)&&r<e)}const z=1e3,D=1e-7,E=c(),F=[c(),c(),c()];export{a as MeshIntersectionOptions,w as computeInvDir,C as computeInvDirFromDirection,j as computeNormalFromBarycentric,U as intersectAabbInvDir,k as intersectAabbInvDirBefore,g as intersectRayTriangles,T as intersectRayTrianglesWithDisplacementWatertight,v as intersectRayTrianglesWithVerticalOffsetENUGlobal,y as intersectRenderGeometryTriangles,h as intersectTriangleGeometry,d as intersectTriangleGeometry2d,M as intersectTriangles,x as intersectTriangles2d,D as triangleRayParallelTolerance};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{generateUID as t}from"../../../../core/uid.js";import{copy as r,multiply as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{transformMat4 as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{NullSphere as s,Sphere as n}from"../../../../geometry/support/sphere.js";import{maxScale as a}from"../../support/mathUtils.js";class h{constructor(r,i={}){this.geometry=r,this.screenToWorldRatio=1,this._transformation=e(),this._shaderTransformation=null,this._boundingSphere=null,this.id=t(),this.layerViewUid=i.layerViewUid,this.graphicUid=i.graphicUid,this.castShadow=i.castShadow??!1,i.objectShaderTransformation&&this.objectShaderTransformationChanged(i.objectShaderTransformation)}get transformation(){return this._transformation}set transformation(t){r(this._transformation,t),this._boundingSphere=null}get boundingInfo(){return this.geometry.boundingInfo}objectShaderTransformationChanged(t){null==t?this._shaderTransformation=null:(this._shaderTransformation??=e(),i(this._shaderTransformation,t,this.geometry.transformation)),this._boundingSphere=null}get boundingSphere(){return this.boundingInfo?(null==this._boundingSphere&&(this._boundingSphere??=new n,o(this._boundingSphere.center,this.boundingInfo.center,this.shaderTransformation),this._boundingSphere.radius=this.boundingInfo.radius*a(this.shaderTransformation)),this._boundingSphere):s}get material(){return this.geometry.material}get type(){return this.geometry.type}get shaderTransformation(){return this._shaderTransformation??this.transformation}get attributes(){return this.geometry.attributes}get positionAttribute(){return this.geometry.positionAttribute}foreachHighlightOptions(t){this.geometry.foreachHighlightOptions(t)}get hasHighlights(){return this.geometry.hasHighlights}get occludees(){return this.geometry.occludees}get visible(){return this.geometry.visible}set visible(t){this.geometry.visible=t}}class m extends h{}export{h as RenderGeometry,m as ValidatedRenderGeometry};
2
+ import{generateUID as t}from"../../../../core/uid.js";import{copy as r,multiply as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{transformMat4 as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{NullSphere as s,Sphere as n}from"../../../../geometry/support/sphere.js";import{maxScale as a}from"../../support/mathUtils.js";class h{constructor(r,i={}){this.geometry=r,this.screenToWorldRatio=1,this._transformation=e(),this._shaderTransformation=null,this._boundingSphere=null,this.id=t(),this.layerViewUid=i.layerViewUid,this.graphicUid=i.graphicUid,this.castShadow=i.castShadow??!1,i.objectShaderTransformation&&this.objectShaderTransformationChanged(i.objectShaderTransformation)}get transformation(){return this._transformation}set transformation(t){r(this._transformation,t),this._boundingSphere=null}get boundingInfo(){return this.geometry.boundingInfo}objectShaderTransformationChanged(t){null==t?this._shaderTransformation=null:(this._shaderTransformation??=e(),i(this._shaderTransformation,t,this.geometry.transformation)),this._boundingSphere=null}get boundingSphere(){return this.boundingInfo?(null==this._boundingSphere&&(this._boundingSphere??=new n,o(this._boundingSphere.center,this.boundingInfo.center,this.shaderTransformation),this._boundingSphere.radius=this.boundingInfo.radius*a(this.shaderTransformation)),this._boundingSphere):s}get material(){return this.geometry.material}get type(){return this.geometry.type}get shaderTransformation(){return this._shaderTransformation??this.transformation}get attributes(){return this.geometry.attributes}get positionAttribute(){return this.geometry.positionAttribute}get primitivePositionIndices(){return this.geometry.primitivePositionIndices}foreachHighlightOptions(t){this.geometry.foreachHighlightOptions(t)}get hasHighlights(){return this.geometry.hasHighlights}get occludees(){return this.geometry.occludees}get visible(){return this.geometry.visible}set visible(t){this.geometry.visible=t}}class m extends h{}export{h as RenderGeometry,m as ValidatedRenderGeometry};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as s}from"../../../../core/asyncUtils.js";import"../../../../core/has.js";import{removeMaybe as r,abortMaybe as i,destroyMaybe as n,releaseMaybe as a}from"../../../../core/maybe.js";import{throwIfAborted as h}from"../../../../core/promiseUtils.js";import{watch as o,syncAndInitial as d,initial as _,sync as l}from"../../../../core/reactiveUtils.js";import{signal as u}from"../../../../core/signal.js";import{property as p,subclass as m}from"../../../../core/accessorSupport/decorators.js";import{equals as c,invert as f,multiply as g}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as b,create as P}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as C}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as w,ZEROS as E}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as T}from"../../../../geometry/support/Indices.js";import{RenderNodeOutput as x,InternalRenderCategory as A,AllRenderNodeOutputs as S,AllInternalRenderNodeOutputs as D}from"../../webgl.js";import{innerAtmosphereFadeStart as R}from"../../environment/atmosphereUtils.js";import{minNearDistanceInMeters as I}from"../../state/NearFarHeuristic.js";import{debugFlags as y}from"../../support/debugFlags.js";import{FBOCache as H}from"../core/FBOCache.js";import{RenderPassManager as O}from"../core/renderPasses/RenderPassManager.js";import{isColor as v}from"../core/shaderLibrary/ShaderOutput.js";import{distanceFadeEnd as F}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as M}from"../effects/RenderNodes.js";import{RenderPluginManager as N}from"../effects/RenderPluginManager.js";import{Blit as q}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as G,renderHighlightBuffer as L}from"../effects/highlight/Highlight.js";import{OITBlend as U}from"../effects/transparency/OITBlend.js";import{AnimationTimer as V}from"./AnimationTimer.js";import{AnimationTimeStep as B}from"./AnimationTimeStep.js";import{BoundingInfo as j}from"./BoundingInfo.js";import{Compositor as k}from"./Compositor.js";import{DepthRange as z}from"./DepthRange.js";import{depthRangeFromScene as W}from"./depthRangeUtils.js";import{MainFramebuffer as Q}from"./MainFramebuffer.js";import{RenderContext as Y,defaultRenderOccludedMask as J}from"./RenderContext.js";import{RendererBase as K}from"./RendererBase.js";import{setupFeatureDefaults as X}from"./RenderFeature.js";import{RenderPluginInput as Z}from"./RenderPluginInput.js";import{ShadowAccumulator as $}from"./ShadowAccumulator.js";import{ShadowMap as ee}from"./ShadowMap.js";import te from"./SliceHelper.js";import{MergedRenderer as se}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as re}from"../parts/renderUtils.js";import{RendererPerformanceInfo as ie,PerformanceCategory as ne}from"../statistics/RendererPerformanceInfo.js";import{PixelType as ae,ColorAttachment1 as he,ColorAttachment2 as oe,ColorAttachment0 as de}from"../../../webgl/enums.js";let _e=class extends K{constructor(e,t,s,r,i){super({stage:e}),this._techniques=s,this._rctx=r,this._requestRender=i,this._pluginsHas={occludedHudElements:!1,hudElements:!1,water:!1},this.renderPassManager=new O,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=w(0,0,0,1),this._sliceHelper=new te,this.sceneDepthRange=u(z.Infinite),this._state=u(2),this._hasAnimations=!1,this._animationTimestep=new B,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=u(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new Z,this._oitCallouts=!1,this._releaseNodeInputs=e=>{for(const t of we)e.some(({name:e})=>e===t)&&this._pluginInput.release(t)},this._debugNeedsDepth=!1,this._fboCache=new H(r),this._compositor=new k(r,s),this._renderStateFeatures=u(X(e.view.qualityProfile)),this._framebuffer=new Q(this.fboCache),this._performanceInfo=new ie(this._rctx),this._shadowMap=new ee(this.fboCache,e.viewingMode),this._blit=new q(s),this._shadowAccumulator=new $(this.fboCache,s,e,e=>{const t=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),this._shadowMap.enabled=t},(t,s,r)=>{const i=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,s,r,!0,i),this._renderShadowCascades(3,t.shadowMap),t.shadowMap.finish(),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)},i),this._renderContext=new Y(this._rctx,this._shadowMap,s),this._nodes=new M(this._renderContext),this._plugins=new N({renderContext:this._renderContext,techniques:s,materials:t,requestRender:i,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this._plugins.add(this.renderPassManager),this.addHandles([o(()=>e.view.state.camera,()=>i(),d),o(()=>y.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},i()},_),o(()=>e.view.environment.background?.color,e=>{const t=e?e.toUnitRGBA():E;C(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),i()},d),o(()=>e.view.state.camera.relativeElevation,e=>this._inGlobeView=(e??1/0)>=F,d),o(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},l),o(()=>this._bindParameters.clouds.data?.state,()=>i(),l),o(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,i()},_)])}destroy(){this._gpuTimerHandle=r(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.destroy(),this._shadowAccumulator=null,this._loadEdgeViewTask=i(this._loadEdgeViewTask),this._edgeView=n(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this._fboCache.destroy(),this._fboCache=null,this._plugins.destroy(),this._plugins=null,this._pluginInput=null,this._oitBlendOrNil=null,this._nodes=null,this._framebuffer=null,this._shadowMap=null,this._renderContext=null,this._performanceInfo=null,j.prune(),se.prune(),T()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _oitBlend(){return this._oitBlendOrNil??=new U(this._techniques),this._oitBlendOrNil}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e){this._renderStateFeatures.value=X(e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,s){this._renderStateFeatures.mutate(r=>r.set(t,e,s)),this._requestRender()}get _highQualityTransparency(){return this.isFeatureEnabled(1)}get hasReflections(){return this._pluginsHas.water&&this.isFeatureEnabled(6)}get _hasHighlights(){return this._plugins.produces(8,2,4,20,14,15,16)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(8,14,15,16)}get hasSSAO(){return this.isFeatureEnabled(5)&&!this._inGlobeView}get hasSMAA(){return this.isFeatureEnabled(0)}get _hasEmission(){return this._plugins.hasEmitters&&this._hasFloatBufferBlendSupport}get highResolutionAtmosphere(){return this.isFeatureEnabled(4)}get fboCache(){return this._fboCache}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=a(this._bindParameters.ssr.lastFrameColor),this._bindParameters.terrainDepth=a(this._bindParameters.terrainDepth),this._bindParameters.geometryDepth=a(this._bindParameters.geometryDepth),this._bindParameters.hudOcclusion=a(this._bindParameters.hudOcclusion)}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeBuffers(),this._bindParameters.depth=a(this._bindParameters.depth),this._bindParameters.hudVisibility=a(this._bindParameters.hudVisibility)}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._shadowAccumulator.readyToRun||this._plugins.updating||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=s(async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");h(e);const s=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:Ae(this.stage.view.resourceController)});return this.addHandles(o(()=>s.updating,()=>this._requestRender(),l)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(s)),this._edgeViewCallbacks.length=0,s})),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&c(this._bindParameters.ssr.reprojectionMatrix,b)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:t,_bindParameters:s}=this;if(void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&t.maxCascades!==e.shadowMapMaxCascades&&(t.maxCascades=e.shadowMapMaxCascades,this._requestRender()),e.environment){void 0!==e.environment.weather&&(this._bindParameters.weather=e.environment.weather);const t="virtual"!==e.environment.lighting.type;s.enableFillLights!==t&&(s.enableFillLights=t,this._requestRender())}void 0!==e.shadowCast&&this._shadowAccumulator.setOptions(e.shadowCast)}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}get _hasFloatBufferBlendSupport(){return this._rctx.driverTest.floatBufferBlend.result}get oitEnabled(){return this.isFeatureEnabled(2)&&this._hasFloatBufferBlendSupport}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}rendererAdded(e){this._plugins.add(e)}rendererRemoved(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this.occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(8&this.plugins.renderOccludedFlags)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,10)}updateHasFlags(){const has=this._pluginsHas;has.occludedHudElements=this._plugins.produces(0,15),has.hudElements=has.occludedHudElements||this._plugins.produces(0,...ge),has.water=this._plugins.produces(2,21),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new V(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const s=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==s&&(this._gpuTimerHandle=s?r(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,s,r=!1){try{return this._isRendering=!0,this._render(e,t,s,r)}catch(i){console.error(`Exception during rendering: ${i}`)}finally{this._isRendering=!1}return new re(this._pluginInput.get(x.FINAL),null)}_render(e,t,s,r){const i=0===s;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=i,this._disposeBindBuffers();const{camera:n,contentCamera:a,mode:h,alignPixelEnabled:o}=e;this._state.value=h,this._renderContext.time=t,this._renderContext.output=0,this._bindParameters.hasEmission=this._hasEmission,this._bindParameters.oitPass=0,this._bindParameters.alignPixelEnabled=o,this._bindParameters.decorations=!r,this._bindParameters.mainDepth=null;const d=!r||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=d?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(A.VIEWSHED),this._bindParameters.cutFillEnabled=this._nodes.produces(A.CUTFILL_DEPTH),this._renderOverlay(),n.setGLViewport(this._rctx);const _=this._framebuffer,l=_.initialize(n.fullWidth,n.fullHeight,this._backgroundColor,this._bindParameters.hasEmission);this.hasReflections?(l?.setName("last frame color"),this._bindParameters.ssr.lastFrameColor=l):l?.release(),this._ensureBindParametersCamera(n,a),this._plugins.sortTestsTransparentOrderedSlots(Pe),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&!r;const u=this._plugins.produces(0,...ue);this._precompilePrepasses(),this.performanceInfo.advance(ne.PREPARE);const p=this._computeShadowDepthRange(n);this._renderShadowMap(n,this._bindParameters.lighting.mainLight.direction,p),this._pluginInput.set("normals",this._renderNormals()),this._renderRemainingGeometryDepth(),this._renderShadowAccumulation(p,n,a,!i),this._oitCallouts=u&&this.oitEnabled,this._ensureBindParametersSSR(t),this._precompileShaders(u),this._renderContext.output=0,_.bind(),this._bindParameters.mainDepth=_.depth.attachment,this._renderOpaque(),this._renderTransparent(u),this._shadowMap.disposeMainBuffer(),this._pluginInput.set(A.FOCUSAREA,this._renderFocusAreaGeometry()),this._pluginInput.set(A.CUTFILL_DEPTH,this._renderCutFillDepth()),_.update(e=>this._renderNodes(A.TRANSPARENT_ENVIRONMENT,e)),_.update(e=>this._renderNodes(A.VIEWSHED,e)),_.update(e=>this._renderNodes(A.LASERLINES,e)),_.update(e=>this._renderNodes(A.FOCUSAREA_COLOR,e)),this._pluginInput.release(A.FOCUSAREA),this._pluginInput.release(A.CUTFILL_DEPTH),_.update(e=>this._renderNodes(A.OCCLUDED,e)),this._pluginInput.set("highlights",this._renderHighlightPrepass()),this._renderHighlightShadowMap(n,this._bindParameters.lighting.mainLight.direction,p);const m=2===s?this._renderObjectAndLayerIdColor():null;_.update(e=>this._renderNodes(x.COMPOSITE,e)),this._shadowMap.disposeBuffers(),_.update(e=>this._renderNodes(A.ANTIALIASING,e));const c=this._hasPhotoshopTerrain||!u?1:2;let f;return this._bindParameters.hasEmission=!1,this._hasHUDHighlights&&_.update(e=>this._renderHUD(c,e)),_.update(e=>this._renderNodes(A.HIGHLIGHT_COLOR,e)),this._hasHUDHighlights||_.update(e=>this._renderHUD(c,e)),this._bindParameters.hasEmission=this._hasEmission,_.update(e=>this._renderNodes(A.MAGNIFIER,e)),_.update(e=>this._renderNodes(x.FINAL,e)),i&&this._blit.toFramebuffer(this._rctx,_.color,this._bindParameters),this.onPostRender?.(),this._releaseFBOs(),_.releaseDepth(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),i||(f=_.color,f.retain(),this._releaseFBOs(),this._disposeOffscreenBuffers()),this.performanceInfo.finishFrame(),new re(f,m)}_precompileShaders(e){++this._plugins.context.techniques.precompiling,this._renderContext.output=0,this._precompileOpaqueGeometry(),this._nodes.precompile(A.OPAQUE_ENVIRONMENT),this._nodes.precompile(A.GAUSSIAN_SPLAT);const t=this._bindParameters;t.terrainDepthTest=t.cullAboveTerrain=this._needsTerrainDepth,this._renderContext.output=1,this._plugins.precompile(...pe),this._needsTerrainDepth&&(this._precompileOpaqueGeometry(),this._precompileTransparentGeometry()),this._renderContext.output=0,this._plugins.precompile(...pe);const s=this._pluginsHas.hudElements&&this.oitEnabled,r=this._pluginsHas.occludedHudElements,i=this._bindParameters.hasEmission;this._oitBlend.precompile(i,r,s),s&&this._oitBlend.precompile(!1,r,s),e&&(this._precompileTransparentGeometry(),this._hasPhotoshopTerrain&&(t.cullAboveTerrain=!1,this._precompileTransparentGeometry(),t.cullAboveTerrain=this._needsTerrainDepth)),this._nodes.precompile(A.FOCUSAREA);const n=this._hasPhotoshopTerrain&&!this._needsTerrainDepth;this._compositor.precompile(this._usesPremultipliedAlphaBlit,!!this._needsEdges,n,i),this._needsHUDVisibility&&this._plugins.precompile(13),this._oitCallouts||this._plugins.precompile(17),this._precompileHUD(0),t.terrainDepthTest=t.cullAboveTerrain=!1,this._nodes.precompile(A.TRANSPARENT_ENVIRONMENT,A.VIEWSHED,A.CUTFILL_DEPTH,A.CUTFILL_COLOR,A.LASERLINES,A.FOCUSAREA_COLOR,A.OCCLUDED,A.ANTIALIASING,A.HIGHLIGHT_COLOR),t.highlightMixTexture=t.highlights.length>1?this._rctx.emptyTexture:null,t.hasEmission=!1,this._precompileHUD(1),this.oitEnabled&&this._precompileHUD(0),t.hasEmission=this._hasEmission,this._hasHighlights&&(t.highlights.forEach((e,s)=>{t.highlightLevel=s,this._precompileAllGeometry(8),this._hasHUDHighlights&&this._plugins.precompile(15,14)}),t.highlightLevel=null,this._nodes.precompile(A.HIGHLIGHT_COLOR)),t.highlightMixTexture=null,this._nodes.precompile(x.COMPOSITE,A.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(9),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(A.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(ne.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces("olid"))return null;const e=this._renderContext.output;++this._techniques.precompiling;const{width:t,height:s}=this._framebuffer.size;let r=this.fboCache.acquire(t,s,"olid");return r.acquireDepth(14),r=this._nodes.render(r,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(ne.OBJECT_AND_LAYER_ID_COLOR),this._renderContext.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,s=0===e;if(s||t){const e=s?this.performanceInfo.elapsedTime:0;let r=0;t?r=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const i=Math.max(e,r);this._animationTimestep.frame(i,s)}}readMainDepth(e,t){const{mainDepth:s,camera:r}=this._bindParameters;if(!s)return;const i=this.fboCache.acquire(this._framebuffer.size.width,this._framebuffer.size.height,"linear depth");this._rctx.bindFramebuffer(i.fbo),r.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(E),this._compositor.blitDepthToLinearDepth(this._bindParameters,s),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),i.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,ae.UNSIGNED_BYTE,t),i.release()}readHUDVisibility(e,t,s,r,i){this._bindParameters.hudVisibility?.fbo?.readPixels(e,t,s,r,6408,ae.UNSIGNED_BYTE,i)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}get _needsEdges(){return this._edgeView?.shouldRender()?this._edgeView:null}_renderEdges(e){const t=this._needsEdges;if(!t)return;const{width:s,height:r}=this._framebuffer.size,i=this.fboCache.acquire(s,r,"edges"),n=this._bindParameters.geometryDepth,a=()=>t.render(this._bindParameters,e);this._renderToTargets(a,i,n??this._framebuffer.depth,E),this._framebuffer.bind(),this._compositor.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(1===e?ne.OPAQUE_EDGES:ne.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(this._renderContext.time),this._bindParameters.overlay&&this.performanceInfo.advance(ne.OVERLAY)}_renderShadowMap(e,t,s){if(!this.shadowsEnabled)return;const r=this._shadowMap;r.start(e,t,s,this.isFeatureEnabled(7),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(5,this._shadowMap),r.copySnapshot(1),this._renderShadowCascades(4,this._shadowMap)):this._renderShadowCascades(3),r.finish(),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this.performanceInfo.advance(ne.SHADOW_MAP)}_renderHighlightShadowMap(e,t,s){if(!this.shadowsEnabled||!this._needsShadowHighlight)return;const r=this._shadowMap;r.start(e,t,s,this.isFeatureEnabled(7),this.stage.view.qualitySettings.maximumPixelRatio),this._renderShadowCascades(4,this._shadowMap),r.moveSnapshot(0),r.finish(),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this.performanceInfo.advance(ne.SHADOW_MAP)}_renderCutFillDepth(){return this._nodes.produce(A.CUTFILL_DEPTH,this._pluginInput)}_precompileShadowCascades(e){0!==this._shadowMap.cascades.length&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._shadowMap){t.bindFbo();for(const s of t.cascades)s.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(s.camera,s.camera),this.renderAllGeometry(e)}get _needsDepth(){return this._plugins.consumes(1)||this._nodes.requireGeometryDepth()||this.hasReflections||this._needsShadowHighlight||this._shadowAccumulator.active||this._debugNeedsDepth}get _usesPremultipliedAlphaBlit(){return this._pluginsHas.hudElements&&this.oitEnabled||this._hasPhotoshopTerrain}_renderRemainingGeometryDepth(){const e=this._pluginInput.get("normals");e?(this._pluginInput.set(A.SSAO,this._renderSSAO()),this._needsDepth?(this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(1),this._bindParameters.depth?.release(),this._bindParameters.depth=e.obtainDepthTexture(),this.performanceInfo.advance(ne.DEPTH)):(e.detachDepth(),this._bindParameters.depth=a(this._bindParameters.depth)),this.hasSSAO&&this._pluginInput.release("normals")):this._renderAllGeometryDepth()}_renderAllGeometryDepth(){if(this._bindParameters.depth=a(this._bindParameters.depth),!this._needsDepth)return;const{width:e,height:t}=this._framebuffer.size,s=this.fboCache.acquire(e,t,"geometry depth",14);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(1280),this.renderAllGeometry(1),this._bindParameters.depth=s.obtainDepthTexture(),s.release(),this.performanceInfo.advance(ne.DEPTH)}_renderTerrainDepth(){if(this._bindParameters.terrainDepth=a(this._bindParameters.terrainDepth),this._bindParameters.terrainDepthTest=this._bindParameters.cullAboveTerrain=this._needsTerrainDepth,!this._needsTerrainDepth)return;const e=this._renderContext.output;this._renderContext.output=1;const{width:t,height:s}=this._framebuffer.size,r=this.fboCache.acquire(t,s,"terrain depth",14);this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(1280),this._renderTransparentGround(),this._bindParameters.terrainDepth=r.obtainDepthTexture(),r.release(),this._renderContext.output=e}_renderGeometryDepth(){if(this._bindParameters.geometryDepth=a(this._bindParameters.geometryDepth),!this._needsTerrainDepth)return;const e=this._renderContext.output,{width:t,height:s}=this._framebuffer.size,r=this.fboCache.acquire(t,s,"geometry depth",14);this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(1280),this._renderOpaqueAndTransparentGeometry(1),this._renderContext.output=e,this._bindParameters.geometryDepth=r.obtainDepthTexture(),r.release()}get _needsShadowDepthRange(){return this._shadowMap.enabled||this._shadowAccumulator.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return z.Zero;const t=W(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal)return void(this.sceneDepthRange.value=z.Infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<R)return void(this.sceneDepthRange.value=z.Infinite);const t=e.clone();t.near=I,t.far=1e10;const s=W(t,this._plugins.plugins,this.stage.layers,1);s.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(s)||(this.sceneDepthRange.value=s)}get _normalsRequired(){const e=this._nodes.require("normals",...S,A.VIEWSHED,A.LASERLINES);return(this.hasSSAO?1:0)+e}_precompilePrepasses(){this._normalsRequired&&this._precompileAllGeometry(2),this._needsDepth&&this._precompileAllGeometry(1),this.shadowsEnabled&&(this._needsShadowHighlight?(this._precompileShadowCascades(4),this._precompileShadowCascades(5)):this._precompileShadowCascades(3)),this._shadowAccumulator.active&&this._precompileAllGeometry(3),this.hasSSAO&&this._normalsRequired&&this._nodes.precompile(A.SSAO)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const{width:t,height:s}=this._framebuffer.size,r=this.fboCache.acquire(t,s,"normals",5);r.acquireDepth(14),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(E,!0,!0),this._renderContext.output=2,this._plugins.render(...me);const i=this._nodes.optional("normals",...S,A.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(ne.NORMALS),r}_renderSSAO(){const e=this._pluginInput.get("normals");if(this.hasSSAO&&e)return this._bindParameters.ssao=this._nodes.produce(A.SSAO,this._pluginInput),this._bindParameters.ssao&&this.performanceInfo.advance(ne.SSAO),this._bindParameters.ssao}_precompileAllGeometry(e){const t=this._renderContext.output;this._renderContext.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(...pe),this._renderContext.output=t}renderAllGeometry(e){this._renderContext.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentGround()}precompileSlots(e,...t){for(const s of t)this._bindParameters.slot=s,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const s of t)this._renderContext.renderOccludedMask=s,this.precompileSlots(e,...fe);this._renderContext.renderOccludedMask=J}renderSlots(e,...t){for(const s of t)this._bindParameters.slot=s,e.forAll(e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)})}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>1&&this._plugins.render(10),this.renderSlots(e,...fe),this._renderContext.renderOccludedMask=J}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Ce[e])}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(18),this.renderHUD(e),this._bindParameters.hudRenderStyle=e,this._plugins.render(16)}precompileViewshedShadowMap(){this._precompileAllGeometry(6)}precompileCutFill(){const e=7,t=this._renderContext.output;this._renderContext.output=e,this._plugins.precompile(0,1,...pe),this._renderContext.output=t}renderViewshedShadowMap(e){const{camera:t,contentCamera:s}=this._bindParameters,r=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(6),this._ensureBindParametersCamera(t,s),this._bindParameters.camera.setGLViewport(this._rctx),this._renderContext.output=r}renderCutFillReferenceDepth(e){const{camera:t,contentCamera:s}=this._bindParameters,r=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._renderContext.output=7,this._plugins.render(0,1,...pe),this._ensureBindParametersCamera(t,s),t.setGLViewport(this._rctx),this._renderContext.output=r}_renderOpaqueAndTransparentGeometry(e){this._renderContext.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithoutNormals(e){this._renderContext.output=e,this._plugins.render(...ce)}_precompileOpaqueGeometry(){this._plugins.precompile(...le),this._nodes.precompile("opaque-color")}_renderOpaqueGeometry(){this._plugins.render(...le)}_renderTransparentGeometry(){this._plugins.render(...ue),this._oitCallouts&&this._plugins.render(17)}get _hasPhotoshopTerrain(){return this._plugins.produces(0,6)}get _needsTerrainDepth(){return this._highQualityTransparency&&this._hasPhotoshopTerrain}_renderPhotoshopTerrain(){if(!this._hasPhotoshopTerrain)return null;const{width:e,height:t}=this._framebuffer.size,s=this.fboCache.acquire(e,t,"transparent terrain"),r=()=>this._plugins.render(6);return this._renderToTargets(r,s,this._framebuffer.depth,E),this.performanceInfo.advance(ne.TRANSPARENT_TERRAIN),s}_renderTransparentGround(){this._plugins.render(...pe)}get _needsHUDVisibility(){return this._plugins.produces(this._renderContext.output,13)}_renderHUDVisibility(){if(!this._needsHUDVisibility)return void(this._bindParameters.hudVisibility=a(this._bindParameters.hudVisibility));const{width:e,height:t}=this._framebuffer.size;let s=this._bindParameters.hudVisibility;s?.fbo?.width===e&&s?.fbo?.height===t||(s?.release(),s=this.fboCache.acquire(e,t,"hud visibility",4),this._bindParameters.hudVisibility=s);const r=this._bindParameters.geometryDepth;s.attachDepth(r||this._framebuffer.depth),this._rctx.bindFramebuffer(s.fbo),this._rctx.clearFramebuffer([0,1,0,1]),this._plugins.render(13),s.detachDepth(),this._framebuffer.bind(),this.performanceInfo.advance(ne.HUD_VISIBILITY)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,0===e){const e=()=>this._plugins.render(17),{width:t,height:s}=this._framebuffer.size,r=this.fboCache.acquireDepth(13,t,s,"line callouts");this._renderToTargets(e,this._framebuffer.color,r,void 0,!0,!0),r.release()}else this._plugins.render(17)}_precompileHUD(e){if(this._pluginsHas.hudElements&&(this._precompileHUDOutput(e),this._hasHighlights)){const t=this._renderContext.output;this._renderContext.output=8,this._precompileHUDOutput(e),this._renderContext.output=t}}_precompileHUDOutput(e){const t=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this.oitEnabled&&v(this._renderContext.output)?(this._bindParameters.oitPass=1,this._plugins.precompile(...ge),this._bindParameters.oitPass=2,this._plugins.precompile(...ge),this._bindParameters.oitPass=0):this._plugins.precompile(...ge),this._bindParameters.hudRenderStyle=t}_renderHUD(e,t){if(!this._pluginsHas.hudElements)return t;if(this.oitEnabled){const s=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo),this._compositor.compositePreMultipliedAlpha(this._bindParameters,s.getTexture(),!1),s.release()}else if(this._renderContext.output=0,0===e){const t=()=>this._renderHUDElements(e),{width:s,height:r}=this._framebuffer.size,i=this.fboCache.acquireDepth(13,s,r,"hud");this._renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(13),this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(256),this._renderHUDElements(e),t.detachDepth();return this.performanceInfo.advance(0===e?ne.HUD_OCCLUDED:ne.HUD),t}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(4,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:s}=this,{width:r,height:i}=this._framebuffer.size,{highlights:n}=s,a=n.length>G?3:1,h=e.acquire(r,i,"highlights",a);h.acquireDepth(14);const o=this._plugins.produces(8,0);return o&&this._framebuffer.color.fbo&&h.fbo&&t.blitFramebuffer(this._framebuffer.color.fbo,h.fbo,1024),t.bindFramebuffer(h.fbo),t.gl.clearBufferuiv(6144,0,[0,0,0,0]),o||t.clear(1024),this._renderContext.output=8,t.bindFramebuffer(h.fbo),L(t,e,r,i,s,()=>this._renderHighlightGeometries()),h.detachDepth(),this.performanceInfo.advance(ne.HIGHLIGHTS),h.retain(this._nodes.require("highlights",...D)+this._nodes.optional("highlights",...D)-1),h}_renderHighlightGeometries(){this._plugins.render(...be),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e,t,s,r){this._shadowAccumulator.updateDepthRange(e),this._shadowAccumulator.accumulating&&this._bindParameters.depth&&this._shadowAccumulator.renderAccumulation(this._bindParameters.depth,t,s,r)&&this.performanceInfo.advance(ne.ACCUMULATED_SHADOWS)}_precompileTransparentGeometry(){this.oitEnabled&&v(this._renderContext.output)?(this._bindParameters.oitPass=1,this._plugins.precompile(...ue),this._oitCallouts&&this._plugins.precompile(17),this._bindParameters.oitPass=2,this._plugins.precompile(...ue),this._oitCallouts&&this._plugins.precompile(17),this._bindParameters.oitPass=0):this._plugins.precompile(...ue)}_renderOIT(e,t=2){const s=1===e,{width:r,height:i}=this._framebuffer.size,n=s?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=this._renderContext.output;this._renderContext.output=0,h.oitPass=1;const d=s?"oit hud":"oit",_=this.fboCache.acquire(r,i,d,8),l=this._bindParameters.hasEmission&&(0===e||1!==t);l&&_.acquireColor(he,8,"oit emissive");const u=l?oe:he;_.acquireColor(u,7,"oit alpha"),s||_.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(_.fbo),this._rctx.clearFramebuffer([0,0,0,1]),l&&this._rctx.clearBuffer(1,E),n(),_.detachDepth(),h.oitPass=2;const p=this.fboCache.acquire(r,i,s?"oit hud front":"oit front");l&&p.acquireColor(he,8,"oit emissive front"),s?p.acquireDepth(13):p.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(p.fbo),this._rctx.clearFramebuffer(E,s),n(),p.detachDepth();const m=this._pluginsHas.occludedHudElements&&!s;let c;return this._bindParameters.hudOcclusion=a(this._bindParameters.hudOcclusion),h.oitPass=0,s?(c=this.fboCache.acquire(r,i,"oit hud composite"),this._rctx.bindFramebuffer(c.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):(m&&(this._framebuffer.color.acquireColor(u,0,"hud occlusion"),this._rctx.clearBuffer(u-de,E)),this._framebuffer.bind()),this._oitBlend.blend(this._rctx,_,p,h,l,m,e),c?.detachDepth(),s||(this._rctx.bindFramebuffer(p.fbo),this._framebuffer.bind(),m&&(this._bindParameters.hudOcclusion=this._framebuffer.color.obtainAttachment(u))),p.release(),_.release(),this._renderContext.output=o,c}_renderOpaque(){const e=this.plugins.produces(0,...le);if(e){this._plugins.render(0,1);const e=this._framebuffer;e.update(e=>this._renderNodes(A.CUTFILL_COLOR,e)),e.update(e=>this._renderNodes(A.OPAQUE_TERRAIN,e)),e.bind(),this._plugins.render(2,3)}const t=this._framebuffer;this._renderTerrainDepth(),t.update(t=>this._renderNodes(x.OPAQUE,t,e)),this.fboCache.debugCallback?.(x.OPAQUE,t.color.fbo),t.update(e=>this._renderNodes(A.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(A.OPAQUE_ENVIRONMENT,t.color.fbo),this._renderEdges(1)}_renderTransparent(e){const t=this._framebuffer;t.bind(),this._renderPlugins(22,ne.VOXEL),t.update(e=>this._renderNodes(A.GAUSSIAN_SPLAT,e)),this.fboCache.debugCallback?.(A.GAUSSIAN_SPLAT,t.color.fbo),this._renderHiddenTransparentEdges(),e&&(this.oitEnabled?this._renderOIT(0):this._renderTransparentGeometry()),t.update(t=>this._renderNodes(x.TRANSPARENT,t,e)),this.fboCache.debugCallback?.(x.TRANSPARENT,t.color.fbo),this._renderGeometryDepth(),this._renderHUDVisibility(),this._needsTerrainDepth||this._oitCallouts||this._plugins.render(17),this._renderEdges(0);const s=this._renderPhotoshopTerrain(),r=s?.getTexture();r&&(this._bindParameters.hudVisibility&&(this._needsTerrainDepth?this._renderLineCallouts(0):(this._rctx.bindFramebuffer(this._bindParameters.hudVisibility?.fbo),this._compositor.compositeHUD(this._bindParameters,r))),this._renderHUD(0,t.color)),this._bindParameters.cullAboveTerrain=!1,r&&(t.bind(),this._compositor.compositePreMultipliedAlpha(this._bindParameters,r),s?.release(),this._needsTerrainDepth&&(this._renderEdges(1),e&&(this.oitEnabled?this._renderOIT(0):this._renderTransparentGeometry(),this.performanceInfo.advance(ne.TRANSPARENT)),this._renderEdges(0))),this._bindParameters.ssao=a(this._bindParameters.ssao),this._needsTerrainDepth&&this._renderLineCallouts(1),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(ne.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(9),this.performanceInfo.advance(ne.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderPlugins(e,t){this._plugins.produces(this._renderContext.output,e)&&(this._plugins.render(e),this.performanceInfo.advance(t))}_renderNodes(e,t,s=!1){const r=t.name;if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return s&&this.performanceInfo.advance(e),t;this._fboCache.debugCallback?.(r,t.fbo);const i=this._nodes.render(t,this._pluginInput,this._releaseNodeInputs);return this.performanceInfo.advance(e),i}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=b:(f(Te,this._bindParameters.camera.viewMatrix),f(Ee,this._bindParameters.camera.projectionMatrix),g(xe,Te,Ee),g(xe,this._renderContext.lastFrameCamera.viewMatrix,xe),g(xe,this._renderContext.lastFrameCamera.projectionMatrix,xe),this._reprojectionMatrix=xe);const t=this.stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=t>0?Math.min(t,e-this._ssrEnableTime)/t:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=b,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,s,r){this._bindParameters.updateLighting(e,t,s,r),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0}}_renderToTargets(e,t,s,r,i=!1,n=!1){t.attachDepth(s),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(r,i,n),e(),t.detachDepth()}get test(){}};e([p({readOnly:!0})],_e.prototype,"highResolutionAtmosphere",null),e([p()],_e.prototype,"_edgeView",void 0),e([p()],_e.prototype,"updating",null),_e=e([m("esri.views.3d.webgl-engine.lib.Renderer")],_e);const le=[0,1,2,3],ue=[7,8,4,5],pe=[6,7,8],me=[0,1,2,4,...pe],ce=[3,5],fe=[2,4,9],ge=[18,14,16,15],be=[4,5,2,3,0,1,...pe],Pe=[4,9,5,12],Ce={0:[15],1:[14],2:[15,14],3:[15,14]},we=["normals","highlights"],Ee=P(),Te=P(),xe=P();function Ae(e){return t=>e.immediate.schedule(t)}export{_e as Renderer};
2
+ import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as s}from"../../../../core/asyncUtils.js";import"../../../../core/has.js";import{removeMaybe as r,abortMaybe as i,destroyMaybe as n,releaseMaybe as a}from"../../../../core/maybe.js";import{throwIfAborted as h}from"../../../../core/promiseUtils.js";import{watch as o,syncAndInitial as d,initial as _,sync as l}from"../../../../core/reactiveUtils.js";import{signal as u}from"../../../../core/signal.js";import{property as p,subclass as m}from"../../../../core/accessorSupport/decorators.js";import{equals as c,invert as f,multiply as g}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as b,create as P}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as C}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as w,ZEROS as E}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as T}from"../../../../geometry/support/Indices.js";import{RenderNodeOutput as x,InternalRenderCategory as A,AllRenderNodeOutputs as S,AllInternalRenderNodeOutputs as D}from"../../webgl.js";import{innerAtmosphereFadeStart as R}from"../../environment/atmosphereUtils.js";import{minNearDistanceInMeters as I}from"../../state/NearFarHeuristic.js";import{debugFlags as y}from"../../support/debugFlags.js";import{FBOCache as H}from"../core/FBOCache.js";import{RenderPassManager as O}from"../core/renderPasses/RenderPassManager.js";import{isColor as v}from"../core/shaderLibrary/ShaderOutput.js";import{distanceFadeEnd as F}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as M}from"../effects/RenderNodes.js";import{RenderPluginManager as N}from"../effects/RenderPluginManager.js";import{Blit as q}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as G,renderHighlightBuffer as L}from"../effects/highlight/Highlight.js";import{OITBlend as U}from"../effects/transparency/OITBlend.js";import{AnimationTimer as V}from"./AnimationTimer.js";import{AnimationTimeStep as B}from"./AnimationTimeStep.js";import{BoundingInfo as j}from"./BoundingInfo.js";import{Compositor as k}from"./Compositor.js";import{DepthRange as z}from"./DepthRange.js";import{depthRangeFromScene as W}from"./depthRangeUtils.js";import{MainFramebuffer as Q}from"./MainFramebuffer.js";import{RenderContext as Y,defaultRenderOccludedMask as J}from"./RenderContext.js";import{RendererBase as K}from"./RendererBase.js";import{setupFeatureDefaults as X}from"./RenderFeature.js";import{RenderPluginInput as Z}from"./RenderPluginInput.js";import{ShadowAccumulator as $}from"./ShadowAccumulator.js";import{ShadowMap as ee}from"./ShadowMap.js";import te from"./SliceHelper.js";import{MergedRenderer as se}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as re}from"../parts/renderUtils.js";import{RendererPerformanceInfo as ie,PerformanceCategory as ne}from"../statistics/RendererPerformanceInfo.js";import{PixelType as ae,ColorAttachment1 as he,ColorAttachment2 as oe,ColorAttachment0 as de}from"../../../webgl/enums.js";let _e=class extends K{constructor(e,t,s,r,i){super({stage:e}),this._techniques=s,this._rctx=r,this._requestRender=i,this._pluginsHas={occludedHudElements:!1,hudElements:!1,water:!1},this.renderPassManager=new O,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=w(0,0,0,1),this._sliceHelper=new te,this.sceneDepthRange=u(z.Infinite),this._state=u(2),this._hasAnimations=!1,this._animationTimestep=new B,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=u(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new Z,this._oitCallouts=!1,this._releaseNodeInputs=e=>{for(const t of we)e.some(({name:e})=>e===t)&&this._pluginInput.release(t)},this._debugNeedsDepth=!1,this._fboCache=new H(r),this._compositor=new k(r,s),this._renderStateFeatures=u(X(e.view.qualityProfile)),this._framebuffer=new Q(this.fboCache),this._performanceInfo=new ie(this._rctx),this._shadowMap=new ee(this.fboCache,e.viewingMode),this._blit=new q(s),this._shadowAccumulator=new $(this.fboCache,s,e,e=>{const t=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),this._shadowMap.enabled=t},(t,s,r)=>{const i=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,s,r,!0,i),this._renderShadowCascades(3,t.shadowMap),t.shadowMap.finish(),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)},i),this._renderContext=new Y(this._rctx,this._shadowMap,s),this._nodes=new M(this._renderContext),this._plugins=new N({renderContext:this._renderContext,techniques:s,materials:t,requestRender:i,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this._plugins.add(this.renderPassManager),this.addHandles([o(()=>e.view.state.camera,()=>i(),d),o(()=>y.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},i()},_),o(()=>e.view.environment.background?.color,e=>{const t=e?e.toUnitRGBA():E;C(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),i()},d),o(()=>e.view.state.camera.relativeElevation,e=>this._inGlobeView=(e??1/0)>=F,d),o(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},l),o(()=>this._bindParameters.clouds.data?.state,()=>i(),l),o(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,i()},_)])}destroy(){this._gpuTimerHandle=r(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.destroy(),this._shadowAccumulator=null,this._loadEdgeViewTask=i(this._loadEdgeViewTask),this._edgeView=n(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this._fboCache.destroy(),this._fboCache=null,this._plugins.destroy(),this._plugins=null,this._pluginInput=null,this._oitBlendOrNil=null,this._nodes=null,this._framebuffer=null,this._shadowMap=null,this._renderContext=null,this._performanceInfo=null,j.prune(),se.prune(),T()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _oitBlend(){return this._oitBlendOrNil??=new U(this._techniques),this._oitBlendOrNil}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e){this._renderStateFeatures.value=X(e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,s){this._renderStateFeatures.mutate(r=>r.set(t,e,s)),this._requestRender()}get _highQualityTransparency(){return this.isFeatureEnabled(1)}get hasReflections(){return this._pluginsHas.water&&this.isFeatureEnabled(6)}get _hasHighlights(){return this._plugins.produces(8,2,4,20,14,15,16)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(8,14,15,16)}get hasSSAO(){return this.isFeatureEnabled(5)&&!this._inGlobeView}get hasSMAA(){return this.isFeatureEnabled(0)}get _hasEmission(){return this._plugins.hasEmitters&&this._hasFloatBufferBlendSupport}get highResolutionAtmosphere(){return this.isFeatureEnabled(4)}get fboCache(){return this._fboCache}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=a(this._bindParameters.ssr.lastFrameColor),this._bindParameters.terrainDepth=a(this._bindParameters.terrainDepth),this._bindParameters.geometryDepth=a(this._bindParameters.geometryDepth),this._bindParameters.hudOcclusion=a(this._bindParameters.hudOcclusion)}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeBuffers(),this._bindParameters.depth=a(this._bindParameters.depth),this._bindParameters.hudVisibility=a(this._bindParameters.hudVisibility)}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._shadowAccumulator.readyToRun||this._plugins.updating||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=s(async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");h(e);const s=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:Ae(this.stage.view.resourceController)});return this.addHandles(o(()=>s.updating,()=>this._requestRender(),l)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(s)),this._edgeViewCallbacks.length=0,s})),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&c(this._bindParameters.ssr.reprojectionMatrix,b)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:t,_bindParameters:s}=this;if(void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&t.maxCascades!==e.shadowMapMaxCascades&&(t.maxCascades=e.shadowMapMaxCascades,this._requestRender()),e.environment){void 0!==e.environment.weather&&(this._bindParameters.weather=e.environment.weather);const t="virtual"!==e.environment.lighting.type;s.enableFillLights!==t&&(s.enableFillLights=t,this._requestRender())}void 0!==e.shadowCast&&this._shadowAccumulator.setOptions(e.shadowCast)}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}get _hasFloatBufferBlendSupport(){return this._rctx.driverTest.floatBufferBlend.result}get oitEnabled(){return this.isFeatureEnabled(2)&&this._hasFloatBufferBlendSupport}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}rendererAdded(e){this._plugins.add(e)}rendererRemoved(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this.occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(8&this.plugins.renderOccludedFlags)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,10)}updateHasFlags(){const has=this._pluginsHas;has.occludedHudElements=this._plugins.produces(0,15),has.hudElements=has.occludedHudElements||this._plugins.produces(0,...ge),has.water=this._plugins.produces(2,21),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new V(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const s=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==s&&(this._gpuTimerHandle=s?r(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,s,r=!1){try{return this._isRendering=!0,this._render(e,t,s,r)}catch(i){console.error(`Exception during rendering: ${i}`)}finally{this._isRendering=!1}return new re(this._pluginInput.get(x.FINAL),null)}_render(e,t,s,r){const i=0===s;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=i,this._disposeBindBuffers();const{camera:n,contentCamera:a,mode:h,alignPixelEnabled:o}=e;this._state.value=h,this._renderContext.time=t,this._renderContext.output=0,this._bindParameters.hasEmission=this._hasEmission,this._bindParameters.oitPass=0,this._bindParameters.alignPixelEnabled=o,this._bindParameters.decorations=!r,this._bindParameters.mainDepth=null;const d=!r||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=d?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(A.VIEWSHED),this._bindParameters.cutFillEnabled=this._nodes.produces(A.CUTFILL_DEPTH),this._renderOverlay(),n.setGLViewport(this._rctx);const _=this._framebuffer,l=_.initialize(n.fullWidth,n.fullHeight,this._backgroundColor,this._bindParameters.hasEmission);this.hasReflections?(l?.setName("last frame color"),this._bindParameters.ssr.lastFrameColor=l):l?.release(),this._ensureBindParametersCamera(n,a),this._plugins.sortTestsTransparentOrderedSlots(Pe),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&!r;const u=this._plugins.produces(0,...ue);this._precompilePrepasses(),this.performanceInfo.advance(ne.PREPARE);const p=this._computeShadowDepthRange(n);this._renderShadowMap(n,this._bindParameters.lighting.mainLight.direction,p),this._pluginInput.set("normals",this._renderNormals()),this._renderRemainingGeometryDepth(),this._renderShadowAccumulation(p,n,a,!i),this._oitCallouts=u&&this.oitEnabled,this._ensureBindParametersSSR(t),this._precompileShaders(u),this._renderContext.output=0,_.bind(),this._bindParameters.mainDepth=_.depth.attachment,this._renderOpaque(),this._renderTransparent(u),this._shadowMap.disposeMainBuffer(),this._pluginInput.set(A.FOCUSAREA,this._renderFocusAreaGeometry()),this._pluginInput.set(A.CUTFILL_DEPTH,this._renderCutFillDepth()),_.update(e=>this._renderNodes(A.TRANSPARENT_ENVIRONMENT,e)),_.update(e=>this._renderNodes(A.VIEWSHED,e)),_.update(e=>this._renderNodes(A.LASERLINES,e)),_.update(e=>this._renderNodes(A.FOCUSAREA_COLOR,e)),this._pluginInput.release(A.FOCUSAREA),this._pluginInput.release(A.CUTFILL_DEPTH),_.update(e=>this._renderNodes(A.OCCLUDED,e)),this._pluginInput.set("highlights",this._renderHighlightPrepass()),this._renderHighlightShadowMap(n,this._bindParameters.lighting.mainLight.direction,p);const m=2===s?this._renderObjectAndLayerIdColor():null;_.update(e=>this._renderNodes(x.COMPOSITE,e)),this._shadowMap.disposeBuffers(),_.update(e=>this._renderNodes(A.ANTIALIASING,e));const c=this._hasPhotoshopTerrain||!u?1:2;let f;return this._bindParameters.hasEmission=!1,this._hasHUDHighlights&&_.update(e=>this._renderHUD(c,e)),_.update(e=>this._renderNodes(A.HIGHLIGHT_COLOR,e)),this._hasHUDHighlights||_.update(e=>this._renderHUD(c,e)),this._bindParameters.hasEmission=this._hasEmission,_.update(e=>this._renderNodes(A.MAGNIFIER,e)),_.update(e=>this._renderNodes(x.FINAL,e)),i&&this._blit.toFramebuffer(this._rctx,_.color,this._bindParameters),this.onPostRender?.(),this._releaseFBOs(),_.releaseDepth(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),i||(f=_.color,f.retain(),this._releaseFBOs(),this._disposeOffscreenBuffers()),this.performanceInfo.finishFrame(),new re(f,m)}_precompileShaders(e){++this._plugins.context.techniques.precompiling,this._renderContext.output=0,this._precompileOpaqueGeometry(),this._nodes.precompile(A.OPAQUE_ENVIRONMENT),this._nodes.precompile(A.GAUSSIAN_SPLAT);const t=this._bindParameters;t.terrainDepthTest=t.cullAboveTerrain=this._needsTerrainDepth,this._renderContext.output=1,this._plugins.precompile(...pe),this._needsTerrainDepth&&(this._precompileOpaqueGeometry(),this._precompileTransparentGeometry()),this._renderContext.output=0,this._plugins.precompile(...pe);const s=this._pluginsHas.hudElements&&this.oitEnabled,r=this._pluginsHas.occludedHudElements,i=this._bindParameters.hasEmission;this._oitBlend.precompile(i,r,s),s&&this._oitBlend.precompile(!1,r,s),e&&(this._precompileTransparentGeometry(),this._hasPhotoshopTerrain&&(t.cullAboveTerrain=!1,this._precompileTransparentGeometry(),t.cullAboveTerrain=this._needsTerrainDepth)),this._nodes.precompile(A.FOCUSAREA);const n=this._hasPhotoshopTerrain&&!this._needsTerrainDepth;this._compositor.precompile(this._usesPremultipliedAlphaBlit,!!this._needsEdges,n,i),this._needsHUDVisibility&&this._plugins.precompile(13),this._oitCallouts||this._plugins.precompile(17),this._precompileHUD(0),t.terrainDepthTest=t.cullAboveTerrain=!1,this._nodes.precompile(A.TRANSPARENT_ENVIRONMENT,A.VIEWSHED,A.CUTFILL_DEPTH,A.CUTFILL_COLOR,A.LASERLINES,A.FOCUSAREA_COLOR,A.OCCLUDED,A.ANTIALIASING,A.HIGHLIGHT_COLOR),t.highlightMixTexture=t.highlights.length>1?this._rctx.emptyTexture:null,t.hasEmission=!1,this._precompileHUD(1),this.oitEnabled&&this._precompileHUD(0),t.hasEmission=this._hasEmission,this._hasHighlights&&(t.highlights.forEach((e,s)=>{t.highlightLevel=s,this._precompileAllGeometry(8),this._hasHUDHighlights&&this._plugins.precompile(15,14)}),t.highlightLevel=null,this._nodes.precompile(A.HIGHLIGHT_COLOR)),t.highlightMixTexture=null,this._nodes.precompile(x.COMPOSITE,A.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(9),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(A.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(ne.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces("olid"))return null;const e=this._renderContext.output;++this._techniques.precompiling;const{width:t,height:s}=this._framebuffer.size;let r=this.fboCache.acquire(t,s,"olid");return r.acquireDepth(13),r=this._nodes.render(r,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(ne.OBJECT_AND_LAYER_ID_COLOR),this._renderContext.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,s=0===e;if(s||t){const e=s?this.performanceInfo.elapsedTime:0;let r=0;t?r=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const i=Math.max(e,r);this._animationTimestep.frame(i,s)}}readMainDepth(e,t){const{mainDepth:s,camera:r}=this._bindParameters;if(!s)return;const i=this.fboCache.acquire(this._framebuffer.size.width,this._framebuffer.size.height,"linear depth");this._rctx.bindFramebuffer(i.fbo),r.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(E),this._compositor.blitDepthToLinearDepth(this._bindParameters,s),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),i.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,ae.UNSIGNED_BYTE,t),i.release()}readHUDVisibility(e,t,s,r,i){this._bindParameters.hudVisibility?.fbo?.readPixels(e,t,s,r,6408,ae.UNSIGNED_BYTE,i)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}get _needsEdges(){return this._edgeView?.shouldRender()?this._edgeView:null}_renderEdges(e){const t=this._needsEdges;if(!t)return;const{width:s,height:r}=this._framebuffer.size,i=this.fboCache.acquire(s,r,"edges"),n=this._bindParameters.geometryDepth,a=()=>t.render(this._bindParameters,e);this._renderToTargets(a,i,n??this._framebuffer.depth,E),this._framebuffer.bind(),this._compositor.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(1===e?ne.OPAQUE_EDGES:ne.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(this._renderContext.time),this._bindParameters.overlay&&this.performanceInfo.advance(ne.OVERLAY)}_renderShadowMap(e,t,s){if(!this.shadowsEnabled)return;const r=this._shadowMap;r.start(e,t,s,this.isFeatureEnabled(7),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(5,this._shadowMap),r.copySnapshot(1),this._renderShadowCascades(4,this._shadowMap)):this._renderShadowCascades(3),r.finish(),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this.performanceInfo.advance(ne.SHADOW_MAP)}_renderHighlightShadowMap(e,t,s){if(!this.shadowsEnabled||!this._needsShadowHighlight)return;const r=this._shadowMap;r.start(e,t,s,this.isFeatureEnabled(7),this.stage.view.qualitySettings.maximumPixelRatio),this._renderShadowCascades(4,this._shadowMap),r.moveSnapshot(0),r.finish(),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this.performanceInfo.advance(ne.SHADOW_MAP)}_renderCutFillDepth(){return this._nodes.produce(A.CUTFILL_DEPTH,this._pluginInput)}_precompileShadowCascades(e){0!==this._shadowMap.cascades.length&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._shadowMap){t.bindFbo();for(const s of t.cascades)s.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(s.camera,s.camera),this.renderAllGeometry(e)}get _needsDepth(){return this._plugins.consumes(1)||this._nodes.requireGeometryDepth()||this.hasReflections||this._needsShadowHighlight||this._shadowAccumulator.active||this._debugNeedsDepth}get _usesPremultipliedAlphaBlit(){return this._pluginsHas.hudElements&&this.oitEnabled||this._hasPhotoshopTerrain}_renderRemainingGeometryDepth(){const e=this._pluginInput.get("normals");e?(this._pluginInput.set(A.SSAO,this._renderSSAO()),this._needsDepth?(this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(1),this._bindParameters.depth?.release(),this._bindParameters.depth=e.obtainDepthTexture(),this.performanceInfo.advance(ne.DEPTH)):(e.detachDepth(),this._bindParameters.depth=a(this._bindParameters.depth)),this.hasSSAO&&this._pluginInput.release("normals")):this._renderAllGeometryDepth()}_renderAllGeometryDepth(){if(this._bindParameters.depth=a(this._bindParameters.depth),!this._needsDepth)return;const{width:e,height:t}=this._framebuffer.size,s=this.fboCache.acquire(e,t,"geometry depth",13);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(1280),this.renderAllGeometry(1),this._bindParameters.depth=s.obtainDepthTexture(),s.release(),this.performanceInfo.advance(ne.DEPTH)}_renderTerrainDepth(){if(this._bindParameters.terrainDepth=a(this._bindParameters.terrainDepth),this._bindParameters.terrainDepthTest=this._bindParameters.cullAboveTerrain=this._needsTerrainDepth,!this._needsTerrainDepth)return;const e=this._renderContext.output;this._renderContext.output=1;const{width:t,height:s}=this._framebuffer.size,r=this.fboCache.acquire(t,s,"terrain depth",13);this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(1280),this._renderTransparentGround(),this._bindParameters.terrainDepth=r.obtainDepthTexture(),r.release(),this._renderContext.output=e}_renderGeometryDepth(){if(this._bindParameters.geometryDepth=a(this._bindParameters.geometryDepth),!this._needsTerrainDepth)return;const e=this._renderContext.output,{width:t,height:s}=this._framebuffer.size,r=this.fboCache.acquire(t,s,"geometry depth",13);this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(1280),this._renderOpaqueAndTransparentGeometry(1),this._renderContext.output=e,this._bindParameters.geometryDepth=r.obtainDepthTexture(),r.release()}get _needsShadowDepthRange(){return this._shadowMap.enabled||this._shadowAccumulator.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return z.Zero;const t=W(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal)return void(this.sceneDepthRange.value=z.Infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<R)return void(this.sceneDepthRange.value=z.Infinite);const t=e.clone();t.near=I,t.far=1e10;const s=W(t,this._plugins.plugins,this.stage.layers,1);s.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(s)||(this.sceneDepthRange.value=s)}get _normalsRequired(){const e=this._nodes.require("normals",...S,A.VIEWSHED,A.LASERLINES);return(this.hasSSAO?1:0)+e}_precompilePrepasses(){this._normalsRequired&&this._precompileAllGeometry(2),this._needsDepth&&this._precompileAllGeometry(1),this.shadowsEnabled&&(this._needsShadowHighlight?(this._precompileShadowCascades(4),this._precompileShadowCascades(5)):this._precompileShadowCascades(3)),this._shadowAccumulator.active&&this._precompileAllGeometry(3),this.hasSSAO&&this._normalsRequired&&this._nodes.precompile(A.SSAO)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const{width:t,height:s}=this._framebuffer.size,r=this.fboCache.acquire(t,s,"normals",5);r.acquireDepth(13),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(E,!0,!0),this._renderContext.output=2,this._plugins.render(...me);const i=this._nodes.optional("normals",...S,A.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(ne.NORMALS),r}_renderSSAO(){const e=this._pluginInput.get("normals");if(this.hasSSAO&&e)return this._bindParameters.ssao=this._nodes.produce(A.SSAO,this._pluginInput),this._bindParameters.ssao&&this.performanceInfo.advance(ne.SSAO),this._bindParameters.ssao}_precompileAllGeometry(e){const t=this._renderContext.output;this._renderContext.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(...pe),this._renderContext.output=t}renderAllGeometry(e){this._renderContext.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentGround()}precompileSlots(e,...t){for(const s of t)this._bindParameters.slot=s,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const s of t)this._renderContext.renderOccludedMask=s,this.precompileSlots(e,...fe);this._renderContext.renderOccludedMask=J}renderSlots(e,...t){for(const s of t)this._bindParameters.slot=s,e.forAll(e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)})}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>1&&this._plugins.render(10),this.renderSlots(e,...fe),this._renderContext.renderOccludedMask=J}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Ce[e])}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(18),this.renderHUD(e),this._bindParameters.hudRenderStyle=e,this._plugins.render(16)}precompileViewshedShadowMap(){this._precompileAllGeometry(6)}precompileCutFill(){const e=7,t=this._renderContext.output;this._renderContext.output=e,this._plugins.precompile(0,1,...pe),this._renderContext.output=t}renderViewshedShadowMap(e){const{camera:t,contentCamera:s}=this._bindParameters,r=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(6),this._ensureBindParametersCamera(t,s),this._bindParameters.camera.setGLViewport(this._rctx),this._renderContext.output=r}renderCutFillReferenceDepth(e){const{camera:t,contentCamera:s}=this._bindParameters,r=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._renderContext.output=7,this._plugins.render(0,1,...pe),this._ensureBindParametersCamera(t,s),t.setGLViewport(this._rctx),this._renderContext.output=r}_renderOpaqueAndTransparentGeometry(e){this._renderContext.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithoutNormals(e){this._renderContext.output=e,this._plugins.render(...ce)}_precompileOpaqueGeometry(){this._plugins.precompile(...le),this._nodes.precompile("opaque-color")}_renderOpaqueGeometry(){this._plugins.render(...le)}_renderTransparentGeometry(){this._plugins.render(...ue),this._oitCallouts&&this._plugins.render(17)}get _hasPhotoshopTerrain(){return this._plugins.produces(0,6)}get _needsTerrainDepth(){return this._highQualityTransparency&&this._hasPhotoshopTerrain}_renderPhotoshopTerrain(){if(!this._hasPhotoshopTerrain)return null;const{width:e,height:t}=this._framebuffer.size,s=this.fboCache.acquire(e,t,"transparent terrain"),r=()=>this._plugins.render(6);return this._renderToTargets(r,s,this._framebuffer.depth,E),this.performanceInfo.advance(ne.TRANSPARENT_TERRAIN),s}_renderTransparentGround(){this._plugins.render(...pe)}get _needsHUDVisibility(){return this._plugins.produces(this._renderContext.output,13)}_renderHUDVisibility(){if(!this._needsHUDVisibility)return void(this._bindParameters.hudVisibility=a(this._bindParameters.hudVisibility));const{width:e,height:t}=this._framebuffer.size;let s=this._bindParameters.hudVisibility;s?.fbo?.width===e&&s?.fbo?.height===t||(s?.release(),s=this.fboCache.acquire(e,t,"hud visibility",4),this._bindParameters.hudVisibility=s);const r=this._bindParameters.geometryDepth;s.attachDepth(r||this._framebuffer.depth),this._rctx.bindFramebuffer(s.fbo),this._rctx.clearFramebuffer([0,1,0,1]),this._plugins.render(13),s.detachDepth(),this._framebuffer.bind(),this.performanceInfo.advance(ne.HUD_VISIBILITY)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,0===e){const e=()=>this._plugins.render(17),{width:t,height:s}=this._framebuffer.size,r=this.fboCache.acquireDepth(12,t,s,"line callouts");this._renderToTargets(e,this._framebuffer.color,r,void 0,!0,!0),r.release()}else this._plugins.render(17)}_precompileHUD(e){if(this._pluginsHas.hudElements&&(this._precompileHUDOutput(e),this._hasHighlights)){const t=this._renderContext.output;this._renderContext.output=8,this._precompileHUDOutput(e),this._renderContext.output=t}}_precompileHUDOutput(e){const t=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this.oitEnabled&&v(this._renderContext.output)?(this._bindParameters.oitPass=1,this._plugins.precompile(...ge),this._bindParameters.oitPass=2,this._plugins.precompile(...ge),this._bindParameters.oitPass=0):this._plugins.precompile(...ge),this._bindParameters.hudRenderStyle=t}_renderHUD(e,t){if(!this._pluginsHas.hudElements)return t;if(this.oitEnabled){const s=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo),this._compositor.compositePreMultipliedAlpha(this._bindParameters,s.getTexture(),!1),s.release()}else if(this._renderContext.output=0,0===e){const t=()=>this._renderHUDElements(e),{width:s,height:r}=this._framebuffer.size,i=this.fboCache.acquireDepth(12,s,r,"hud");this._renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(12),this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(256),this._renderHUDElements(e),t.detachDepth();return this.performanceInfo.advance(0===e?ne.HUD_OCCLUDED:ne.HUD),t}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(4,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:s}=this,{width:r,height:i}=this._framebuffer.size,{highlights:n}=s,a=n.length>G?3:1,h=e.acquire(r,i,"highlights",a);h.acquireDepth(13);const o=this._plugins.produces(8,0);return o&&this._framebuffer.color.fbo&&h.fbo&&t.blitFramebuffer(this._framebuffer.color.fbo,h.fbo,1024),t.bindFramebuffer(h.fbo),t.gl.clearBufferuiv(6144,0,[0,0,0,0]),o||t.clear(1024),this._renderContext.output=8,t.bindFramebuffer(h.fbo),L(t,e,r,i,s,()=>this._renderHighlightGeometries()),h.detachDepth(),this.performanceInfo.advance(ne.HIGHLIGHTS),h.retain(this._nodes.require("highlights",...D)+this._nodes.optional("highlights",...D)-1),h}_renderHighlightGeometries(){this._plugins.render(...be),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e,t,s,r){this._shadowAccumulator.updateDepthRange(e),this._shadowAccumulator.accumulating&&this._bindParameters.depth&&this._shadowAccumulator.renderAccumulation(this._bindParameters.depth,t,s,r)&&this.performanceInfo.advance(ne.ACCUMULATED_SHADOWS)}_precompileTransparentGeometry(){this.oitEnabled&&v(this._renderContext.output)?(this._bindParameters.oitPass=1,this._plugins.precompile(...ue),this._oitCallouts&&this._plugins.precompile(17),this._bindParameters.oitPass=2,this._plugins.precompile(...ue),this._oitCallouts&&this._plugins.precompile(17),this._bindParameters.oitPass=0):this._plugins.precompile(...ue)}_renderOIT(e,t=2){const s=1===e,{width:r,height:i}=this._framebuffer.size,n=s?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=this._renderContext.output;this._renderContext.output=0,h.oitPass=1;const d=s?"oit hud":"oit",_=this.fboCache.acquire(r,i,d,8),l=this._bindParameters.hasEmission&&(0===e||1!==t);l&&_.acquireColor(he,8,"oit emissive");const u=l?oe:he;_.acquireColor(u,7,"oit alpha"),s||_.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(_.fbo),this._rctx.clearFramebuffer([0,0,0,1]),l&&this._rctx.clearBuffer(1,E),n(),_.detachDepth(),h.oitPass=2;const p=this.fboCache.acquire(r,i,s?"oit hud front":"oit front");l&&p.acquireColor(he,8,"oit emissive front"),s?p.acquireDepth(12):p.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(p.fbo),this._rctx.clearFramebuffer(E,s),n(),p.detachDepth();const m=this._pluginsHas.occludedHudElements&&!s;let c;return this._bindParameters.hudOcclusion=a(this._bindParameters.hudOcclusion),h.oitPass=0,s?(c=this.fboCache.acquire(r,i,"oit hud composite"),this._rctx.bindFramebuffer(c.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):(m&&(this._framebuffer.color.acquireColor(u,0,"hud occlusion"),this._rctx.clearBuffer(u-de,E)),this._framebuffer.bind()),this._oitBlend.blend(this._rctx,_,p,h,l,m,e),c?.detachDepth(),s||(this._rctx.bindFramebuffer(p.fbo),this._framebuffer.bind(),m&&(this._bindParameters.hudOcclusion=this._framebuffer.color.obtainAttachment(u))),p.release(),_.release(),this._renderContext.output=o,c}_renderOpaque(){const e=this.plugins.produces(0,...le);if(e){this._plugins.render(0,1);const e=this._framebuffer;e.update(e=>this._renderNodes(A.CUTFILL_COLOR,e)),e.update(e=>this._renderNodes(A.OPAQUE_TERRAIN,e)),e.bind(),this._plugins.render(2,3)}const t=this._framebuffer;this._renderTerrainDepth(),t.update(t=>this._renderNodes(x.OPAQUE,t,e)),this.fboCache.debugCallback?.(x.OPAQUE,t.color.fbo),t.update(e=>this._renderNodes(A.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(A.OPAQUE_ENVIRONMENT,t.color.fbo),this._renderEdges(1)}_renderTransparent(e){const t=this._framebuffer;t.bind(),this._renderPlugins(22,ne.VOXEL),t.update(e=>this._renderNodes(A.GAUSSIAN_SPLAT,e)),this.fboCache.debugCallback?.(A.GAUSSIAN_SPLAT,t.color.fbo),this._renderHiddenTransparentEdges(),e&&(this.oitEnabled?this._renderOIT(0):this._renderTransparentGeometry()),t.update(t=>this._renderNodes(x.TRANSPARENT,t,e)),this.fboCache.debugCallback?.(x.TRANSPARENT,t.color.fbo),this._renderGeometryDepth(),this._renderHUDVisibility(),this._needsTerrainDepth||this._oitCallouts||this._plugins.render(17),this._renderEdges(0);const s=this._renderPhotoshopTerrain(),r=s?.getTexture();r&&(this._bindParameters.hudVisibility&&(this._needsTerrainDepth?this._renderLineCallouts(0):(this._rctx.bindFramebuffer(this._bindParameters.hudVisibility?.fbo),this._compositor.compositeHUD(this._bindParameters,r))),this._renderHUD(0,t.color)),this._bindParameters.cullAboveTerrain=!1,r&&(t.bind(),this._compositor.compositePreMultipliedAlpha(this._bindParameters,r),s?.release(),this._needsTerrainDepth&&(this._renderEdges(1),e&&(this.oitEnabled?this._renderOIT(0):this._renderTransparentGeometry(),this.performanceInfo.advance(ne.TRANSPARENT)),this._renderEdges(0))),this._bindParameters.ssao=a(this._bindParameters.ssao),this._needsTerrainDepth&&this._renderLineCallouts(1),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(ne.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(9),this.performanceInfo.advance(ne.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderPlugins(e,t){this._plugins.produces(this._renderContext.output,e)&&(this._plugins.render(e),this.performanceInfo.advance(t))}_renderNodes(e,t,s=!1){const r=t.name;if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return s&&this.performanceInfo.advance(e),t;this._fboCache.debugCallback?.(r,t.fbo);const i=this._nodes.render(t,this._pluginInput,this._releaseNodeInputs);return this.performanceInfo.advance(e),i}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=b:(f(Te,this._bindParameters.camera.viewMatrix),f(Ee,this._bindParameters.camera.projectionMatrix),g(xe,Te,Ee),g(xe,this._renderContext.lastFrameCamera.viewMatrix,xe),g(xe,this._renderContext.lastFrameCamera.projectionMatrix,xe),this._reprojectionMatrix=xe);const t=this.stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=t>0?Math.min(t,e-this._ssrEnableTime)/t:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=b,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,s,r){this._bindParameters.updateLighting(e,t,s,r),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0}}_renderToTargets(e,t,s,r,i=!1,n=!1){t.attachDepth(s),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(r,i,n),e(),t.detachDepth()}get test(){}};e([p({readOnly:!0})],_e.prototype,"highResolutionAtmosphere",null),e([p()],_e.prototype,"_edgeView",void 0),e([p()],_e.prototype,"updating",null),_e=e([m("esri.views.3d.webgl-engine.lib.Renderer")],_e);const le=[0,1,2,3],ue=[7,8,4,5],pe=[6,7,8],me=[0,1,2,4,...pe],ce=[3,5],fe=[2,4,9],ge=[18,14,16,15],be=[4,5,2,3,0,1,...pe],Pe=[4,9,5,12],Ce={0:[15],1:[14],2:[15,14],3:[15,14]},we=["normals","highlights"],Ee=P(),Te=P(),xe=P();function Ae(e){return t=>e.immediate.schedule(t)}export{_e as Renderer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import has from"../../../../core/has.js";import{ScreenSpaceGeometry as e}from"../effects/ScreenSpaceGeometry.js";import{createEmptyTexture as s}from"./glUtil3D.js";import{TextureBufferCache as r}from"../materials/renderers/TextureBufferCache.js";import{VaoCache as t}from"../materials/renderers/VaoCache.js";import{VboCache as i}from"../materials/renderers/VboCache.js";import{AppleAmdDriverHelper as a}from"../../../webgl/AppleAmdDriverHelper.js";import{RenderingContext as h}from"../../../webgl/RenderingContext.js";class o extends h{constructor(r,t){super(r,t),this.emptyTexture=s(this),this._vaoCaches=new Map,this._vboCaches=new Map,this._textureBufferCaches=new Map,this.debugBoundTechnique="",this._appleAmdDriverHelper=null,this._refCount=1,this._newCache=t.newCache,this._screen=new e(this)}configure(e){super.configure(e),this._newCache=e.newCache}destroy(){this._vaoCaches.forEach(e=>e.dispose()),this._vaoCaches.clear(),this._vboCaches.forEach(e=>e.dispose()),this._vboCaches.clear(),this._textureBufferCaches.forEach(e=>e.dispose()),this._textureBufferCaches.clear(),--this._refCount>0||this.dispose()}ref(){++this._refCount}get refCount(){return this._refCount}dispose(){this.emptyTexture.dispose(),this._screen.destroy(),this._screen=null,super.dispose(),this._appleAmdDriverHelper?.dispose(),this._vaoCaches.forEach(e=>e.dispose()),this._vaoCaches.clear(),this._vboCaches.forEach(e=>e.dispose()),this._vboCaches.clear(),this._textureBufferCaches.forEach(e=>e.dispose()),this._textureBufferCaches.clear()}get newCache(){return this._newCache}get screen(){return this._screen}getVaoCache(e){const s=JSON.stringify(e),r=this._vaoCaches.get(s);if(r)return r;const i=new t(this,e);return this._vaoCaches.set(s,i),i}getVboCache(e){const s=JSON.stringify(e),r=this._vboCaches.get(s);if(r)return r;const t=new i(this,e);return this._vboCaches.set(s,t),t}getTextureBufferCache(e){const s=JSON.stringify(e),t=this._textureBufferCaches.get(s);if(t)return t;const i=new r(this,e);return this._textureBufferCaches.set(s,i),i}bindTechnique(e,s,r,t){return this.debugBoundTechnique=e.declaredClass,this.useProgram(e.program),this.setPipelineState(e.getPipeline(s)),e.program.bind(s),r&&(e.program.bindPass(r,s),t&&e.program.bindDraw(s,r,t)),e.program}runAppleAmdDriverHelper(){this.driverTest.drawArraysRequiresIndicesTypeReset.result&&(this._appleAmdDriverHelper??=new a(this),this._appleAmdDriverHelper.run())}get isAssumedMetalDriver(){if(null==this._isAssumedMetalDriver&&(this._isAssumedMetalDriver=!!has("ios")||!!has("safari"),!this._isAssumedMetalDriver&&has("mac")&&has("chrome"))){const e=this.capabilities.rendererInfo?.getUnmaskedRenderer().toLowerCase(),s=e?.includes("apple")&&e?.includes("angle")&&e?.includes("metal");this._isAssumedMetalDriver=s??!0}return this._isAssumedMetalDriver}get test(){}}export{o as RenderingContext};
2
+ import has from"../../../../core/has.js";import{disposeMaybe as e}from"../../../../core/maybe.js";import{ScreenSpaceGeometry as s}from"../effects/ScreenSpaceGeometry.js";import{createEmptyTexture as r}from"./glUtil3D.js";import{IndexBufferCache as t}from"../materials/renderers/IndexBufferCache.js";import{TextureBufferCache as i}from"../materials/renderers/TextureBufferCache.js";import{VaoCache as h}from"../materials/renderers/VaoCache.js";import{VboCache as a}from"../materials/renderers/VboCache.js";import{AppleAmdDriverHelper as n}from"../../../webgl/AppleAmdDriverHelper.js";import{RenderingContext as o}from"../../../webgl/RenderingContext.js";class c extends o{constructor(e,t){super(e,t),this.emptyTexture=r(this),this._vaoCaches=new Map,this._vboCaches=new Map,this._indexBufferCache=null,this._textureBufferCaches=new Map,this.debugBoundTechnique="",this._appleAmdDriverHelper=null,this._refCount=1,this._newCache=t.newCache,this._screen=new s(this)}configure(e){super.configure(e),this._newCache=e.newCache}destroy(){this._vaoCaches.forEach(e=>e.dispose()),this._vaoCaches.clear(),this._vboCaches.forEach(e=>e.dispose()),this._vboCaches.clear(),this._indexBufferCache=e(this._indexBufferCache),this._textureBufferCaches.forEach(e=>e.dispose()),this._textureBufferCaches.clear(),--this._refCount>0||this.dispose()}ref(){++this._refCount}get refCount(){return this._refCount}dispose(){this.emptyTexture.dispose(),this._screen.destroy(),this._screen=null,super.dispose(),this._appleAmdDriverHelper?.dispose(),this._vaoCaches.forEach(e=>e.dispose()),this._vaoCaches.clear(),this._vboCaches.forEach(e=>e.dispose()),this._vboCaches.clear(),this._indexBufferCache?.dispose(),this._indexBufferCache=null,this._textureBufferCaches.forEach(e=>e.dispose()),this._textureBufferCaches.clear()}get newCache(){return this._newCache}get screen(){return this._screen}getVaoCache(e){const s=JSON.stringify(e),r=this._vaoCaches.get(s);if(r)return r;const t=new h(this,e);return this._vaoCaches.set(s,t),t}getVboCache(e){const s=JSON.stringify(e),r=this._vboCaches.get(s);if(r)return r;const t=new a(this,e);return this._vboCaches.set(s,t),t}get indexBufferCache(){return this._indexBufferCache??=new t(this),this._indexBufferCache}getTextureBufferCache(e){const s=JSON.stringify(e),r=this._textureBufferCaches.get(s);if(r)return r;const t=new i(this,e);return this._textureBufferCaches.set(s,t),t}bindTechnique(e,s,r,t){return this.debugBoundTechnique=e.declaredClass,this.useProgram(e.program),this.setPipelineState(e.getPipeline(s)),e.program.bind(s),r&&(e.program.bindPass(r,s),t&&e.program.bindDraw(s,r,t)),e.program}runAppleAmdDriverHelper(){this.driverTest.drawArraysRequiresIndicesTypeReset.result&&(this._appleAmdDriverHelper??=new n(this),this._appleAmdDriverHelper.run())}get isAssumedMetalDriver(){if(null==this._isAssumedMetalDriver&&(this._isAssumedMetalDriver=!!has("ios")||!!has("safari"),!this._isAssumedMetalDriver&&has("mac")&&has("chrome"))){const e=this.capabilities.rendererInfo?.getUnmaskedRenderer().toLowerCase(),s=e?.includes("apple")&&e?.includes("angle")&&e?.includes("metal");this._isAssumedMetalDriver=s??!0}return this._isAssumedMetalDriver}get test(){}}export{c as RenderingContext};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import has from"../../../../core/has.js";import{clamp as t,lerp as s,acosClamped as e}from"../../../../core/mathUtils.js";import{releaseMaybe as i}from"../../../../core/maybe.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{translate as r,multiply as h,invert as o,lookAt as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as c,create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as d,add as m,scale as u,lerp as _,squaredDistance as f,subtract as g,dot as p,negate as x,normalize as b,copy as w}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as M}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{exactEquals as C,copy as j,negate as y,transformMat4 as v,set as S}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as H}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as D,transformMat4 as F}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{create as O}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{CascadeCamera as T}from"./CascadeCamera.js";import{applyTextureResizeModulo as Q}from"./textureUtils.js";import{assert as B,logWithBase as L,verify as V,rayRay2D as N}from"./Util.js";import{DepthStencilAttachment as R}from"../../../webgl/enums.js";class W{constructor(){this.camera=new T,this.lightMat=l()}}class q{constructor(){this.maxNumCascadesHighQuality=4,this.maxNumCascadesLowQuality=4,this.textureSizeModHighQuality=1.3,this.textureSizeModLowQuality=.9,this.splitSchemeLambda=0}}class z{constructor(t,s){this._fbos=t,this._viewingMode=s,this._snapshots=new Array,this._textureHeight=0,this._numCascades=1,this.settings=new q,this._projectionView=l(),this._projectionViewInverse=l(),this._modelViewLight=l(),this._cascadeDistances=[0,0,0,0,0],this._usedCascadeDistances=O(),this._cascades=[new W,new W,new W,new W],this._lastOrigin=null,this._enabled=!1,this._maxTextureWidth=Math.min(has("esri-mobile")?4096:16384,t.rctx.parameters.maxTextureSize)}dispose(){this.enabled=!1,this.disposeBuffers()}get depthTexture(){return this._handle?.getTexture(R)}get _textureWidth(){return this._textureHeight*this._numCascades}get numCascades(){return this._numCascades}get cascadeDistances(){return D(this._usedCascadeDistances,this._cascadeDistances[0],this._numCascades>1?this._cascadeDistances[1]:1/0,this._numCascades>2?this._cascadeDistances[2]:1/0,this._numCascades>3?this._cascadeDistances[3]:1/0)}disposeMainBuffer(){this._handle=i(this._handle)}disposeBuffers(){this.disposeMainBuffer(),this._discardSnapshots()}set maxCascades(s){this.settings.maxNumCascadesHighQuality=t(Math.floor(s),1,4)}get maxCascades(){return this.settings.maxNumCascadesHighQuality}set enabled(t){this._enabled=t,t||this.disposeBuffers()}get enabled(){return this._enabled}get ready(){return this._enabled&&null!=this.depthTexture}get cascades(){for(let t=0;t<this._numCascades;++t)X[t]=this._cascades[t];return X.length=this._numCascades,X}start(t,s,e,i,a){B(this.enabled);const{near:r,far:h}=xt(e);this._computeCascadeDistances(r,h,i),this._textureHeight=this._computeTextureHeight(t,a,i),this._setupMatrices(t,s);const{viewMatrix:o,projectionMatrix:n}=t;for(let c=0;c<this._numCascades;++c)this._constructCascade(c,n,o,s);this._lastOrigin=null,this.clear()}finish(){B(this.enabled)}getShadowMapMatrices(t){if(!this._lastOrigin||!C(t,this._lastOrigin)){this._lastOrigin=this._lastOrigin||H(),j(this._lastOrigin,t);for(let s=0;s<this._numCascades;++s){r(Z,this._cascades[s].lightMat,t);for(let t=0;t<16;++t)$[16*s+t]=Z[t]}}return $}moveSnapshot(t){B(this.enabled),this._snapshots[t]?.release(),this._snapshots[t]=this._handle,this._handle?.setName(0===t?"shadow map highlight":"shadow map excluding highlight"),this._handle=null}copySnapshot(t){if(!this.enabled)return;const s=this._handle?.getTexture(R)?.descriptor;if(!s)return;this._snapshots[t]?.release();const e=0===t?"shadow map highlight":"shadow map excluding highlight",i=this._acquireFBO(e);this._snapshots[t]=i;const a=this._handle?.fbo;if(!a||!i?.fbo)return void console.error("No FBO");const{rctx:r}=this._fbos;r.blitFramebuffer(a,i.fbo,256)}getSnapshot(t){return this.enabled?this._snapshots[t]?.getTexture(R):null}clear(){this._ensureFbo(),this.bindFbo(),this._fbos.rctx.clear(256)}_computeTextureHeight({pixelRatio:t,fullWidth:s,fullHeight:e},i,a){const r=Math.min(window.devicePixelRatio,i)/t,h=a?this.settings.textureSizeModHighQuality:this.settings.textureSizeModLowQuality;return Q(Math.max(s,e)*r*h,this._maxTextureWidth/this._numCascades)}_ensureFbo(){this._handle?.fbo?.width===this._textureWidth&&this._handle?.fbo.height===this._textureHeight||(this._handle?.release(),this._handle=this._acquireFBO("shadow map"))}_acquireFBO(t){const s=this._fbos.acquire(this._textureWidth,this._textureHeight,t,13);return s.getTexture(R)?.setShadowFiltering(!0),s}_discardSnapshot(t){this._snapshots[t]=i(this._snapshots[t])}_discardSnapshots(){for(let t=0;t<this._snapshots.length;++t)this._discardSnapshot(t);this._snapshots.length=0}bindFbo(){this._fbos.rctx.bindFramebuffer(this._handle?.fbo)}_constructCascade(t,s,e,i){const a=this._cascades[t],o=-this._cascadeDistances[t],n=-this._cascadeDistances[t+1],c=(s[10]*o+s[14])/Math.abs(s[11]*o+s[15]),l=(s[10]*n+s[14])/Math.abs(s[11]*n+s[15]);B(c<l);for(let r=0;r<8;++r){D(I,r%4==0||r%4==3?-1:1,r%4==0||r%4==1?-1:1,r<4?c:l,1);const t=U[r];F(t,I,this._projectionViewInverse),t[0]/=t[3],t[1]/=t[3],t[2]/=t[3]}y(K,U[0]),a.camera.viewMatrix=r(A,this._modelViewLight,K);for(let r=0;r<8;++r)v(U[r],U[r],a.camera.viewMatrix);let d=U[0][2],m=U[0][2];for(let r=1;r<8;++r)d=Math.min(d,U[r][2]),m=Math.max(m,U[r][2]);d-=200,m+=200,a.camera.near=-m,a.camera.far=-d,pt(e,i,d,m,a.camera),h(a.lightMat,a.camera.projectionMatrix,a.camera.viewMatrix);const u=this._textureHeight;a.camera.viewport=[t*u,0,u,u]}_setupMatrices(t,s){h(this._projectionView,t.projectionMatrix,t.viewMatrix),o(this._projectionViewInverse,this._projectionView);const e=1===this._viewingMode?t.eye:S(K,0,0,1);n(this._modelViewLight,[0,0,0],[-s[0],-s[1],-s[2]],e)}_computeCascadeDistances(t,e,i){const a=i?this.settings.maxNumCascadesHighQuality:this.settings.maxNumCascadesLowQuality;this._numCascades=Math.min(1+Math.floor(L(e/t,4)),a);const r=(e-t)/this._numCascades,h=(e/t)**(1/this._numCascades);let o=t,n=t;for(let c=0;c<this._numCascades+1;++c)this._cascadeDistances[c]=s(o,n,this.settings.splitSchemeLambda),o*=h,n+=r}get test(){}}const A=l(),I=O(),U=[];for(let bt=0;bt<8;++bt)U.push(O());const P=M(),k=M(),E=M(),G=M(),J=M(),K=H(),X=[];function Y(){X.length=0}const Z=l(),$=c.concat(c,c,c),tt=M(),st=M(),et=[M(),M(),M(),M()],it=M(),at=M(),rt=M(),ht=M(),ot=M(),nt=M(),ct=M();function lt(t,s,e,i,a,r,h,o){d(tt,0,0);for(let d=0;d<4;++d)m(tt,tt,t[d]);u(tt,tt,.25),d(st,0,0);for(let d=4;d<8;++d)m(st,st,t[d]);u(st,st,.25),_(et[0],t[4],t[5],.5),_(et[1],t[5],t[6],.5),_(et[2],t[6],t[7],.5),_(et[3],t[7],t[4],.5);let n=0,c=f(et[0],tt);for(let d=1;d<4;++d){const t=f(et[d],tt);t<c&&(c=t,n=d)}g(it,et[n],t[n+4]);const l=it[0];let M,C;it[0]=-it[1],it[1]=l,g(at,st,tt),p(at,it)<0&&x(it,it),_(it,it,at,e),b(it,it),M=C=p(g(rt,t[0],tt),it);for(let d=1;d<8;++d){const s=p(g(rt,t[d],tt),it);s<M?M=s:s>C&&(C=s)}w(i,tt),u(rt,it,M-s),m(i,i,rt);let j=-1,y=1,v=0,S=0;for(let d=0;d<8;++d){g(ht,t[d],i),b(ht,ht);const s=it[0]*ht[1]-it[1]*ht[0];s>0?s>j&&(j=s,v=d):s<y&&(y=s,S=d)}V(j>0,"leftArea"),V(y<0,"rightArea"),u(ot,it,M),m(ot,ot,tt),u(nt,it,C),m(nt,nt,tt),ct[0]=-it[1],ct[1]=it[0];const H=N(i,t[S],nt,m(rt,nt,ct),1,a),D=N(i,t[v],nt,rt,1,r),F=N(i,t[v],ot,m(rt,ot,ct),1,h),O=N(i,t[S],ot,rt,1,o);V(H,"rayRay"),V(D,"rayRay"),V(F,"rayRay"),V(O,"rayRay")}function dt(t,s){return 3*s+t}const mt=M();function ut(t,s){return d(mt,t[s],t[s+3]),mt}const _t=M(),ft=a();function gt(t,s,e,i,a){g(_t,e,i),u(_t,_t,.5),ft[0]=_t[0],ft[1]=_t[1],ft[2]=0,ft[3]=_t[1],ft[4]=-_t[0],ft[5]=0,ft[6]=_t[0]*_t[0]+_t[1]*_t[1],ft[7]=_t[0]*_t[1]-_t[1]*_t[0],ft[8]=1,ft[dt(0,2)]=-p(ut(ft,0),t),ft[dt(1,2)]=-p(ut(ft,1),t);let r=p(ut(ft,0),e)+ft[dt(0,2)],h=p(ut(ft,1),e)+ft[dt(1,2)],o=p(ut(ft,0),i)+ft[dt(0,2)],n=p(ut(ft,1),i)+ft[dt(1,2)];r=-(r+o)/(h+n),ft[dt(0,0)]+=ft[dt(1,0)]*r,ft[dt(0,1)]+=ft[dt(1,1)]*r,ft[dt(0,2)]+=ft[dt(1,2)]*r,r=1/(p(ut(ft,0),e)+ft[dt(0,2)]),h=1/(p(ut(ft,1),e)+ft[dt(1,2)]),ft[dt(0,0)]*=r,ft[dt(0,1)]*=r,ft[dt(0,2)]*=r,ft[dt(1,0)]*=h,ft[dt(1,1)]*=h,ft[dt(1,2)]*=h,ft[dt(2,0)]=ft[dt(1,0)],ft[dt(2,1)]=ft[dt(1,1)],ft[dt(2,2)]=ft[dt(1,2)],ft[dt(1,2)]+=1,r=p(ut(ft,1),s)+ft[dt(1,2)],h=p(ut(ft,2),s)+ft[dt(2,2)],o=p(ut(ft,1),e)+ft[dt(1,2)],n=p(ut(ft,2),e)+ft[dt(2,2)],r=-.5*(r/h+o/n),ft[dt(1,0)]+=ft[dt(2,0)]*r,ft[dt(1,1)]+=ft[dt(2,1)]*r,ft[dt(1,2)]+=ft[dt(2,2)]*r,r=p(ut(ft,1),s)+ft[dt(1,2)],h=p(ut(ft,2),s)+ft[dt(2,2)],o=-h/r,ft[dt(1,0)]*=o,ft[dt(1,1)]*=o,ft[dt(1,2)]*=o,a[0]=ft[0],a[1]=ft[1],a[2]=0,a[3]=ft[2],a[4]=ft[3],a[5]=ft[4],a[6]=0,a[7]=ft[5],a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=ft[6],a[13]=ft[7],a[14]=0,a[15]=ft[8]}function pt(t,s,i,a,r){const h=1/U[0][3],o=1/U[4][3];B(h<o);let n=h+Math.sqrt(h*o);const c=Math.sin(e(t[2]*s[0]+t[6]*s[1]+t[10]*s[2]));n/=c,lt(U,n,c,P,k,E,G,J),gt(P,k,G,J,r.projectionMatrix),r.projectionMatrix[10]=2/(i-a),r.projectionMatrix[14]=-(i+a)/(i-a)}function xt(t){let{near:s,far:e}=t;return s<2&&(s=2),e<2&&(e=2),s>=e&&(s=2,e=4),{near:s,far:e}}export{z as ShadowMap,Y as cleanupShadowmap};
2
+ import has from"../../../../core/has.js";import{clamp as t,lerp as s,acosClamped as e}from"../../../../core/mathUtils.js";import{releaseMaybe as i}from"../../../../core/maybe.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{translate as r,multiply as h,invert as o,lookAt as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as c,create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as d,add as m,scale as u,lerp as _,squaredDistance as f,subtract as g,dot as p,negate as x,normalize as b,copy as w}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as M}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{exactEquals as C,copy as j,negate as y,transformMat4 as v,set as S}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as H}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as D,transformMat4 as F}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{create as O}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{CascadeCamera as T}from"./CascadeCamera.js";import{applyTextureResizeModulo as Q}from"./textureUtils.js";import{assert as B,logWithBase as L,verify as V,rayRay2D as N}from"./Util.js";import{DepthStencilAttachment as R}from"../../../webgl/enums.js";class W{constructor(){this.camera=new T,this.lightMat=l()}}class q{constructor(){this.maxNumCascadesHighQuality=4,this.maxNumCascadesLowQuality=4,this.textureSizeModHighQuality=1.3,this.textureSizeModLowQuality=.9,this.splitSchemeLambda=0}}class z{constructor(t,s){this._fbos=t,this._viewingMode=s,this._snapshots=new Array,this._textureHeight=0,this._numCascades=1,this.settings=new q,this._projectionView=l(),this._projectionViewInverse=l(),this._modelViewLight=l(),this._cascadeDistances=[0,0,0,0,0],this._usedCascadeDistances=O(),this._cascades=[new W,new W,new W,new W],this._lastOrigin=null,this._enabled=!1,this._maxTextureWidth=Math.min(has("esri-mobile")?4096:16384,t.rctx.parameters.maxTextureSize)}dispose(){this.enabled=!1,this.disposeBuffers()}get depthTexture(){return this._handle?.getTexture(R)}get _textureWidth(){return this._textureHeight*this._numCascades}get numCascades(){return this._numCascades}get cascadeDistances(){return D(this._usedCascadeDistances,this._cascadeDistances[0],this._numCascades>1?this._cascadeDistances[1]:1/0,this._numCascades>2?this._cascadeDistances[2]:1/0,this._numCascades>3?this._cascadeDistances[3]:1/0)}disposeMainBuffer(){this._handle=i(this._handle)}disposeBuffers(){this.disposeMainBuffer(),this._discardSnapshots()}set maxCascades(s){this.settings.maxNumCascadesHighQuality=t(Math.floor(s),1,4)}get maxCascades(){return this.settings.maxNumCascadesHighQuality}set enabled(t){this._enabled=t,t||this.disposeBuffers()}get enabled(){return this._enabled}get ready(){return this._enabled&&null!=this.depthTexture}get cascades(){for(let t=0;t<this._numCascades;++t)X[t]=this._cascades[t];return X.length=this._numCascades,X}start(t,s,e,i,a){B(this.enabled);const{near:r,far:h}=xt(e);this._computeCascadeDistances(r,h,i),this._textureHeight=this._computeTextureHeight(t,a,i),this._setupMatrices(t,s);const{viewMatrix:o,projectionMatrix:n}=t;for(let c=0;c<this._numCascades;++c)this._constructCascade(c,n,o,s);this._lastOrigin=null,this.clear()}finish(){B(this.enabled)}getShadowMapMatrices(t){if(!this._lastOrigin||!C(t,this._lastOrigin)){this._lastOrigin=this._lastOrigin||H(),j(this._lastOrigin,t);for(let s=0;s<this._numCascades;++s){r(Z,this._cascades[s].lightMat,t);for(let t=0;t<16;++t)$[16*s+t]=Z[t]}}return $}moveSnapshot(t){B(this.enabled),this._snapshots[t]?.release(),this._snapshots[t]=this._handle,this._handle?.setName(0===t?"shadow map highlight":"shadow map excluding highlight"),this._handle=null}copySnapshot(t){if(!this.enabled)return;const s=this._handle?.getTexture(R)?.descriptor;if(!s)return;this._snapshots[t]?.release();const e=0===t?"shadow map highlight":"shadow map excluding highlight",i=this._acquireFBO(e);this._snapshots[t]=i;const a=this._handle?.fbo;if(!a||!i?.fbo)return void console.error("No FBO");const{rctx:r}=this._fbos;r.blitFramebuffer(a,i.fbo,256)}getSnapshot(t){return this.enabled?this._snapshots[t]?.getTexture(R):null}clear(){this._ensureFbo(),this.bindFbo(),this._fbos.rctx.clear(256)}_computeTextureHeight({pixelRatio:t,fullWidth:s,fullHeight:e},i,a){const r=Math.min(window.devicePixelRatio,i)/t,h=a?this.settings.textureSizeModHighQuality:this.settings.textureSizeModLowQuality;return Q(Math.max(s,e)*r*h,this._maxTextureWidth/this._numCascades)}_ensureFbo(){this._handle?.fbo?.width===this._textureWidth&&this._handle?.fbo.height===this._textureHeight||(this._handle?.release(),this._handle=this._acquireFBO("shadow map"))}_acquireFBO(t){const s=this._fbos.acquire(this._textureWidth,this._textureHeight,t,12);return s.getTexture(R)?.setShadowFiltering(!0),s}_discardSnapshot(t){this._snapshots[t]=i(this._snapshots[t])}_discardSnapshots(){for(let t=0;t<this._snapshots.length;++t)this._discardSnapshot(t);this._snapshots.length=0}bindFbo(){this._fbos.rctx.bindFramebuffer(this._handle?.fbo)}_constructCascade(t,s,e,i){const a=this._cascades[t],o=-this._cascadeDistances[t],n=-this._cascadeDistances[t+1],c=(s[10]*o+s[14])/Math.abs(s[11]*o+s[15]),l=(s[10]*n+s[14])/Math.abs(s[11]*n+s[15]);B(c<l);for(let r=0;r<8;++r){D(I,r%4==0||r%4==3?-1:1,r%4==0||r%4==1?-1:1,r<4?c:l,1);const t=U[r];F(t,I,this._projectionViewInverse),t[0]/=t[3],t[1]/=t[3],t[2]/=t[3]}y(K,U[0]),a.camera.viewMatrix=r(A,this._modelViewLight,K);for(let r=0;r<8;++r)v(U[r],U[r],a.camera.viewMatrix);let d=U[0][2],m=U[0][2];for(let r=1;r<8;++r)d=Math.min(d,U[r][2]),m=Math.max(m,U[r][2]);d-=200,m+=200,a.camera.near=-m,a.camera.far=-d,pt(e,i,d,m,a.camera),h(a.lightMat,a.camera.projectionMatrix,a.camera.viewMatrix);const u=this._textureHeight;a.camera.viewport=[t*u,0,u,u]}_setupMatrices(t,s){h(this._projectionView,t.projectionMatrix,t.viewMatrix),o(this._projectionViewInverse,this._projectionView);const e=1===this._viewingMode?t.eye:S(K,0,0,1);n(this._modelViewLight,[0,0,0],[-s[0],-s[1],-s[2]],e)}_computeCascadeDistances(t,e,i){const a=i?this.settings.maxNumCascadesHighQuality:this.settings.maxNumCascadesLowQuality;this._numCascades=Math.min(1+Math.floor(L(e/t,4)),a);const r=(e-t)/this._numCascades,h=(e/t)**(1/this._numCascades);let o=t,n=t;for(let c=0;c<this._numCascades+1;++c)this._cascadeDistances[c]=s(o,n,this.settings.splitSchemeLambda),o*=h,n+=r}get test(){}}const A=l(),I=O(),U=[];for(let bt=0;bt<8;++bt)U.push(O());const P=M(),k=M(),E=M(),G=M(),J=M(),K=H(),X=[];function Y(){X.length=0}const Z=l(),$=c.concat(c,c,c),tt=M(),st=M(),et=[M(),M(),M(),M()],it=M(),at=M(),rt=M(),ht=M(),ot=M(),nt=M(),ct=M();function lt(t,s,e,i,a,r,h,o){d(tt,0,0);for(let d=0;d<4;++d)m(tt,tt,t[d]);u(tt,tt,.25),d(st,0,0);for(let d=4;d<8;++d)m(st,st,t[d]);u(st,st,.25),_(et[0],t[4],t[5],.5),_(et[1],t[5],t[6],.5),_(et[2],t[6],t[7],.5),_(et[3],t[7],t[4],.5);let n=0,c=f(et[0],tt);for(let d=1;d<4;++d){const t=f(et[d],tt);t<c&&(c=t,n=d)}g(it,et[n],t[n+4]);const l=it[0];let M,C;it[0]=-it[1],it[1]=l,g(at,st,tt),p(at,it)<0&&x(it,it),_(it,it,at,e),b(it,it),M=C=p(g(rt,t[0],tt),it);for(let d=1;d<8;++d){const s=p(g(rt,t[d],tt),it);s<M?M=s:s>C&&(C=s)}w(i,tt),u(rt,it,M-s),m(i,i,rt);let j=-1,y=1,v=0,S=0;for(let d=0;d<8;++d){g(ht,t[d],i),b(ht,ht);const s=it[0]*ht[1]-it[1]*ht[0];s>0?s>j&&(j=s,v=d):s<y&&(y=s,S=d)}V(j>0,"leftArea"),V(y<0,"rightArea"),u(ot,it,M),m(ot,ot,tt),u(nt,it,C),m(nt,nt,tt),ct[0]=-it[1],ct[1]=it[0];const H=N(i,t[S],nt,m(rt,nt,ct),1,a),D=N(i,t[v],nt,rt,1,r),F=N(i,t[v],ot,m(rt,ot,ct),1,h),O=N(i,t[S],ot,rt,1,o);V(H,"rayRay"),V(D,"rayRay"),V(F,"rayRay"),V(O,"rayRay")}function dt(t,s){return 3*s+t}const mt=M();function ut(t,s){return d(mt,t[s],t[s+3]),mt}const _t=M(),ft=a();function gt(t,s,e,i,a){g(_t,e,i),u(_t,_t,.5),ft[0]=_t[0],ft[1]=_t[1],ft[2]=0,ft[3]=_t[1],ft[4]=-_t[0],ft[5]=0,ft[6]=_t[0]*_t[0]+_t[1]*_t[1],ft[7]=_t[0]*_t[1]-_t[1]*_t[0],ft[8]=1,ft[dt(0,2)]=-p(ut(ft,0),t),ft[dt(1,2)]=-p(ut(ft,1),t);let r=p(ut(ft,0),e)+ft[dt(0,2)],h=p(ut(ft,1),e)+ft[dt(1,2)],o=p(ut(ft,0),i)+ft[dt(0,2)],n=p(ut(ft,1),i)+ft[dt(1,2)];r=-(r+o)/(h+n),ft[dt(0,0)]+=ft[dt(1,0)]*r,ft[dt(0,1)]+=ft[dt(1,1)]*r,ft[dt(0,2)]+=ft[dt(1,2)]*r,r=1/(p(ut(ft,0),e)+ft[dt(0,2)]),h=1/(p(ut(ft,1),e)+ft[dt(1,2)]),ft[dt(0,0)]*=r,ft[dt(0,1)]*=r,ft[dt(0,2)]*=r,ft[dt(1,0)]*=h,ft[dt(1,1)]*=h,ft[dt(1,2)]*=h,ft[dt(2,0)]=ft[dt(1,0)],ft[dt(2,1)]=ft[dt(1,1)],ft[dt(2,2)]=ft[dt(1,2)],ft[dt(1,2)]+=1,r=p(ut(ft,1),s)+ft[dt(1,2)],h=p(ut(ft,2),s)+ft[dt(2,2)],o=p(ut(ft,1),e)+ft[dt(1,2)],n=p(ut(ft,2),e)+ft[dt(2,2)],r=-.5*(r/h+o/n),ft[dt(1,0)]+=ft[dt(2,0)]*r,ft[dt(1,1)]+=ft[dt(2,1)]*r,ft[dt(1,2)]+=ft[dt(2,2)]*r,r=p(ut(ft,1),s)+ft[dt(1,2)],h=p(ut(ft,2),s)+ft[dt(2,2)],o=-h/r,ft[dt(1,0)]*=o,ft[dt(1,1)]*=o,ft[dt(1,2)]*=o,a[0]=ft[0],a[1]=ft[1],a[2]=0,a[3]=ft[2],a[4]=ft[3],a[5]=ft[4],a[6]=0,a[7]=ft[5],a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=ft[6],a[13]=ft[7],a[14]=0,a[15]=ft[8]}function pt(t,s,i,a,r){const h=1/U[0][3],o=1/U[4][3];B(h<o);let n=h+Math.sqrt(h*o);const c=Math.sin(e(t[2]*s[0]+t[6]*s[1]+t[10]*s[2]));n/=c,lt(U,n,c,P,k,E,G,J),gt(P,k,G,J,r.projectionMatrix),r.projectionMatrix[10]=2/(i-a),r.projectionMatrix[14]=-(i+a)/(i-a)}function xt(t){let{near:s,far:e}=t;return s<2&&(s=2),e<2&&(e=2),s>=e&&(s=2,e=4),{near:s,far:e}}export{z as ShadowMap,Y as cleanupShadowmap};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import has from"../../../../core/has.js";import{clamp as t}from"../../../../core/mathUtils.js";import{releaseMaybe as e}from"../../../../core/maybe.js";import{fromRotation as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{sub as r,add as o,negate as a,transformMat4 as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{applyTextureResizeModulo as n}from"./textureUtils.js";import{ViewshedFaceCamera as l}from"./ViewshedFaceCamera.js";import{DepthStencilAttachment as u,SizedDepthFormat as m}from"../../../webgl/enums.js";import{isSizedDepthStencilFormat as f}from"../../../webgl/textureUtils.js";class d{constructor(){this.textureSizeQuality=1,this.textureSizeModHighQuality=1.3,this.textureSizeModLowQuality=.9,this.textureSizeMultiple=128,this.toleranceSides=5,this.toleranceBottomTop=10}textureSizeModifier(t){const e=t?this.textureSizeModHighQuality:this.textureSizeModLowQuality;return this.textureSizeQuality*e}textureResizeModulo(t){return Math.ceil(t/this.textureSizeMultiple)*this.textureSizeMultiple}}const p=["front","left","right","back","top","bottom"];function g(t){return!["top","bottom"].includes(t)}class x{constructor(t){this._fbos=t,this._faces={},this._width=0,this._height=0,this.settings=new d,this._maxTextureSize=Math.min(has("esri-mobile")?4096:16384,t.rctx.parameters.maxTextureSize)}get depthTexture(){return this._handle?.getTexture(u)}get ready(){return null!=this.depthTexture&&0!==this._width&&0!==this._height}get nearFar(){const t=this.faces;return 0===t.length?null:t[0].nearFar}get numActiveFaces(){const t=this._faces;let e=0;return Object.keys(t).forEach(i=>{t[i]&&(e+=1)}),e}get faces(){const t=this._faces,e=[];for(const i of p){const s=t[i];s&&e.push(s)}return e}get atlasRegions(){return this.faces.map(t=>[t.x/this._width,(t.x+t.width)/this._width,t.y/this._height,(t.y+t.height)/this._height])}get viewshedProjectionMatrices(){return this.faces.map(t=>t.projectionMatrix)}get viewshedViewMatrices(){return this.faces.map(t=>t.viewMatrix)}_setupFaceCamera(e,n,u,m){const{effectiveObserverRenderSpace:f,tiltedUpVector:d,targetRenderSpace:p,farDistanceRenderSpace:x,horizontalFieldOfView:_,verticalFieldOfView:b}=n,w=c();r(w,p,f);const M=c(),S=c(),F=(t,e)=>{const r=c(),a=s();return i(a,t,e),h(r,w,a),o(r,f,r),r};let z,T=d;const v=Math.min(90,_),O=Math.min(90,Math.max(0,(_-90)/2));let j=-45,B=45,y=-45,k=45;if(g(e)){const e=e=>t(e,-45,45);y=e(-b/2)-this.settings.toleranceBottomTop,k=e(+b/2)+this.settings.toleranceBottomTop}switch(e){case"front":z=p,j=-v/2,B=v/2;break;case"left":z=F(Math.PI/2,d),j=45-O;break;case"right":z=F(-Math.PI/2,d),B=-45+O;break;case"top":z=o(M,f,d),T=a(S,w);break;case"bottom":z=r(M,f,d),T=w;break;case"back":z=F(Math.PI,d)}const V=new l({center:z,eye:f,up:T,far:x});V.sectionAnglesDeg=[j-this.settings.toleranceSides,B+this.settings.toleranceSides,y,k],V.fovY=Math.PI/2;const P=V.setViewport(u,m);return this._faces[e]=V,P}isActive(t){return this._computeActiveFaces(t).size>0}_computeActiveFaces(t){const e=new Set,{horizontalFieldOfView:i,verticalFieldOfView:s}=t,r=-s/2,o=s/2;return 0===i||0===s||(r<=45&&o>=-45&&e.add("front"),i>90&&(e.add("left"),e.add("right")),i>270&&e.add("back"),o>45-this.settings.toleranceBottomTop&&e.add("top"),r<-45+this.settings.toleranceBottomTop&&e.add("bottom")),e}_computeBaseTextureSize({pixelRatio:t,fullWidth:e,fullHeight:i},s,r,o){const a=s/t,h=this.settings.textureSizeModifier(r);return n(Math.max(e,i)*a*h,this._maxTextureSize/o)}_ensureFBO(t){const e=this._width,i=this._height,s=this._handle?.fbo;s&&s.width===e&&s.height===i&&t===f(s.depthStencilTexture?.descriptor?.internalFormat??m.DEPTH_COMPONENT16)||(this._handle?.release(),this._handle=this._allocateFBO(t))}_allocateFBO(t){const{_width:e,_height:i}=this,s=t?14:13,r=this._fbos.acquire(e,i,"viewshed shadow map",s);return r.getTexture(u)?.setShadowFiltering(!1),r}clearFBO(t){const e=this._fbos.rctx;this._ensureFBO(t),e.bindFramebuffer(this._handle?.fbo),e.setClearColor(1,1,1,1),e.clear(16640)}dispose(){this._debugFBO||(this._handle=e(this._handle))}start(t,e,i,s,r=!1){this._faces={};const o=this._computeActiveFaces(e),a=o.size;if(0===a)return!1;const h=this._computeBaseTextureSize(t,s,i,a);let c=0,n=0,l=0;return p.filter(t=>o.has(t)).forEach(t=>{const i=_(t,a);i>n&&(l=Math.max(l,c),c=0),n=i;const s=i*h;c+=this._setupFaceCamera(t,e,[c,s],h)}),l=Math.max(l,c),this._width=this.settings.textureResizeModulo(l),this._height=b(a)*h,this.clearFBO(r),!0}finish(){}get test(){}}function _(t,e){if(e<4)return 0;const i="front"===t||"left"===t;return 4===e?i?0:1:i||"right"===t?0:1}function b(t){return t<4?1:2}export{x as ViewshedShadowMap};
2
+ import has from"../../../../core/has.js";import{clamp as t}from"../../../../core/mathUtils.js";import{releaseMaybe as e}from"../../../../core/maybe.js";import{fromRotation as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{sub as r,add as o,negate as a,transformMat4 as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{applyTextureResizeModulo as n}from"./textureUtils.js";import{ViewshedFaceCamera as l}from"./ViewshedFaceCamera.js";import{DepthStencilAttachment as u,SizedDepthFormat as m}from"../../../webgl/enums.js";import{isSizedDepthStencilFormat as f}from"../../../webgl/textureUtils.js";class d{constructor(){this.textureSizeQuality=1,this.textureSizeModHighQuality=1.3,this.textureSizeModLowQuality=.9,this.textureSizeMultiple=128,this.toleranceSides=5,this.toleranceBottomTop=10}textureSizeModifier(t){const e=t?this.textureSizeModHighQuality:this.textureSizeModLowQuality;return this.textureSizeQuality*e}textureResizeModulo(t){return Math.ceil(t/this.textureSizeMultiple)*this.textureSizeMultiple}}const p=["front","left","right","back","top","bottom"];function g(t){return!["top","bottom"].includes(t)}class x{constructor(t){this._fbos=t,this._faces={},this._width=0,this._height=0,this.settings=new d,this._maxTextureSize=Math.min(has("esri-mobile")?4096:16384,t.rctx.parameters.maxTextureSize)}get depthTexture(){return this._handle?.getTexture(u)}get ready(){return null!=this.depthTexture&&0!==this._width&&0!==this._height}get nearFar(){const t=this.faces;return 0===t.length?null:t[0].nearFar}get numActiveFaces(){const t=this._faces;let e=0;return Object.keys(t).forEach(i=>{t[i]&&(e+=1)}),e}get faces(){const t=this._faces,e=[];for(const i of p){const s=t[i];s&&e.push(s)}return e}get atlasRegions(){return this.faces.map(t=>[t.x/this._width,(t.x+t.width)/this._width,t.y/this._height,(t.y+t.height)/this._height])}get viewshedProjectionMatrices(){return this.faces.map(t=>t.projectionMatrix)}get viewshedViewMatrices(){return this.faces.map(t=>t.viewMatrix)}_setupFaceCamera(e,n,u,m){const{effectiveObserverRenderSpace:f,tiltedUpVector:d,targetRenderSpace:p,farDistanceRenderSpace:x,horizontalFieldOfView:_,verticalFieldOfView:b}=n,w=c();r(w,p,f);const M=c(),S=c(),F=(t,e)=>{const r=c(),a=s();return i(a,t,e),h(r,w,a),o(r,f,r),r};let z,T=d;const v=Math.min(90,_),O=Math.min(90,Math.max(0,(_-90)/2));let j=-45,B=45,y=-45,k=45;if(g(e)){const e=e=>t(e,-45,45);y=e(-b/2)-this.settings.toleranceBottomTop,k=e(+b/2)+this.settings.toleranceBottomTop}switch(e){case"front":z=p,j=-v/2,B=v/2;break;case"left":z=F(Math.PI/2,d),j=45-O;break;case"right":z=F(-Math.PI/2,d),B=-45+O;break;case"top":z=o(M,f,d),T=a(S,w);break;case"bottom":z=r(M,f,d),T=w;break;case"back":z=F(Math.PI,d)}const V=new l({center:z,eye:f,up:T,far:x});V.sectionAnglesDeg=[j-this.settings.toleranceSides,B+this.settings.toleranceSides,y,k],V.fovY=Math.PI/2;const P=V.setViewport(u,m);return this._faces[e]=V,P}isActive(t){return this._computeActiveFaces(t).size>0}_computeActiveFaces(t){const e=new Set,{horizontalFieldOfView:i,verticalFieldOfView:s}=t,r=-s/2,o=s/2;return 0===i||0===s||(r<=45&&o>=-45&&e.add("front"),i>90&&(e.add("left"),e.add("right")),i>270&&e.add("back"),o>45-this.settings.toleranceBottomTop&&e.add("top"),r<-45+this.settings.toleranceBottomTop&&e.add("bottom")),e}_computeBaseTextureSize({pixelRatio:t,fullWidth:e,fullHeight:i},s,r,o){const a=s/t,h=this.settings.textureSizeModifier(r);return n(Math.max(e,i)*a*h,this._maxTextureSize/o)}_ensureFBO(t){const e=this._width,i=this._height,s=this._handle?.fbo;s&&s.width===e&&s.height===i&&t===f(s.depthStencilTexture?.descriptor?.internalFormat??m.DEPTH_COMPONENT16)||(this._handle?.release(),this._handle=this._allocateFBO(t))}_allocateFBO(t){const{_width:e,_height:i}=this,s=t?13:12,r=this._fbos.acquire(e,i,"viewshed shadow map",s);return r.getTexture(u)?.setShadowFiltering(!1),r}clearFBO(t){const e=this._fbos.rctx;this._ensureFBO(t),e.bindFramebuffer(this._handle?.fbo),e.setClearColor(1,1,1,1),e.clear(16640)}dispose(){this._debugFBO||(this._handle=e(this._handle))}start(t,e,i,s,r=!1){this._faces={};const o=this._computeActiveFaces(e),a=o.size;if(0===a)return!1;const h=this._computeBaseTextureSize(t,s,i,a);let c=0,n=0,l=0;return p.filter(t=>o.has(t)).forEach(t=>{const i=_(t,a);i>n&&(l=Math.max(l,c),c=0),n=i;const s=i*h;c+=this._setupFaceCamera(t,e,[c,s],h)}),l=Math.max(l,c),this._width=this.settings.textureResizeModulo(l),this._height=b(a)*h,this.clearFBO(r),!0}finish(){}get test(){}}function _(t,e){if(e<4)return 0;const i="front"===t||"left"===t;return 4===e?i?0:1:i||"right"===t?0:1}function b(t){return t<4?1:2}export{x as ViewshedShadowMap};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{equals as r,binaryIndexOf as s}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import n from"../../../../../core/Logger.js";import{clamp as i}from"../../../../../core/mathUtils.js";import{disposeMaybe as o,destroyMaybe as a}from"../../../../../core/maybe.js";import{isAbortError as l,onAbortOrThrow as c}from"../../../../../core/promiseUtils.js";import{property as d,subclass as h}from"../../../../../core/accessorSupport/decorators.js";import{fromMat4 as u,transpose as g,invert as m}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as f}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as p}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as _,copy as b,sub as y,dot as w}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as j,clone as O}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as E}from"../../../../../core/support/UpdatingHandles.js";import{c as v}from"../../../../../chunks/vec32.js";import{TwoVectorPosition as x}from"../../core/util/TwoVectorPosition.js";import{Attribute as M}from"../Attribute.js";import{GridLocalOriginFactory as T}from"../GridLocalOriginFactory.js";import{applyToModelMatrix as R}from"../localOriginHelper.js";import{LocalOriginManager as C}from"../LocalOriginManager.js";import{Object3D as A}from"../Object3D.js";import{VertexArrayObject as P}from"../VertexArrayObject.js";import{VertexLayout as D,glVertexLayout as L,edgeViewTextureLayout as S,EdgeInputBufferLayout as k,RegularEdgeInstancesGLLayout as U,SilhouetteEdgeInstancesGLLayout as q}from"./bufferLayouts.js";import{EdgeRenderer as H,lineWidthFractionFactor as B,extensionLengthOffset as V}from"./EdgeRenderer.js";import{EdgePassParameters as I}from"./EdgeShaderParameters.js";import{EdgeWorkerHandle as F}from"./EdgeWorkerHandle.js";import{LegacyTransform as N,isLegacyTransform as z}from"./LegacyTransform.js";import{generateStrokesTexture as W}from"./strokes.js";import{determineRendererType as G,determineEdgeTransparency as K,determineObjectTransparency as J,fillComponentBufferIndices as Q}from"./util.js";import{BufferManager as X}from"../TextureBackedBuffer/BufferManager.js";import{VertexBuffer as Y}from"../../../../webgl/VertexBuffer.js";const Z=128;let $=class extends t{constructor(e){super(e),this._updatingHandles=new E,this._objectEntries=new Map,this._pendingDeletions=new Map,this._renderers=new Map,this._gpuMemoryUsage=0,this._workerAbort=new AbortController,this._tmpModelPosition=j(),this._localOrigins=new C(new T(e.renderSR));const t=D.createBuffer(4);for(let r=0;r<4;r++)t.sideness.set(r,0,0===r||3===r?0:1),t.sideness.set(r,1,0===r||1===r?0:1);this._vertexBuffer=new Y(e.rctx,L,t.buffer)}initialize(){this._workerHandle=new F(this.schedule),this._componentColorManager=new X(this.rctx,S)}destroy(){this.destroyed||(this._objectEntries.forEach(e=>this._discardObjectEntry(e)),this._objectEntries.clear(),this._pendingDeletions.forEach(e=>this._discardObjectEntry(e)),this._pendingDeletions.clear(),this._strokesTexture=o(this._strokesTexture),this._componentColorManager=a(this._componentColorManager),this._workerAbort.abort(),this._workerHandle.destroy(),this._vertexBuffer.dispose(),this._renderers.clear(),this._updatingHandles.destroy(),this._set("schedule",pe))}get updating(){return this._updatingHandles.updating}get usedMemory(){return this._gpuMemoryUsage}shouldRender(){return this._renderers.size>0}async addComponentObject(e,t,r,s,n,i,o){if(this.hasObject(e))return this._getObjectMemoryUsage(e);let a;const l=new re(null,new Promise(e=>a=e),e.obb.center,e.obb.radius);this._objectEntries.set(e,l);const c=await this._updatingHandles.addPromise(this._addComponentGeometry(e.transform,l,t,r,s,n,i,o));return this.setNeedsRender(),a(),c}async addOrUpdateObject3D(e,t,r,s){if(this.destroyed)return void n.getLogger(this).warn("Attempt to add an object to a destroyed instance");const i=new AbortController;let o;const{center:a,radius:c}=e.boundingVolumeWorldSpace.bounds,d=new re(i,new Promise(e=>o=e),a,c),h=this._objectEntries.get(e);h&&(this._pendingDeletions.has(e)?this._discardObjectEntry(h):this._pendingDeletions.set(e,h)),this._objectEntries.set(e,d);try{const n=new Array;if(e.geometries.length>1&&te(e))n.push(this._addObjectMergedGeometries(e,d,t,r,s));else for(const i of e.geometries)i.material.supportsEdges&&n.push(this._addGeometry(e,d,i,t,r,s));await this._updatingHandles.addPromise(Promise.all(n)),this._removePendingDeletion(e)}catch(u){l(u)?this._discardObjectEntry(d):this._removePendingDeletion(e)}finally{this.setNeedsRender(),o()}}removeObject(e){const t=this._objectEntries.get(e);this._objectEntries.delete(e),this._discardObjectEntry(t),this._removePendingDeletion(e)}_removePendingDeletion(e){const t=this._pendingDeletions.get(e);this._pendingDeletions.delete(e),this._discardObjectEntry(t)}async _getObjectEntry(e){const t=this._objectEntries.get(e);if(!t)throw new Error("no object");return await t.loaded,null==t.loaded?null:t}fastUpdateObject3DEdgesTransform(e){if(this.destroyed)return!1;const t=this._objectEntries.get(e);if(!t)return!1;const{geometries:r}=e,{renderables:s}=t;if(0===r.length||0===s.length)return!0;if(s.length>1)return!1;const[n]=s,i=n.transform;if(!(i instanceof N))return!1;const[o]=r;if(o.localOrigin!==i.origin.origin)return!1;const a=p(),l=this._computeModelTransformWithLocalOrigin(e,o,a);return n.transform=new N(a,l),this.setNeedsRender(),!0}_discardObjectEntry(e){e&&(e.abort?.abort(),e.renderables.length&&(e.renderables.forEach(e=>this._removeRenderable(e)),this.setNeedsRender()),e.loaded=null)}hasObject(e){return this._objectEntries.has(e)}async updateAllComponentOpacities(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));if(null==r)return;const s=Array.isArray(t)?e=>t[e]:()=>t;r.renderables.forEach(e=>{const{meta:t,buffer:r}=e.components,n=t.length,i=r.textureBuffer.getScalarField("opacity");for(let o=0;o<n;o++){const e=s(o),r=t[o],n=r.index;r.material.opacity=e,i.set(n,e)}this._updateTransparency(e)}),this.setNeedsRender()}async _getObjectMemoryUsage(e){const t=await this._getObjectEntry(e);return t?t.renderables.reduce((e,t)=>e+t.statistics.gpuMemoryUsage,0):0}async updateAllComponentMaterials(e,t,r,s){const n=e instanceof A,i=G(t),o=H.getKey(i,r,n),a=await this._updatingHandles.addPromise(this._getObjectEntry(e));null!=a&&(a.renderables.forEach(e=>{if(o!==e.rendererKey){const t=this._renderers.get(e.rendererKey),s=this._acquireRenderer(i,r,n);t.removeRenderable(e),--t.refCount,e.rendererKey=o,s.addRenderable(e)}if(Array.isArray(t))for(let r=0;r<t.length;r++)e.components.meta[r].material=t[r];else e.components.meta[0].material=t;s&&ae(e.components),this._updateTransparency(e)}),this.setNeedsRender())}async updateAllVerticalOffsets(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));null!=r&&this._updateAllVerticalOffsets(r,t)}_updateAllVerticalOffsets(e,t){e.renderables.forEach(e=>{const r=e.components.meta;for(let s=0;s<r.length;s++)e.components.meta[s].verticalOffset=t?.[s]??0;ae(e.components)}),this.setNeedsRender()}async updateObjectVisibility(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));r&&(r.renderables.forEach(e=>e.visible=t),this.setNeedsRender())}render(e,t){if(null==this._componentColorManager)return;this._localOrigins.updateViewMatrices(e.camera.viewMatrix);const r=e.camera.viewInverseTransposeMatrix,s=j(),n=new x;let i=0,o=0;if(this._renderers.forEach(r=>{0!==r.refCount?(++this.techniques.precompiling,r.forEachRenderable(t=>{t.visible&&(i+=t.statistics.averageEdgeLength,o++,t.regular&&r.acquireTechnique(e,!1),t.silhouette&&r.acquireTechnique(e,!0))},t),--this.techniques.precompiling):this._renderers.delete(r.key)}),this._componentColorManager.garbageCollect(),this._componentColorManager.updateTextures(),0===o)return;const a=new I(40*i/o,t);_(s,r[3],r[7],r[11]),n.set(s),b(a.transformWorldFromViewTH,n.high),b(a.transformWorldFromViewTL,n.low),u(a.transformViewFromCameraRelativeRS,e.camera.viewMatrix),g(fe,a.transformViewFromCameraRelativeRS),m(a.transformNormalViewFromGlobal,fe),this._updateObjectCameraDistances(e),this._renderers.forEach(t=>{le(t,e,a),ce(t,e,a)})}_updateTransparency(e){const t=K(e.components.meta),r=J(e.components.meta);t===e.edgeTransparency&&r===e.objectTransparency||(e.edgeTransparency=t,e.objectTransparency=r,this._renderers.get(e.rendererKey).setRenderablesDirty())}_computeModelTransformWithLocalOrigin(e,t,r){e.getCombinedShaderTransformation(t,r);const s=null!=t.localOrigin?this._localOrigins.register(t.localOrigin):this._localOrigins.acquire(_(this._tmpModelPosition,r[12],r[13],r[14]));return t.localOrigin=s.origin,R(s.origin.vec3,r),s}_createComponentBuffers(e){if(null==this._componentColorManager)return null;const t=new Array,r=this._componentColorManager.getBuffer(e.length),s=r.acquireIndices(e.length);for(let i=0;i<e.length;i++){const r=e[i],n=s[i];t.push({index:n,verticalOffset:0,material:r})}const n=new se(r,t);return ae(n),n}_extractEdges(e,t,r,s,n,i,o=i.length){return o<Z&&(n=!0),this._workerHandle.process({data:r,indices:i,indicesLength:o,writerSettings:t,skipDeduplicate:s},e,n)}_createRenderable(e,t,r,s,n){const i=t=>new ne(new P(this.rctx,new Map([["vertices",this._vertexBuffer],["instances",0===t?new Y(this.rctx,U,e.regular.instancesData.buffer):new Y(this.rctx,q,e.silhouette.instancesData.buffer)]])),0===t?e.regular.lodInfo:e.silhouette.lodInfo),o=e.regular.lodInfo.lengths.length>0?i(0):null,a=e.silhouette.lodInfo.lengths.length>0?i(1):null,l=(o?.vao.usedMemory??0)+(a?.vao.usedMemory??0);return new ie(o,a,{gpuMemoryUsage:l,externalMemoryUsage:n,averageEdgeLength:e.averageEdgeLength},r,K(t.meta),J(t.meta),t,s)}async _addGeometry(e,t,r,s,n,i){if(r.edgeIndicesLength<=0)return;const o=r.attributes.get("position"),a=p(),l=this._computeModelTransformWithLocalOrigin(e,r,a),c=new me(o,a,l);return this._addPositionData(t,c,r.edgeIndicesLength,s,n,i)}async _addPositionData(e,t,r,s,n,i=!1){if(null==e.loaded)return;const o=this._createComponentBuffers([s]);if(null==o)return;const a=this._acquireRenderer(s.type,n,!0),{modelTransform:l,origin:c}=t,d=t.position.indices,h=t.position,u=h.data.length/h.size,g=k.createBuffer(u);for(let p=0;p<u;p++)g.position.set(p,0,h.data[p*h.size]),g.position.set(p,1,h.data[p*h.size+1]),g.position.set(p,2,h.data[p*h.size+2]);Q(o.meta,[0,g.componentIndex.count],g.componentIndex);const m=await this._updatingHandles.addPromise(this._extractEdges(e.abort?.signal||this._workerAbort.signal,a.writerSettings,g,!1,i,d,r));if(null==e.loaded)return;const f=this._createRenderable(m,o,new N(l,c),a.key,!1);e.renderables.push(f),a.addRenderable(f),this._gpuMemoryUsage+=f.statistics.gpuMemoryUsage}async _addComponentGeometry(e,t,r,s,n,i,o,a){if(null==t.loaded)return 0;const l=this._createComponentBuffers(i);if(null==l)return 0;const c=G(i),d=this._acquireRenderer(c,o||!1,!1),h=k.createBuffer(r.length/3);v(h.position.typedBuffer,r,h.position.typedBufferStride,3),Q(l.meta,n,h.componentIndex,s);const u=!0,g=d.writerSettings,m=await this._updatingHandles.addPromise(this._extractEdges(this._workerAbort.signal,g,h,u,!1,s));if(null==t.loaded)return 0;const f=this._createRenderable(m,l,e,d.key,!0);return t.renderables.push(f),d.addRenderable(f),this._updateAllVerticalOffsets(t,a),f.statistics.gpuMemoryUsage}async _addObjectMergedGeometries(e,t,r,s,n){const i=new Map;let o=0,a=0,l=null;const c=e.geometries.filter(e=>{if(e.edgeIndicesLength<=0||!e.material.supportsEdges)return!1;!l&&e.localOrigin&&(l=e);const t=e.positionAttribute;return a+=t.data.length/t.size,o+=e.edgeIndicesLength,!0});if(0===c.length)return;const d=a>=65536?Uint32Array:Uint16Array,h=o?new d(o):null,u=[];let g=0;c.forEach(e=>{const t=e.attributes.get("position"),r=t.indices;let s=i.get(t.data);if(null==s){s=u.length/3;for(let e=0;e<t.data.length;e+=t.size)u.push(t.data[e]),u.push(t.data[e+1]),u.push(t.data[e+2]);i.set(t.data,s)}for(let n=0;n<e.edgeIndicesLength;n++)h[g++]=s+r[n]});const m=l||e.geometries[0],f=p(),_=this._computeModelTransformWithLocalOrigin(e,m,f);for(let p=0;p<e.geometries.length;p++)e.geometries[p].localOrigin=_.origin;const b=new me(new M(u,h,3),f,_);await this._updatingHandles.addPromise(this._addPositionData(t,b,h.length,r,s,n))}_acquireRenderer(e,t,r){const s=H.getKey(e,t,r);let n=this._renderers.get(s);return null==this._strokesTexture&&(this._strokesTexture=W(this.rctx)),n||(n=new H(this.rctx,this.techniques,{type:e,hasSlicePlane:t,strokesTexture:this._strokesTexture,legacy:r,spherical:1===this.viewingMode}),this._renderers.set(s,n)),++n.refCount,n}_removeRenderable(e){ee(e.regular),ee(e.silhouette);const t=this._renderers.get(e.rendererKey);if(t){t.removeRenderable(e),--t.refCount,z(e.transform)&&this._localOrigins.release(e.transform.origin),this._gpuMemoryUsage-=e.statistics.externalMemoryUsage?0:e.statistics.gpuMemoryUsage;for(const t of e.components.meta)e.components.buffer.releaseIndex(t.index)}}_updateObjectCameraDistances(e){const t=e.camera.eye,r=e.camera.viewForward,s=j(),n=e=>{y(s,e.center,t);const n=w(s,r),i=e.radius,o=n<-i?1/0:n<i?0:n-i;e.renderables.forEach(e=>e.distanceToCamera=o)};this._objectEntries.forEach(n),this._pendingDeletions.forEach(n)}get test(){}};function ee(e){e?.vao&&(e.vao.buffer("instances")?.dispose(),e.vao.disposeVAOOnly(),e.vao=null)}function te(e){let t=null,s=null;for(const n of e.geometries){if(n.material.supportsEdges){if(t){if(!r(t,n.transformation))return!1}else t=n.transformation;if(s||null==n.localOrigin){if(null!=s?.localOrigin&&null!=n.localOrigin&&s.localOrigin.id!==n.localOrigin.id)return!1}else s=n}}return!0}e([d({constructOnly:!0})],$.prototype,"rctx",void 0),e([d({constructOnly:!0})],$.prototype,"renderSR",void 0),e([d({constructOnly:!0})],$.prototype,"viewingMode",void 0),e([d({constructOnly:!0})],$.prototype,"techniques",void 0),e([d({constructOnly:!0})],$.prototype,"setNeedsRender",void 0),e([d({constructOnly:!0})],$.prototype,"schedule",void 0),e([d({readOnly:!0})],$.prototype,"_updatingHandles",void 0),e([d({readOnly:!0})],$.prototype,"updating",null),$=e([h("esri.views.3d.webgl-engine.lib.edgeRendering.EdgeView")],$);class re{constructor(e,t,r,s){this.abort=e,this.radius=s,this.renderables=new Array;const n=e?c(e.signal,()=>e.abort()):null;this.loaded=t,this.loaded.then(()=>{null!=this.loaded&&(this.loaded=!0),this.abort=null,n?.remove()}),this.center=O(r)}}class se{constructor(e,t){this.buffer=e,this.meta=t}}class ne{constructor(e,t){this.vao=e,this.lod=t}}class ie{constructor(e,t,r,s,n,i,o,a){this.regular=e,this.silhouette=t,this.statistics=r,this.transform=s,this.edgeTransparency=n,this.objectTransparency=i,this.components=o,this.rendererKey=a,this.distanceToCamera=0,this.visible=!0}}class oe extends ie{}function ae(e){const{meta:t,buffer:r}=e,s=r.textureBuffer,n=s.getVec4Field("color"),o=s.getScalarField("lineWidth"),a=s.getScalarField("extensionLength"),l=s.getScalarField("materialType"),c=s.getScalarField("opacity"),d=s.getScalarField("elevationOffset");for(let h=0;h<t.length;h++){const e=t[h].material,r=t[h].index,s=i(Math.round(e.size*B),0,255),u=i(e.extensionLength,-V,255-V)+V;n.setArray(r,e.color),o.set(r,s),a.set(r,u),l.set(r,e.type),c.set(r,e.opacity),d.set(r,t[h].verticalOffset)}}function le(e,t,r){let s,n;const i=r.transparency,o=t.camera.perScreenPixelRatio;e.forEachRenderable(i=>{if(!de(i)||!i.visible)return;s??=e.acquireTechnique(t,!1),n??=e.rctx.bindTechnique(s,t,r);const a=ge(i.regular.lod.lengths,i.distanceToCamera,o);e.renderRegularEdges(n,i,r,t,a)},i)}function ce(e,t,r){let s,n;const i=r.transparency,o=t.camera.perScreenPixelRatio;e.forEachRenderable(i=>{if(!ue(i)||!i.visible)return;s??=e.acquireTechnique(t,!0),n??=e.rctx.bindTechnique(s,t,r);const a=ge(i.silhouette.lod.lengths,i.distanceToCamera,o);e.renderSilhouetteEdges(n,i,r,t,a)},i)}function de(e){return null!=e.regular}class he extends ie{}function ue(e){return null!=e.silhouette}function ge(e,t,r){const n=t*r,i=s(e,n,!0);return-1===i?n<e[0]?e.length:0:e.length-i}class me{constructor(e,t,r){this.position=e,this.modelTransform=t,this.origin=r}}const fe=f(),pe=()=>Promise.reject();export{$ as EdgeView,oe as RegularRenderable,ie as Renderable,he as SilhouetteRenderable};
2
+ import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{equals as r,binaryIndexOf as s}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import n from"../../../../../core/Logger.js";import{clamp as i}from"../../../../../core/mathUtils.js";import{disposeMaybe as o,destroyMaybe as a}from"../../../../../core/maybe.js";import{isAbortError as c,onAbortOrThrow as l}from"../../../../../core/promiseUtils.js";import{property as d,subclass as h}from"../../../../../core/accessorSupport/decorators.js";import{fromMat4 as u,transpose as g,invert as m}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as f}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as p}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as _,copy as b,sub as y,dot as w}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as j,clone as O}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as E}from"../../../../../core/support/UpdatingHandles.js";import{c as v}from"../../../../../chunks/vec32.js";import{TwoVectorPosition as x}from"../../core/util/TwoVectorPosition.js";import{Attribute as M}from"../Attribute.js";import{GridLocalOriginFactory as T}from"../GridLocalOriginFactory.js";import{applyToModelMatrix as R}from"../localOriginHelper.js";import{LocalOriginManager as C}from"../LocalOriginManager.js";import{Object3D as A}from"../Object3D.js";import{VertexArrayObject as P}from"../VertexArrayObject.js";import{VertexLayout as D,glVertexLayout as L,edgeViewTextureLayout as S,EdgeInputBufferLayout as k,RegularEdgeInstancesGLLayout as U,SilhouetteEdgeInstancesGLLayout as q}from"./bufferLayouts.js";import{EdgeRenderer as H,lineWidthFractionFactor as B,extensionLengthOffset as V}from"./EdgeRenderer.js";import{EdgePassParameters as I}from"./EdgeShaderParameters.js";import{EdgeWorkerHandle as F}from"./EdgeWorkerHandle.js";import{LegacyTransform as z,isLegacyTransform as N}from"./LegacyTransform.js";import{generateStrokesTexture as W}from"./strokes.js";import{determineRendererType as G,determineEdgeTransparency as K,determineObjectTransparency as J,fillComponentBufferIndices as Q}from"./util.js";import{BufferManager as X}from"../TextureBackedBuffer/BufferManager.js";import{VertexBuffer as Y}from"../../../../webgl/VertexBuffer.js";const Z=128;let $=class extends t{constructor(e){super(e),this._updatingHandles=new E,this._objectEntries=new Map,this._pendingDeletions=new Map,this._renderers=new Map,this._gpuMemoryUsage=0,this._workerAbort=new AbortController,this._tmpModelPosition=j(),this._localOrigins=new C(new T(e.renderSR));const t=D.createBuffer(4);for(let r=0;r<4;r++)t.sideness.set(r,0,0===r||3===r?0:1),t.sideness.set(r,1,0===r||1===r?0:1);this._vertexBuffer=new Y(e.rctx,L,t.buffer)}initialize(){this._workerHandle=new F(this.schedule),this._componentColorManager=new X(this.rctx,S)}destroy(){this.destroyed||(this._objectEntries.forEach(e=>this._discardObjectEntry(e)),this._objectEntries.clear(),this._pendingDeletions.forEach(e=>this._discardObjectEntry(e)),this._pendingDeletions.clear(),this._strokesTexture=o(this._strokesTexture),this._componentColorManager=a(this._componentColorManager),this._workerAbort.abort(),this._workerHandle.destroy(),this._vertexBuffer.dispose(),this._renderers.clear(),this._updatingHandles.destroy(),this._set("schedule",pe))}get updating(){return this._updatingHandles.updating}get usedMemory(){return this._gpuMemoryUsage}shouldRender(){return this._renderers.size>0}async addComponentObject(e,t,r,s,n,i,o){if(this.hasObject(e))return this._getObjectMemoryUsage(e);let a;const c=new re(null,new Promise(e=>a=e),e.obb.center,e.obb.radius);this._objectEntries.set(e,c);const l=await this._updatingHandles.addPromise(this._addComponentGeometry(e.transform,c,t,r,s,n,i,o));return this.setNeedsRender(),a(),l}async addOrUpdateObject3D(e,t,r,s){if(this.destroyed)return void n.getLogger(this).warn("Attempt to add an object to a destroyed instance");const i=new AbortController;let o;const{center:a,radius:l}=e.boundingVolumeWorldSpace.bounds,d=new re(i,new Promise(e=>o=e),a,l),h=this._objectEntries.get(e);h&&(this._pendingDeletions.has(e)?this._discardObjectEntry(h):this._pendingDeletions.set(e,h)),this._objectEntries.set(e,d);try{const n=new Array;if(e.geometries.length>1&&te(e))n.push(this._addObjectMergedGeometries(e,d,t,r,s));else for(const i of e.geometries)i.material.supportsEdges&&n.push(this._addGeometry(e,d,i,t,r,s));await this._updatingHandles.addPromise(Promise.all(n)),this._removePendingDeletion(e)}catch(u){c(u)?this._discardObjectEntry(d):this._removePendingDeletion(e)}finally{this.setNeedsRender(),o()}}removeObject(e){const t=this._objectEntries.get(e);this._objectEntries.delete(e),this._discardObjectEntry(t),this._removePendingDeletion(e)}_removePendingDeletion(e){const t=this._pendingDeletions.get(e);this._pendingDeletions.delete(e),this._discardObjectEntry(t)}async _getObjectEntry(e){const t=this._objectEntries.get(e);if(!t)throw new Error("no object");return await t.loaded,null==t.loaded?null:t}fastUpdateObject3DEdgesTransform(e){if(this.destroyed)return!1;const t=this._objectEntries.get(e);if(!t)return!1;const{geometries:r}=e,{renderables:s}=t;if(0===r.length||0===s.length)return!0;if(s.length>1)return!1;const[n]=s,i=n.transform;if(!(i instanceof z))return!1;const[o]=r;if(o.localOrigin!==i.origin.origin)return!1;const a=p(),c=this._computeModelTransformWithLocalOrigin(e,o,a);return n.transform=new z(a,c),this.setNeedsRender(),!0}_discardObjectEntry(e){e&&(e.abort?.abort(),e.renderables.length&&(e.renderables.forEach(e=>this._removeRenderable(e)),this.setNeedsRender()),e.loaded=null)}hasObject(e){return this._objectEntries.has(e)}async updateAllComponentOpacities(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));if(null==r)return;const s=Array.isArray(t)?e=>t[e]:()=>t;r.renderables.forEach(e=>{const{meta:t,buffer:r}=e.components,n=t.length,i=r.textureBuffer.getScalarField("opacity");for(let o=0;o<n;o++){const e=s(o),r=t[o],n=r.index;r.material.opacity=e,i.set(n,e)}this._updateTransparency(e)}),this.setNeedsRender()}async _getObjectMemoryUsage(e){const t=await this._getObjectEntry(e);return t?t.renderables.reduce((e,t)=>e+t.statistics.gpuMemoryUsage,0):0}async updateAllComponentMaterials(e,t,r,s){const n=e instanceof A,i=G(t),o=H.getKey(i,r,n),a=await this._updatingHandles.addPromise(this._getObjectEntry(e));null!=a&&(a.renderables.forEach(e=>{if(o!==e.rendererKey){const t=this._renderers.get(e.rendererKey),s=this._acquireRenderer(i,r,n);t.removeRenderable(e),--t.refCount,e.rendererKey=o,s.addRenderable(e)}if(Array.isArray(t))for(let r=0;r<t.length;r++)e.components.meta[r].material=t[r];else e.components.meta[0].material=t;s&&ae(e.components),this._updateTransparency(e)}),this.setNeedsRender())}async updateAllVerticalOffsets(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));null!=r&&this._updateAllVerticalOffsets(r,t)}_updateAllVerticalOffsets(e,t){e.renderables.forEach(e=>{const r=e.components.meta;for(let s=0;s<r.length;s++)e.components.meta[s].verticalOffset=t?.[s]??0;ae(e.components)}),this.setNeedsRender()}async updateObjectVisibility(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));r&&(r.renderables.forEach(e=>e.visible=t),this.setNeedsRender())}render(e,t){if(null==this._componentColorManager)return;this._localOrigins.updateViewMatrices(e.camera.viewMatrix);const r=e.camera.viewInverseTransposeMatrix,s=j(),n=new x;let i=0,o=0;if(this._renderers.forEach(r=>{0!==r.refCount?(++this.techniques.precompiling,r.forEachRenderable(t=>{t.visible&&(i+=t.statistics.averageEdgeLength,o++,t.regular&&r.acquireTechnique(e,!1),t.silhouette&&r.acquireTechnique(e,!0))},t),--this.techniques.precompiling):this._renderers.delete(r.key)}),this._componentColorManager.garbageCollect(),this._componentColorManager.updateTextures(),0===o)return;const a=new I(40*i/o,t);_(s,r[3],r[7],r[11]),n.set(s),b(a.transformWorldFromViewTH,n.high),b(a.transformWorldFromViewTL,n.low),u(a.transformViewFromCameraRelativeRS,e.camera.viewMatrix),g(fe,a.transformViewFromCameraRelativeRS),m(a.transformNormalViewFromGlobal,fe),this._updateObjectCameraDistances(e),this._renderers.forEach(t=>{ce(t,e,a),le(t,e,a)})}_updateTransparency(e){const t=K(e.components.meta),r=J(e.components.meta);t===e.edgeTransparency&&r===e.objectTransparency||(e.edgeTransparency=t,e.objectTransparency=r,this._renderers.get(e.rendererKey).setRenderablesDirty())}_computeModelTransformWithLocalOrigin(e,t,r){e.getCombinedShaderTransformation(t,r);const s=null!=t.localOrigin?this._localOrigins.register(t.localOrigin):this._localOrigins.acquire(_(this._tmpModelPosition,r[12],r[13],r[14]));return t.localOrigin=s.origin,R(s.origin.vec3,r),s}_createComponentBuffers(e){if(null==this._componentColorManager)return null;const t=new Array,r=this._componentColorManager.getBuffer(e.length),s=r.acquireIndices(e.length);for(let i=0;i<e.length;i++){const r=e[i],n=s[i];t.push({index:n,verticalOffset:0,material:r})}const n=new se(r,t);return ae(n),n}_extractEdges(e,t,r,s,n,i,o=i.length){return o<Z&&(n=!0),this._workerHandle.process({data:r,indices:i,indicesLength:o,writerSettings:t,skipDeduplicate:s},e,n)}_createRenderable(e,t,r,s,n){const i=t=>new ne(new P(this.rctx,new Map([["vertices",this._vertexBuffer],["instances",0===t?new Y(this.rctx,U,e.regular.instancesData.buffer):new Y(this.rctx,q,e.silhouette.instancesData.buffer)]])),0===t?e.regular.lodInfo:e.silhouette.lodInfo),o=e.regular.lodInfo.lengths.length>0?i(0):null,a=e.silhouette.lodInfo.lengths.length>0?i(1):null,c=(o?.vao.usedMemory??0)+(a?.vao.usedMemory??0);return new ie(o,a,{gpuMemoryUsage:c,externalMemoryUsage:n,averageEdgeLength:e.averageEdgeLength},r,K(t.meta),J(t.meta),t,s)}async _addGeometry(e,t,r,s,n,i){if(r.edgeIndicesLength<=0)return;const o=r.positionAttribute,a=r.primitivePositionIndices,c=a===o.indices?o:new M(o.data,a,o.size,!1,o.stride),l=p(),d=this._computeModelTransformWithLocalOrigin(e,r,l),h=new me(c,l,d);return this._addPositionData(t,h,r.edgeIndicesLength,s,n,i)}async _addPositionData(e,t,r,s,n,i=!1){if(null==e.loaded)return;const o=this._createComponentBuffers([s]);if(null==o)return;const a=this._acquireRenderer(s.type,n,!0),{modelTransform:c,origin:l}=t,d=t.position.indices,h=t.position,u=h.data.length/h.size,g=k.createBuffer(u);for(let p=0;p<u;p++)g.position.set(p,0,h.data[p*h.size]),g.position.set(p,1,h.data[p*h.size+1]),g.position.set(p,2,h.data[p*h.size+2]);Q(o.meta,[0,g.componentIndex.count],g.componentIndex);const m=await this._updatingHandles.addPromise(this._extractEdges(e.abort?.signal||this._workerAbort.signal,a.writerSettings,g,!1,i,d,r));if(null==e.loaded)return;const f=this._createRenderable(m,o,new z(c,l),a.key,!1);e.renderables.push(f),a.addRenderable(f),this._gpuMemoryUsage+=f.statistics.gpuMemoryUsage}async _addComponentGeometry(e,t,r,s,n,i,o,a){if(null==t.loaded)return 0;const c=this._createComponentBuffers(i);if(null==c)return 0;const l=G(i),d=this._acquireRenderer(l,o||!1,!1),h=k.createBuffer(r.length/3);v(h.position.typedBuffer,r,h.position.typedBufferStride,3),Q(c.meta,n,h.componentIndex,s);const u=!0,g=d.writerSettings,m=await this._updatingHandles.addPromise(this._extractEdges(this._workerAbort.signal,g,h,u,!1,s));if(null==t.loaded)return 0;const f=this._createRenderable(m,c,e,d.key,!0);return t.renderables.push(f),d.addRenderable(f),this._updateAllVerticalOffsets(t,a),f.statistics.gpuMemoryUsage}async _addObjectMergedGeometries(e,t,r,s,n){const i=new Map;let o=0,a=0,c=null;const l=e.geometries.filter(e=>{if(e.edgeIndicesLength<=0||!e.material.supportsEdges)return!1;!c&&e.localOrigin&&(c=e);const t=e.positionAttribute;return a+=t.data.length/t.size,o+=e.edgeIndicesLength,!0});if(0===l.length)return;const d=a>=65536?Uint32Array:Uint16Array,h=o?new d(o):null,u=[];let g=0;l.forEach(e=>{const t=e.positionAttribute,r=e.primitivePositionIndices;let s=i.get(t.data);if(null==s){s=u.length/3;for(let e=0;e<t.data.length;e+=t.size)u.push(t.data[e]),u.push(t.data[e+1]),u.push(t.data[e+2]);i.set(t.data,s)}for(let n=0;n<e.edgeIndicesLength;n++)h[g++]=s+r[n]});const m=c||e.geometries[0],f=p(),_=this._computeModelTransformWithLocalOrigin(e,m,f);for(let p=0;p<e.geometries.length;p++)e.geometries[p].localOrigin=_.origin;const b=new me(new M(u,h,3),f,_);await this._updatingHandles.addPromise(this._addPositionData(t,b,h.length,r,s,n))}_acquireRenderer(e,t,r){const s=H.getKey(e,t,r);let n=this._renderers.get(s);return null==this._strokesTexture&&(this._strokesTexture=W(this.rctx)),n||(n=new H(this.rctx,this.techniques,{type:e,hasSlicePlane:t,strokesTexture:this._strokesTexture,legacy:r,spherical:1===this.viewingMode}),this._renderers.set(s,n)),++n.refCount,n}_removeRenderable(e){ee(e.regular),ee(e.silhouette);const t=this._renderers.get(e.rendererKey);if(t){t.removeRenderable(e),--t.refCount,N(e.transform)&&this._localOrigins.release(e.transform.origin),this._gpuMemoryUsage-=e.statistics.externalMemoryUsage?0:e.statistics.gpuMemoryUsage;for(const t of e.components.meta)e.components.buffer.releaseIndex(t.index)}}_updateObjectCameraDistances(e){const t=e.camera.eye,r=e.camera.viewForward,s=j(),n=e=>{y(s,e.center,t);const n=w(s,r),i=e.radius,o=n<-i?1/0:n<i?0:n-i;e.renderables.forEach(e=>e.distanceToCamera=o)};this._objectEntries.forEach(n),this._pendingDeletions.forEach(n)}get test(){}};function ee(e){e?.vao&&(e.vao.buffer("instances")?.dispose(),e.vao.disposeVAOOnly(),e.vao=null)}function te(e){let t=null,s=null;for(const n of e.geometries){if(n.material.supportsEdges){if(t){if(!r(t,n.transformation))return!1}else t=n.transformation;if(s||null==n.localOrigin){if(null!=s?.localOrigin&&null!=n.localOrigin&&s.localOrigin.id!==n.localOrigin.id)return!1}else s=n}}return!0}e([d({constructOnly:!0})],$.prototype,"rctx",void 0),e([d({constructOnly:!0})],$.prototype,"renderSR",void 0),e([d({constructOnly:!0})],$.prototype,"viewingMode",void 0),e([d({constructOnly:!0})],$.prototype,"techniques",void 0),e([d({constructOnly:!0})],$.prototype,"setNeedsRender",void 0),e([d({constructOnly:!0})],$.prototype,"schedule",void 0),e([d({readOnly:!0})],$.prototype,"_updatingHandles",void 0),e([d({readOnly:!0})],$.prototype,"updating",null),$=e([h("esri.views.3d.webgl-engine.lib.edgeRendering.EdgeView")],$);class re{constructor(e,t,r,s){this.abort=e,this.radius=s,this.renderables=new Array;const n=e?l(e.signal,()=>e.abort()):null;this.loaded=t,this.loaded.then(()=>{null!=this.loaded&&(this.loaded=!0),this.abort=null,n?.remove()}),this.center=O(r)}}class se{constructor(e,t){this.buffer=e,this.meta=t}}class ne{constructor(e,t){this.vao=e,this.lod=t}}class ie{constructor(e,t,r,s,n,i,o,a){this.regular=e,this.silhouette=t,this.statistics=r,this.transform=s,this.edgeTransparency=n,this.objectTransparency=i,this.components=o,this.rendererKey=a,this.distanceToCamera=0,this.visible=!0}}class oe extends ie{}function ae(e){const{meta:t,buffer:r}=e,s=r.textureBuffer,n=s.getVec4Field("color"),o=s.getScalarField("lineWidth"),a=s.getScalarField("extensionLength"),c=s.getScalarField("materialType"),l=s.getScalarField("opacity"),d=s.getScalarField("elevationOffset");for(let h=0;h<t.length;h++){const e=t[h].material,r=t[h].index,s=i(Math.round(e.size*B),0,255),u=i(e.extensionLength,-V,255-V)+V;n.setArray(r,e.color),o.set(r,s),a.set(r,u),c.set(r,e.type),l.set(r,e.opacity),d.set(r,t[h].verticalOffset)}}function ce(e,t,r){let s,n;const i=r.transparency,o=t.camera.perScreenPixelRatio;e.forEachRenderable(i=>{if(!de(i)||!i.visible)return;s??=e.acquireTechnique(t,!1),n??=e.rctx.bindTechnique(s,t,r);const a=ge(i.regular.lod.lengths,i.distanceToCamera,o);e.renderRegularEdges(n,i,r,t,a)},i)}function le(e,t,r){let s,n;const i=r.transparency,o=t.camera.perScreenPixelRatio;e.forEachRenderable(i=>{if(!ue(i)||!i.visible)return;s??=e.acquireTechnique(t,!0),n??=e.rctx.bindTechnique(s,t,r);const a=ge(i.silhouette.lod.lengths,i.distanceToCamera,o);e.renderSilhouetteEdges(n,i,r,t,a)},i)}function de(e){return null!=e.regular}class he extends ie{}function ue(e){return null!=e.silhouette}function ge(e,t,r){const n=t*r,i=s(e,n,!0);return-1===i?n<e[0]?e.length:0:e.length-i}class me{constructor(e,t,r){this.position=e,this.modelTransform=t,this.origin=r}}const fe=f(),pe=()=>Promise.reject();export{$ as EdgeView,oe as RegularRenderable,ie as Renderable,he as SilhouetteRenderable};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{set as t,add as e,scale as r,dist as n}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{areaPoints3d as i}from"../../../../geometry/support/triangle.js";function s(n,o){if(!n)return!1;const{size:s,data:c,indices:f}=n;t(o,0,0,0),t(u,0,0,0);let g=0,d=0;for(let p=0;p<f.length-2;p+=3){const n=f[p]*s,h=f[p+1]*s,j=f[p+2]*s;t(l,c[n],c[n+1],c[n+2]),t(a,c[h],c[h+1],c[h+2]),t(m,c[j],c[j+1],c[j+2]);const x=i(l,a,m);x?(e(l,l,a),e(l,l,m),r(l,l,1/3*x),e(o,o,l),g+=x):(e(u,u,l),e(u,u,a),e(u,u,m),d+=3)}return(0!==d||0!==g)&&(0!==g?(r(o,o,1/g),!0):0!==d&&(r(o,u,1/d),!0))}function c(e,n){if(!e)return!1;const{size:o,data:i,indices:s}=e;t(n,0,0,0);let c=-1,f=0;for(let t=0;t<s.length;t++){const e=s[t]*o;c!==e&&(n[0]+=i[e],n[1]+=i[e+1],n[2]+=i[e+2],f++),c=e}return f>1&&r(n,n,1/f),f>0}function f(o,i,s){if(!o)return!1;t(s,0,0,0),t(u,0,0,0);let c=0,f=0;const{size:m,data:g,indices:d}=o,p=d.length-1,h=p+(i?2:0);for(let t=0;t<h;t+=2){const o=t<p?t+1:0,i=d[t<p?t:p]*m,h=d[o]*m;l[0]=g[i],l[1]=g[i+1],l[2]=g[i+2],a[0]=g[h],a[1]=g[h+1],a[2]=g[h+2],r(l,e(l,l,a),.5);const j=n(l,a);j>0?(e(s,s,r(l,l,j)),c+=j):0===c&&(e(u,u,l),f++)}return 0!==c?(r(s,s,1/c),!0):0!==f&&(r(s,u,1/f),!0)}const l=o(),a=o(),m=o(),u=o();export{f as computeAttachmentOriginLines,c as computeAttachmentOriginPoints,s as computeAttachmentOriginTriangles};
2
+ import{set as t,add as e,scale as r,dist as n}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{areaPoints3d as i}from"../../../../geometry/support/triangle.js";function s(n,o,s=o?.indices){if(!o||!s)return!1;const{size:c,data:f}=o;t(n,0,0,0),t(u,0,0,0);let g=0,d=0;for(let p=0;p<s.length-2;p+=3){const o=s[p]*c,h=s[p+1]*c,j=s[p+2]*c;t(l,f[o],f[o+1],f[o+2]),t(a,f[h],f[h+1],f[h+2]),t(m,f[j],f[j+1],f[j+2]);const x=i(l,a,m);x?(e(l,l,a),e(l,l,m),r(l,l,1/3*x),e(n,n,l),g+=x):(e(u,u,l),e(u,u,a),e(u,u,m),d+=3)}return(0!==d||0!==g)&&(0!==g?(r(n,n,1/g),!0):0!==d&&(r(n,u,1/d),!0))}function c(e,n,o=n?.indices){if(!n||!o)return!1;const{size:i,data:s}=n;t(e,0,0,0);let c=-1,f=0;for(let t=0;t<o.length;t++){const r=o[t]*i;c!==r&&(e[0]+=s[r],e[1]+=s[r+1],e[2]+=s[r+2],f++),c=r}return f>1&&r(e,e,1/f),f>0}function f(o,i,s,c=i?.indices){if(!i||!c)return!1;t(o,0,0,0),t(u,0,0,0);let f=0,m=0;const{size:g,data:d}=i,p=c.length-1,h=p+(s?2:0);for(let t=0;t<h;t+=2){const i=t<p?t+1:0,s=c[t<p?t:p]*g,h=c[i]*g;l[0]=d[s],l[1]=d[s+1],l[2]=d[s+2],a[0]=d[h],a[1]=d[h+1],a[2]=d[h+2],r(l,e(l,l,a),.5);const j=n(l,a);j>0?(e(o,o,r(l,l,j)),f+=j):0===f&&(e(u,u,l),m++)}return 0!==f?(r(o,o,1/f),!0):0!==m&&(r(o,u,1/m),!0)}const l=o(),a=o(),m=o(),u=o();export{f as computeAttachmentOriginLines,c as computeAttachmentOriginPoints,s as computeAttachmentOriginTriangles};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{ZEROS as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColorOrOLID as e,isDepth as r,is2DGeometryOutput as s,isColor as i}from"../core/shaderLibrary/ShaderOutput.js";import a from"../lib/GLMaterial.js";import{DefaultBufferWriter as o}from"./DefaultBufferWriter.js";import{TriangleMaterial as n}from"./TriangleMaterial.js";import{VisualVariablePassParameters as h}from"./VisualVariablePassParameters.js";import{getLayout as p,ColorMaterialTechnique as u}from"../shaders/ColorMaterialTechnique.js";import{ColorMaterialTechniqueConfiguration as c}from"../shaders/ColorMaterialTechniqueConfiguration.js";import{alphaCutoff as l}from"../../../../webscene/support/AlphaCutoff.js";class f extends n{constructor(t){super(t,g),this._configuration=new c,this.supportsEdges=!0,this.produces=new Map([[2,t=>this._isOpaqueMaterialPass(t)],[3,t=>this._isOpaqueNoSSAODepthPass(t)],[4,t=>e(t)&&this._transparent&&this.parameters.writeDepth],[5,t=>r(t)&&this._transparent&&this.parameters.writeDepth],[9,t=>e(t)&&this._transparent&&!this.parameters.writeDepth],[20,t=>s(t)]])}getConfiguration(t,e){return super.getConfiguration(t,e,this._configuration),this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasVertexColors=this.parameters.hasVertexColors&&!this.parameters.vvColor,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this._transparent,this._configuration.discardInvisibleFragments=this._transparent&&!this._isOpaquePass(t)&&this.parameters.discardInvisibleFragments,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=e.hasOccludees,this._configuration.enableOffset=e.enableOffset,this._configuration.terrainDepthTest=e.terrainDepthTest&&i(t),this._configuration.cullAboveTerrain=e.cullAboveTerrain,this._configuration.hasVVColor=!!this.parameters.vvColor,this._configuration.draped=this.parameters.draped,this._configuration.emissionSource=this.hasEmissions?1:0,this._configuration}get visible(){return this.parameters.color[3]>=l}get _transparent(){return this.parameters.color[3]<1||this.parameters.forceTransparentMode}get hasEmissions(){return this.parameters.emissiveStrength>0}_isOpaquePass(t){return i(t)||this._isOpaqueMaterialPass(t)||this._isOpaqueNoSSAODepthPass(t)}_isOpaqueMaterialPass(t){return 8===t||e(t)&&!this._transparent}_isOpaqueNoSSAODepthPass(t){return r(t)&&this.parameters.writeDepth&&!this._transparent}createGLMaterial(t){return new m(t)}createBufferWriter(){return new o(p(this.parameters))}}class m extends a{beginSlot(t){return this.getTechnique(u,t)}}class g extends h{constructor(){super(...arguments),this.color=t,this.forceTransparentMode=!1,this.writeDepth=!0,this.hasVertexColors=!1,this.polygonOffset=!1,this.hasSlicePlane=!1,this.cullFace=0,this.draped=!1,this.discardInvisibleFragments=!1,this.emissiveStrength=0}}export{f as ColorMaterial,g as Parameters};
2
+ import{ZEROS as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColorOrOLID as e,isDepth as s,is2DGeometryOutput as r,isColor as i}from"../core/shaderLibrary/ShaderOutput.js";import a from"../lib/GLMaterial.js";import{DefaultBufferWriter as n}from"./DefaultBufferWriter.js";import{TriangleMaterial as o}from"./TriangleMaterial.js";import{VisualVariablePassParameters as h}from"./VisualVariablePassParameters.js";import{getLayout as p,ColorMaterialTechnique as u}from"../shaders/ColorMaterialTechnique.js";import{ColorMaterialTechniqueConfiguration as c}from"../shaders/ColorMaterialTechniqueConfiguration.js";import{alphaCutoff as l}from"../../../../webscene/support/AlphaCutoff.js";class f extends o{constructor(t){super(t,g),this._configuration=new c,this.supportsEdges=!0,this.produces=new Map([[2,t=>this._isOpaqueMaterialPass(t)],[3,t=>this._isOpaqueNoSSAODepthPass(t)],[4,t=>e(t)&&this._transparent&&this.parameters.writeDepth],[5,t=>s(t)&&this._transparent&&this.parameters.writeDepth],[9,t=>e(t)&&this._transparent&&!this.parameters.writeDepth],[20,t=>r(t)]])}getConfiguration(t,e){return super.getConfiguration(t,e,this._configuration),this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasVertexColors=this.parameters.hasVertexColors&&!this.parameters.vvColor,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this._transparent,this._configuration.discardInvisibleFragments=this._transparent&&!this._isOpaquePass(t)&&this.parameters.discardInvisibleFragments,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=e.hasOccludees,this._configuration.enableOffset=e.enableOffset,this._configuration.terrainDepthTest=e.terrainDepthTest&&i(t),this._configuration.cullAboveTerrain=e.cullAboveTerrain,this._configuration.hasVVColor=!!this.parameters.vvColor,this._configuration.draped=this.parameters.draped,this._configuration.emissionSource=this.hasEmissions?1:0,this._configuration}get visible(){return this.parameters.color[3]>=l}get _transparent(){return this.parameters.color[3]<1||this.parameters.forceTransparentMode}get hasEmissions(){return this.parameters.emissiveStrength>0}_isOpaquePass(t){return i(t)||this._isOpaqueMaterialPass(t)||this._isOpaqueNoSSAODepthPass(t)}_isOpaqueMaterialPass(t){return 8===t||e(t)&&!this._transparent}_isOpaqueNoSSAODepthPass(t){return s(t)&&this.parameters.writeDepth&&!this._transparent}createGLMaterial(t){return new m(t)}createBufferWriter(){return new n(p(this.parameters))}}class m extends a{beginSlot(t){return this.getTechnique(u,t)}}class g extends h{constructor(){super(...arguments),this.color=t,this.forceTransparentMode=!1,this.writeDepth=!0,this.hasVertexColors=!1,this.polygonOffset=!1,this.hasSlicePlane=!1,this.cullFace=0,this.draped=!1,this.discardInvisibleFragments=!1,this.emissiveStrength=0,this.useIndexing=!1}}export{f as ColorMaterial,g as Parameters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{exactEquals as e,set as r,copy as t,normalize as s,subtract as i,length as a,scale as o,dot as n,transformMat3 as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as u,create as c,fromValues as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{is3DGeometryOutputMRT as m,isShadowLike as p,isColor as d}from"../core/shaderLibrary/ShaderOutput.js";import{GLTextureMaterial as f}from"../lib/GLTextureMaterial.js";import{Material as T}from"../lib/Material.js";import{intersectTriangleGeometry as x}from"../lib/RayIntersections.js";import{getVerticalOffsetObject3D as g}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as v}from"./DefaultBufferWriter.js";import{verticalOffsetAtDistance as S}from"./internal/MaterialUtil.js";import{getLayout as b,DefaultMaterialPassParameters as M,DefaultMaterialTechnique as O}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as C}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as w}from"../shaders/RealisticTreeTechnique.js";import{alphaCutoff as y}from"../../../../webscene/support/AlphaCutoff.js";class R extends T{constructor(e,r){super(e,P),this.materialType="default",this.supportsEdges=!0,this.intersectDraped=void 0,this.produces=new Map([[2,e=>(m(e)||p(e))&&!this.transparent],[4,e=>(m(e)||p(e))&&this.transparent&&this.parameters.writeDepth],[9,e=>(m(e)||p(e))&&this.transparent&&!this.parameters.writeDepth]]),this._layout=b(this.parameters),this._configuration=new C(r.spherical)}isVisibleForOutput(e){return 3!==e&&5!==e&&4!==e||this.parameters.castShadows}get visible(){const{layerOpacity:e,colorMixMode:r,opacity:t,externalColor:s}=this.parameters;return e*("replace"===r?1:t)*("ignore"===r||isNaN(s[3])?1:s[3])>=y}get _hasEmissiveBase(){return!!this.parameters.emissiveTextureId||!e(this.parameters.emissiveBaseColor,u)}get hasEmissions(){return this.parameters.emissiveStrength>0&&(0===this.parameters.emissiveSource&&this._hasEmissiveBase||1===this.parameters.emissiveSource)}getConfiguration(e,r){const{parameters:t,_configuration:s}=this,{treeRendering:i,doubleSided:a,doubleSidedType:o}=t;return super.getConfiguration(e,r,this._configuration),s.hasNormalTexture=t.hasNormalTexture,s.hasColorTexture=t.hasColorTexture,s.hasMetallicRoughnessTexture=t.hasMetallicRoughnessTexture,s.hasOcclusionTexture=t.hasOcclusionTexture,s.hasVertexTangents=!i&&t.hasVertexTangents,s.instanced=t.instanced,s.instancedDoublePrecision=t.instancedDoublePrecision,s.hasVVColor=!!t.vvColor,s.hasVVSize=!!t.vvSize,s.hasVerticalOffset=null!=t.verticalOffset,s.hasScreenSizePerspective=null!=t.screenSizePerspective,s.hasSlicePlane=t.hasSlicePlane,s.alphaDiscardMode=t.textureAlphaMode,s.normalType=i?0:t.normalType,s.transparent=this.transparent,s.writeDepth=t.writeDepth,s.customDepthTest=t.customDepthTest??0,s.hasOccludees=r.hasOccludees,s.cullFace=t.hasSlicePlane?0:t.cullFace,s.cullAboveTerrain=r.cullAboveTerrain,s.hasModelTransformation=!i&&null!=t.modelTransformation,s.hasVertexColors=t.hasVertexColors,s.hasSymbolColors=t.hasSymbolColors,s.doubleSidedMode=i?2:a&&"normal"===o?1:a&&"winding-order"===o?2:0,s.instancedFeatureAttribute=t.instancedFeatureAttribute,s.instancedColor=t.instancedColor,d(e)?(s.terrainDepthTest=r.terrainDepthTest,s.receiveShadows=t.receiveShadows,s.receiveAmbientOcclusion=t.receiveAmbientOcclusion&&null!=r.ssao):(s.terrainDepthTest=!1,s.receiveShadows=s.receiveAmbientOcclusion=!1),s.textureAlphaPremultiplied=!!t.textureAlphaPremultiplied,s.pbrMode=t.usePBR?t.isSchematic?2:1:0,s.emissionSource=t.emissionSource,s.offsetBackfaces=!(!this.transparent||!t.offsetTransparentBackfaces),s.enableOffset=r.enableOffset,s.snowCover=r.snowCover>0,s.hasColorTextureTransform=!!t.colorTextureTransformMatrix,s.hasNormalTextureTransform=!!t.normalTextureTransformMatrix,s.hasEmissionTextureTransform=!!t.emissiveTextureTransformMatrix,s.hasOcclusionTextureTransform=!!t.occlusionTextureTransformMatrix,s.hasMetallicRoughnessTextureTransform=!!t.metallicRoughnessTextureTransformMatrix,s}intersect(e,u,c,h,m,p){if(null!=this.parameters.verticalOffset){const e=c.camera;r(N,u[12],u[13],u[14]);let p=null;switch(c.viewingMode){case 1:p=s(_,N);break;case 2:p=t(_,I)}const d=i(z,N,e.eye),f=a(d),T=o(d,d,1/f);let x=null;this.parameters.screenSizePerspective&&(x=n(p,T));const g=S(e,f,this.parameters.verticalOffset,x??0,this.parameters.screenSizePerspective,null);o(p,p,g),l(B,p,c.transform.inverseRotation),h=i(A,h,B),m=i(V,m,B)}x(e,c,h,m,g(c.verticalOffset),p)}createGLMaterial(e){return new D(e)}createBufferWriter(){return new v(this._layout)}get transparent(){return j(this.parameters)}}class D extends f{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){this._material.setParameters({receiveShadows:e.shadowMap.enabled});const t=this._material.parameters;this.updateTexture(t.textureId);const s=e.camera.viewInverseTransposeMatrix;return r(t.origin,s[3],s[7],s[11]),this._material.setParameters(this.textureBindParameters),this.getTechnique(t.treeRendering?w:O,e)}}class P extends M{constructor(){super(...arguments),this.treeRendering=!1,this.hasVertexTangents=!1}get hasNormalTexture(){return!this.treeRendering&&!!this.normalTextureId}get hasColorTexture(){return!!this.textureId}get hasMetallicRoughnessTexture(){return!this.treeRendering&&!!this.metallicRoughnessTextureId}get hasOcclusionTexture(){return!this.treeRendering&&!!this.occlusionTextureId}get emissiveStrength(){return this.emissiveStrengthFromSymbol*this.emissiveStrengthKHR}get emissionSource(){return this.treeRendering?0:null!=this.emissiveTextureId&&0===this.emissiveSource?3:0===this.emissiveSource?2:1}get hasTextures(){return this.hasColorTexture||this.hasNormalTexture||this.hasMetallicRoughnessTexture||3===this.emissionSource||this.hasOcclusionTexture}}function j(e){const{drivenOpacity:r,opacity:t,externalColor:s,layerOpacity:i,texture:a,textureId:o,textureAlphaMode:n,colorMixMode:l}=e,u=s[3];return r||t<1&&"replace"!==l||u<1&&"ignore"!==l||i<1||(null!=a||null!=o)&&1!==n&&2!==n&&"replace"!==l}const A=c(),V=c(),I=h(0,0,1),_=c(),B=c(),N=c(),z=c();export{D as DefaultGLMaterial,R as DefaultMaterial,P as DefaultMaterialParameters,j as isTransparent};
2
+ import{exactEquals as e,set as r,copy as t,normalize as s,subtract as i,length as a,scale as o,dot as n,transformMat3 as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as u,create as c,fromValues as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{is3DGeometryOutputMRT as m,isShadowLike as p,isColor as d}from"../core/shaderLibrary/ShaderOutput.js";import{GLTextureMaterial as f}from"../lib/GLTextureMaterial.js";import{Material as T}from"../lib/Material.js";import{intersectTriangleGeometry as x}from"../lib/RayIntersections.js";import{getVerticalOffsetObject3D as g}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as v}from"./DefaultBufferWriter.js";import{verticalOffsetAtDistance as S}from"./internal/MaterialUtil.js";import{getLayout as b,DefaultMaterialPassParameters as M,DefaultMaterialTechnique as O}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as C}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as w}from"../shaders/RealisticTreeTechnique.js";import{alphaCutoff as y}from"../../../../webscene/support/AlphaCutoff.js";class R extends T{constructor(e,r){super(e,P),this.materialType="default",this.supportsEdges=!0,this.intersectDraped=void 0,this.produces=new Map([[2,e=>(m(e)||p(e))&&!this.transparent],[4,e=>(m(e)||p(e))&&this.transparent&&this.parameters.writeDepth],[9,e=>(m(e)||p(e))&&this.transparent&&!this.parameters.writeDepth]]),this._layout=b(this.parameters),this._configuration=new C(r.spherical)}isVisibleForOutput(e){return 3!==e&&5!==e&&4!==e||this.parameters.castShadows}get visible(){const{layerOpacity:e,colorMixMode:r,opacity:t,externalColor:s}=this.parameters;return e*("replace"===r?1:t)*("ignore"===r||isNaN(s[3])?1:s[3])>=y}get _hasEmissiveBase(){return!!this.parameters.emissiveTextureId||!e(this.parameters.emissiveBaseColor,u)}get hasEmissions(){return this.parameters.emissiveStrength>0&&(0===this.parameters.emissiveSource&&this._hasEmissiveBase||1===this.parameters.emissiveSource)}getConfiguration(e,r){const{parameters:t,_configuration:s}=this,{treeRendering:i,doubleSided:a,doubleSidedType:o}=t;return super.getConfiguration(e,r,this._configuration),s.hasNormalTexture=t.hasNormalTexture,s.hasColorTexture=t.hasColorTexture,s.hasMetallicRoughnessTexture=t.hasMetallicRoughnessTexture,s.hasOcclusionTexture=t.hasOcclusionTexture,s.hasVertexTangents=!i&&t.hasVertexTangents,s.instanced=t.instanced,s.instancedDoublePrecision=t.instancedDoublePrecision,s.hasVVColor=!!t.vvColor,s.hasVVSize=!!t.vvSize,s.hasVerticalOffset=null!=t.verticalOffset,s.hasScreenSizePerspective=null!=t.screenSizePerspective,s.hasSlicePlane=t.hasSlicePlane,s.alphaDiscardMode=t.textureAlphaMode,s.normalType=i?0:t.normalType,s.transparent=this.transparent,s.writeDepth=t.writeDepth,s.customDepthTest=t.customDepthTest??0,s.hasOccludees=r.hasOccludees,s.cullFace=t.hasSlicePlane?0:t.cullFace,s.cullAboveTerrain=r.cullAboveTerrain,s.hasModelTransformation=!i&&null!=t.modelTransformation,s.hasVertexColors=t.hasVertexColors,s.hasSymbolColors=t.hasSymbolColors,s.doubleSidedMode=i?2:a&&"normal"===o?1:a&&"winding-order"===o?2:0,s.instancedFeatureAttribute=t.instancedFeatureAttribute,s.instancedColor=t.instancedColor,d(e)?(s.terrainDepthTest=r.terrainDepthTest,s.receiveShadows=t.receiveShadows,s.receiveAmbientOcclusion=t.receiveAmbientOcclusion&&null!=r.ssao):(s.terrainDepthTest=!1,s.receiveShadows=s.receiveAmbientOcclusion=!1),s.textureAlphaPremultiplied=!!t.textureAlphaPremultiplied,s.pbrMode=t.usePBR?t.isSchematic?2:1:0,s.emissionSource=t.emissionSource,s.offsetBackfaces=!(!this.transparent||!t.offsetTransparentBackfaces),s.enableOffset=r.enableOffset,s.snowCover=r.snowCover>0,s.hasColorTextureTransform=!!t.colorTextureTransformMatrix,s.hasNormalTextureTransform=!!t.normalTextureTransformMatrix,s.hasEmissionTextureTransform=!!t.emissiveTextureTransformMatrix,s.hasOcclusionTextureTransform=!!t.occlusionTextureTransformMatrix,s.hasMetallicRoughnessTextureTransform=!!t.metallicRoughnessTextureTransformMatrix,s}intersect(e,u,c,h,m,p){if(null!=this.parameters.verticalOffset){const e=c.camera;r(N,u[12],u[13],u[14]);let p=null;switch(c.viewingMode){case 1:p=s(_,N);break;case 2:p=t(_,V)}const d=i(z,N,e.eye),f=a(d),T=o(d,d,1/f);let x=null;this.parameters.screenSizePerspective&&(x=n(p,T));const g=S(e,f,this.parameters.verticalOffset,x??0,this.parameters.screenSizePerspective,null);o(p,p,g),l(B,p,c.transform.inverseRotation),h=i(A,h,B),m=i(I,m,B)}x(e,c,h,m,g(c.verticalOffset),p)}createGLMaterial(e){return new D(e)}createBufferWriter(){return new v(this._layout)}get transparent(){return j(this.parameters)}}class D extends f{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){this._material.setParameters({receiveShadows:e.shadowMap.enabled});const t=this._material.parameters;this.updateTexture(t.textureId);const s=e.camera.viewInverseTransposeMatrix;return r(t.origin,s[3],s[7],s[11]),this._material.setParameters(this.textureBindParameters),this.getTechnique(t.treeRendering?w:O,e)}}class P extends M{constructor(){super(...arguments),this.treeRendering=!1,this.useIndexing=!1,this.hasVertexTangents=!1}get hasNormalTexture(){return!this.treeRendering&&!!this.normalTextureId}get hasColorTexture(){return!!this.textureId}get hasMetallicRoughnessTexture(){return!this.treeRendering&&!!this.metallicRoughnessTextureId}get hasOcclusionTexture(){return!this.treeRendering&&!!this.occlusionTextureId}get emissiveStrength(){return this.emissiveStrengthFromSymbol*this.emissiveStrengthKHR}get emissionSource(){return this.treeRendering?0:null!=this.emissiveTextureId&&0===this.emissiveSource?3:0===this.emissiveSource?2:1}get hasTextures(){return this.hasColorTexture||this.hasNormalTexture||this.hasMetallicRoughnessTexture||3===this.emissionSource||this.hasOcclusionTexture}}function j(e){const{drivenOpacity:r,opacity:t,externalColor:s,layerOpacity:i,texture:a,textureId:o,textureAlphaMode:n,colorMixMode:l}=e,u=s[3];return r||t<1&&"replace"!==l||u<1&&"ignore"!==l||i<1||(null!=a||null!=o)&&1!==n&&2!==n&&"replace"!==l}const A=c(),I=c(),V=h(0,0,1),_=c(),B=c(),N=c(),z=c();export{D as DefaultGLMaterial,R as DefaultMaterial,P as DefaultMaterialParameters,j as isTransparent};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{IDENTITY as e}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{BufferViewVec4f as r,BufferViewUint32 as s,BufferViewMat3f as i,BufferViewVec4u8 as o,BufferViewFloat as n}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOLID as a,isColor as u,isDepth as l,isColorHighlightOrOLID as f}from"../core/shaderLibrary/ShaderOutput.js";import c from"../lib/GLMaterial.js";import{assert as h}from"../lib/Util.js";import{DefaultBufferWriter as p}from"./DefaultBufferWriter.js";import{TriangleMaterial as m}from"./TriangleMaterial.js";import{VisualVariablePassParameters as g}from"./VisualVariablePassParameters.js";import{writeAttributes as d,writeBufferVec4 as b,writeColor as x,writeVVFeatureAttribute as y}from"./internal/bufferWriterUtils.js";import{getLayout as j,getTextureLayout as _}from"../shaders/PatternLayouts.js";import{PatternTechnique as v}from"../shaders/PatternTechnique.js";import{PatternTechniqueConfiguration as C}from"../shaders/PatternTechniqueConfiguration.js";import{alphaCutoff as w}from"../../../../webscene/support/AlphaCutoff.js";class B extends m{constructor(e){super(e,P),this._configuration=new C,this.supportsEdges=!0,this.produces=new Map([[2,e=>a(e)],[4,e=>u(e)],[5,e=>l(e)],[20,e=>this.parameters.draped&&f(e)]])}getConfiguration(e,t){return super.getConfiguration(e,t,this._configuration),this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasVertexColors=this.parameters.hasVertexColors&&!this.parameters.vvColor,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.style=this.parameters.style,this._configuration.draped=this.parameters.draped,this._configuration.enableOffset=t.enableOffset,this._configuration.terrainDepthTest=t.terrainDepthTest&&u(e),this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.hasVVColor=!!this.parameters.vvColor,this._configuration.emissionSource=this.hasEmissions?1:0,this._configuration}get visible(){return this.parameters.color[3]>=w}get hasEmissions(){return this.parameters.emissiveStrength>0}createGLMaterial(e){return new F(e)}createBufferWriter(){return new S(j(this.parameters),_(this.parameters))}}class F extends c{beginSlot(e){return this.getTechnique(v,e)}}class S extends p{constructor(e,t){super(e),this.textureBufferLayout=t}elementCountTextureBuffer(e){return e.get("boundingRect")?.indices.length??0}write(e,t,i,o,n,a,u){const l=d(i,o,this.layout,e,t,n,a);for(const s of this.layout.fields.keys()){const e=i.get(s),t=e?.indices;if(e&&t)switch(s){case"uvMapSpace":{h(4===e.size);const t=n.getField(s,r);t&&b(e,t,a);break}}}const{textureBufferLayout:f}=this;if(null==f)return l;h(null!=u,"Using a texture layout, but the texture range for this instance was not provided");const c=u.from;h(1===u.numElements,"Provided more than one texture buffer element per polygon");const p=n.getField("textureElementIndex",s);h(null!=p,"Missing component index field");const m=i.get("position")?.indices.length??0;for(let r=0;r<m;++r)p.set(a+r,c);return l}writeTextureBuffer(t,r,s,a,u){const{textureBufferLayout:l}=this;if(null==l)return;const f=a.getField("boundingRect",i),c=s.get("boundingRect");f&&c&&(h(9===c.size),T(c,t??e,f,u));const p=a.getField("color",o),m=s.get("color");p&&m&&(h(3===m.size||4===m.size),x(m,m.size,p,u));const g=a.getField("colorFeatureAttribute",n),d=s.get("colorFeatureAttribute");g&&d&&(h(1===d.size),y(d,g,u))}}function T(e,t,r,s){const{data:i,indices:o}=e,n=t,a=r.typedBuffer,u=r.typedBufferStride,l=o.length;s*=u;for(let f=0;f<l;++f){const e=9*o[f],t=i[e],r=i[e+1],l=i[e+2];a[s]=n[0]*t+n[4]*r+n[8]*l+n[12],a[s+1]=n[1]*t+n[5]*r+n[9]*l+n[13],a[s+2]=n[2]*t+n[6]*r+n[10]*l+n[14];for(let o=3;o<9;++o)a[s+o]=i[e+o];s+=u}}class P extends g{constructor(){super(...arguments),this.color=t(1,1,1,1),this.emissiveStrength=0,this.hasVertexColors=!1,this.polygonOffset=!1,this.hasSlicePlane=!1,this.cullFace=0,this.hasOccludees=!1,this.style=2,this.draped=!0}}export{P as Parameters,B as PatternMaterial};
2
+ import{IDENTITY as e}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{BufferViewVec4f as r,BufferViewUint32 as s,BufferViewMat3f as i,BufferViewVec4u8 as o,BufferViewFloat as n}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOLID as a,isColor as u,isDepth as l,isColorHighlightOrOLID as f}from"../core/shaderLibrary/ShaderOutput.js";import c from"../lib/GLMaterial.js";import{assert as h}from"../lib/Util.js";import{DefaultBufferWriter as p}from"./DefaultBufferWriter.js";import{TriangleMaterial as m}from"./TriangleMaterial.js";import{VisualVariablePassParameters as g}from"./VisualVariablePassParameters.js";import{writeAttributes as d,writeBufferVec4 as b,writeColor as x,writeVVFeatureAttribute as y}from"./internal/bufferWriterUtils.js";import{getLayout as j,getTextureLayout as _}from"../shaders/PatternLayouts.js";import{PatternTechnique as v}from"../shaders/PatternTechnique.js";import{PatternTechniqueConfiguration as C}from"../shaders/PatternTechniqueConfiguration.js";import{alphaCutoff as w}from"../../../../webscene/support/AlphaCutoff.js";class B extends m{constructor(e){super(e,P),this._configuration=new C,this.supportsEdges=!0,this.produces=new Map([[2,e=>a(e)],[4,e=>u(e)],[5,e=>l(e)],[20,e=>this.parameters.draped&&f(e)]])}getConfiguration(e,t){return super.getConfiguration(e,t,this._configuration),this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasVertexColors=this.parameters.hasVertexColors&&!this.parameters.vvColor,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.style=this.parameters.style,this._configuration.draped=this.parameters.draped,this._configuration.enableOffset=t.enableOffset,this._configuration.terrainDepthTest=t.terrainDepthTest&&u(e),this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.hasVVColor=!!this.parameters.vvColor,this._configuration.emissionSource=this.hasEmissions?1:0,this._configuration}get visible(){return this.parameters.color[3]>=w}get hasEmissions(){return this.parameters.emissiveStrength>0}createGLMaterial(e){return new F(e)}createBufferWriter(){return new S(j(this.parameters),_(this.parameters))}}class F extends c{beginSlot(e){return this.getTechnique(v,e)}}class S extends p{constructor(e,t){super(e),this.textureBufferLayout=t}elementCountTextureBuffer(e){return e.get("boundingRect")?.indices.length??0}write(e,t,i,o,n,a,u){const l=d(i,o,this.layout,e,t,n,a);for(const s of this.layout.fields.keys()){const e=i.get(s),t=e?.indices;if(e&&t)switch(s){case"uvMapSpace":{h(4===e.size);const t=n.getField(s,r);t&&b(e,t,a);break}}}const{textureBufferLayout:f}=this;if(null==f)return l;h(null!=u,"Using a texture layout, but the texture range for this instance was not provided");const c=u.from;h(1===u.numElements,"Provided more than one texture buffer element per polygon");const p=n.getField("textureElementIndex",s);h(null!=p,"Missing component index field");const m=i.get("position")?.indices.length??0;for(let r=0;r<m;++r)p.set(a+r,c);return l}writeTextureBuffer(t,r,s,a,u){const{textureBufferLayout:l}=this;if(null==l)return;const f=a.getField("boundingRect",i),c=s.get("boundingRect");f&&c&&(h(9===c.size),T(c,t??e,f,u));const p=a.getField("color",o),m=s.get("color");p&&m&&(h(3===m.size||4===m.size),x(m,m.size,p,u));const g=a.getField("colorFeatureAttribute",n),d=s.get("colorFeatureAttribute");g&&d&&(h(1===d.size),y(d,g,u))}}function T(e,t,r,s){const{data:i,indices:o}=e,n=t,a=r.typedBuffer,u=r.typedBufferStride,l=o.length;s*=u;for(let f=0;f<l;++f){const e=9*o[f],t=i[e],r=i[e+1],l=i[e+2];a[s]=n[0]*t+n[4]*r+n[8]*l+n[12],a[s+1]=n[1]*t+n[5]*r+n[9]*l+n[13],a[s+2]=n[2]*t+n[6]*r+n[10]*l+n[14];for(let o=3;o<9;++o)a[s+o]=i[e+o];s+=u}}class P extends g{constructor(){super(...arguments),this.color=t(1,1,1,1),this.emissiveStrength=0,this.hasVertexColors=!1,this.polygonOffset=!1,this.hasSlicePlane=!1,this.cullFace=0,this.hasOccludees=!1,this.style=2,this.draped=!0,this.useIndexing=!0}}export{P as Parameters,B as PatternMaterial};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{BufferCache as e}from"./BufferCache.js";import{getStrideForDataType as r}from"./IndexLayout.js";import{BufferObject as t}from"../../../../webgl/BufferObject.js";import{DataType as s}from"../../../../webgl/enums.js";class c{constructor(r){this._cache=new e(r.newCache,e=>{const c=t.createIndex(r,35044);return c.setSize(e,s.UNSIGNED_BYTE),c},"IndexBufferCache")}dispose(){this._cache.dispose()}newIndexBuffer(e,t){const s=r(t)*e,c=this._cache.newBuffer(s);return c.setIndexType(t),c}deleteIndexBuffer(e){this._cache.deleteBuffer(e)}}export{c as IndexBufferCache};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{assert as r}from"../../lib/Util.js";import{DataType as t}from"../../../../webgl/enums.js";class e{constructor(r){this.bufferConstructor=r,this.dataType=r===Uint8Array?t.UNSIGNED_BYTE:r===Uint16Array?t.UNSIGNED_SHORT:t.UNSIGNED_INT}get stride(){return this.bufferConstructor.BYTES_PER_ELEMENT}createView(r,t){return new this.bufferConstructor(r,t)}}const n=new e(Uint8Array),i=new e(Uint16Array),s=new e(Uint32Array);function u(e){switch(e){case t.UNSIGNED_BYTE:return n;case t.UNSIGNED_SHORT:return i;case t.UNSIGNED_INT:case void 0:case null:return s;default:r(!1,`Invalid dataType ${e}`)}}function a(r){return u(r).stride}function o(r){return null==r?s:r<255?n:r<65535?i:s}export{e as IndexLayout,u as getIndexLayoutForDataType,o as getIndexLayoutForMaxIndex,a as getStrideForDataType};