@arcgis/core 4.23.0-next.20220127 → 4.23.0-next.20220131

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 (404) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/0463ba46df855a92b9c0.js +1 -0
  3. package/assets/esri/core/workers/chunks/{8001b0e514bfffe9d7f8.js → 0c15d77d8e817cf45a9a.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{e657ba0cab29f05d02da.js → 0cd0a6eef51fc5b9ea61.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{e4896cf85fb2da8a9cc7.js → 17de7a324dfa7f57ad5d.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{c36f84daa7736878418d.js → 197ec52641aed20029c6.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{0317f37b6c8705b363fd.js → 1c733b7db092a2a88ef3.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{9387db408f496e7dd003.js → 214910032945dd2d86b0.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{d835b2a683fcd8aeeed8.js → 27474b007988855bea9d.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{e93dfdede0532a89ffa5.js → 2b25fc7945a187c2bb9d.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{5948923e07bd1662c24a.js → 37c03cfc19086ce631c6.js} +1 -1
  12. package/assets/esri/core/workers/chunks/44f0c3663b293afbd172.js +1 -0
  13. package/assets/esri/core/workers/chunks/483d5d8593d96d0f0b15.js +1 -0
  14. package/assets/esri/core/workers/chunks/49a1a633bb0d93764aae.js +1 -0
  15. package/assets/esri/core/workers/chunks/{5f1dcb6556820cd0aa31.js → 4be35af7d6babbfe9d84.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{f9ff3eaf4eb324429fbd.js → 5457962a70bd3c557a75.js} +1 -1
  17. package/assets/esri/core/workers/chunks/56657f890e0f79f5d2ad.js +1 -0
  18. package/assets/esri/core/workers/chunks/57856b4a9b8784a69844.js +1 -0
  19. package/assets/esri/core/workers/chunks/{56274b37ff74ca0d68a6.js → 5d11b97b667921d67ae7.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{ba5eb394f098968c22d2.js → 655b55ac0cd533d7e9d7.js} +1 -1
  21. package/assets/esri/core/workers/chunks/70d6bb3c7112cb702389.js +1 -0
  22. package/assets/esri/core/workers/chunks/810a763373d7f78ae398.js +1 -0
  23. package/assets/esri/core/workers/chunks/918bb7a7d901544a7367.js +1 -0
  24. package/assets/esri/core/workers/chunks/949b2269457302ffc64b.js +1 -0
  25. package/assets/esri/core/workers/chunks/{601e697dc7414bda128a.js → 952980635afc7ec81804.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{e8741bf421f80213f1d3.js → 9876a1bae350795fab36.js} +1 -1
  27. package/assets/esri/core/workers/chunks/99619fcb772807c74f3b.js +1 -0
  28. package/assets/esri/core/workers/chunks/{3f343f792fd9f44d6f25.js → b3f5e91116112b0b612a.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{9d77467aa71d345fc1b6.js → bcc01bbffaa3bb5f60a8.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{4c76146014dc15143ba3.js → be588873c16770ceb9ef.js} +1 -1
  31. package/assets/esri/core/workers/chunks/d1fe53b597351dc58305.js +1 -0
  32. package/assets/esri/core/workers/chunks/d98dab12b71912fa397b.js +1 -0
  33. package/assets/esri/core/workers/chunks/{b62e3dccd9f662c0afeb.js → db3c729ce0c0b2690dc9.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{199670a3a564ebe3bd79.js → e218bde41ffbcc5194f5.js} +1 -1
  35. package/assets/esri/core/workers/chunks/e21b211913aefde47e30.js +1 -0
  36. package/assets/esri/core/workers/chunks/{c9cbf8135e95f0f42cd9.js → e287f49184d076af17e2.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{bde1d5b0a7717350986e.js → e4019b63a1fe74e2c842.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{6e6a3c5866e8d8820457.js → eb82ff10cef2bde6e57f.js} +1 -1
  39. package/assets/esri/core/workers/chunks/ebc6f4764b82d4104c65.js +1 -0
  40. package/assets/esri/core/workers/chunks/{842db82733635dbf25cb.js → ee6e0db58dc64410e687.js} +1 -1
  41. package/assets/esri/core/workers/chunks/f0a9f161805fc7a30fc5.js +1 -0
  42. package/assets/esri/core/workers/chunks/f7150547d7e3259a0f29.js +981 -0
  43. package/assets/esri/core/workers/chunks/fc046a15466c25d081ff.js +1 -0
  44. package/assets/esri/images/portal/mediaservice16.png +0 -0
  45. package/assets/esri/libs/vxl/vxlLayer.wasm +0 -0
  46. package/assets/esri/widgets/Directions/t9n/Directions.json +1 -1
  47. package/assets/esri/widgets/Directions/t9n/Directions_ar.json +1 -1
  48. package/assets/esri/widgets/Directions/t9n/Directions_bg.json +1 -1
  49. package/assets/esri/widgets/Directions/t9n/Directions_bs.json +1 -1
  50. package/assets/esri/widgets/Directions/t9n/Directions_ca.json +1 -1
  51. package/assets/esri/widgets/Directions/t9n/Directions_cs.json +1 -1
  52. package/assets/esri/widgets/Directions/t9n/Directions_da.json +1 -1
  53. package/assets/esri/widgets/Directions/t9n/Directions_de.json +1 -1
  54. package/assets/esri/widgets/Directions/t9n/Directions_el.json +1 -1
  55. package/assets/esri/widgets/Directions/t9n/Directions_en.json +1 -1
  56. package/assets/esri/widgets/Directions/t9n/Directions_es.json +1 -1
  57. package/assets/esri/widgets/Directions/t9n/Directions_et.json +1 -1
  58. package/assets/esri/widgets/Directions/t9n/Directions_fi.json +1 -1
  59. package/assets/esri/widgets/Directions/t9n/Directions_fr.json +1 -1
  60. package/assets/esri/widgets/Directions/t9n/Directions_he.json +1 -1
  61. package/assets/esri/widgets/Directions/t9n/Directions_hr.json +1 -1
  62. package/assets/esri/widgets/Directions/t9n/Directions_hu.json +1 -1
  63. package/assets/esri/widgets/Directions/t9n/Directions_id.json +1 -1
  64. package/assets/esri/widgets/Directions/t9n/Directions_it.json +1 -1
  65. package/assets/esri/widgets/Directions/t9n/Directions_ja.json +1 -1
  66. package/assets/esri/widgets/Directions/t9n/Directions_ko.json +1 -1
  67. package/assets/esri/widgets/Directions/t9n/Directions_lt.json +1 -1
  68. package/assets/esri/widgets/Directions/t9n/Directions_lv.json +1 -1
  69. package/assets/esri/widgets/Directions/t9n/Directions_nb.json +1 -1
  70. package/assets/esri/widgets/Directions/t9n/Directions_nl.json +1 -1
  71. package/assets/esri/widgets/Directions/t9n/Directions_pl.json +1 -1
  72. package/assets/esri/widgets/Directions/t9n/Directions_pt-BR.json +1 -1
  73. package/assets/esri/widgets/Directions/t9n/Directions_pt-PT.json +1 -1
  74. package/assets/esri/widgets/Directions/t9n/Directions_ro.json +1 -1
  75. package/assets/esri/widgets/Directions/t9n/Directions_ru.json +1 -1
  76. package/assets/esri/widgets/Directions/t9n/Directions_sk.json +1 -1
  77. package/assets/esri/widgets/Directions/t9n/Directions_sl.json +1 -1
  78. package/assets/esri/widgets/Directions/t9n/Directions_sr.json +1 -1
  79. package/assets/esri/widgets/Directions/t9n/Directions_sv.json +1 -1
  80. package/assets/esri/widgets/Directions/t9n/Directions_th.json +1 -1
  81. package/assets/esri/widgets/Directions/t9n/Directions_tr.json +1 -1
  82. package/assets/esri/widgets/Directions/t9n/Directions_uk.json +1 -1
  83. package/assets/esri/widgets/Directions/t9n/Directions_vi.json +1 -1
  84. package/assets/esri/widgets/Directions/t9n/Directions_zh-CN.json +1 -1
  85. package/assets/esri/widgets/Directions/t9n/Directions_zh-HK.json +1 -1
  86. package/assets/esri/widgets/Directions/t9n/Directions_zh-TW.json +1 -1
  87. package/chunks/BlendLayers.glsl.js +2 -2
  88. package/chunks/ChapmanAtmosphere.glsl.js +17 -17
  89. package/chunks/CheckerBoard.glsl.js +3 -3
  90. package/chunks/Clouds.glsl.js +2 -2
  91. package/chunks/CloudsComposition.glsl.js +1 -1
  92. package/chunks/ColorMaterial.glsl.js +12 -12
  93. package/chunks/ComponentShader.glsl.js +3 -3
  94. package/chunks/Compositing.glsl.js +1 -1
  95. package/chunks/DefaultMaterial.glsl.js +33 -33
  96. package/chunks/EdgeShaderProgram.glsl.js +7 -7
  97. package/chunks/Fog.glsl.js +10 -12
  98. package/chunks/HUDMaterial.glsl.js +2 -2
  99. package/chunks/HighlightComposition.glsl.js +5 -5
  100. package/chunks/ImageMaterial.glsl.js +6 -6
  101. package/chunks/LaserlinePath.glsl.js +8 -8
  102. package/chunks/LineCallout.glsl.js +6 -6
  103. package/chunks/MeasurementArrow.glsl.js +1 -1
  104. package/chunks/NativeLine.glsl.js +1 -1
  105. package/chunks/Path.glsl.js +5 -5
  106. package/chunks/Pattern.glsl.js +9 -9
  107. package/chunks/PointRenderer.glsl.js +14 -14
  108. package/chunks/Precipitation.glsl.js +2 -2
  109. package/chunks/RealisticTree.glsl.js +21 -21
  110. package/chunks/RibbonLine.glsl.js +11 -11
  111. package/chunks/SMAA.glsl.js +40 -40
  112. package/chunks/ShadedColorMaterial.glsl.js +12 -12
  113. package/chunks/ShadowCast.glsl.js +6 -6
  114. package/chunks/ShadowHighlight.glsl.js +4 -4
  115. package/chunks/SimpleAtmosphere.glsl.js +3 -3
  116. package/chunks/SlicePlaneMaterial.glsl.js +3 -3
  117. package/chunks/Stars.glsl.js +3 -3
  118. package/chunks/Terrain.glsl.js +11 -11
  119. package/chunks/TextureOnly.glsl.js +2 -2
  120. package/chunks/WaterSurface.glsl.js +5 -5
  121. package/chunks/boundedPlane.js +1 -1
  122. package/core/accessorSupport/watch.js +1 -1
  123. package/core/loadAll.js +1 -1
  124. package/geometry/support/frustum.js +1 -1
  125. package/geometry/support/plane.js +1 -1
  126. package/interfaces.d.ts +653 -55
  127. package/layers/RouteLayer.d.ts +4 -0
  128. package/layers/RouteLayer.js +1 -1
  129. package/layers/VectorTileLayer.js +1 -1
  130. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  131. package/layers/graphics/featureConversionUtils.js +1 -1
  132. package/layers/support/LayerContingentValuesCache.js +1 -1
  133. package/layers/support/TileInfo.js +1 -1
  134. package/package.json +1 -1
  135. package/portal/PortalItem.js +1 -1
  136. package/rest/support/DirectionLine.d.ts +4 -0
  137. package/rest/support/DirectionPoint.d.ts +4 -0
  138. package/rest/support/RouteInfo.d.ts +4 -0
  139. package/rest/support/RouteInfo.js +1 -1
  140. package/rest/support/RouteSolveResult.d.ts +4 -0
  141. package/smartMapping/statistics/support/predominanceUtils.d.ts +4 -0
  142. package/support/revision.js +1 -1
  143. package/symbols/FillSymbol3DLayer.js +1 -1
  144. package/symbols/IconSymbol3DLayer.js +1 -1
  145. package/symbols/ObjectSymbol3DLayer.js +1 -1
  146. package/symbols/Symbol3D.js +1 -1
  147. package/symbols/WebStyleSymbol.js +1 -1
  148. package/symbols/cim/CIMSymbolRasterizer.js +1 -1
  149. package/symbols/support/IconSymbol3DLayerResource.js +1 -1
  150. package/symbols/support/ObjectSymbol3DLayerResource.js +1 -1
  151. package/symbols/support/Symbol3DAnchorPosition2D.js +1 -1
  152. package/symbols/support/Symbol3DAnchorPosition3D.js +1 -1
  153. package/symbols/support/Symbol3DFillMaterial.js +1 -1
  154. package/symbols/support/Symbol3DIconOutline.js +1 -1
  155. package/symbols/support/Symbol3DOutline.js +1 -1
  156. package/symbols/support/Thumbnail.js +1 -1
  157. package/symbols/support/webStyleSymbolUtils.js +1 -1
  158. package/views/2d/engine/vectorTiles/SchemaHelper.js +1 -1
  159. package/views/2d/layers/RouteLayerView2D.js +1 -1
  160. package/views/3d/environment/ChapmanAtmosphere.glsl.js +1 -1
  161. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  162. package/views/3d/environment/CloudsComposition.glsl.js +1 -1
  163. package/views/3d/environment/CloudsComposition.js +1 -1
  164. package/views/3d/environment/CloudsGenerator.js +1 -1
  165. package/views/3d/environment/Fog.glsl.js +1 -1
  166. package/views/3d/environment/Fog.js +1 -1
  167. package/views/3d/environment/NoiseTextureAtlas.js +1 -1
  168. package/views/3d/environment/PanoramicAtmosphere.js +1 -1
  169. package/views/3d/environment/Precipitation.glsl.js +1 -1
  170. package/views/3d/environment/Precipitation.js +1 -1
  171. package/views/3d/environment/PrecipitationTechnique.js +1 -1
  172. package/views/3d/environment/SimpleAtmosphere.glsl.js +1 -1
  173. package/views/3d/environment/SimpleAtmosphere.js +1 -1
  174. package/views/3d/environment/Stars.glsl.js +1 -1
  175. package/views/3d/environment/Stars.js +1 -1
  176. package/views/3d/interactive/analysisTools/slice/sliceToolUtils.js +1 -1
  177. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  178. package/views/3d/interactive/visualElements/MeasurementAreaVisualElement.js +1 -1
  179. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  180. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  181. package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
  182. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  183. package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
  184. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  185. package/views/3d/layers/I3SMeshView3D.js +1 -1
  186. package/views/3d/layers/VectorTileLayerView3D.js +1 -1
  187. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  188. package/views/3d/layers/graphics/ElevationAligners.js +1 -1
  189. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  190. package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
  191. package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
  192. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  193. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  194. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  195. package/views/3d/layers/graphics/graphicUtils.js +1 -1
  196. package/views/3d/layers/graphics/lineUtils.js +1 -1
  197. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  198. package/views/3d/layers/graphics/polygonUtils.js +1 -1
  199. package/views/3d/layers/graphics/symbolComplexity.js +1 -1
  200. package/views/3d/layers/i3s/I3SBinaryReader.js +1 -1
  201. package/views/3d/layers/i3s/I3SCrossfadeHelper.js +1 -1
  202. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  203. package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
  204. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  205. package/views/3d/layers/i3s/PointRenderer.js +1 -1
  206. package/views/3d/layers/support/HeatmapFeatureProcessor.js +5 -0
  207. package/views/3d/layers/support/overlayImageUtils.js +1 -1
  208. package/views/3d/layers/support/patternUtils.js +1 -1
  209. package/views/3d/state/controllers/local/PinchAndPanController.js +1 -1
  210. package/views/3d/support/FrustumExtentIntersection.js +1 -1
  211. package/views/3d/support/LaserLineRenderer.js +1 -1
  212. package/views/3d/support/LaserlinePathData.js +1 -1
  213. package/views/3d/terrain/OverlayRenderer.js +1 -1
  214. package/views/3d/terrain/PatchGeometryFactory.js +1 -1
  215. package/views/3d/terrain/TerrainRenderer.js +1 -1
  216. package/views/3d/terrain/TerrainSurface.js +1 -1
  217. package/views/3d/terrain/Tile.js +1 -1
  218. package/views/3d/terrain/TileRenderer.js +1 -1
  219. package/views/3d/terrain/terrainUtils.js +1 -1
  220. package/views/3d/terrain/tileUtils.js +1 -1
  221. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  222. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  223. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
  224. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentData.glsl.js +10 -10
  225. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentShader.glsl.js +1 -1
  226. package/views/3d/webgl-engine/collections/Component/SourceGeometry.js +1 -1
  227. package/views/3d/webgl-engine/core/renderPasses/AllRenderPasses.js +1 -1
  228. package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
  229. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  230. package/views/3d/webgl-engine/core/shaderLibrary/ForwardLinearDepth.glsl.js +2 -2
  231. package/views/3d/webgl-engine/core/shaderLibrary/ScreenSizeScaling.glsl.js +2 -2
  232. package/views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.js +2 -2
  233. package/views/3d/webgl-engine/core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js +2 -2
  234. package/views/3d/webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js +4 -4
  235. package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathVertexPosition.glsl.js +1 -1
  236. package/views/3d/webgl-engine/core/shaderLibrary/attributes/PositionAttribute.glsl.js +1 -1
  237. package/views/3d/webgl-engine/core/shaderLibrary/attributes/RibbonVertexPosition.glsl.js +1 -1
  238. package/views/3d/webgl-engine/core/shaderLibrary/attributes/SymbolColor.glsl.js +1 -1
  239. package/views/3d/webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js +3 -3
  240. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexColor.glsl.js +1 -1
  241. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexNormal.glsl.js +6 -6
  242. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexPosition.glsl.js +12 -12
  243. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexTextureCoordinates.glsl.js +4 -4
  244. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VerticalOffset.glsl.js +1 -1
  245. package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +16 -16
  246. package/views/3d/webgl-engine/core/shaderLibrary/default/RealisticTree.glsl.js +1 -1
  247. package/views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js +5 -5
  248. package/views/3d/webgl-engine/core/shaderLibrary/hud/HUDOcclusionPass.glsl.js +3 -3
  249. package/views/3d/webgl-engine/core/shaderLibrary/raster/BasicGrid.glsl.js +2 -2
  250. package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeMaterialColor.glsl.js +6 -6
  251. package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeNormalTexture.glsl.js +2 -2
  252. package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeShadingNormal.glsl.js +10 -11
  253. package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +2 -2
  254. package/views/3d/webgl-engine/core/shaderLibrary/shading/MultipassGeometryTest.glsl.js +2 -2
  255. package/views/3d/webgl-engine/core/shaderLibrary/shading/MultipassTerrainTest.glsl.js +2 -2
  256. package/views/3d/webgl-engine/core/shaderLibrary/shading/Normals.glsl.js +6 -6
  257. package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadBaseColorTexture.glsl.js +4 -4
  258. package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js +6 -6
  259. package/views/3d/webgl-engine/core/shaderLibrary/shading/Reprojection.glsl.js +4 -4
  260. package/views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceReflections.glsl.js +5 -5
  261. package/views/3d/webgl-engine/core/shaderLibrary/shading/VisualVariables.glsl.js +1 -1
  262. package/views/3d/webgl-engine/core/shaderLibrary/shading/Water.glsl.js +10 -10
  263. package/views/3d/webgl-engine/core/shaderLibrary/terrain/Terrain.glsl.js +1 -1
  264. package/views/3d/webgl-engine/core/shaderLibrary/util/BlendLayers.glsl.js +1 -1
  265. package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +4 -4
  266. package/views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js +1 -1
  267. package/views/3d/webgl-engine/lib/Camera.js +1 -1
  268. package/views/3d/webgl-engine/lib/CompositingHelper.js +1 -1
  269. package/views/3d/webgl-engine/lib/DefaultVertexAttributeLocations.js +1 -1
  270. package/views/3d/webgl-engine/lib/DefaultVertexBufferLayouts.js +1 -1
  271. package/views/3d/webgl-engine/lib/Geometry.js +1 -1
  272. package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
  273. package/views/3d/webgl-engine/lib/GridLocalOriginFactory.js +1 -1
  274. package/views/3d/webgl-engine/lib/HighlightHelper.js +1 -1
  275. package/views/3d/webgl-engine/lib/MagnifierHelper.js +1 -1
  276. package/views/3d/webgl-engine/lib/Material.js +1 -1
  277. package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
  278. package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
  279. package/views/3d/webgl-engine/lib/SSAOHelper.js +1 -1
  280. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  281. package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
  282. package/views/3d/webgl-engine/lib/ShadowHighlightHelper.js +1 -1
  283. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  284. package/views/3d/webgl-engine/lib/SmaaRenderPass.js +1 -1
  285. package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
  286. package/views/3d/webgl-engine/lib/Texture.js +1 -1
  287. package/views/3d/webgl-engine/lib/TextureUniformName.js +4 -0
  288. package/views/3d/webgl-engine/lib/UniformName.js +4 -0
  289. package/views/3d/webgl-engine/lib/VertexAttribute.js +5 -0
  290. package/views/3d/webgl-engine/lib/basicInterfaces.js +1 -1
  291. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  292. package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
  293. package/views/3d/webgl-engine/lib/edgeRendering/EdgeShaderTechnique.js +1 -1
  294. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  295. package/views/3d/webgl-engine/lib/edgeRendering/bufferLayouts.js +1 -1
  296. package/views/3d/webgl-engine/lib/lodRendering/InstanceData.js +1 -1
  297. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  298. package/views/3d/webgl-engine/lib/lodRendering/RenderInstanceData.js +1 -1
  299. package/views/3d/webgl-engine/lib/pathGeometryUtils.js +1 -1
  300. package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
  301. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  302. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  303. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  304. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  305. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  306. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  307. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  308. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  309. package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
  310. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  311. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  312. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  313. package/views/3d/webgl-engine/materials/SlicePlaneMaterial.js +1 -1
  314. package/views/3d/webgl-engine/materials/VisualVariableMaterialParameters.js +1 -1
  315. package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
  316. package/views/3d/webgl-engine/materials/internal/DefaultBufferWriter.js +1 -1
  317. package/views/3d/webgl-engine/materials/internal/MaterialUtil.js +1 -1
  318. package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
  319. package/views/3d/webgl-engine/materials/internal/waterMaterialUtils.js +1 -1
  320. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  321. package/views/3d/webgl-engine/shaders/CheckerBoard.glsl.js +1 -1
  322. package/views/3d/webgl-engine/shaders/CheckerBoardTechnique.js +1 -1
  323. package/views/3d/webgl-engine/shaders/ColorMaterial.glsl.js +1 -1
  324. package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
  325. package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
  326. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  327. package/views/3d/webgl-engine/shaders/HUDMaterial.glsl.js +1 -1
  328. package/views/3d/webgl-engine/shaders/HUDMaterialTechnique.js +1 -1
  329. package/views/3d/webgl-engine/shaders/HighlightComposition.glsl.js +1 -1
  330. package/views/3d/webgl-engine/shaders/HighlightTechnique.js +1 -1
  331. package/views/3d/webgl-engine/shaders/ImageMaterial.glsl.js +1 -1
  332. package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
  333. package/views/3d/webgl-engine/shaders/LaserlinePath.glsl.js +1 -1
  334. package/views/3d/webgl-engine/shaders/LaserlinePathTechnique.js +1 -1
  335. package/views/3d/webgl-engine/shaders/LineCallout.glsl.js +1 -1
  336. package/views/3d/webgl-engine/shaders/LineCalloutTechnique.js +1 -1
  337. package/views/3d/webgl-engine/shaders/Magnifier.glsl.js +1 -1
  338. package/views/3d/webgl-engine/shaders/MeasurementArrow.glsl.js +1 -1
  339. package/views/3d/webgl-engine/shaders/NativeLine.glsl.js +1 -1
  340. package/views/3d/webgl-engine/shaders/Pattern.glsl.js +1 -1
  341. package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
  342. package/views/3d/webgl-engine/shaders/PointRenderer.glsl.js +1 -1
  343. package/views/3d/webgl-engine/shaders/RealisticTreeTechnique.js +1 -1
  344. package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
  345. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  346. package/views/3d/webgl-engine/shaders/SMAA.glsl.js +1 -1
  347. package/views/3d/webgl-engine/shaders/ShadedColorMaterial.glsl.js +1 -1
  348. package/views/3d/webgl-engine/shaders/ShadedColorMaterialTechnique.js +1 -1
  349. package/views/3d/webgl-engine/shaders/ShadowCastTechnique.js +1 -1
  350. package/views/3d/webgl-engine/shaders/ShadowHighlightTechnique.js +1 -1
  351. package/views/3d/webgl-engine/shaders/SlicePlaneMaterial.glsl.js +1 -1
  352. package/views/3d/webgl-engine/shaders/WaterSurface.glsl.js +1 -1
  353. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/AdjustProjectedPosition.glsl.js +10 -10
  354. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/DiscardShortEdges.glsl.js +1 -1
  355. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/EdgeShaderProgram.glsl.js +1 -1
  356. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/EdgeUtil.glsl.js +21 -21
  357. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/LineAmplitude.glsl.js +6 -6
  358. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/LineOffset.glsl.js +13 -13
  359. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/UnpackAttributes.glsl.js +6 -6
  360. package/views/SceneView.js +1 -1
  361. package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
  362. package/views/support/WatchUpdatingTracking.js +1 -1
  363. package/views/webgl/BufferObject.js +1 -1
  364. package/views/webgl/InstanceCounter.js +1 -1
  365. package/views/webgl/Program.js +1 -1
  366. package/webdoc/support/{Thumbnail.js → SlideThumbnail.js} +1 -1
  367. package/webmap/Bookmark.js +1 -1
  368. package/webmap/Version.js +1 -1
  369. package/webscene/Slide.js +1 -1
  370. package/webscene/Version.js +1 -1
  371. package/webscene/support/SlideVisibleLayer.js +1 -1
  372. package/widgets/BasemapGallery/support/basemapCompatibilityUtils.js +1 -1
  373. package/widgets/Bookmarks/BookmarksViewModel.js +1 -1
  374. package/widgets/Bookmarks.js +1 -1
  375. package/widgets/Directions/DirectionsViewModel.js +1 -1
  376. package/widgets/Directions/support/directionsUtils.js +1 -1
  377. package/widgets/Directions/support/resources.js +1 -1
  378. package/widgets/Directions.js +1 -1
  379. package/widgets/FeatureTemplates/FeatureTemplatesViewModel.js +1 -1
  380. package/widgets/Search/support/locatorUtils.js +1 -1
  381. package/widgets/Search.js +1 -1
  382. package/widgets/TimeSlider.js +1 -1
  383. package/assets/esri/core/workers/chunks/12c0cabb6c59e65d8546.js +0 -1
  384. package/assets/esri/core/workers/chunks/322d917e8cb398816a93.js +0 -1
  385. package/assets/esri/core/workers/chunks/392b6382e06652dd4c80.js +0 -1
  386. package/assets/esri/core/workers/chunks/3aa73119b055e05bbbeb.js +0 -1
  387. package/assets/esri/core/workers/chunks/52ea678ba1da0e349919.js +0 -1
  388. package/assets/esri/core/workers/chunks/5ee497d5d7b0e580526a.js +0 -1
  389. package/assets/esri/core/workers/chunks/663ad15b86936eb06b69.js +0 -1
  390. package/assets/esri/core/workers/chunks/83b8fec1650e061aaa56.js +0 -1
  391. package/assets/esri/core/workers/chunks/9796d54ff12b6429164a.js +0 -1
  392. package/assets/esri/core/workers/chunks/c093dff4592832ac0973.js +0 -1
  393. package/assets/esri/core/workers/chunks/d07440469fe7d181c4fd.js +0 -1
  394. package/assets/esri/core/workers/chunks/dbf192b4ce7e608610f6.js +0 -1
  395. package/assets/esri/core/workers/chunks/de6cff7b6cbbf99b20d1.js +0 -981
  396. package/assets/esri/core/workers/chunks/dee9929d95e9fe26929c.js +0 -1
  397. package/assets/esri/core/workers/chunks/e12d91ef44d6f879a02a.js +0 -1
  398. package/assets/esri/core/workers/chunks/e59764ee8cf25d4f74e2.js +0 -1
  399. package/assets/esri/core/workers/chunks/fc7e31d87555beb63291.js +0 -1
  400. package/assets/esri/core/workers/chunks/fff6b0338f06dad0c45d.js +0 -1
  401. package/widgets/Directions/support/CostSummary.js +0 -5
  402. package/widgets/Directions/support/RouteSection.js +0 -5
  403. package/widgets/Directions/support/RouteSections.js +0 -5
  404. package/widgets/Directions/support/maneuverUtils.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{isNone as e}from"../../../../../core/maybe.js";import{isAborted as t,throwIfAborted as s}from"../../../../../core/promiseUtils.js";import{I as a,c as n}from"../../../../../chunks/mat4f64.js";import{a as i}from"../../../../../chunks/vec2f64.js";import{f as r,d as l,m as o}from"../../../../../chunks/vec3.js";import{c}from"../../../../../chunks/vec3f64.js";import{c as h}from"../../../../../chunks/vec4f64.js";import d from"../../../support/debugFlags.js";import{glLayout as u}from"../../../support/buffer/glUtil.js";import{bindOutputHighlight as _}from"../../core/shaderLibrary/output/OutputHighlight.glsl.js";import m from"../Camera.js";import{Default3D as p}from"../DefaultVertexAttributeLocations.js";import{IntersectorType as f}from"../IntersectorInterfaces.js";import{DepthOrder as g}from"../Octree.js";import{RenderPass as I}from"../RenderPass.js";import{RenderSlot as D}from"../RenderSlot.js";import{assert as v}from"../Util.js";import{InstanceData as y,StateFlags as E}from"./InstanceData.js";import{InstanceOctree as T}from"./InstanceOctree.js";import{LevelSelector as R}from"./LevelSelector.js";import{LodLevel as A}from"./LodLevel.js";import{RenderInstanceData as C}from"./RenderInstanceData.js";import{getInstanceBufferLayout as b}from"../../materials/DefaultMaterial.js";import{colorMixModes as L}from"../../materials/internal/MaterialUtil.js";import{encodeDoubleVec3 as S}from"../../materials/renderers/utils.js";import{bindVertexBufferLayout as U,unbindVertexBufferLayout as x}from"../../../../webgl/Util.js";let P=function(e){const t=e.baseBoundingSphere.radius,s=e.levels.map((e=>e.minScreenSpaceRadius));return new R(t,s)};function O(e){P=e}class H{constructor(e,t,s,a){this.type=f.LOD,this.isGround=!1,this._inverseViewport=i(),this._levels=[],this._defaultRenderInstanceData=[],this._highlightRenderInstanceData=[],this._instanceIndex=0,this._slicePlane=!1,this._enableLevelSelection=!0,this._lastCamera=new m,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this.slots=[D.OPAQUE_PLUGIN,D.TRANSPARENT_PLUGIN],this.canRender=!0,this._symbol=e,this._optionalFields=t,this._metadata=s,this._instanceBufferLayout=b({instancedDoublePrecision:!0,instanced:t}),this._glInstanceBufferLayout=u(this._instanceBufferLayout,1),this._instanceData=new y(this._optionalFields,a),this._instanceData.on("instance-added",(()=>this._requestUpdateCycle())),this._instanceData.on("instance-removed",(()=>this._requestUpdateCycle())),this._instanceData.on("instance-transform-changed",(e=>{this._requestUpdateCycle(),this._metadata.notifyGraphicGeometryChanged(e.index)})),this._instanceData.on("instance-visibility-changed",(e=>{this._requestUpdateCycle(!0),this._metadata.notifyGraphicVisibilityChanged(e.index)})),this._instanceData.on("instance-highlight-changed",(()=>this._requestUpdateCycle(!0))),this._enableLevelSelection=this._symbol.levels.length>1}get levels(){return this._levels}get baseBoundingBox(){return this._levels[this._levels.length-1].boundingBox}get baseBoundingSphere(){return this._levels[this._levels.length-1].boundingSphere}get baseMaterial(){return this._levels[this._levels.length-1].components[0].material}get slicePlaneEnabled(){return this._slicePlane}set slicePlaneEnabled(e){this._slicePlane=e}get layerUid(){return this._metadata.layerUid}get instanceData(){return this._instanceData}get memoryUsage(){const e={cpu:0,gpu:0};return this._defaultRenderInstanceData.forEach((t=>{const s=t.memoryUsage;e.cpu+=s.cpu,e.gpu+=s.gpu})),this._highlightRenderInstanceData.forEach((t=>{const s=t.memoryUsage;e.cpu+=s.cpu,e.gpu+=s.gpu})),e}get renderStats(){const e=this._instanceData.size,t=[];return this._levels.forEach(((e,s)=>{const a=this._defaultRenderInstanceData[s],n=this._highlightRenderInstanceData[s],i=a.size+n.size,r=e.triangleCount;t.push({renderedInstances:i,renderedTriangles:i*r,trianglesPerInstance:r})})),{totalInstances:e,renderedInstances:t.reduce(((e,t)=>e+t.renderedInstances),0),renderedTriangles:t.reduce(((e,t)=>e+t.renderedTriangles),0),levels:t}}async initializeRenderContext(e,a){this._context=e;const n=e.renderContext.rctx,i=await Promise.allSettled(this._symbol.levels.map((t=>(this._defaultRenderInstanceData.push(new C(n,this._instanceBufferLayout)),this._highlightRenderInstanceData.push(new C(n,this._instanceBufferLayout)),A.create(e,t,a))))),r=i.map((e=>"fulfilled"===e.status?e.value:null)).filter((e=>e));if(t(a)||r.length!==i.length){r.forEach((e=>e.destroy())),s(a);for(const e of i)if("rejected"===e.status)throw e.reason}this._levels=r,this._levelSelector=P(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach((e=>e.destroy())),this._defaultRenderInstanceData.forEach((e=>e.destroy())),this._highlightRenderInstanceData.forEach((e=>e.destroy()))}get needsTransparentPass(){return this._levels.some((e=>e.components.some((e=>e.material.requiresSlot(D.TRANSPARENT_MATERIAL)))))}get needsHighlight(){return this._highlightRenderInstanceData.some((e=>e.size>0))}prepareRender(e,t){if(d.LOD_INSTANCE_RENDERER_DISABLE_UPDATES)return;if(this._enableLevelSelection){const e=t.equals(this._lastCamera);this._lastCamera.copyFrom(t),e||this._requestUpdateCycle()}const s=this._needFullCycle?this._instanceData.size:2e3;this._needFullCycle=!1,this._updateInstances(t,s),this.needsUpdates&&this._context.requestRender()}render(e){var t,s,n,i;const r=e.slot===D.OPAQUE_PLUGIN?D.OPAQUE_MATERIAL:e.slot===D.TRANSPARENT_PLUGIN?D.TRANSPARENT_MATERIAL:null;if(!r||!this.baseMaterial.isVisible()||!this.baseMaterial.isVisibleInPass(e.pass))return;const l=e.camera;this._inverseViewport[0]=1/l.fullViewport[2],this._inverseViewport[1]=1/l.fullViewport[3];const o={slot:r,origin:[0,0,0],camera:l,inverseViewport:this._inverseViewport,shadowMap:e.shadowMap,shadowMappingEnabled:e.shadowMap.enabled,ssaoHelper:e.ssaoHelper,ssaoEnabled:e.ssaoHelper.enabled,screenToWorldRatio:null,screenToPCSRatio:null,slicePlane:e.sliceHelper&&e.sliceHelper.plane,hudVisibilityTexture:null!=(t=null==(s=e.offscreenRenderingHelper)?void 0:s.hudVisibilityTexture)?t:null,highlightDepthTexture:null!=(n=null==(i=e.offscreenRenderingHelper)?void 0:i.depthTexture)?n:null,hasOccludees:!1,linearDepthTexture:null,lastFrameColorTexture:null,reprojectionMatrix:a,ssrEnabled:!1,lighting:e.scenelightingData,transparencyPassType:e.transparencyPassType,terrainLinearDepthTexture:e.multipassTerrainParams.terrainLinearDepthTexture,geometryLinearDepthTexture:e.multipassGeometryParams.geometryLinearDepthTexture,multipassTerrainEnabled:e.multipassTerrainParams.multipassTerrainEnabled,cullAboveGround:e.multipassTerrainParams.cullAboveGround,multipassGeometryEnabled:e.multipassGeometryParams.multipassGeometryEnabled,highlightColorTexture:null,cloudsCompositionParams:null};e.rctx.bindVAO();const c=e.pass!==I.MATERIAL_HIGHLIGHT&&e.pass!==I.MATERIAL_DEPTH_SHADOWMAP_HIGHLIGHT,h=e.pass!==I.MATERIAL_DEPTH_SHADOWMAP_DEFAULT;c&&this._renderComponents(e,r,o,this._defaultRenderInstanceData),h&&this._renderComponents(e,r,o,this._highlightRenderInstanceData)}intersect(e,t,s,a){if(!this.baseMaterial.isVisible())return;const n=c();r(n,a,s);const i=n=>{this._instanceData.getCombinedModelTransform(n,N),e.transform.set(N),o(G,s,e.transform.inverse),o(F,a,e.transform.inverse);const i=this._instanceData.getState(n),r=this._instanceData.getLodLevel(n);v(i&E.ACTIVE,"invalid instance state"),v(r>=0&&r<this._levels.length,"invaid lod level"),this._levels[r].intersect(e,t,G,F,n,this._metadata)};this.baseMaterial.parameters.verticalOffset?this.octree.forEach(i):this.octree.forEachAlongRay(s,n,i)}queryDepthRange(e){return this._queryDepthRangeOctree(e)}notifyShaderTransformationChanged(){this._invalidateOctree()}_requestUpdateCycle(e=!1){this._updateCyclesWithStaticCamera=-1,e&&(this._needFullCycle=!0),this.needsUpdates&&this._context.requestRender()}get needsUpdates(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}get octree(){return this._octree||(this._octree=this._buildOctree()),this._octree}_invalidateOctree(){this._octree&&(this._octree.destroy(),this._octree=null)}_buildOctree(){const e=new T(this._instanceData,this.baseBoundingSphere),t=this._instanceData,s=t.view?t.view.state:null;for(let a=0;a<this._instanceData.capacity;++a){s.get(a)&E.ACTIVE&&e.addInstance(a)}return e}_queryDepthRangeOctree(e){const t=e.eye,s=e.viewForward,a=this.octree.findClosest(s,g.FRONT_TO_BACK,e.frustum),n=this.octree.findClosest(s,g.BACK_TO_FRONT,e.frustum);if(null!=a&&null!=n){this._instanceData.view.boundingSphere.getVec(a,j),r(j,j,t);const i=l(j,s)-j[3];this._instanceData.view.boundingSphere.getVec(n,j),r(j,j,t);const o=l(j,s)+j[3];return{near:Math.max(e.near,i),far:Math.min(e.far,o)}}return{near:1/0,far:-1/0}}_startUpdateCycle(){this._updateCyclesWithStaticCamera++,this._defaultRenderInstanceData.forEach((e=>{e.startUpdateCylce()})),this._highlightRenderInstanceData.forEach((e=>{e.startUpdateCylce()})),this.needsUpdates&&this._context.requestRender()}_updateInstances(e,t){const s=this._enableLevelSelection,a=this._levelSelector;a.updateCamera(e),this._defaultRenderInstanceData.forEach((e=>{e.beginUpdate()})),this._highlightRenderInstanceData.forEach((e=>{e.beginUpdate()}));const n=this._instanceData,i=this._instanceData.view,r=n.size,l=n.capacity;let o=this._instanceIndex;t=Math.min(r,t);for(let c=0;c<t;++c){0===o&&this._startUpdateCycle();const e=i.state.get(o);let r=0;if(!(e&E.ALLOCATED)){o=(o+1)%l,t++;continue}const c=i.lodLevel.get(o);if(e&E.DEFAULT_ACTIVE&&this._defaultRenderInstanceData[c].freeTail(),e&E.HIGHLIGHT_ACTIVE&&this._highlightRenderInstanceData[c].freeTail(),e&E.REMOVE)n.freeInstance(o);else if(e&E.VISIBLE){let t=0;s&&(i.modelOrigin.getVec(o,w),t=a.selectLevel(w,n.getCombinedMedianScaleFactor(o))),r=e&~(E.ACTIVE|E.TRANSFORM_CHANGED),t>=0&&(e&E.HIGHLIGHT?(M(this._highlightRenderInstanceData[t],i,o),r|=E.HIGHLIGHT_ACTIVE):(M(this._defaultRenderInstanceData[t],i,o),r|=E.DEFAULT_ACTIVE)),i.state.set(o,r),i.lodLevel.set(o,t)}else r=e&~(E.ACTIVE|E.TRANSFORM_CHANGED),i.state.set(o,r);if(this._octree){const t=!!(e&E.ACTIVE),s=!!(r&E.ACTIVE);!t&&s?this._octree.addInstance(o):t&&!s?this._octree.removeInstance(o):t&&s&&e&E.TRANSFORM_CHANGED&&(this._octree.removeInstance(o),this._octree.addInstance(o))}o=(o+1)%l}this._instanceIndex=o,this._defaultRenderInstanceData.forEach((e=>{e.endUpdate()})),this._highlightRenderInstanceData.forEach((e=>{e.endUpdate()}))}_renderComponents(e,t,s,a){this.levels.forEach(((n,i)=>{n.components.forEach((n=>{this._renderComponent(e,t,s,a[i],n,i)}))}))}_renderComponent(t,s,a,n,i,r){if(0===n.size||!i.material.requiresSlot(s))return;const{rctx:l,pass:o}=t,c=i.glMaterials.load(l,o);if(e(c))return;const h=l.capabilities.instancing,u=c.beginSlot(a),m=u.program;u.bindPipelineState(l,s),l.useProgram(m),c.bind(a,u),l.bindVAO(i.vao),u.ensureAttributeLocations(i.vao),t.isHighlightPass&&_(m,a),u.bindDraw(a),d.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&t.pass===I.MATERIAL&&(m.setUniform4fv("externalColor",B[Math.min(r,B.length-1)]),m.setUniform1i("colorMixMode",L.replace));const f=n.capacity,g=n.headIndex,D=n.tailIndex,y=n.firstIndex,E=this._glInstanceBufferLayout,T=(e,t)=>{U(l,p,n.buffer,E,e),h.drawArraysInstanced(u.primitiveType,0,i.vertexCount,t-e),x(l,p,n.buffer,E)};i.material.parameters.transparent&&null!=y?g>D?(v(y>=D&&y<=g,"invalid firstIndex"),T(y,g),T(D,y)):g<D&&(y<=g?(v(y>=0&&y<=g,"invalid firstIndex"),T(y,g),T(D,f),T(0,y)):(v(y>=D&&y<=f,"invalid firstIndex"),T(y,f),T(0,g),T(D,y))):g>D?T(D,g):g<D&&(T(0,g),T(D,f)),l.bindVAO(null)}}function M(e,t,s){const a=e.allocateHead();V(t,s,e.view,a)}function V(e,t,s,a){S(e.modelOrigin,t,s.modelOriginHi,s.modelOriginLo,a),s.model.copyFrom(a,e.model,t),s.modelNormal.copyFrom(a,e.modelNormal,t),e.color&&s.color&&s.color.copyFrom(a,e.color,t),e.featureAttribute&&s.featureAttribute&&s.featureAttribute.copyFrom(a,e.featureAttribute,t)}const w=c(),j=h(),N=n(),G=c(),F=c(),B=[[1,0,1,1],[0,0,1,1],[0,1,0,1],[1,1,0,1],[1,0,0,1]];export{H as LodRenderer,O as setLevelSelectorFactory};
5
+ import{isNone as e}from"../../../../../core/maybe.js";import{isAborted as t,throwIfAborted as s}from"../../../../../core/promiseUtils.js";import{I as a,c as n}from"../../../../../chunks/mat4f64.js";import{a as i}from"../../../../../chunks/vec2f64.js";import{f as r,d as l,m as o}from"../../../../../chunks/vec3.js";import{c}from"../../../../../chunks/vec3f64.js";import{c as h}from"../../../../../chunks/vec4f64.js";import d from"../../../support/debugFlags.js";import{glLayout as u}from"../../../support/buffer/glUtil.js";import{bindOutputHighlight as _}from"../../core/shaderLibrary/output/OutputHighlight.glsl.js";import m from"../Camera.js";import{Default3D as p}from"../DefaultVertexAttributeLocations.js";import{IntersectorType as f}from"../IntersectorInterfaces.js";import{DepthOrder as g}from"../Octree.js";import{RenderPass as I}from"../RenderPass.js";import{RenderSlot as D}from"../RenderSlot.js";import{assert as T}from"../Util.js";import{InstanceData as v,StateFlags as y}from"./InstanceData.js";import{InstanceOctree as E}from"./InstanceOctree.js";import{LevelSelector as R}from"./LevelSelector.js";import{LodLevel as A}from"./LodLevel.js";import{RenderInstanceData as C}from"./RenderInstanceData.js";import{getInstanceBufferLayout as b}from"../../materials/DefaultMaterial.js";import{colorMixModes as L}from"../../materials/internal/MaterialUtil.js";import{encodeDoubleVec3 as S}from"../../materials/renderers/utils.js";import{bindVertexBufferLayout as U,unbindVertexBufferLayout as x}from"../../../../webgl/Util.js";let O=function(e){const t=e.baseBoundingSphere.radius,s=e.levels.map((e=>e.minScreenSpaceRadius));return new R(t,s)};function P(e){O=e}class H{constructor(e,t,s,a){this.type=f.LOD,this.isGround=!1,this._inverseViewport=i(),this._levels=[],this._defaultRenderInstanceData=[],this._highlightRenderInstanceData=[],this._instanceIndex=0,this._slicePlane=!1,this._enableLevelSelection=!0,this._lastCamera=new m,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this.slots=[D.OPAQUE_PLUGIN,D.TRANSPARENT_PLUGIN],this.canRender=!0,this._symbol=e,this._optionalFields=t,this._metadata=s,this._instanceBufferLayout=b({instancedDoublePrecision:!0,instanced:t}),this._glInstanceBufferLayout=u(this._instanceBufferLayout,1),this._instanceData=new v(this._optionalFields,a),this._instanceData.on("instance-added",(()=>this._requestUpdateCycle())),this._instanceData.on("instance-removed",(()=>this._requestUpdateCycle())),this._instanceData.on("instance-transform-changed",(e=>{this._requestUpdateCycle(),this._metadata.notifyGraphicGeometryChanged(e.index)})),this._instanceData.on("instance-visibility-changed",(e=>{this._requestUpdateCycle(!0),this._metadata.notifyGraphicVisibilityChanged(e.index)})),this._instanceData.on("instance-highlight-changed",(()=>this._requestUpdateCycle(!0))),this._enableLevelSelection=this._symbol.levels.length>1}get levels(){return this._levels}get baseBoundingBox(){return this._levels[this._levels.length-1].boundingBox}get baseBoundingSphere(){return this._levels[this._levels.length-1].boundingSphere}get baseMaterial(){return this._levels[this._levels.length-1].components[0].material}get slicePlaneEnabled(){return this._slicePlane}set slicePlaneEnabled(e){this._slicePlane=e}get layerUid(){return this._metadata.layerUid}get instanceData(){return this._instanceData}get memoryUsage(){const e={cpu:0,gpu:0};return this._defaultRenderInstanceData.forEach((t=>{const s=t.memoryUsage;e.cpu+=s.cpu,e.gpu+=s.gpu})),this._highlightRenderInstanceData.forEach((t=>{const s=t.memoryUsage;e.cpu+=s.cpu,e.gpu+=s.gpu})),e}get renderStats(){const e=this._instanceData.size,t=[];return this._levels.forEach(((e,s)=>{const a=this._defaultRenderInstanceData[s],n=this._highlightRenderInstanceData[s],i=a.size+n.size,r=e.triangleCount;t.push({renderedInstances:i,renderedTriangles:i*r,trianglesPerInstance:r})})),{totalInstances:e,renderedInstances:t.reduce(((e,t)=>e+t.renderedInstances),0),renderedTriangles:t.reduce(((e,t)=>e+t.renderedTriangles),0),levels:t}}async initializeRenderContext(e,a){this._context=e;const n=e.renderContext.rctx,i=await Promise.allSettled(this._symbol.levels.map((t=>(this._defaultRenderInstanceData.push(new C(n,this._instanceBufferLayout)),this._highlightRenderInstanceData.push(new C(n,this._instanceBufferLayout)),A.create(e,t,a))))),r=i.map((e=>"fulfilled"===e.status?e.value:null)).filter((e=>e));if(t(a)||r.length!==i.length){r.forEach((e=>e.destroy())),s(a);for(const e of i)if("rejected"===e.status)throw e.reason}this._levels=r,this._levelSelector=O(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach((e=>e.destroy())),this._defaultRenderInstanceData.forEach((e=>e.destroy())),this._highlightRenderInstanceData.forEach((e=>e.destroy()))}get needsTransparentPass(){return this._levels.some((e=>e.components.some((e=>e.material.requiresSlot(D.TRANSPARENT_MATERIAL)))))}get needsHighlight(){return this._highlightRenderInstanceData.some((e=>e.size>0))}prepareRender(e,t){if(d.LOD_INSTANCE_RENDERER_DISABLE_UPDATES)return;if(this._enableLevelSelection){const e=t.equals(this._lastCamera);this._lastCamera.copyFrom(t),e||this._requestUpdateCycle()}const s=this._needFullCycle?this._instanceData.size:2e3;this._needFullCycle=!1,this._updateInstances(t,s),this.needsUpdates&&this._context.requestRender()}render(e){var t,s,n,i;const r=e.slot===D.OPAQUE_PLUGIN?D.OPAQUE_MATERIAL:e.slot===D.TRANSPARENT_PLUGIN?D.TRANSPARENT_MATERIAL:null;if(!r||!this.baseMaterial.isVisible()||!this.baseMaterial.isVisibleInPass(e.pass))return;const l=e.camera;this._inverseViewport[0]=1/l.fullViewport[2],this._inverseViewport[1]=1/l.fullViewport[3];const o={slot:r,origin:[0,0,0],camera:l,inverseViewport:this._inverseViewport,shadowMap:e.shadowMap,shadowMappingEnabled:e.shadowMap.enabled,ssaoHelper:e.ssaoHelper,ssaoEnabled:e.ssaoHelper.enabled,screenToWorldRatio:null,screenToPCSRatio:null,slicePlane:e.sliceHelper&&e.sliceHelper.plane,hudVisibilityTexture:null!=(t=null==(s=e.offscreenRenderingHelper)?void 0:s.hudVisibilityTexture)?t:null,highlightDepthTexture:null!=(n=null==(i=e.offscreenRenderingHelper)?void 0:i.depthTexture)?n:null,hasOccludees:!1,linearDepthTexture:null,lastFrameColorTexture:null,reprojectionMatrix:a,ssrEnabled:!1,lighting:e.scenelightingData,transparencyPassType:e.transparencyPassType,terrainLinearDepthTexture:e.multipassTerrainParams.terrainLinearDepthTexture,geometryLinearDepthTexture:e.multipassGeometryParams.geometryLinearDepthTexture,multipassTerrainEnabled:e.multipassTerrainParams.multipassTerrainEnabled,cullAboveGround:e.multipassTerrainParams.cullAboveGround,multipassGeometryEnabled:e.multipassGeometryParams.multipassGeometryEnabled,highlightColorTexture:null,cloudsCompositionParams:null};e.rctx.bindVAO();const c=e.pass!==I.MATERIAL_HIGHLIGHT&&e.pass!==I.MATERIAL_DEPTH_SHADOWMAP_HIGHLIGHT,h=e.pass!==I.MATERIAL_DEPTH_SHADOWMAP_DEFAULT;c&&this._renderComponents(e,r,o,this._defaultRenderInstanceData),h&&this._renderComponents(e,r,o,this._highlightRenderInstanceData)}intersect(e,t,s,a){if(!this.baseMaterial.isVisible())return;const n=c();r(n,a,s);const i=n=>{this._instanceData.getCombinedModelTransform(n,N),e.transform.set(N),o(G,s,e.transform.inverse),o(F,a,e.transform.inverse);const i=this._instanceData.getState(n),r=this._instanceData.getLodLevel(n);T(i&y.ACTIVE,"invalid instance state"),T(r>=0&&r<this._levels.length,"invaid lod level"),this._levels[r].intersect(e,t,G,F,n,this._metadata)};this.baseMaterial.parameters.verticalOffset?this.octree.forEach(i):this.octree.forEachAlongRay(s,n,i)}queryDepthRange(e){return this._queryDepthRangeOctree(e)}notifyShaderTransformationChanged(){this._invalidateOctree()}_requestUpdateCycle(e=!1){this._updateCyclesWithStaticCamera=-1,e&&(this._needFullCycle=!0),this.needsUpdates&&this._context.requestRender()}get needsUpdates(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}get octree(){return this._octree||(this._octree=this._buildOctree()),this._octree}_invalidateOctree(){this._octree&&(this._octree.destroy(),this._octree=null)}_buildOctree(){const e=new E(this._instanceData,this.baseBoundingSphere),t=this._instanceData,s=t.view?t.view.state:null;for(let a=0;a<this._instanceData.capacity;++a){s.get(a)&y.ACTIVE&&e.addInstance(a)}return e}_queryDepthRangeOctree(e){const t=e.eye,s=e.viewForward,a=this.octree.findClosest(s,g.FRONT_TO_BACK,e.frustum),n=this.octree.findClosest(s,g.BACK_TO_FRONT,e.frustum);if(null!=a&&null!=n){this._instanceData.view.boundingSphere.getVec(a,j),r(j,j,t);const i=l(j,s)-j[3];this._instanceData.view.boundingSphere.getVec(n,j),r(j,j,t);const o=l(j,s)+j[3];return{near:Math.max(e.near,i),far:Math.min(e.far,o)}}return{near:1/0,far:-1/0}}_startUpdateCycle(){this._updateCyclesWithStaticCamera++,this._defaultRenderInstanceData.forEach((e=>{e.startUpdateCylce()})),this._highlightRenderInstanceData.forEach((e=>{e.startUpdateCylce()})),this.needsUpdates&&this._context.requestRender()}_updateInstances(e,t){const s=this._enableLevelSelection,a=this._levelSelector;a.updateCamera(e),this._defaultRenderInstanceData.forEach((e=>{e.beginUpdate()})),this._highlightRenderInstanceData.forEach((e=>{e.beginUpdate()}));const n=this._instanceData,i=this._instanceData.view,r=n.size,l=n.capacity;let o=this._instanceIndex;t=Math.min(r,t);for(let c=0;c<t;++c){0===o&&this._startUpdateCycle();const e=i.state.get(o);let r=0;if(!(e&y.ALLOCATED)){o=(o+1)%l,t++;continue}const c=i.lodLevel.get(o);if(e&y.DEFAULT_ACTIVE&&this._defaultRenderInstanceData[c].freeTail(),e&y.HIGHLIGHT_ACTIVE&&this._highlightRenderInstanceData[c].freeTail(),e&y.REMOVE)n.freeInstance(o);else if(e&y.VISIBLE){let t=0;s&&(i.modelOrigin.getVec(o,w),t=a.selectLevel(w,n.getCombinedMedianScaleFactor(o))),r=e&~(y.ACTIVE|y.TRANSFORM_CHANGED),t>=0&&(e&y.HIGHLIGHT?(M(this._highlightRenderInstanceData[t],i,o),r|=y.HIGHLIGHT_ACTIVE):(M(this._defaultRenderInstanceData[t],i,o),r|=y.DEFAULT_ACTIVE)),i.state.set(o,r),i.lodLevel.set(o,t)}else r=e&~(y.ACTIVE|y.TRANSFORM_CHANGED),i.state.set(o,r);if(this._octree){const t=!!(e&y.ACTIVE),s=!!(r&y.ACTIVE);!t&&s?this._octree.addInstance(o):t&&!s?this._octree.removeInstance(o):t&&s&&e&y.TRANSFORM_CHANGED&&(this._octree.removeInstance(o),this._octree.addInstance(o))}o=(o+1)%l}this._instanceIndex=o,this._defaultRenderInstanceData.forEach((e=>{e.endUpdate()})),this._highlightRenderInstanceData.forEach((e=>{e.endUpdate()}))}_renderComponents(e,t,s,a){this.levels.forEach(((n,i)=>{n.components.forEach((n=>{this._renderComponent(e,t,s,a[i],n,i)}))}))}_renderComponent(t,s,a,n,i,r){if(0===n.size||!i.material.requiresSlot(s))return;const{rctx:l,pass:o}=t,c=i.glMaterials.load(l,o);if(e(c))return;const h=c.beginSlot(a),u=l.useTechnique(h,s);c.bind(a,h),l.bindVAO(i.vao),h.ensureAttributeLocations(i.vao),t.isHighlightPass&&_(u,a),h.bindDraw(a),d.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&t.pass===I.MATERIAL&&(u.setUniform4fv("externalColor",q[Math.min(r,q.length-1)]),u.setUniform1i("colorMixMode",L.replace));const m=l.capabilities.instancing,f=n.capacity,g=n.headIndex,D=n.tailIndex,v=n.firstIndex,y=this._glInstanceBufferLayout,E=(e,t)=>{U(l,p,n.buffer,y,e),m.drawArraysInstanced(h.primitiveType,0,i.vertexCount,t-e),x(l,p,n.buffer,y)};i.material.parameters.transparent&&null!=v?g>D?(T(v>=D&&v<=g,"invalid firstIndex"),E(v,g),E(D,v)):g<D&&(v<=g?(T(v>=0&&v<=g,"invalid firstIndex"),E(v,g),E(D,f),E(0,v)):(T(v>=D&&v<=f,"invalid firstIndex"),E(v,f),E(0,g),E(D,v))):g>D?E(D,g):g<D&&(E(0,g),E(D,f)),l.bindVAO(null)}}function M(e,t,s){const a=e.allocateHead();V(t,s,e.view,a)}function V(e,t,s,a){S(e.modelOrigin,t,s.modelOriginHi,s.modelOriginLo,a),s.model.copyFrom(a,e.model,t),s.modelNormal.copyFrom(a,e.modelNormal,t),e.color&&s.color&&s.color.copyFrom(a,e.color,t),e.featureAttribute&&s.featureAttribute&&s.featureAttribute.copyFrom(a,e.featureAttribute,t)}const w=c(),j=h(),N=n(),G=c(),F=c(),q=[[1,0,1,1],[0,0,1,1],[0,1,0,1],[1,1,0,1],[1,0,0,1]];export{H as LodRenderer,P as setLevelSelectorFactory};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{BufferViewVec3f as t,BufferViewMat3f as i,BufferViewVec4f as e}from"../../../../../geometry/support/buffer/BufferView.js";import{VertexAttribute as s}from"../basicInterfaces.js";import{assert as a}from"../Util.js";import r from"./BackedBufferObject.js";class h{constructor(a){this.modelOriginHi=a.getField(s.MODELORIGINHI,t),this.modelOriginLo=a.getField(s.MODELORIGINLO,t),this.model=a.getField(s.MODEL,i),this.modelNormal=a.getField(s.MODELNORMAL,i),this.color=a.getField(s.INSTANCECOLOR,e),this.featureAttribute=a.getField(s.INSTANCEFEATUREATTRIBUTE,e)}}class n{constructor(t,i){this._headIndex=0,this._tailIndex=0,this._captureFirstIndex=!0,this._updating=!1,this._prevHeadIndex=0,this._resized=!1,this._rctx=t,this._instanceBufferLayout=i,this._elementSize=i.stride,this._capacity=1}destroy(){this._buffer&&this._buffer.destroy()}get buffer(){return this._buffer.buffer}get view(){return this._view}get capacity(){return this._capacity}get size(){const t=this._headIndex,i=this._tailIndex;return t>=i?t-i:t+this._capacity-i}get isEmpty(){return this._headIndex===this._tailIndex}get isFull(){return this._tailIndex===(this._headIndex+1)%this._capacity}get headIndex(){return this._headIndex}get tailIndex(){return this._tailIndex}get firstIndex(){return this._firstIndex}get memoryUsage(){return this._buffer?this._buffer.memoryUsage:{cpu:0,gpu:0}}reset(){this._headIndex=0,this._tailIndex=0,this._firstIndex=null}startUpdateCylce(){this._captureFirstIndex=!0}beginUpdate(){a(!this._updating,"already updating"),this._updating=!0,this._prevHeadIndex=this._headIndex}endUpdate(){a(this._updating,"not updating"),this.size<c*this.capacity&&this._shrink(),this._resized?(this._buffer.transferAll(),this._resized=!1):this._transferRange(this._prevHeadIndex,this._headIndex),this._updating=!1}allocateHead(){a(this._updating,"not updating"),this.isFull&&this._grow();const t=this.headIndex;return this._captureFirstIndex&&(this._firstIndex=t,this._captureFirstIndex=!1),this._incrementHead(),a(this._headIndex!==this._tailIndex,"invalid pointers"),t}freeTail(){a(this._updating,"not updating"),a(this.size>0,"invalid size");const t=this._tailIndex===this._firstIndex;this._incrementTail(),t&&(this._firstIndex=this._tailIndex)}_grow(){const t=Math.max(_,Math.floor(this._capacity*d));this._resize(t)}_shrink(){const t=Math.max(_,Math.floor(this._capacity*f));this._resize(t)}_resize(t){if(a(this._updating,"not updating"),t===this._capacity)return;const i=new r(this._rctx,this._elementSize,t);if(this._buffer){this._firstIndex&&(this._firstIndex=(this._firstIndex+this._capacity-this._tailIndex)%this._capacity);const t=this.size,e=this._compactInstances(i);a(e===t,"invalid compaction"),this._buffer.destroy(),this._tailIndex=0,this._headIndex=e,this._prevHeadIndex=0}this._resized=!0,this._capacity=t,this._buffer=i,this._view=new h(this._instanceBufferLayout.createView(this._buffer.array))}_compactInstances(t){const i=this._headIndex,e=this._tailIndex;return e<i?(this._buffer.copyRange(e,i,t),i-e):e>i?(this._buffer.copyRange(e,this._capacity,t),i>0&&this._buffer.copyRange(0,i,t,this._capacity-e),i+(this._capacity-e)):0}_incrementHead(t=1){this._headIndex=(this._headIndex+t)%this._capacity}_incrementTail(t=1){this._tailIndex=(this._tailIndex+t)%this._capacity}_transferRange(t,i){t<i?this._buffer.transferRange(t,i):t>i&&(i>0&&this._buffer.transferRange(0,i),this._buffer.transferRange(t,this._capacity))}}const _=1024,d=2,c=.3,f=.5;export{n as RenderInstanceData,h as RenderInstanceDataView};
5
+ import{BufferViewVec3f as t,BufferViewMat3f as i,BufferViewVec4f as e}from"../../../../../geometry/support/buffer/BufferView.js";import{assert as s}from"../Util.js";import{VertexAttribute as a}from"../VertexAttribute.js";import r from"./BackedBufferObject.js";class h{constructor(s){this.modelOriginHi=s.getField(a.MODELORIGINHI,t),this.modelOriginLo=s.getField(a.MODELORIGINLO,t),this.model=s.getField(a.MODEL,i),this.modelNormal=s.getField(a.MODELNORMAL,i),this.color=s.getField(a.INSTANCECOLOR,e),this.featureAttribute=s.getField(a.INSTANCEFEATUREATTRIBUTE,e)}}class n{constructor(t,i){this._headIndex=0,this._tailIndex=0,this._captureFirstIndex=!0,this._updating=!1,this._prevHeadIndex=0,this._resized=!1,this._rctx=t,this._instanceBufferLayout=i,this._elementSize=i.stride,this._capacity=1}destroy(){this._buffer&&this._buffer.destroy()}get buffer(){return this._buffer.buffer}get view(){return this._view}get capacity(){return this._capacity}get size(){const t=this._headIndex,i=this._tailIndex;return t>=i?t-i:t+this._capacity-i}get isEmpty(){return this._headIndex===this._tailIndex}get isFull(){return this._tailIndex===(this._headIndex+1)%this._capacity}get headIndex(){return this._headIndex}get tailIndex(){return this._tailIndex}get firstIndex(){return this._firstIndex}get memoryUsage(){return this._buffer?this._buffer.memoryUsage:{cpu:0,gpu:0}}reset(){this._headIndex=0,this._tailIndex=0,this._firstIndex=null}startUpdateCylce(){this._captureFirstIndex=!0}beginUpdate(){s(!this._updating,"already updating"),this._updating=!0,this._prevHeadIndex=this._headIndex}endUpdate(){s(this._updating,"not updating"),this.size<c*this.capacity&&this._shrink(),this._resized?(this._buffer.transferAll(),this._resized=!1):this._transferRange(this._prevHeadIndex,this._headIndex),this._updating=!1}allocateHead(){s(this._updating,"not updating"),this.isFull&&this._grow();const t=this.headIndex;return this._captureFirstIndex&&(this._firstIndex=t,this._captureFirstIndex=!1),this._incrementHead(),s(this._headIndex!==this._tailIndex,"invalid pointers"),t}freeTail(){s(this._updating,"not updating"),s(this.size>0,"invalid size");const t=this._tailIndex===this._firstIndex;this._incrementTail(),t&&(this._firstIndex=this._tailIndex)}_grow(){const t=Math.max(_,Math.floor(this._capacity*d));this._resize(t)}_shrink(){const t=Math.max(_,Math.floor(this._capacity*f));this._resize(t)}_resize(t){if(s(this._updating,"not updating"),t===this._capacity)return;const i=new r(this._rctx,this._elementSize,t);if(this._buffer){this._firstIndex&&(this._firstIndex=(this._firstIndex+this._capacity-this._tailIndex)%this._capacity);const t=this.size,e=this._compactInstances(i);s(e===t,"invalid compaction"),this._buffer.destroy(),this._tailIndex=0,this._headIndex=e,this._prevHeadIndex=0}this._resized=!0,this._capacity=t,this._buffer=i,this._view=new h(this._instanceBufferLayout.createView(this._buffer.array))}_compactInstances(t){const i=this._headIndex,e=this._tailIndex;return e<i?(this._buffer.copyRange(e,i,t),i-e):e>i?(this._buffer.copyRange(e,this._capacity,t),i>0&&this._buffer.copyRange(0,i,t,this._capacity-e),i+(this._capacity-e)):0}_incrementHead(t=1){this._headIndex=(this._headIndex+t)%this._capacity}_incrementTail(t=1){this._tailIndex=(this._tailIndex+t)%this._capacity}_transferRange(t,i){t<i?this._buffer.transferRange(t,i):t>i&&(i>0&&this._buffer.transferRange(0,i),this._buffer.transferRange(t,this._capacity))}}const _=1024,d=2,c=.3,f=.5;export{n as RenderInstanceData,h as RenderInstanceDataView};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{acosClamped as t,reciprocalClamped as e}from"../../../../core/mathUtils.js";import{s as i}from"../../../../chunks/mat2.js";import{c as s}from"../../../../chunks/mat2f64.js";import{j as r,d as o}from"../../../../chunks/mat4.js";import{c as h}from"../../../../chunks/mat4f64.js";import{s as n,k as a,p as l,f as u,g as p,m as c,i as f,l as x}from"../../../../chunks/vec2.js";import{a as d,b as v,f as m}from"../../../../chunks/vec2f64.js";import{d as g,g as V,b,n as A,a as C,f as D,c as I,o as R,s as N,l as P,m as S}from"../../../../chunks/vec3.js";import{c as U}from"../../../../chunks/vec3f64.js";import{create as _,fromPositionAndNormal as y,intersectRay as T}from"../../../../geometry/support/plane.js";import{wrap as L}from"../../../../geometry/support/ray.js";import{VertexAttribute as F}from"./basicInterfaces.js";import O from"./GeometryUtil.js";import{intersectTriangles as M}from"../materials/internal/MaterialUtil.js";function k(){return{up:U(),right:U()}}function E(t,e,i){S(t.up,e.up,i),S(t.right,e.right,i)}function B(t,e,i){t[0]=i[0]*e.right[0]+i[1]*e.up[0],t[1]=i[0]*e.right[1]+i[1]*e.up[1],t[2]=i[0]*e.right[2]+i[1]*e.up[2]}function w(t,e,i){n(t,g(i,e.right),g(i,e.up))}class G{constructor(){this.pos=U(),this.posES=U(),this.posGS=U(),this.vRight=U(),this.vLeft=U(),this.frame=k(),this.rotationFrame=k(),this.rotationRight=d(),this.rotationAngle=0,this.miterStretch=s()}setFrameFromUpVector(t){V(this.frame.up,t),b(at,this.vLeft,this.vRight),A(at,at),C(nt,this.frame.up,g(at,this.frame.up)),D(pt,at,nt),A(pt,pt),I(this.frame.right,pt,this.frame.up)}computeRotationAxisAndAngleFromUpVector(){V(this.rotationFrame.up,this.frame.up),V(this.rotationFrame.right,this.frame.right),n(this.rotationRight,1,0),C(nt,this.frame.up,g(this.frame.up,this.vLeft)),D(nt,this.vLeft,nt),R(nt,nt),A(nt,nt),C(at,this.frame.up,g(this.frame.up,this.vRight)),D(at,this.vRight,at),A(at,at),I(lt,this.rotationFrame.up,this.vLeft);const s=Math.sign(g(lt,this.vRight));if(this.rotationAngle=s*(Math.PI-t(g(nt,at))),Math.abs(this.rotationAngle)>0){const t=e(Math.cos(.5*this.rotationAngle));i(this.miterStretch,t-1+1,0,0,1)}const r=Math.PI-this.rotationAngle;this.maxStretchDistance=Math.abs(Math.min(this.vLeftLength,this.vRightLength)/Math.cos(.5*r))}}class j{constructor(){this.vertices=[],this.vertexIndices=[],this.vertexNormals=[],this.poles=[],this.poleIndices=[],this.uvs=null,this.uvIndices=null}addVertex(t,e){return this.vertices.push(v(t)),this.vertexNormals.push(v(e)),this.vertices.length-1}addUV(t){return this.uvs||(this.uvs=[],this.uvIndices=[]),this.uvs.push(t),this.uvs.length-1}addPole(t,e=null){return this.poles.push({position:v(t),normal:e?v(e):null}),this.poles.length-1}addSegment(t,e=null,i=null){this.vertexIndices.push(t.v0),this.vertexIndices.push(t.v1),e&&(this.uvIndices.push(e.v0),this.uvIndices.push(e.v1)),i&&(this.poleIndices.push(i.v0),this.poleIndices.push(i.v1))}get numSegments(){return this.vertexIndices.length/2}hasUV(){return null!=this.uvs}translate(t,e){for(const i of this.vertices)i[0]+=t,i[1]+=e;for(const i of this.poles)i.position[0]+=t,i.position[1]+=e}static circle(t=20){const e=.5,i=new j,s={v0:0,v1:0};i.addPole(m(0,0));for(let h=0;h<t;++h){const s=2*h*Math.PI/t,r=Math.cos(s),o=Math.sin(s),n=m(r*e,o*e),a=m(r,o);i.addVertex(n,a),i.addUV(h/t)}i.addUV(1);for(let h=0;h<t-1;++h){const t={v0:h,v1:h+1},e=t;i.addSegment(t,e,s)}const r={v0:t-1,v1:0},o={v0:t-1,v1:t};return i.addSegment(r,o,s),i}static rect(){const t=1,e=1,i=new j,s=m(.5*-t,.5*-e),r=m(.5*t,.5*-e),o=m(.5*t,.5*e),h=m(.5*-t,.5*e),n=m(0,-1),a=m(1,0),l=m(0,1),u=m(-1,0);i.addUV(0),i.addUV(1),i.addPole(m(0,.5*e),l),i.addPole(m(0,.5*e)),i.addPole(m(0,.5*-e)),i.addPole(m(0,.5*-e),n);const p={v0:0,v1:1};return i.addVertex(s,n),i.addVertex(r,n),i.addSegment({v0:0,v1:1},p,{v0:3,v1:3}),i.addVertex(r,a),i.addVertex(o,a),i.addSegment({v0:2,v1:3},p,{v0:2,v1:1}),i.addVertex(o,l),i.addVertex(h,l),i.addSegment({v0:4,v1:5},p,{v0:0,v1:0}),i.addVertex(h,u),i.addVertex(s,u),i.addSegment({v0:6,v1:7},p,{v0:1,v1:2}),i}}class z{constructor(t){this.vertices=[],this.offset=U(),this.xform=h(),this.vertices=t;const e=Math.floor((t.length-1)/2);V(this.offset,this.vertices[e].pos);for(const i of this.vertices)D(i.pos,i.pos,this.offset);r(this.xform,this.xform,this.offset),this.updatePathVertexInformation()}updatePathVertexInformation(){const t=this.vertices.length;let e=this.vertices[0];e.index=0,N(e.vLeft,0,0,0),e.vLeftLength=0,D(e.vRight,this.vertices[1].pos,e.pos),e.vRightLength=P(e.vRight),A(e.vRight,e.vRight);let i=e;for(let s=1;s<t;++s)e=this.vertices[s],e.index=s,V(e.vLeft,i.vRight),e.vLeftLength=i.vRightLength,s<t-1?(D(e.vRight,this.vertices[s+1].pos,e.pos),e.vRightLength=P(e.vRight),A(e.vRight,e.vRight)):(V(e.vRight,e.vLeft),e.vRightLength=e.vLeftLength),i=e}}function J(t,e){let i=null;const s=t.vertices.length,r=.99619469809,o=U(),h=U(),n=U(),a=U(),l=U(),u=U(),p=_();let c=t.vertices[0];V(h,e),N(o,0,1,0),O.makeOrthoBasisDirUpFallback(c.vRight,h,o,o,n,h,r),V(c.frame.up,h),V(c.frame.right,n),i=c;for(let f=1;f<s;++f){c=t.vertices[f],b(l,c.vLeft,c.vRight);let e=P(l);e>0?(e=1/Math.sqrt(e),l[0]=l[0]*e,l[1]=l[1]*e,l[2]=l[2]*e):(l[0]=c.vRight[0],l[1]=c.vRight[1],l[2]=c.vRight[2]),b(u,i.pos,i.frame.up),y(c.pos,l,p);T(p,L(u,c.vLeft),a)?(D(a,a,c.pos),A(h,a),I(n,l,h),A(n,n)):O.makeOrthoBasisDirUpFallback(l,i.frame.up,i.frame.right,o,n,h,r),V(c.frame.up,h),V(c.frame.right,n),i=c}}class H{}class X{numProfilesPerJoin(){return 1}extrude(t,e,i){for(let s=0;s<e.vertices.length;++s)i(t.index,t.frame,e.vertices[s],e.vertexNormals[s],!1)}}class q{constructor(t=.8*Math.PI,e=1){this.cutoffAngle=t,this.numBendSubdivisions=e}numProfilesPerJoin(){return this.numBendSubdivisions+1}extrude(t,e,i){const s=ct;if(Math.abs(t.rotationAngle)>=this.cutoffAngle)for(let r=0;r<this.numBendSubdivisions+1;++r){o(ft,.5*-t.rotationAngle+r*t.rotationAngle/this.numBendSubdivisions,t.rotationFrame.up),E(s,t.frame,ft);for(let r=0;r<e.vertices.length;++r){a(e.vertices[r],t.rotationRight)*t.rotationAngle>=0?i(t.index,s,e.vertices[r],e.vertexNormals[r],!1):(l(rt,e.vertices[r],t.miterStretch),i(t.index,t.frame,rt,e.vertexNormals[r],!0))}}else for(let r=0;r<this.numBendSubdivisions+1;++r)for(let s=0;s<e.vertices.length;++s){const r=a(e.vertices[s],t.rotationRight)*t.rotationAngle>=0;l(rt,e.vertices[s],t.miterStretch),i(t.index,t.frame,rt,e.vertexNormals[s],!r)}}}const K={generateUV:!1};class Q{rebuildConnectingProfileGeometry(t,e,i){for(let s=0;s<e.vertices.length;++s)i(t.index,t.frame,e.vertices[s],e.vertexNormals[s],0,0)}}class W extends Q{constructor(){super()}getNumVertices(){return 0}getNumIndices(){return 0}rebuildCapGeometry(){}buildTopology(){}}class Y extends Q{constructor(t,e=0,i=!1){super(),this.profile=t,this.profilePlaneOffset=e,this.flip=i}getNumVertices(){return this.profile.vertices.length}getNumIndices(){return 3*this.profile.numSegments}rebuildConnectingProfileGeometry(t,e,i){for(let s=0;s<e.vertices.length;++s)i(t.index,t.frame,e.vertices[s],e.vertexNormals[s],this.profilePlaneOffset,0)}rebuildCapGeometry(t,e){const i=ot;n(i,0,0);const s=this.flip?1:-1;for(let r=0;r<this.profile.vertices.length;++r)e(t.index,t.frame,this.profile.vertices[r],i,this.profilePlaneOffset,s)}buildTopology(t,e){const i=this.vertexBufferStart+this.profile.vertexIndices[0];for(let s=1;s<this.profile.numSegments;++s){const t=this.profile.vertexIndices[2*s+0],r=this.profile.vertexIndices[2*s+1],o=this.vertexBufferStart+t,h=this.vertexBufferStart+r;this.flip?e(h,o,i):e(i,o,h)}}}class Z extends Q{constructor(t){super(),this.flip=!1,this.sign=0,this.breakNormals=!1,this.numSegments=3,this.profile=t.profile,this.flip=t.flip,this.sign=this.flip?1:-1,this.breakNormals=t.breakNormals,this.numSegments=t.subdivisions}getNumVertices(){let t=0;return t=this.profile.vertices.length*(this.numSegments-1),this.breakNormals&&(t+=this.profile.vertices.length),t+=this.profile.poles.length,t}getNumIndices(){let t=0;t+=2*this.profile.numSegments*(this.numSegments-1);for(let e=0;e<this.profile.numSegments;++e){const i=this.profile.vertexIndices[2*e+0],s=this.profile.vertexIndices[2*e+1];this.profile.poleIndices[i]===this.profile.poleIndices[s]?t+=1:t+=2}return 3*t}rebuildCapGeometry(t,e){const i=t.frame,s=.5*this.sign,r=rt,o=ot;n(o,0,0);for(let h=0;h<this.profile.poles.length;++h){const r=this.profile.poles[h];r.normal?e(t.index,i,r.position,r.normal,s,0):e(t.index,i,r.position,o,s,this.sign)}if(this.breakNormals)for(let h=0;h<this.profile.vertices.length;++h)e(t.index,i,this.profile.vertices[h],this.profile.vertexNormals[h],0,0);for(let h=0;h<this.numSegments-1;++h){const n=(1-(h+1)/this.numSegments)*Math.PI*.5,a=Math.sin(n),l=Math.cos(n);for(let h=0;h<this.profile.vertices.length;++h){const n=this.profile.poles[this.profile.poleIndices[h]];u(r,this.profile.vertices[h],n.position),p(r,r,a),n.normal?(c(r,r,n.position),e(t.index,i,r,n.normal,s*l,0)):(f(o,r),p(o,o,a),c(r,r,n.position),e(t.index,i,r,o,s*l,this.sign*l))}}}buildTopology(t,e){const i=this.breakNormals?this.vertexBufferStart+this.profile.poles.length:this.firstProfileVertexIndex,s=this.breakNormals?this.vertexBufferStart+this.profile.poles.length+this.profile.vertices.length:this.vertexBufferStart+this.profile.poles.length;for(let r=0;r<this.profile.numSegments;++r){const t=this.profile.vertexIndices[2*r+0],o=this.profile.vertexIndices[2*r+1],h=this.vertexBufferStart+this.profile.poleIndices[t],n=this.vertexBufferStart+this.profile.poleIndices[o];let a=i+t,l=i+o;for(let i=0;i<this.numSegments-1;++i){const r=s+i*this.profile.vertices.length+t,h=s+i*this.profile.vertices.length+o;this.flip?(e(r,l,a),e(l,r,h)):(e(a,l,r),e(h,r,l)),a=r,l=h}this.flip?(e(h,l,a),h!==n&&e(h,n,l)):(e(a,l,h),h!==n&&e(l,n,h))}}}class ${constructor(t,e,i,s,r,o=K){this.options=o,this._extrusionVertexCount=0,this._triangleCount=0,this.numExtrusionProfiles=0,this.numVerticesTotal=0,this.numNormalsTotal=0,this.numUVTotal=0,this.profile=e,this.path=t,this.extruder=i,this.startCap=s,this.endCap=r;const h=this.path.vertices.length-2;this.numExtrusionProfiles=i.numProfilesPerJoin()*h+2,this.numVerticesTotal=e.vertices.length*this.numExtrusionProfiles,this.numNormalsTotal=this.numVerticesTotal,this.startCap.vertexBufferStart=this.numVerticesTotal;const n=this.startCap.getNumVertices();this.numVerticesTotal+=n,this.numNormalsTotal+=n,this.endCap.vertexBufferStart=this.numVerticesTotal;const a=this.endCap.getNumVertices();this.numVerticesTotal+=a,this.numNormalsTotal+=a,this.pathVertexData=new Float32Array(1*this.numVerticesTotal),this.profileRightAxisData=new Float32Array(4*this.numVerticesTotal),this.profileUpAxisData=new Float32Array(4*this.numVerticesTotal),this.profileVertexAndNormalData=new Float32Array(4*this.numVerticesTotal),this.profile.hasUV()&&this.options.generateUV&&(this.numUVTotal=this.profile.uvs.length,this.uvData=new Float32Array(2*this.numUVTotal)),this.originData=new Float32Array(3*this.path.vertices.length),this._rebuildGeometry(),this.buildTopology()}emitVertex(t,e,i,s,r){if(this.profileRightAxisData[4*this._extrusionVertexCount+0]=e.right[0],this.profileRightAxisData[4*this._extrusionVertexCount+1]=e.right[1],this.profileRightAxisData[4*this._extrusionVertexCount+2]=e.right[2],this.profileUpAxisData[4*this._extrusionVertexCount+0]=e.up[0],this.profileUpAxisData[4*this._extrusionVertexCount+1]=e.up[1],this.profileUpAxisData[4*this._extrusionVertexCount+2]=e.up[2],this.profileVertexAndNormalData[4*this._extrusionVertexCount+0]=i[0],this.profileVertexAndNormalData[4*this._extrusionVertexCount+1]=i[1],this.profileVertexAndNormalData[4*this._extrusionVertexCount+2]=s[0],this.profileVertexAndNormalData[4*this._extrusionVertexCount+3]=s[1],this.pathVertexData[this._extrusionVertexCount]=t,r){const e=this.path.vertices[t];this.profileRightAxisData[4*this._extrusionVertexCount+3]=e.rotationRight[0]*e.maxStretchDistance,this.profileUpAxisData[4*this._extrusionVertexCount+3]=e.rotationRight[1]*e.maxStretchDistance}else this.profileRightAxisData[4*this._extrusionVertexCount+3]=0,this.profileUpAxisData[4*this._extrusionVertexCount+3]=0;++this._extrusionVertexCount}emitCapVertex(t,e,i,s,r,o){this.profileRightAxisData[4*this._extrusionVertexCount+0]=e.right[0],this.profileRightAxisData[4*this._extrusionVertexCount+1]=e.right[1],this.profileRightAxisData[4*this._extrusionVertexCount+2]=e.right[2],this.profileUpAxisData[4*this._extrusionVertexCount+0]=e.up[0],this.profileUpAxisData[4*this._extrusionVertexCount+1]=e.up[1],this.profileUpAxisData[4*this._extrusionVertexCount+2]=e.up[2],this.profileVertexAndNormalData[4*this._extrusionVertexCount+0]=i[0],this.profileVertexAndNormalData[4*this._extrusionVertexCount+1]=i[1],this.profileVertexAndNormalData[4*this._extrusionVertexCount+2]=s[0],this.profileVertexAndNormalData[4*this._extrusionVertexCount+3]=s[1],this.pathVertexData[this._extrusionVertexCount]=t,this.profileRightAxisData[4*this._extrusionVertexCount+3]=r,this.profileUpAxisData[4*this._extrusionVertexCount+3]=o,++this._extrusionVertexCount}emitTriangle(t,e,i){this.vertexIndices[3*this._triangleCount+0]=t,this.vertexIndices[3*this._triangleCount+1]=e,this.vertexIndices[3*this._triangleCount+2]=i,this.pathVertexIndices[3*this._triangleCount+0]=this.pathVertexData[t],this.pathVertexIndices[3*this._triangleCount+1]=this.pathVertexData[e],this.pathVertexIndices[3*this._triangleCount+2]=this.pathVertexData[i],this.normalIndices[3*this._triangleCount+0]=t,this.normalIndices[3*this._triangleCount+1]=e,this.normalIndices[3*this._triangleCount+2]=i,++this._triangleCount}_rebuildGeometry(){const t=(t,e,i,s,r)=>this.emitVertex(t,e,i,s,r),e=(t,e,i,s,r,o)=>this.emitCapVertex(t,e,i,s,r,o);this._extrusionVertexCount=0;for(const i of this.path.vertices)this.originData[3*i.index+0]=i.pos[0],this.originData[3*i.index+1]=i.pos[1],this.originData[3*i.index+2]=i.pos[2];this.startCap.rebuildConnectingProfileGeometry(this.path.vertices[0],this.profile,e);for(let i=1;i<this.path.vertices.length-1;++i)this.extruder.extrude(this.path.vertices[i],this.profile,t);if(this.endCap.rebuildConnectingProfileGeometry(this.path.vertices[this.path.vertices.length-1],this.profile,e),this.startCap.rebuildCapGeometry(this.path.vertices[0],e),this.endCap.rebuildCapGeometry(this.path.vertices[this.path.vertices.length-1],e),this.profile.hasUV()&&this.options.generateUV)for(let i=0;i<this.profile.uvs.length;++i)this.uvData[2*i+0]=this.profile.uvs[i],this.uvData[2*i+1]=0}buildTopology(){const t=(t,e,i)=>this.emitTriangle(t,e,i);this._triangleCount=0;const e=this.profile.vertices.length,i=this.profile.numSegments,s=this.numExtrusionProfiles-1;let r=3*(2*(i*s));this.startCap.indexBufferStart=r,this.startCap.firstProfileVertexIndex=0,r+=this.startCap.getNumIndices(),this.endCap.indexBufferStart=r,this.endCap.firstProfileVertexIndex=e*(this.numExtrusionProfiles-1),r+=this.endCap.getNumIndices(),this.vertexIndices=new Uint32Array(r),this.normalIndices=new Uint32Array(r),this.pathVertexIndices=new Uint32Array(r),this.profile.hasUV()&&this.options.generateUV&&(this.uvIndices=new Uint32Array(r));for(let o=0;o<i;++o){const i=this.profile.vertexIndices[2*o],r=this.profile.vertexIndices[2*o+1];for(let o=0;o<s;++o){const s=o*e+i,h=(o+1)*e+r,n=o*e+r;t(s,(o+1)*e+i,h),t(s,h,n)}}this.startCap.buildTopology(this.path.vertices[0],t),this.endCap.buildTopology(this.path.vertices[this.path.vertices.length-1],t)}onPathChanged(){this._rebuildGeometry()}}class tt{constructor(t){this.builder=t}get xform(){return this.builder.path.xform}onPathChanged(){this.builder.onPathChanged()}}class et extends tt{constructor(t){super(t),this.vertexAttributePosition=null,this.vertexAttributeNormal=null,this.vertexAttributeColor=null,this.vertexAttributePosition=new Float32Array(3*this.builder.numVerticesTotal),this.vertexAttributeNormal=new Float32Array(3*this.builder.numNormalsTotal),this.vertexAttributeColor=new Uint8Array(4),this.vertexAttributeColor[0]=255,this.vertexAttributeColor[1]=255,this.vertexAttributeColor[2]=255,this.vertexAttributeColor[3]=255}bakeVertexColors(t){this.vertexAttributeColor[0]=255*t[0],this.vertexAttributeColor[1]=255*t[1],this.vertexAttributeColor[2]=255*t[2],this.vertexAttributeColor[3]=255*(t.length>3?t[3]:1)}bake(t){this.size=t;for(let e=0;e<this.builder.numVerticesTotal;++e){let i=this.builder.pathVertexData[e];const s=0===i||i===this.builder.path.vertices.length-1;i*=3;const r=st;N(r,this.builder.originData[i++],this.builder.originData[i++],this.builder.originData[i]);const o=4*e,h=nt,l=rt,u=at,d=lt,v=ut;let m=0,g=0;if(N(d,this.builder.profileRightAxisData[o],this.builder.profileRightAxisData[o+1],this.builder.profileRightAxisData[o+2]),N(v,this.builder.profileUpAxisData[o],this.builder.profileUpAxisData[o+1],this.builder.profileUpAxisData[o+2]),n(l,this.builder.profileVertexAndNormalData[o]*t[0],this.builder.profileVertexAndNormalData[o+1]*t[1]),s)I(u,v,d),m=this.builder.profileRightAxisData[o+3]*t[0],g=this.builder.profileUpAxisData[o+3];else{const t=ot,e=ht;n(t,this.builder.profileRightAxisData[o+3],this.builder.profileUpAxisData[o+3]);const i=x(t);f(t,t);const s=a(l,t);if(Math.abs(s)>i){n(e,-t[1],t[0]);const r=a(l,e);p(t,t,i*Math.sign(s)),p(e,e,r),c(l,t,e)}N(u,0,0,0)}N(h,d[0]*l[0]+v[0]*l[1],d[1]*l[0]+v[1]*l[1],d[2]*l[0]+v[2]*l[1]),this.vertexAttributePosition[3*e+0]=r[0]+h[0]+u[0]*m,this.vertexAttributePosition[3*e+1]=r[1]+h[1]+u[1]*m,this.vertexAttributePosition[3*e+2]=r[2]+h[2]+u[2]*m;const V=rt;n(V,this.builder.profileVertexAndNormalData[o+2],this.builder.profileVertexAndNormalData[o+3]),this.vertexAttributeNormal[3*e+0]=d[0]*V[0]+v[0]*V[1]+u[0]*g,this.vertexAttributeNormal[3*e+1]=d[1]*V[0]+v[1]*V[1]+u[1]*g,this.vertexAttributeNormal[3*e+2]=d[2]*V[0]+v[2]*V[1]+u[2]*g}}createGeometryData(){const t=[[F.POSITION,this.builder.vertexIndices],[F.NORMAL,this.builder.normalIndices]],e=[[F.POSITION,{size:3,data:this.vertexAttributePosition,exclusive:!0}],[F.NORMAL,{size:3,data:this.vertexAttributeNormal,exclusive:!0}]];if(this.vertexAttributeColor){const i=this.builder.vertexIndices.length;t.push([F.COLOR,new Uint32Array(i)]),e.push([F.COLOR,{size:4,data:this.vertexAttributeColor}])}return{vertexAttributes:e,indices:t}}onPathChanged(){super.onPathChanged(),this.bake(this.size)}intersect(t,e,i){const s=this.builder.vertexIndices,r={size:3,data:this.vertexAttributePosition},o=s.length/3;M(t,e,0,o,s,r,void 0,void 0,i)}}class it extends tt{constructor(t,e,i,s){super(t),this.sizeAttributeValue=e,this.colorAttributeValue=i,this.opacityAttributeValue=s,this.vvData=null,this.baked=new et(t),this.vvData=new Float32Array(4*this.builder.path.vertices.length);for(let r=0;r<this.builder.path.vertices.length;++r){this.vvData[4*r+0]=e,this.vvData[4*r+1]=i,this.vvData[4*r+2]=s;const t=0===r||r===this.builder.path.vertices.length-1;this.vvData[4*r+3]=t?1:0}}createGeometryData(){return{vertexAttributes:[[F.POSITION,{size:3,data:this.builder.originData,exclusive:!0}],[F.PROFILERIGHT,{size:4,data:this.builder.profileRightAxisData,exclusive:!0}],[F.PROFILEUP,{size:4,data:this.builder.profileUpAxisData,exclusive:!0}],[F.PROFILEVERTEXANDNORMAL,{size:4,data:this.builder.profileVertexAndNormalData,exclusive:!0}],[F.FEATUREVALUE,{size:4,data:this.vvData,exclusive:!0}]],indices:[[F.POSITION,this.builder.pathVertexIndices],[F.PROFILERIGHT,this.builder.vertexIndices],[F.PROFILEUP,this.builder.vertexIndices],[F.PROFILEVERTEXANDNORMAL,this.builder.vertexIndices],[F.FEATUREVALUE,this.builder.pathVertexIndices]]}}}const st=U(),rt=d(),ot=d(),ht=d(),nt=U(),at=U(),lt=U(),ut=U(),pt=U(),ct=k(),ft=h();export{$ as Builder,Q as CapBuilder,H as Extruder,it as FastUpdatePathGeometry,q as MiterExtruder,W as NoCapBuilder,z as Path,tt as PathGeometryData,G as PathVertex,j as Profile,Z as RoundCapBuilder,X as SimpleExtruder,et as StaticPathGeometry,Y as TriangulationCapBuilder,J as computeMinimumRotationTangentFrame,k as makeFrame,B as profileSpaceToVertexSpace,w as vertexSpaceToProfileSpace};
5
+ import{acosClamped as t,reciprocalClamped as e}from"../../../../core/mathUtils.js";import{s as i}from"../../../../chunks/mat2.js";import{c as s}from"../../../../chunks/mat2f64.js";import{j as r,d as o}from"../../../../chunks/mat4.js";import{c as h}from"../../../../chunks/mat4f64.js";import{s as n,k as a,p as l,f as u,g as p,m as f,i as c,l as x}from"../../../../chunks/vec2.js";import{a as d,b as v,f as m}from"../../../../chunks/vec2f64.js";import{d as g,g as V,b as A,n as b,a as C,f as D,c as I,o as R,s as N,l as P,m as S}from"../../../../chunks/vec3.js";import{c as U}from"../../../../chunks/vec3f64.js";import{create as _,fromPositionAndNormal as y,intersectRay as T}from"../../../../geometry/support/plane.js";import{wrap as L}from"../../../../geometry/support/ray.js";import F from"./GeometryUtil.js";import{VertexAttribute as O}from"./VertexAttribute.js";import{intersectTriangles as M}from"../materials/internal/MaterialUtil.js";function k(){return{up:U(),right:U()}}function E(t,e,i){S(t.up,e.up,i),S(t.right,e.right,i)}function B(t,e,i){t[0]=i[0]*e.right[0]+i[1]*e.up[0],t[1]=i[0]*e.right[1]+i[1]*e.up[1],t[2]=i[0]*e.right[2]+i[1]*e.up[2]}function w(t,e,i){n(t,g(i,e.right),g(i,e.up))}class G{constructor(){this.pos=U(),this.posES=U(),this.posGS=U(),this.vRight=U(),this.vLeft=U(),this.frame=k(),this.rotationFrame=k(),this.rotationRight=d(),this.rotationAngle=0,this.miterStretch=s()}setFrameFromUpVector(t){V(this.frame.up,t),A(at,this.vLeft,this.vRight),b(at,at),C(nt,this.frame.up,g(at,this.frame.up)),D(pt,at,nt),b(pt,pt),I(this.frame.right,pt,this.frame.up)}computeRotationAxisAndAngleFromUpVector(){V(this.rotationFrame.up,this.frame.up),V(this.rotationFrame.right,this.frame.right),n(this.rotationRight,1,0),C(nt,this.frame.up,g(this.frame.up,this.vLeft)),D(nt,this.vLeft,nt),R(nt,nt),b(nt,nt),C(at,this.frame.up,g(this.frame.up,this.vRight)),D(at,this.vRight,at),b(at,at),I(lt,this.rotationFrame.up,this.vLeft);const s=Math.sign(g(lt,this.vRight));if(this.rotationAngle=s*(Math.PI-t(g(nt,at))),Math.abs(this.rotationAngle)>0){const t=e(Math.cos(.5*this.rotationAngle));i(this.miterStretch,t-1+1,0,0,1)}const r=Math.PI-this.rotationAngle;this.maxStretchDistance=Math.abs(Math.min(this.vLeftLength,this.vRightLength)/Math.cos(.5*r))}}class j{constructor(){this.vertices=[],this.vertexIndices=[],this.vertexNormals=[],this.poles=[],this.poleIndices=[],this.uvs=null,this.uvIndices=null}addVertex(t,e){return this.vertices.push(v(t)),this.vertexNormals.push(v(e)),this.vertices.length-1}addUV(t){return this.uvs||(this.uvs=[],this.uvIndices=[]),this.uvs.push(t),this.uvs.length-1}addPole(t,e=null){return this.poles.push({position:v(t),normal:e?v(e):null}),this.poles.length-1}addSegment(t,e=null,i=null){this.vertexIndices.push(t.v0),this.vertexIndices.push(t.v1),e&&(this.uvIndices.push(e.v0),this.uvIndices.push(e.v1)),i&&(this.poleIndices.push(i.v0),this.poleIndices.push(i.v1))}get numSegments(){return this.vertexIndices.length/2}hasUV(){return null!=this.uvs}translate(t,e){for(const i of this.vertices)i[0]+=t,i[1]+=e;for(const i of this.poles)i.position[0]+=t,i.position[1]+=e}static circle(t=20){const e=.5,i=new j,s={v0:0,v1:0};i.addPole(m(0,0));for(let h=0;h<t;++h){const s=2*h*Math.PI/t,r=Math.cos(s),o=Math.sin(s),n=m(r*e,o*e),a=m(r,o);i.addVertex(n,a),i.addUV(h/t)}i.addUV(1);for(let h=0;h<t-1;++h){const t={v0:h,v1:h+1},e=t;i.addSegment(t,e,s)}const r={v0:t-1,v1:0},o={v0:t-1,v1:t};return i.addSegment(r,o,s),i}static rect(){const t=1,e=1,i=new j,s=m(.5*-t,.5*-e),r=m(.5*t,.5*-e),o=m(.5*t,.5*e),h=m(.5*-t,.5*e),n=m(0,-1),a=m(1,0),l=m(0,1),u=m(-1,0);i.addUV(0),i.addUV(1),i.addPole(m(0,.5*e),l),i.addPole(m(0,.5*e)),i.addPole(m(0,.5*-e)),i.addPole(m(0,.5*-e),n);const p={v0:0,v1:1};return i.addVertex(s,n),i.addVertex(r,n),i.addSegment({v0:0,v1:1},p,{v0:3,v1:3}),i.addVertex(r,a),i.addVertex(o,a),i.addSegment({v0:2,v1:3},p,{v0:2,v1:1}),i.addVertex(o,l),i.addVertex(h,l),i.addSegment({v0:4,v1:5},p,{v0:0,v1:0}),i.addVertex(h,u),i.addVertex(s,u),i.addSegment({v0:6,v1:7},p,{v0:1,v1:2}),i}}class z{constructor(t){this.vertices=[],this.offset=U(),this.xform=h(),this.vertices=t;const e=Math.floor((t.length-1)/2);V(this.offset,this.vertices[e].pos);for(const i of this.vertices)D(i.pos,i.pos,this.offset);r(this.xform,this.xform,this.offset),this.updatePathVertexInformation()}updatePathVertexInformation(){const t=this.vertices.length;let e=this.vertices[0];e.index=0,N(e.vLeft,0,0,0),e.vLeftLength=0,D(e.vRight,this.vertices[1].pos,e.pos),e.vRightLength=P(e.vRight),b(e.vRight,e.vRight);let i=e;for(let s=1;s<t;++s)e=this.vertices[s],e.index=s,V(e.vLeft,i.vRight),e.vLeftLength=i.vRightLength,s<t-1?(D(e.vRight,this.vertices[s+1].pos,e.pos),e.vRightLength=P(e.vRight),b(e.vRight,e.vRight)):(V(e.vRight,e.vLeft),e.vRightLength=e.vLeftLength),i=e}}function J(t,e){let i=null;const s=t.vertices.length,r=.99619469809,o=U(),h=U(),n=U(),a=U(),l=U(),u=U(),p=_();let f=t.vertices[0];V(h,e),N(o,0,1,0),F.makeOrthoBasisDirUpFallback(f.vRight,h,o,o,n,h,r),V(f.frame.up,h),V(f.frame.right,n),i=f;for(let c=1;c<s;++c){f=t.vertices[c],A(l,f.vLeft,f.vRight);let e=P(l);e>0?(e=1/Math.sqrt(e),l[0]=l[0]*e,l[1]=l[1]*e,l[2]=l[2]*e):(l[0]=f.vRight[0],l[1]=f.vRight[1],l[2]=f.vRight[2]),A(u,i.pos,i.frame.up),y(f.pos,l,p);T(p,L(u,f.vLeft),a)?(D(a,a,f.pos),b(h,a),I(n,l,h),b(n,n)):F.makeOrthoBasisDirUpFallback(l,i.frame.up,i.frame.right,o,n,h,r),V(f.frame.up,h),V(f.frame.right,n),i=f}}class H{}class X{numProfilesPerJoin(){return 1}extrude(t,e,i){for(let s=0;s<e.vertices.length;++s)i(t.index,t.frame,e.vertices[s],e.vertexNormals[s],!1)}}class q{constructor(t=.8*Math.PI,e=1){this.cutoffAngle=t,this.numBendSubdivisions=e}numProfilesPerJoin(){return this.numBendSubdivisions+1}extrude(t,e,i){const s=ft;if(Math.abs(t.rotationAngle)>=this.cutoffAngle)for(let r=0;r<this.numBendSubdivisions+1;++r){o(ct,.5*-t.rotationAngle+r*t.rotationAngle/this.numBendSubdivisions,t.rotationFrame.up),E(s,t.frame,ct);for(let r=0;r<e.vertices.length;++r){a(e.vertices[r],t.rotationRight)*t.rotationAngle>=0?i(t.index,s,e.vertices[r],e.vertexNormals[r],!1):(l(rt,e.vertices[r],t.miterStretch),i(t.index,t.frame,rt,e.vertexNormals[r],!0))}}else for(let r=0;r<this.numBendSubdivisions+1;++r)for(let s=0;s<e.vertices.length;++s){const r=a(e.vertices[s],t.rotationRight)*t.rotationAngle>=0;l(rt,e.vertices[s],t.miterStretch),i(t.index,t.frame,rt,e.vertexNormals[s],!r)}}}const K={generateUV:!1};class Q{rebuildConnectingProfileGeometry(t,e,i){for(let s=0;s<e.vertices.length;++s)i(t.index,t.frame,e.vertices[s],e.vertexNormals[s],0,0)}}class W extends Q{constructor(){super()}getNumVertices(){return 0}getNumIndices(){return 0}rebuildCapGeometry(){}buildTopology(){}}class Y extends Q{constructor(t,e=0,i=!1){super(),this.profile=t,this.profilePlaneOffset=e,this.flip=i}getNumVertices(){return this.profile.vertices.length}getNumIndices(){return 3*this.profile.numSegments}rebuildConnectingProfileGeometry(t,e,i){for(let s=0;s<e.vertices.length;++s)i(t.index,t.frame,e.vertices[s],e.vertexNormals[s],this.profilePlaneOffset,0)}rebuildCapGeometry(t,e){const i=ot;n(i,0,0);const s=this.flip?1:-1;for(let r=0;r<this.profile.vertices.length;++r)e(t.index,t.frame,this.profile.vertices[r],i,this.profilePlaneOffset,s)}buildTopology(t,e){const i=this.vertexBufferStart+this.profile.vertexIndices[0];for(let s=1;s<this.profile.numSegments;++s){const t=this.profile.vertexIndices[2*s+0],r=this.profile.vertexIndices[2*s+1],o=this.vertexBufferStart+t,h=this.vertexBufferStart+r;this.flip?e(h,o,i):e(i,o,h)}}}class Z extends Q{constructor(t){super(),this.flip=!1,this.sign=0,this.breakNormals=!1,this.numSegments=3,this.profile=t.profile,this.flip=t.flip,this.sign=this.flip?1:-1,this.breakNormals=t.breakNormals,this.numSegments=t.subdivisions}getNumVertices(){let t=0;return t=this.profile.vertices.length*(this.numSegments-1),this.breakNormals&&(t+=this.profile.vertices.length),t+=this.profile.poles.length,t}getNumIndices(){let t=0;t+=2*this.profile.numSegments*(this.numSegments-1);for(let e=0;e<this.profile.numSegments;++e){const i=this.profile.vertexIndices[2*e+0],s=this.profile.vertexIndices[2*e+1];this.profile.poleIndices[i]===this.profile.poleIndices[s]?t+=1:t+=2}return 3*t}rebuildCapGeometry(t,e){const i=t.frame,s=.5*this.sign,r=rt,o=ot;n(o,0,0);for(let h=0;h<this.profile.poles.length;++h){const r=this.profile.poles[h];r.normal?e(t.index,i,r.position,r.normal,s,0):e(t.index,i,r.position,o,s,this.sign)}if(this.breakNormals)for(let h=0;h<this.profile.vertices.length;++h)e(t.index,i,this.profile.vertices[h],this.profile.vertexNormals[h],0,0);for(let h=0;h<this.numSegments-1;++h){const n=(1-(h+1)/this.numSegments)*Math.PI*.5,a=Math.sin(n),l=Math.cos(n);for(let h=0;h<this.profile.vertices.length;++h){const n=this.profile.poles[this.profile.poleIndices[h]];u(r,this.profile.vertices[h],n.position),p(r,r,a),n.normal?(f(r,r,n.position),e(t.index,i,r,n.normal,s*l,0)):(c(o,r),p(o,o,a),f(r,r,n.position),e(t.index,i,r,o,s*l,this.sign*l))}}}buildTopology(t,e){const i=this.breakNormals?this.vertexBufferStart+this.profile.poles.length:this.firstProfileVertexIndex,s=this.breakNormals?this.vertexBufferStart+this.profile.poles.length+this.profile.vertices.length:this.vertexBufferStart+this.profile.poles.length;for(let r=0;r<this.profile.numSegments;++r){const t=this.profile.vertexIndices[2*r+0],o=this.profile.vertexIndices[2*r+1],h=this.vertexBufferStart+this.profile.poleIndices[t],n=this.vertexBufferStart+this.profile.poleIndices[o];let a=i+t,l=i+o;for(let i=0;i<this.numSegments-1;++i){const r=s+i*this.profile.vertices.length+t,h=s+i*this.profile.vertices.length+o;this.flip?(e(r,l,a),e(l,r,h)):(e(a,l,r),e(h,r,l)),a=r,l=h}this.flip?(e(h,l,a),h!==n&&e(h,n,l)):(e(a,l,h),h!==n&&e(l,n,h))}}}class ${constructor(t,e,i,s,r,o=K){this.options=o,this._extrusionVertexCount=0,this._triangleCount=0,this.numExtrusionProfiles=0,this.numVerticesTotal=0,this.numNormalsTotal=0,this.numUVTotal=0,this.profile=e,this.path=t,this.extruder=i,this.startCap=s,this.endCap=r;const h=this.path.vertices.length-2;this.numExtrusionProfiles=i.numProfilesPerJoin()*h+2,this.numVerticesTotal=e.vertices.length*this.numExtrusionProfiles,this.numNormalsTotal=this.numVerticesTotal,this.startCap.vertexBufferStart=this.numVerticesTotal;const n=this.startCap.getNumVertices();this.numVerticesTotal+=n,this.numNormalsTotal+=n,this.endCap.vertexBufferStart=this.numVerticesTotal;const a=this.endCap.getNumVertices();this.numVerticesTotal+=a,this.numNormalsTotal+=a,this.pathVertexData=new Float32Array(1*this.numVerticesTotal),this.profileRightAxisData=new Float32Array(4*this.numVerticesTotal),this.profileUpAxisData=new Float32Array(4*this.numVerticesTotal),this.profileVertexAndNormalData=new Float32Array(4*this.numVerticesTotal),this.profile.hasUV()&&this.options.generateUV&&(this.numUVTotal=this.profile.uvs.length,this.uvData=new Float32Array(2*this.numUVTotal)),this.originData=new Float32Array(3*this.path.vertices.length),this._rebuildGeometry(),this.buildTopology()}emitVertex(t,e,i,s,r){if(this.profileRightAxisData[4*this._extrusionVertexCount+0]=e.right[0],this.profileRightAxisData[4*this._extrusionVertexCount+1]=e.right[1],this.profileRightAxisData[4*this._extrusionVertexCount+2]=e.right[2],this.profileUpAxisData[4*this._extrusionVertexCount+0]=e.up[0],this.profileUpAxisData[4*this._extrusionVertexCount+1]=e.up[1],this.profileUpAxisData[4*this._extrusionVertexCount+2]=e.up[2],this.profileVertexAndNormalData[4*this._extrusionVertexCount+0]=i[0],this.profileVertexAndNormalData[4*this._extrusionVertexCount+1]=i[1],this.profileVertexAndNormalData[4*this._extrusionVertexCount+2]=s[0],this.profileVertexAndNormalData[4*this._extrusionVertexCount+3]=s[1],this.pathVertexData[this._extrusionVertexCount]=t,r){const e=this.path.vertices[t];this.profileRightAxisData[4*this._extrusionVertexCount+3]=e.rotationRight[0]*e.maxStretchDistance,this.profileUpAxisData[4*this._extrusionVertexCount+3]=e.rotationRight[1]*e.maxStretchDistance}else this.profileRightAxisData[4*this._extrusionVertexCount+3]=0,this.profileUpAxisData[4*this._extrusionVertexCount+3]=0;++this._extrusionVertexCount}emitCapVertex(t,e,i,s,r,o){this.profileRightAxisData[4*this._extrusionVertexCount+0]=e.right[0],this.profileRightAxisData[4*this._extrusionVertexCount+1]=e.right[1],this.profileRightAxisData[4*this._extrusionVertexCount+2]=e.right[2],this.profileUpAxisData[4*this._extrusionVertexCount+0]=e.up[0],this.profileUpAxisData[4*this._extrusionVertexCount+1]=e.up[1],this.profileUpAxisData[4*this._extrusionVertexCount+2]=e.up[2],this.profileVertexAndNormalData[4*this._extrusionVertexCount+0]=i[0],this.profileVertexAndNormalData[4*this._extrusionVertexCount+1]=i[1],this.profileVertexAndNormalData[4*this._extrusionVertexCount+2]=s[0],this.profileVertexAndNormalData[4*this._extrusionVertexCount+3]=s[1],this.pathVertexData[this._extrusionVertexCount]=t,this.profileRightAxisData[4*this._extrusionVertexCount+3]=r,this.profileUpAxisData[4*this._extrusionVertexCount+3]=o,++this._extrusionVertexCount}emitTriangle(t,e,i){this.vertexIndices[3*this._triangleCount+0]=t,this.vertexIndices[3*this._triangleCount+1]=e,this.vertexIndices[3*this._triangleCount+2]=i,this.pathVertexIndices[3*this._triangleCount+0]=this.pathVertexData[t],this.pathVertexIndices[3*this._triangleCount+1]=this.pathVertexData[e],this.pathVertexIndices[3*this._triangleCount+2]=this.pathVertexData[i],this.normalIndices[3*this._triangleCount+0]=t,this.normalIndices[3*this._triangleCount+1]=e,this.normalIndices[3*this._triangleCount+2]=i,++this._triangleCount}_rebuildGeometry(){const t=(t,e,i,s,r)=>this.emitVertex(t,e,i,s,r),e=(t,e,i,s,r,o)=>this.emitCapVertex(t,e,i,s,r,o);this._extrusionVertexCount=0;for(const i of this.path.vertices)this.originData[3*i.index+0]=i.pos[0],this.originData[3*i.index+1]=i.pos[1],this.originData[3*i.index+2]=i.pos[2];this.startCap.rebuildConnectingProfileGeometry(this.path.vertices[0],this.profile,e);for(let i=1;i<this.path.vertices.length-1;++i)this.extruder.extrude(this.path.vertices[i],this.profile,t);if(this.endCap.rebuildConnectingProfileGeometry(this.path.vertices[this.path.vertices.length-1],this.profile,e),this.startCap.rebuildCapGeometry(this.path.vertices[0],e),this.endCap.rebuildCapGeometry(this.path.vertices[this.path.vertices.length-1],e),this.profile.hasUV()&&this.options.generateUV)for(let i=0;i<this.profile.uvs.length;++i)this.uvData[2*i+0]=this.profile.uvs[i],this.uvData[2*i+1]=0}buildTopology(){const t=(t,e,i)=>this.emitTriangle(t,e,i);this._triangleCount=0;const e=this.profile.vertices.length,i=this.profile.numSegments,s=this.numExtrusionProfiles-1;let r=3*(2*(i*s));this.startCap.indexBufferStart=r,this.startCap.firstProfileVertexIndex=0,r+=this.startCap.getNumIndices(),this.endCap.indexBufferStart=r,this.endCap.firstProfileVertexIndex=e*(this.numExtrusionProfiles-1),r+=this.endCap.getNumIndices(),this.vertexIndices=new Uint32Array(r),this.normalIndices=new Uint32Array(r),this.pathVertexIndices=new Uint32Array(r),this.profile.hasUV()&&this.options.generateUV&&(this.uvIndices=new Uint32Array(r));for(let o=0;o<i;++o){const i=this.profile.vertexIndices[2*o],r=this.profile.vertexIndices[2*o+1];for(let o=0;o<s;++o){const s=o*e+i,h=(o+1)*e+r,n=o*e+r;t(s,(o+1)*e+i,h),t(s,h,n)}}this.startCap.buildTopology(this.path.vertices[0],t),this.endCap.buildTopology(this.path.vertices[this.path.vertices.length-1],t)}onPathChanged(){this._rebuildGeometry()}}class tt{constructor(t){this.builder=t}get xform(){return this.builder.path.xform}onPathChanged(){this.builder.onPathChanged()}}class et extends tt{constructor(t){super(t),this.vertexAttributePosition=null,this.vertexAttributeNormal=null,this.vertexAttributeColor=null,this.vertexAttributePosition=new Float32Array(3*this.builder.numVerticesTotal),this.vertexAttributeNormal=new Float32Array(3*this.builder.numNormalsTotal),this.vertexAttributeColor=new Uint8Array(4),this.vertexAttributeColor[0]=255,this.vertexAttributeColor[1]=255,this.vertexAttributeColor[2]=255,this.vertexAttributeColor[3]=255}bakeVertexColors(t){this.vertexAttributeColor[0]=255*t[0],this.vertexAttributeColor[1]=255*t[1],this.vertexAttributeColor[2]=255*t[2],this.vertexAttributeColor[3]=255*(t.length>3?t[3]:1)}bake(t){this.size=t;for(let e=0;e<this.builder.numVerticesTotal;++e){let i=this.builder.pathVertexData[e];const s=0===i||i===this.builder.path.vertices.length-1;i*=3;const r=st;N(r,this.builder.originData[i++],this.builder.originData[i++],this.builder.originData[i]);const o=4*e,h=nt,l=rt,u=at,d=lt,v=ut;let m=0,g=0;if(N(d,this.builder.profileRightAxisData[o],this.builder.profileRightAxisData[o+1],this.builder.profileRightAxisData[o+2]),N(v,this.builder.profileUpAxisData[o],this.builder.profileUpAxisData[o+1],this.builder.profileUpAxisData[o+2]),n(l,this.builder.profileVertexAndNormalData[o]*t[0],this.builder.profileVertexAndNormalData[o+1]*t[1]),s)I(u,v,d),m=this.builder.profileRightAxisData[o+3]*t[0],g=this.builder.profileUpAxisData[o+3];else{const t=ot,e=ht;n(t,this.builder.profileRightAxisData[o+3],this.builder.profileUpAxisData[o+3]);const i=x(t);c(t,t);const s=a(l,t);if(Math.abs(s)>i){n(e,-t[1],t[0]);const r=a(l,e);p(t,t,i*Math.sign(s)),p(e,e,r),f(l,t,e)}N(u,0,0,0)}N(h,d[0]*l[0]+v[0]*l[1],d[1]*l[0]+v[1]*l[1],d[2]*l[0]+v[2]*l[1]),this.vertexAttributePosition[3*e+0]=r[0]+h[0]+u[0]*m,this.vertexAttributePosition[3*e+1]=r[1]+h[1]+u[1]*m,this.vertexAttributePosition[3*e+2]=r[2]+h[2]+u[2]*m;const V=rt;n(V,this.builder.profileVertexAndNormalData[o+2],this.builder.profileVertexAndNormalData[o+3]),this.vertexAttributeNormal[3*e+0]=d[0]*V[0]+v[0]*V[1]+u[0]*g,this.vertexAttributeNormal[3*e+1]=d[1]*V[0]+v[1]*V[1]+u[1]*g,this.vertexAttributeNormal[3*e+2]=d[2]*V[0]+v[2]*V[1]+u[2]*g}}createGeometryData(){const t=[[O.POSITION,this.builder.vertexIndices],[O.NORMAL,this.builder.normalIndices]],e=[[O.POSITION,{size:3,data:this.vertexAttributePosition,exclusive:!0}],[O.NORMAL,{size:3,data:this.vertexAttributeNormal,exclusive:!0}]];if(this.vertexAttributeColor){const i=this.builder.vertexIndices.length;t.push([O.COLOR,new Uint32Array(i)]),e.push([O.COLOR,{size:4,data:this.vertexAttributeColor}])}return{vertexAttributes:e,indices:t}}onPathChanged(){super.onPathChanged(),this.bake(this.size)}intersect(t,e,i){const s=this.builder.vertexIndices,r={size:3,data:this.vertexAttributePosition},o=s.length/3;M(t,e,0,o,s,r,void 0,void 0,i)}}class it extends tt{constructor(t,e,i,s){super(t),this.sizeAttributeValue=e,this.colorAttributeValue=i,this.opacityAttributeValue=s,this.vvData=null,this.baked=new et(t),this.vvData=new Float32Array(4*this.builder.path.vertices.length);for(let r=0;r<this.builder.path.vertices.length;++r){this.vvData[4*r+0]=e,this.vvData[4*r+1]=i,this.vvData[4*r+2]=s;const t=0===r||r===this.builder.path.vertices.length-1;this.vvData[4*r+3]=t?1:0}}createGeometryData(){return{vertexAttributes:[[O.POSITION,{size:3,data:this.builder.originData,exclusive:!0}],[O.PROFILERIGHT,{size:4,data:this.builder.profileRightAxisData,exclusive:!0}],[O.PROFILEUP,{size:4,data:this.builder.profileUpAxisData,exclusive:!0}],[O.PROFILEVERTEXANDNORMAL,{size:4,data:this.builder.profileVertexAndNormalData,exclusive:!0}],[O.FEATUREVALUE,{size:4,data:this.vvData,exclusive:!0}]],indices:[[O.POSITION,this.builder.pathVertexIndices],[O.PROFILERIGHT,this.builder.vertexIndices],[O.PROFILEUP,this.builder.vertexIndices],[O.PROFILEVERTEXANDNORMAL,this.builder.vertexIndices],[O.FEATUREVALUE,this.builder.pathVertexIndices]]}}}const st=U(),rt=d(),ot=d(),ht=d(),nt=U(),at=U(),lt=U(),ut=U(),pt=U(),ft=k(),ct=h();export{$ as Builder,Q as CapBuilder,H as Extruder,it as FastUpdatePathGeometry,q as MiterExtruder,W as NoCapBuilder,z as Path,tt as PathGeometryData,G as PathVertex,j as Profile,Z as RoundCapBuilder,X as SimpleExtruder,et as StaticPathGeometry,Y as TriangulationCapBuilder,J as computeMinimumRotationTangentFrame,k as makeFrame,B as profileSpaceToVertexSpace,w as vertexSpaceToProfileSpace};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{ShaderOutput as e}from"../core/shaderLibrary/ShaderOutputOptions.js";import{TransparencyPassType as t}from"../lib/basicInterfaces.js";import r from"../lib/GLMaterial.js";import{Material as s,materialParametersDefaults as i}from"../lib/Material.js";import{RenderSlot as a}from"../lib/RenderSlot.js";import{DefaultBufferWriter as n,PositionUVLayout as o}from"./internal/DefaultBufferWriter.js";import{intersectTriangleGeometry as p}from"./internal/MaterialUtil.js";import{CheckerBoardTechniqueConfiguration as u,CheckerBoardTechnique as h}from"../shaders/CheckerBoardTechnique.js";class l extends s{constructor(e){super(e,f),this.techniqueConfig=new u}dispose(){}getPassParameters(){return this.parameters}getTechniqueConfig(e,r){return this.techniqueConfig.transparent=this.parameters.transparent,this.techniqueConfig.writeDepth=this.parameters.writeDepth,this.techniqueConfig.polygonOffset=this.parameters.polygonOffset,this.techniqueConfig.transparencyPassType=r?r.transparencyPassType:t.NONE,this.techniqueConfig.multipassTerrainEnabled=!!r&&r.multipassTerrainEnabled,this.techniqueConfig.cullAboveGround=!!r&&r.cullAboveGround,this.techniqueConfig}intersect(e,t,r,s,i,a,n){return p(e,t,s,i,a,void 0,n)}requiresSlot(e){let t=a.OPAQUE_MATERIAL;return this.parameters.transparent&&(t=this.parameters.writeDepth?a.TRANSPARENT_MATERIAL:a.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),e===t||e===a.DRAPED_MATERIAL}createGLMaterial(t){return t.output===e.Color||t.output===e.Alpha?new c(t):null}createBufferWriter(){return new n(o)}}class c extends r{updateParameters(e){return this.ensureTechnique(h,e)}beginSlot(e){return this.updateParameters(e)}bind(e,t){t.bindPass(this._material.getPassParameters(),e)}}const f={size:[1,1],color1:[.75,.75,.75,1],color2:[.5,.5,.5,1],transparent:!1,writeDepth:!0,polygonOffset:!1,...i};export{l as CheckerBoardMaterial};
5
+ import{ShaderOutput as e}from"../core/shaderLibrary/ShaderOutputOptions.js";import{TransparencyPassType as t}from"../lib/basicInterfaces.js";import r from"../lib/GLMaterial.js";import{Material as s,DefaultMaterialParameters as i}from"../lib/Material.js";import{RenderSlot as a}from"../lib/RenderSlot.js";import{DefaultBufferWriter as n,PositionUVLayout as o}from"./internal/DefaultBufferWriter.js";import{intersectTriangleGeometry as p}from"./internal/MaterialUtil.js";import{CheckerBoardTechniqueConfiguration as u,CheckerBoardTechnique as h}from"../shaders/CheckerBoardTechnique.js";class l extends s{constructor(e){super(e,f),this.techniqueConfig=new u}dispose(){}getPassParameters(){return this.parameters}getTechniqueConfig(e,r){return this.techniqueConfig.transparent=this.parameters.transparent,this.techniqueConfig.writeDepth=this.parameters.writeDepth,this.techniqueConfig.polygonOffset=this.parameters.polygonOffset,this.techniqueConfig.transparencyPassType=r?r.transparencyPassType:t.NONE,this.techniqueConfig.multipassTerrainEnabled=!!r&&r.multipassTerrainEnabled,this.techniqueConfig.cullAboveGround=!!r&&r.cullAboveGround,this.techniqueConfig}intersect(e,t,r,s,i,a,n){return p(e,t,s,i,a,void 0,n)}requiresSlot(e){let t=a.OPAQUE_MATERIAL;return this.parameters.transparent&&(t=this.parameters.writeDepth?a.TRANSPARENT_MATERIAL:a.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),e===t||e===a.DRAPED_MATERIAL}createGLMaterial(t){return t.output===e.Color||t.output===e.Alpha?new c(t):null}createBufferWriter(){return new n(o)}}class c extends r{updateParameters(e){return this.ensureTechnique(h,e)}beginSlot(e){return this.updateParameters(e)}bind(e,t){t.bindPass(this._material.getPassParameters(),e)}}const f={size:[1,1],color1:[.75,.75,.75,1],color2:[.5,.5,.5,1],transparent:!1,writeDepth:!0,polygonOffset:!1,...i};export{l as CheckerBoardMaterial};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{ShaderOutput as e}from"../core/shaderLibrary/ShaderOutputOptions.js";import{CullFaceOptions as t}from"../lib/basicInterfaces.js";import r from"../lib/GLMaterial.js";import{outputFromPass as s}from"../lib/GLMaterials.js";import{materialParametersDefaults as i,Material as a}from"../lib/Material.js";import{OITPolygonOffsetLimit as n}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as o}from"../lib/RenderSlot.js";import{DefaultBufferWriter as l,PositionColorLayout as u}from"./internal/DefaultBufferWriter.js";import{intersectTriangleGeometry as h}from"./internal/MaterialUtil.js";import{ColorMaterialTechniqueConfiguration as p,ColorMaterialTechnique as c}from"../shaders/ColorMaterialTechnique.js";class m extends a{constructor(e){super(e,d),this.supportsEdges=!0,this.techniqueConfig=new p}getTechniqueConfig(e,t){return this.techniqueConfig.output=e,this.techniqueConfig.cullFace=this.parameters.cullFace,this.techniqueConfig.vertexColors=this.parameters.vertexColors,this.techniqueConfig.slicePlaneEnabled=this.parameters.slicePlaneEnabled,this.techniqueConfig.transparent=this.parameters.transparent,this.techniqueConfig.polygonOffset=this.parameters.polygonOffset,this.techniqueConfig.writeDepth=this.parameters.writeDepth,this.techniqueConfig.sceneHasOcludees=this.parameters.sceneHasOcludees,this.techniqueConfig.transparencyPassType=t.transparencyPassType,this.techniqueConfig.enableOffset=t.camera.relativeElevation<n,this.techniqueConfig.multipassTerrainEnabled=t.multipassTerrainEnabled,this.techniqueConfig.cullAboveGround=t.cullAboveGround,this.techniqueConfig}getPassParameters(){return this.parameters}intersect(e,t,r,s,i,a,n){h(e,t,s,i,a,void 0,n)}requiresSlot(t,r){if(t===o.DRAPED_MATERIAL)return!0;if(s(r)===e.Highlight)return t===o.OPAQUE_MATERIAL;return t===(this.parameters.transparent?this.parameters.writeDepth?o.TRANSPARENT_MATERIAL:o.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL:o.OPAQUE_MATERIAL)}createGLMaterial(t){return t.output===e.Color||t.output===e.Alpha||t.output===e.Highlight||t.output===e.Depth&&this.parameters.writeLinearDepth?new f(t):null}createBufferWriter(){return new l(u)}}class f extends r{updateParameters(e){return this.ensureTechnique(c,e)}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.sceneHasOcludees&&this._material.setParameters({sceneHasOcludees:e.hasOccludees})}beginSlot(t){return this._output!==e.Color&&this._output!==e.Alpha||this._updateOccludeeState(t),this.updateParameters(t)}bind(e,t){t.bindPass(this._material.getPassParameters(),e)}}const d={color:[1,1,1,1],transparent:!1,writeDepth:!0,writeLinearDepth:!1,vertexColors:!1,polygonOffset:!1,slicePlaneEnabled:!1,cullFace:t.None,sceneHasOcludees:!1,...i};export{m as ColorMaterial};
5
+ import{ShaderOutput as e}from"../core/shaderLibrary/ShaderOutputOptions.js";import{CullFaceOptions as t}from"../lib/basicInterfaces.js";import r from"../lib/GLMaterial.js";import{outputFromPass as s}from"../lib/GLMaterials.js";import{DefaultMaterialParameters as i,Material as a}from"../lib/Material.js";import{OITPolygonOffsetLimit as n}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as o}from"../lib/RenderSlot.js";import{DefaultBufferWriter as l,PositionColorLayout as u}from"./internal/DefaultBufferWriter.js";import{intersectTriangleGeometry as h}from"./internal/MaterialUtil.js";import{ColorMaterialTechniqueConfiguration as p,ColorMaterialTechnique as c}from"../shaders/ColorMaterialTechnique.js";class m extends a{constructor(e){super(e,d),this.supportsEdges=!0,this.techniqueConfig=new p}getTechniqueConfig(e,t){return this.techniqueConfig.output=e,this.techniqueConfig.cullFace=this.parameters.cullFace,this.techniqueConfig.vertexColors=this.parameters.vertexColors,this.techniqueConfig.slicePlaneEnabled=this.parameters.slicePlaneEnabled,this.techniqueConfig.transparent=this.parameters.transparent,this.techniqueConfig.polygonOffset=this.parameters.polygonOffset,this.techniqueConfig.writeDepth=this.parameters.writeDepth,this.techniqueConfig.sceneHasOcludees=this.parameters.sceneHasOcludees,this.techniqueConfig.transparencyPassType=t.transparencyPassType,this.techniqueConfig.enableOffset=t.camera.relativeElevation<n,this.techniqueConfig.multipassTerrainEnabled=t.multipassTerrainEnabled,this.techniqueConfig.cullAboveGround=t.cullAboveGround,this.techniqueConfig}getPassParameters(){return this.parameters}intersect(e,t,r,s,i,a,n){h(e,t,s,i,a,void 0,n)}requiresSlot(t,r){if(t===o.DRAPED_MATERIAL)return!0;if(s(r)===e.Highlight)return t===o.OPAQUE_MATERIAL;return t===(this.parameters.transparent?this.parameters.writeDepth?o.TRANSPARENT_MATERIAL:o.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL:o.OPAQUE_MATERIAL)}createGLMaterial(t){return t.output===e.Color||t.output===e.Alpha||t.output===e.Highlight||t.output===e.Depth&&this.parameters.writeLinearDepth?new f(t):null}createBufferWriter(){return new l(u)}}class f extends r{updateParameters(e){return this.ensureTechnique(c,e)}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.sceneHasOcludees&&this._material.setParameters({sceneHasOcludees:e.hasOccludees})}beginSlot(t){return this._output!==e.Color&&this._output!==e.Alpha||this._updateOccludeeState(t),this.updateParameters(t)}bind(e,t){t.bindPass(this._material.getPassParameters(),e)}}const d={color:[1,1,1,1],transparent:!1,writeDepth:!0,writeLinearDepth:!1,vertexColors:!1,polygonOffset:!1,slicePlaneEnabled:!1,cullFace:t.None,sceneHasOcludees:!1,...i};export{m as ColorMaterial};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as e}from"../../../../core/maybe.js";import{c as t}from"../../../../chunks/mat3f64.js";import{s as i,g as s,n as r,f as a,l as n,a as o,d as l,t as c}from"../../../../chunks/vec3.js";import{c as u,f as h}from"../../../../chunks/vec3f64.js";import{ViewingMode as d}from"../../../ViewingMode.js";import{newLayout as p}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as m}from"../core/shaderLibrary/ShaderOutputOptions.js";import{Normals as f}from"../core/shaderLibrary/shading/Normals.glsl.js";import{defaultMaskAlphaCutoff as v}from"../core/shaderLibrary/util/AlphaDiscard.glsl.js";import{CullFaceOptions as g,AlphaDiscardMode as T,VertexAttribute as b}from"../lib/basicInterfaces.js";import C from"../lib/GLMaterialTexture.js";import{materialParametersDefaults as S,Material as O}from"../lib/Material.js";import{OITPolygonOffsetLimit as x}from"../lib/OrderIndependentTransparency.js";import{RenderPass as A}from"../lib/RenderPass.js";import{RenderSlot as E}from"../lib/RenderSlot.js";import{getVerticalOffsetObject3D as M}from"../lib/verticalOffsetUtils.js";import{writeDefaultAttributes as q}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as I,intersectTriangleGeometry as P}from"./internal/MaterialUtil.js";import{DefaultMaterialTechniqueConfiguration as L,DefaultMaterialTechnique as D}from"../shaders/DefaultMaterialTechnique.js";import{RealisticTreeTechnique as R}from"../shaders/RealisticTreeTechnique.js";class y extends O{constructor(e){super(e,w),this.supportsEdges=!0,this.techniqueConfig=new L,this.vertexBufferLayout=N(this.parameters),this.instanceBufferLayout=e.instanced?j(this.parameters):null}isVisibleInPass(e){return e!==A.MATERIAL_DEPTH_SHADOWMAP_ALL&&e!==A.MATERIAL_DEPTH_SHADOWMAP_DEFAULT&&e!==A.MATERIAL_DEPTH_SHADOWMAP_HIGHLIGHT||this.parameters.castShadows}isVisible(){const e=this.parameters;if(!super.isVisible()||0===e.layerOpacity)return!1;const t=e.instanced,i=e.vertexColors,s=e.symbolColors,r=!!t&&t.indexOf("color")>-1,a=e.vvColorEnabled,n="replace"===e.colorMixMode,o=e.opacity>0,l=e.externalColor&&e.externalColor[3]>0;return i&&(r||a||s)?!!n||o:i?n?l:o:r||a||s?!!n||o:n?l:o}getTechniqueConfig(t,i){return this.techniqueConfig.output=t,this.techniqueConfig.hasNormalTexture=!!this.parameters.normalTextureId,this.techniqueConfig.hasColorTexture=!!this.parameters.textureId,this.techniqueConfig.vertexTangents=this.parameters.vertexTangents,this.techniqueConfig.instanced=!!this.parameters.instanced,this.techniqueConfig.instancedDoublePrecision=this.parameters.instancedDoublePrecision,this.techniqueConfig.vvSize=this.parameters.vvSizeEnabled,this.techniqueConfig.verticalOffset=null!==this.parameters.verticalOffset,this.techniqueConfig.screenSizePerspective=null!==this.parameters.screenSizePerspective,this.techniqueConfig.slicePlaneEnabled=this.parameters.slicePlaneEnabled,this.techniqueConfig.sliceHighlightDisabled=this.parameters.sliceHighlightDisabled,this.techniqueConfig.alphaDiscardMode=this.parameters.textureAlphaMode,this.techniqueConfig.normalsTypeDerivate="screenDerivative"===this.parameters.normals,this.techniqueConfig.transparent=this.parameters.transparent,this.techniqueConfig.writeDepth=this.parameters.writeDepth,this.techniqueConfig.sceneHasOcludees=this.parameters.sceneHasOcludees,this.techniqueConfig.cullFace=this.parameters.slicePlaneEnabled?g.None:this.parameters.cullFace,this.techniqueConfig.multipassTerrainEnabled=i.multipassTerrainEnabled,this.techniqueConfig.cullAboveGround=i.cullAboveGround,this.techniqueConfig.hasModelTransformation=e(this.parameters.modelTransformation),t!==m.Color&&t!==m.Alpha||(this.techniqueConfig.vertexColors=this.parameters.vertexColors,this.techniqueConfig.symbolColors=this.parameters.symbolColors,this.parameters.treeRendering?this.techniqueConfig.doubleSidedMode=f.DoubleSidedMode.WindingOrder:this.techniqueConfig.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?f.DoubleSidedMode.View:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?f.DoubleSidedMode.WindingOrder:f.DoubleSidedMode.None,this.techniqueConfig.instancedColor=!!this.parameters.instanced&&this.parameters.instanced.indexOf("color")>-1,this.techniqueConfig.receiveShadows=this.parameters.receiveShadows&&this.parameters.shadowMappingEnabled,this.techniqueConfig.receiveAmbientOcclusion=!!i.ssaoEnabled&&this.parameters.receiveSSAO,this.techniqueConfig.vvColor=this.parameters.vvColorEnabled,this.techniqueConfig.textureAlphaPremultiplied=!!this.parameters.textureAlphaPremultiplied,this.techniqueConfig.usePBR=this.parameters.usePBR,this.techniqueConfig.hasMetalnessAndRoughnessTexture=!!this.parameters.metallicRoughnessTextureId,this.techniqueConfig.hasEmissionTexture=!!this.parameters.emissiveTextureId,this.techniqueConfig.hasOcclusionTexture=!!this.parameters.occlusionTextureId,this.techniqueConfig.offsetBackfaces=!(!this.parameters.transparent||!this.parameters.offsetTransparentBackfaces),this.techniqueConfig.isSchematic=this.parameters.usePBR&&this.parameters.isSchematic,this.techniqueConfig.transparencyPassType=i.transparencyPassType,this.techniqueConfig.enableOffset=i.camera.relativeElevation<x),this.techniqueConfig}intersect(e,t,u,h,p,m,f){if(null!==this.parameters.verticalOffset){const e=h.camera;i(U,u[12],u[13],u[14]);let t=null;switch(h.viewingMode){case d.Global:t=r(k,U);break;case d.Local:t=s(k,G)}let f=0;if(null!==this.parameters.verticalOffset){const i=a(V,U,e.eye),s=n(i),r=o(i,i,1/s);let c=null;this.parameters.screenSizePerspective&&(c=l(t,r)),f+=I(e,s,this.parameters.verticalOffset,c,this.parameters.screenSizePerspective)}o(t,t,f),c(F,t,h.transform.inverseRotation),p=a(H,p,F),m=a(z,m,F)}P(e,t,h,p,m,M(h.verticalOffset),f)}requiresSlot(e){return e===(this.parameters.transparent?this.parameters.writeDepth?E.TRANSPARENT_MATERIAL:E.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL:E.OPAQUE_MATERIAL)||e===E.DRAPED_MATERIAL}createGLMaterial(e){return e.output===m.Color||e.output===m.Alpha||e.output===m.Depth||e.output===m.Normal||e.output===m.Shadow||e.output===m.Highlight?new _(e):null}createBufferWriter(){return new B(this.vertexBufferLayout,this.instanceBufferLayout)}}class _ extends C{constructor(e){super({...e,...e.material.parameters})}updateParameters(e){const t=this._material.parameters;return this.updateTexture(t.textureId),this.ensureTechnique(t.treeRendering?R:D,e)}_updateShadowState(e){e.shadowMappingEnabled!==this._material.parameters.shadowMappingEnabled&&this._material.setParameters({shadowMappingEnabled:e.shadowMappingEnabled})}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.sceneHasOcludees&&this._material.setParameters({sceneHasOcludees:e.hasOccludees})}beginSlot(e){return this._output!==m.Color&&this._output!==m.Alpha||(this._updateShadowState(e),this._updateOccludeeState(e)),this.updateParameters(e)}bind(e,t){t.bindPass(this._material.parameters,e),this.bindTextures(t.program)}}const w={textureId:void 0,initTextureTransparent:!1,isSchematic:!1,usePBR:!1,normalTextureId:void 0,vertexTangents:!1,occlusionTextureId:void 0,emissiveTextureId:void 0,metallicRoughnessTextureId:void 0,emissiveFactor:[0,0,0],mrrFactors:[0,1,.5],ambient:[.2,.2,.2],diffuse:[.8,.8,.8],externalColor:[1,1,1,1],colorMixMode:"multiply",opacity:1,layerOpacity:1,vertexColors:!1,symbolColors:!1,doubleSided:!1,doubleSidedType:"normal",cullFace:g.Back,instanced:void 0,instancedDoublePrecision:!1,normals:"default",receiveSSAO:!0,receiveShadows:!0,castShadows:!0,shadowMappingEnabled:!1,verticalOffset:null,screenSizePerspective:null,slicePlaneEnabled:!1,sliceHighlightDisabled:!1,offsetTransparentBackfaces:!1,vvSizeEnabled:!1,vvSizeMinSize:[1,1,1],vvSizeMaxSize:[100,100,100],vvSizeOffset:[0,0,0],vvSizeFactor:[1,1,1],vvSizeValue:[1,1,1],vvColorEnabled:!1,vvColorValues:[0,0,0,0,0,0,0,0],vvColorColors:[1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0],vvSymbolAnchor:[0,0,0],vvSymbolRotationMatrix:t(),modelTransformation:null,transparent:!1,writeDepth:!0,textureAlphaMode:T.Blend,textureAlphaCutoff:v,textureAlphaPremultiplied:!1,sceneHasOcludees:!1,...S};class B{constructor(e,t){this.vertexBufferLayout=e,this.instanceBufferLayout=t}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){return e.indices.get(b.POSITION).length}write(e,t,i,s){q(t,this.vertexBufferLayout,e.transformation,e.invTranspTransformation,i,s)}}function N(e){const t=e.textureId||e.normalTextureId||e.metallicRoughnessTextureId||e.emissiveTextureId||e.occlusionTextureId,i=p().vec3f(b.POSITION).vec3f(b.NORMAL);return e.vertexTangents&&i.vec4f(b.TANGENT),t&&i.vec2f(b.UV0),e.vertexColors&&i.vec4u8(b.COLOR),e.symbolColors&&i.vec4u8(b.SYMBOLCOLOR),i}function j(e){let t=p();return t=e.instancedDoublePrecision?t.vec3f(b.MODELORIGINHI).vec3f(b.MODELORIGINLO).mat3f(b.MODEL).mat3f(b.MODELNORMAL):t.mat4f(b.MODEL).mat4f(b.MODELNORMAL),e.instanced&&e.instanced.indexOf("color")>-1&&(t=t.vec4f(b.INSTANCECOLOR)),e.instanced&&e.instanced.indexOf("featureAttribute")>-1&&(t=t.vec4f(b.INSTANCEFEATUREATTRIBUTE)),t}const H=u(),z=u(),G=h(0,0,1),k=u(),F=u(),U=u(),V=u();export{y as DefaultMaterial,j as getInstanceBufferLayout};
5
+ import{isSome as e}from"../../../../core/maybe.js";import{c as t}from"../../../../chunks/mat3f64.js";import{s as i,g as r,n as s,f as a,l as n,a as o,d as l,t as c}from"../../../../chunks/vec3.js";import{c as h,f as u}from"../../../../chunks/vec3f64.js";import{ViewingMode as d}from"../../../ViewingMode.js";import{newLayout as p}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as m}from"../core/shaderLibrary/ShaderOutputOptions.js";import{NormalsDoubleSidedMode as f}from"../core/shaderLibrary/shading/Normals.glsl.js";import{defaultMaskAlphaCutoff as v}from"../core/shaderLibrary/util/AlphaDiscard.glsl.js";import{CullFaceOptions as g,AlphaDiscardMode as T}from"../lib/basicInterfaces.js";import C from"../lib/GLMaterialTexture.js";import{DefaultMaterialParameters as b,Material as O}from"../lib/Material.js";import{OITPolygonOffsetLimit as x}from"../lib/OrderIndependentTransparency.js";import{RenderPass as S}from"../lib/RenderPass.js";import{RenderSlot as A}from"../lib/RenderSlot.js";import{VertexAttribute as E}from"../lib/VertexAttribute.js";import{getVerticalOffsetObject3D as M}from"../lib/verticalOffsetUtils.js";import{writeDefaultAttributes as q}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as I,intersectTriangleGeometry as P}from"./internal/MaterialUtil.js";import{DefaultMaterialTechniqueConfiguration as L,DefaultMaterialTechnique as R}from"../shaders/DefaultMaterialTechnique.js";import{RealisticTreeTechnique as y}from"../shaders/RealisticTreeTechnique.js";class D extends O{constructor(e){super(e,w),this.supportsEdges=!0,this.techniqueConfig=new L,this.vertexBufferLayout=N(this.parameters),this.instanceBufferLayout=e.instanced?j(this.parameters):null}isVisibleInPass(e){return e!==S.MATERIAL_DEPTH_SHADOWMAP_ALL&&e!==S.MATERIAL_DEPTH_SHADOWMAP_DEFAULT&&e!==S.MATERIAL_DEPTH_SHADOWMAP_HIGHLIGHT||this.parameters.castShadows}isVisible(){const e=this.parameters;if(!super.isVisible()||0===e.layerOpacity)return!1;const t=e.instanced,i=e.vertexColors,r=e.symbolColors,s=!!t&&t.indexOf("color")>-1,a=e.vvColorEnabled,n="replace"===e.colorMixMode,o=e.opacity>0,l=e.externalColor&&e.externalColor[3]>0;return i&&(s||a||r)?!!n||o:i?n?l:o:s||a||r?!!n||o:n?l:o}getTechniqueConfig(t,i){return this.techniqueConfig.output=t,this.techniqueConfig.hasNormalTexture=!!this.parameters.normalTextureId,this.techniqueConfig.hasColorTexture=!!this.parameters.textureId,this.techniqueConfig.vertexTangents=this.parameters.vertexTangents,this.techniqueConfig.instanced=!!this.parameters.instanced,this.techniqueConfig.instancedDoublePrecision=this.parameters.instancedDoublePrecision,this.techniqueConfig.vvSize=this.parameters.vvSizeEnabled,this.techniqueConfig.verticalOffset=null!==this.parameters.verticalOffset,this.techniqueConfig.screenSizePerspective=null!==this.parameters.screenSizePerspective,this.techniqueConfig.slicePlaneEnabled=this.parameters.slicePlaneEnabled,this.techniqueConfig.sliceHighlightDisabled=this.parameters.sliceHighlightDisabled,this.techniqueConfig.alphaDiscardMode=this.parameters.textureAlphaMode,this.techniqueConfig.normalsTypeDerivate="screenDerivative"===this.parameters.normals,this.techniqueConfig.transparent=this.parameters.transparent,this.techniqueConfig.writeDepth=this.parameters.writeDepth,this.techniqueConfig.sceneHasOcludees=this.parameters.sceneHasOcludees,this.techniqueConfig.cullFace=this.parameters.slicePlaneEnabled?g.None:this.parameters.cullFace,this.techniqueConfig.multipassTerrainEnabled=i.multipassTerrainEnabled,this.techniqueConfig.cullAboveGround=i.cullAboveGround,this.techniqueConfig.hasModelTransformation=e(this.parameters.modelTransformation),t!==m.Color&&t!==m.Alpha||(this.techniqueConfig.vertexColors=this.parameters.vertexColors,this.techniqueConfig.symbolColors=this.parameters.symbolColors,this.parameters.treeRendering?this.techniqueConfig.doubleSidedMode=f.WindingOrder:this.techniqueConfig.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?f.View:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?f.WindingOrder:f.None,this.techniqueConfig.instancedColor=!!this.parameters.instanced&&this.parameters.instanced.indexOf("color")>-1,this.techniqueConfig.receiveShadows=this.parameters.receiveShadows&&this.parameters.shadowMappingEnabled,this.techniqueConfig.receiveAmbientOcclusion=!!i.ssaoEnabled&&this.parameters.receiveSSAO,this.techniqueConfig.vvColor=this.parameters.vvColorEnabled,this.techniqueConfig.textureAlphaPremultiplied=!!this.parameters.textureAlphaPremultiplied,this.techniqueConfig.usePBR=this.parameters.usePBR,this.techniqueConfig.hasMetalnessAndRoughnessTexture=!!this.parameters.metallicRoughnessTextureId,this.techniqueConfig.hasEmissionTexture=!!this.parameters.emissiveTextureId,this.techniqueConfig.hasOcclusionTexture=!!this.parameters.occlusionTextureId,this.techniqueConfig.offsetBackfaces=!(!this.parameters.transparent||!this.parameters.offsetTransparentBackfaces),this.techniqueConfig.isSchematic=this.parameters.usePBR&&this.parameters.isSchematic,this.techniqueConfig.transparencyPassType=i.transparencyPassType,this.techniqueConfig.enableOffset=i.camera.relativeElevation<x),this.techniqueConfig}intersect(e,t,h,u,p,m,f){if(null!==this.parameters.verticalOffset){const e=u.camera;i(F,h[12],h[13],h[14]);let t=null;switch(u.viewingMode){case d.Global:t=s(V,F);break;case d.Local:t=r(V,G)}let f=0;if(null!==this.parameters.verticalOffset){const i=a(U,F,e.eye),r=n(i),s=o(i,i,1/r);let c=null;this.parameters.screenSizePerspective&&(c=l(t,s)),f+=I(e,r,this.parameters.verticalOffset,c,this.parameters.screenSizePerspective)}o(t,t,f),c(k,t,u.transform.inverseRotation),p=a(H,p,k),m=a(z,m,k)}P(e,t,u,p,m,M(u.verticalOffset),f)}requiresSlot(e){return e===(this.parameters.transparent?this.parameters.writeDepth?A.TRANSPARENT_MATERIAL:A.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL:A.OPAQUE_MATERIAL)||e===A.DRAPED_MATERIAL}createGLMaterial(e){return e.output===m.Color||e.output===m.Alpha||e.output===m.Depth||e.output===m.Normal||e.output===m.Shadow||e.output===m.Highlight?new _(e):null}createBufferWriter(){return new B(this.vertexBufferLayout,this.instanceBufferLayout)}}class _ extends C{constructor(e){super({...e,...e.material.parameters})}updateParameters(e){const t=this._material.parameters;return this.updateTexture(t.textureId),this.ensureTechnique(t.treeRendering?y:R,e)}_updateShadowState(e){e.shadowMappingEnabled!==this._material.parameters.shadowMappingEnabled&&this._material.setParameters({shadowMappingEnabled:e.shadowMappingEnabled})}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.sceneHasOcludees&&this._material.setParameters({sceneHasOcludees:e.hasOccludees})}beginSlot(e){return this._output!==m.Color&&this._output!==m.Alpha||(this._updateShadowState(e),this._updateOccludeeState(e)),this.updateParameters(e)}bind(e,t){t.bindPass(this._material.parameters,e),this.bindTextures(t.program)}}const w={textureId:void 0,initTextureTransparent:!1,isSchematic:!1,usePBR:!1,normalTextureId:void 0,vertexTangents:!1,occlusionTextureId:void 0,emissiveTextureId:void 0,metallicRoughnessTextureId:void 0,emissiveFactor:[0,0,0],mrrFactors:[0,1,.5],ambient:[.2,.2,.2],diffuse:[.8,.8,.8],externalColor:[1,1,1,1],colorMixMode:"multiply",opacity:1,layerOpacity:1,vertexColors:!1,symbolColors:!1,doubleSided:!1,doubleSidedType:"normal",cullFace:g.Back,instanced:void 0,instancedDoublePrecision:!1,normals:"default",receiveSSAO:!0,receiveShadows:!0,castShadows:!0,shadowMappingEnabled:!1,verticalOffset:null,screenSizePerspective:null,slicePlaneEnabled:!1,sliceHighlightDisabled:!1,offsetTransparentBackfaces:!1,vvSizeEnabled:!1,vvSizeMinSize:[1,1,1],vvSizeMaxSize:[100,100,100],vvSizeOffset:[0,0,0],vvSizeFactor:[1,1,1],vvSizeValue:[1,1,1],vvColorEnabled:!1,vvColorValues:[0,0,0,0,0,0,0,0],vvColorColors:[1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0],vvSymbolAnchor:[0,0,0],vvSymbolRotationMatrix:t(),modelTransformation:null,transparent:!1,writeDepth:!0,textureAlphaMode:T.Blend,textureAlphaCutoff:v,textureAlphaPremultiplied:!1,sceneHasOcludees:!1,...b};class B{constructor(e,t){this.vertexBufferLayout=e,this.instanceBufferLayout=t}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){return e.indices.get(E.POSITION).length}write(e,t,i,r){q(t,this.vertexBufferLayout,e.transformation,e.invTranspTransformation,i,r)}}function N(e){const t=e.textureId||e.normalTextureId||e.metallicRoughnessTextureId||e.emissiveTextureId||e.occlusionTextureId,i=p().vec3f(E.POSITION).vec3f(E.NORMAL);return e.vertexTangents&&i.vec4f(E.TANGENT),t&&i.vec2f(E.UV0),e.vertexColors&&i.vec4u8(E.COLOR),e.symbolColors&&i.vec4u8(E.SYMBOLCOLOR),i}function j(e){let t=p();return t=e.instancedDoublePrecision?t.vec3f(E.MODELORIGINHI).vec3f(E.MODELORIGINLO).mat3f(E.MODEL).mat3f(E.MODELNORMAL):t.mat4f(E.MODEL).mat4f(E.MODELNORMAL),e.instanced&&e.instanced.indexOf("color")>-1&&(t=t.vec4f(E.INSTANCECOLOR)),e.instanced&&e.instanced.indexOf("featureAttribute")>-1&&(t=t.vec4f(E.INSTANCEFEATUREATTRIBUTE)),t}const H=h(),z=h(),G=u(0,0,1),V=h(),k=h(),F=h(),U=h();export{D as DefaultMaterial,j as getInstanceBufferLayout};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{clamp as e}from"../../../../core/mathUtils.js";import{isSome as t}from"../../../../core/maybe.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{f as s}from"../../../../chunks/mat3.js";import{c as i}from"../../../../chunks/mat3f64.js";import{a as n}from"../../../../chunks/mat4.js";import{c as a}from"../../../../chunks/mat4f64.js";import{c as o}from"../../../../chunks/vec2.js";import{a as c,f as l}from"../../../../chunks/vec2f64.js";import{s as f,m as u,n as p,f as m,a as h,g as d,l as g,i as O,t as S,d as v,b}from"../../../../chunks/vec3.js";import{c as A,f as P}from"../../../../chunks/vec3f64.js";import{isMat4 as x}from"../../../../core/libs/gl-matrix-2/types/mat4.js";import{create as C}from"../../../../geometry/support/aaBoundingRect.js";import{newLayout as y}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as I}from"../core/shaderLibrary/ShaderOutputOptions.js";import{HUDSpace as z}from"../core/shaderLibrary/hud/HUD.glsl.js";import{VertexAttribute as T}from"../lib/basicInterfaces.js";import{computeAttachmentOriginPoints as _}from"../lib/geometryDataUtils.js";import E from"../lib/GLMaterialTexture.js";import{Material as U,materialParametersDefaults as j}from"../lib/Material.js";import{RenderSlot as q}from"../lib/RenderSlot.js";import{applyScaleFactor as M,applyPrecomputedScaleFactor as w,precomputeScaleFactor as L}from"../lib/screenSizePerspectiveUtils.js";import{assert as D}from"../lib/Util.js";import{writePosition as R,writeNormal as V,writeColor as N,writeBufferVec4 as G}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as B}from"./internal/MaterialUtil.js";import{isInstanceHidden as H}from"./renderers/utils.js";import{c as X}from"../../../../chunks/HUDMaterial.glsl.js";import{HUDMaterialTechniqueConfiguration as k,HUDMaterialTechnique as F}from"../shaders/HUDMaterialTechnique.js";class W extends U{constructor(e){super(e,ge),this.techniqueConfig=new k}getTechniqueConfig(e,t){return this.techniqueConfig.output=e,this.techniqueConfig.slicePlaneEnabled=this.parameters.slicePlaneEnabled,this.techniqueConfig.verticalOffset=!!this.parameters.verticalOffset,this.techniqueConfig.screenSizePerspective=!!this.parameters.screenSizePerspective,this.techniqueConfig.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits?z.Screen:z.World,this.techniqueConfig.polygonOffsetEnabled=this.parameters.polygonOffset,this.techniqueConfig.isDraped=this.parameters.isDraped,this.techniqueConfig.occlusionTestEnabled=this.parameters.occlusionTest,this.techniqueConfig.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,this.techniqueConfig.sdf=this.parameters.textureIsSignedDistanceField,this.techniqueConfig.vvSize=!!this.parameters.vvSizeEnabled,this.techniqueConfig.vvColor=!!this.parameters.vvColorEnabled,e===I.Color&&(this.techniqueConfig.debugDrawLabelBorder=!!this.parameters.debugDrawLabelBorder),e===I.Highlight&&(this.techniqueConfig.binaryHighlightOcclusion=this.parameters.binaryHighlightOcclusion),this.techniqueConfig.depthEnabled=this.parameters.depthEnabled,this.techniqueConfig.transparencyPassType=t.transparencyPassType,this.techniqueConfig.multipassGeometryEnabled=t.multipassGeometryEnabled,this.techniqueConfig.multipassTerrainEnabled=t.multipassTerrainEnabled,this.techniqueConfig.cullAboveGround=t.cullAboveGround,this.techniqueConfig}intersect(e,r,s,i,n,a,o,c,l){t(l)?this._intersectDrapedHudGeometry(e,a,o,c,l):this._intersectHudGeometry(e,r,s,i,o,c)}_intersectDrapedHudGeometry(e,r,s,i,n){const a=e.vertexAttributes.get(T.POSITION),o=e.vertexAttributes.get(T.SIZE),c=this.parameters,l=X(c);let f=1,u=1;if(t(i)){const e=i(ue);f=e[0],u=e[5]}f*=e.screenToWorldRatio,u*=e.screenToWorldRatio;const p=me*e.screenToWorldRatio;for(let t=0;t<a.data.length/a.size;t++){const i=t*a.size,m=a.data[i],h=a.data[i+1],d=t*o.size;let g;he[0]=o.data[d]*f,he[1]=o.data[d+1]*u,c.textureIsSignedDistanceField&&(g=c.outlineSize*e.screenToWorldRatio/2),Y(r,m,h,he,p,g,c,l)&&s(n.dist,n.normal,-1,!0)}}_intersectHudGeometry(e,r,i,a,o,c){if(!a.options.selectionMode||!a.options.hud||H(r))return;const l=this.parameters;let S=1,v=1;if(s(ae,i),t(c)){const e=c(ue);S=e[0],v=e[5],Q(ae)}const b=e.vertexAttributes.get(T.POSITION),P=e.vertexAttributes.get(T.SIZE),x=e.vertexAttributes.get(T.NORMAL),C=e.vertexAttributes.get(T.AUXPOS1);D(b.size>=3);const y=a.point,I=a.camera,z=X(l);S*=I.pixelRatio,v*=I.pixelRatio;const _="screen"===this.parameters.centerOffsetUnits;for(let t=0;t<b.data.length/b.size;t++){const e=t*b.size;f(te,b.data[e],b.data[e+1],b.data[e+2]),u(te,te,i);const r=t*P.size;he[0]=P.data[r]*S,he[1]=P.data[r+1]*v,u(te,te,I.viewMatrix);const s=t*C.size;if(f(le,C.data[s+0],C.data[s+1],C.data[s+2]),!_&&(te[0]+=le[0],te[1]+=le[1],0!==le[2])){const e=le[2];p(le,te),m(te,te,h(le,le,e))}const c=t*x.size;if(f(re,x.data[c],x.data[c+1],x.data[c+2]),this._normalAndViewAngle(re,ae,I,fe),this._applyVerticalOffsetTransformationView(te,fe,I,$),I.applyProjection(te,se),se[0]>-1){let e=Math.floor(se[0])+this.parameters.screenOffset[0],t=Math.floor(se[1])+this.parameters.screenOffset[1];_&&(e+=le[0],0!==le[1]&&(t+=M(le[1],$.factorAlignment))),w(he,$.factor,he);const r=pe*I.pixelRatio;let s;if(l.textureIsSignedDistanceField&&(s=l.outlineSize*I.pixelRatio/2),Y(y,e,t,he,r,s,l,z)){const e=a.ray;if(u(ne,te,n(ce,I.viewMatrix)),se[0]=y[0],se[1]=y[1],I.unprojectFromRenderScreen(se,te)){const t=A();d(t,e.direction);const r=1/g(t);h(t,t,r);o(O(e.origin,te)*r,t,-1,!0,1,ne)}}}}}computeAttachmentOrigin(e,t){const r=e.vertexAttributes;if(!r)return!1;const s=r.get(T.POSITION),i=e.indices.get(T.POSITION);return _(s,i,t)}createBufferWriter(){return new Se(this)}_normalAndViewAngle(e,t,r,i){return x(t)&&(t=s(oe,t)),S(i.normal,e,t),u(i.normal,i.normal,r.viewInverseTransposeMatrix),i.cosAngle=v(ie,de),i}_updateScaleInfo(e,t,r){const s=this.parameters;s.screenSizePerspective?L(r,t,s.screenSizePerspective,e.factor):(e.factor.scale=1,e.factor.factor=0,e.factor.minPixelSize=0,e.factor.paddingPixels=0),s.screenSizePerspectiveAlignment?L(r,t,s.screenSizePerspectiveAlignment,e.factorAlignment):(e.factorAlignment.factor=e.factor.factor,e.factorAlignment.scale=e.factor.scale,e.factorAlignment.minPixelSize=e.factor.minPixelSize,e.factorAlignment.paddingPixels=e.factor.paddingPixels)}applyShaderOffsetsView(e,t,r,s,i,n,a){const o=this._normalAndViewAngle(t,r,i,fe);return this._applyVerticalGroundOffsetView(e,o,i,a),this._applyVerticalOffsetTransformationView(a,o,i,n),this._applyPolygonOffsetView(a,o,s[3],i,a),this._applyCenterOffsetView(a,s,a),a}applyShaderOffsetsNDC(e,r,s,i,n){return this._applyCenterOffsetNDC(e,r,s,i),t(n)&&d(n,i),this._applyPolygonOffsetNDC(i,r,s,i),i}_applyPolygonOffsetView(t,r,s,i,n){const a=i.aboveGround?1:-1;let o=Math.sign(s);0===o&&(o=a);const c=a*o;if(this.parameters.shaderPolygonOffset<=0)return d(n,t);const l=e(Math.abs(r.cosAngle),.01,1),f=1-Math.sqrt(1-l*l)/l/i.viewport[2];return h(n,t,c>0?f:1/f),n}_applyVerticalGroundOffsetView(e,t,r,s){const i=g(e),n=r.aboveGround?1:-1,a=.5*r.computeRenderPixelSizeAtDist(i),o=h(te,t.normal,n*a);return b(s,e,o),s}_applyVerticalOffsetTransformationView(e,t,r,s){const i=this.parameters;if(!i.verticalOffset||!i.verticalOffset.screenLength){if(i.screenSizePerspective||i.screenSizePerspectiveAlignment){const r=g(e);this._updateScaleInfo(s,r,t.cosAngle)}else s.factor.scale=1,s.factorAlignment.scale=1;return e}const n=g(e),a=i.screenSizePerspectiveAlignment||i.screenSizePerspective,o=B(r,n,i.verticalOffset,t.cosAngle,a);return this._updateScaleInfo(s,n,t.cosAngle),h(t.normal,t.normal,o),b(e,e,t.normal)}_applyCenterOffsetView(e,t,r){const s="screen"!==this.parameters.centerOffsetUnits;return r!==e&&d(r,e),s&&(r[0]+=t[0],r[1]+=t[1],t[2]&&(p(re,r),b(r,r,h(re,re,t[2])))),r}_applyCenterOffsetNDC(e,t,r,s){const i="screen"!==this.parameters.centerOffsetUnits;return s!==e&&d(s,e),i||(s[0]+=t[0]/r.fullWidth*2,s[1]+=t[1]/r.fullHeight*2),s}_applyPolygonOffsetNDC(e,t,r,s){const i=this.parameters.shaderPolygonOffset;if(e!==s&&d(s,e),i){const e=r.aboveGround?1:-1,n=e*Math.sign(t[3]);s[2]-=(n||e)*i}return s}requiresSlot(e){if(e===q.DRAPED_MATERIAL)return!0;const{drawInSecondSlot:t,occlusionTest:r}=this.parameters;return e===(t?q.LABEL_MATERIAL:q.HUD_MATERIAL)||r&&e===q.OCCLUSION_PIXELS}createGLMaterial(e){return e.output===I.Color||e.output===I.Alpha?new J(e):e.output===I.Highlight?new Z(e):null}calculateRelativeScreenBounds(e,t,r=C()){return K(this.parameters,e,t,r),r[2]=r[0]+e[0],r[3]=r[1]+e[1],r}}class Z extends E{constructor(e){super({...e,...e.material.parameters})}updateParameters(e){return this.updateTexture(this._material.parameters.textureId),this.selectProgram(e)}selectProgram(e){return this.ensureTechnique(F,e)}beginSlot(e){return this.updateParameters(e)}bind(e,t){this.bindTextures(t.program),this.bindTextureScale(t.program),t.bindPass(this._material.parameters,e)}}class J extends Z{_isOcclusionSlot(e){return e.slot===q.OCCLUSION_PIXELS&&this._material.parameters.occlusionTest&&(this._output===I.Color||this._output===I.Alpha)}selectProgram(e){return this.ensureTechnique(F,e,this._isOcclusionSlot(e)?I.Occlusion:this._output)}bind(e,t){this._isOcclusionSlot(e)||(this.bindTextures(t.program),this.bindTextureScale(t.program)),t.bindPass(this._material.parameters,e)}}function K(e,t,r,s=ee){return o(s,e.anchorPos),s[0]*=-t[0],s[1]*=-t[1],s[0]+=e.screenOffset[0]*r,s[1]+=e.screenOffset[1]*r,s}function Q(e){const t=e[0],r=e[1],s=e[2],i=e[3],n=e[4],a=e[5],o=e[6],c=e[7],l=e[8],f=1/Math.sqrt(t*t+r*r+s*s),u=1/Math.sqrt(i*i+n*n+a*a),p=1/Math.sqrt(o*o+c*c+l*l);return e[0]=t*f,e[1]=r*f,e[2]=s*f,e[3]=i*u,e[4]=n*u,e[5]=a*u,e[6]=o*p,e[7]=c*p,e[8]=l*p,e}function Y(e,t,r,s,i,n,a,o){let c=t-i-(o[0]>0?s[0]*o[0]:0),l=c+s[0]+2*i,f=r-i-(o[1]>0?s[1]*o[1]:0),u=f+s[1]+2*i;if(a.textureIsSignedDistanceField){const e=a.distanceFieldBoundingBox;c+=s[0]*e[0],f+=s[1]*e[1],l-=s[0]*(1-e[2]),u-=s[1]*(1-e[3]),c-=n,l+=n,f-=n,u+=n}return e[0]>c&&e[0]<l&&e[1]>f&&e[1]<u}const $={factor:{scale:0,factor:0,minPixelSize:0,paddingPixels:0},factorAlignment:{scale:0,factor:0,minPixelSize:0,paddingPixels:0}},ee=c(),te=A(),re=A(),se=r(),ie=A(),ne=A(),ae=i(),oe=i(),ce=a(),le=A(),fe={normal:ie,cosAngle:0},ue=a(),pe=1,me=2,he=[0,0],de=P(0,0,1),ge={texCoordScale:[1,1],occlusionTest:!0,binaryHighlightOcclusion:!0,drawInSecondSlot:!1,color:[1,1,1,1],outlineColor:[1,1,1,1],outlineSize:0,textureIsSignedDistanceField:!1,distanceFieldBoundingBox:null,vvSizeEnabled:!1,vvSizeMinSize:[1,1,1],vvSizeMaxSize:[100,100,100],vvSizeOffset:[0,0,0],vvSizeFactor:[1,1,1],vvColorEnabled:!1,vvColorValues:[0,0,0,0,0,0,0,0],vvColorColors:[1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0],screenOffset:[0,0],verticalOffset:null,screenSizePerspective:null,screenSizePerspectiveAlignment:null,slicePlaneEnabled:!1,anchorPos:l(.5,.5),shaderPolygonOffset:1e-5,polygonOffset:!1,textureId:null,centerOffsetUnits:"world",depthEnabled:!0,pixelSnappingEnabled:!0,debugDrawLabelBorder:!1,isDraped:!1,...j},Oe=y().vec3f(T.POSITION).vec3f(T.NORMAL).vec2f(T.UV0).vec4u8(T.COLOR).vec2f(T.SIZE).vec4f(T.AUXPOS1).vec4f(T.AUXPOS2);class Se{constructor(e){this.material=e,this.vertexBufferLayout=Oe}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){return 6*e.indices.get(T.POSITION).length}write(e,t,r,s){R(t.indices.get(T.POSITION),t.vertexAttributes.get(T.POSITION).data,e.transformation,r.position,s,6),V(t.indices.get(T.NORMAL),t.vertexAttributes.get(T.NORMAL).data,e.invTranspTransformation,r.normal,s,6);{const e=t.vertexAttributes.get(T.UV0).data;let i,n,a,o;if(null==e||e.length<4){const e=this.material.parameters;i=0,n=0,a=e.texCoordScale[0],o=e.texCoordScale[1]}else i=e[0],n=e[1],a=e[2],o=e[3];a=Math.min(1.99999,a+1),o=Math.min(1.99999,o+1);const c=t.indices.get(T.POSITION).length,l=r.uv0;let f=s;for(let t=0;t<c;++t)l.set(f,0,i),l.set(f,1,n),f+=1,l.set(f,0,a),l.set(f,1,n),f+=1,l.set(f,0,a),l.set(f,1,o),f+=1,l.set(f,0,a),l.set(f,1,o),f+=1,l.set(f,0,i),l.set(f,1,o),f+=1,l.set(f,0,i),l.set(f,1,n),f+=1}N(t.indices.get(T.COLOR),t.vertexAttributes.get(T.COLOR).data,4,r.color,s,6);{const e=t.indices.get(T.SIZE),i=t.vertexAttributes.get(T.SIZE).data,n=e.length,a=r.size;let o=s;for(let t=0;t<n;++t){const r=i[2*e[t]],s=i[2*e[t]+1];for(let e=0;e<6;++e)a.set(o,0,r),a.set(o,1,s),o+=1}}t.indices.get(T.AUXPOS1)&&t.vertexAttributes.get(T.AUXPOS1)&&G(t.indices.get(T.AUXPOS1),t.vertexAttributes.get(T.AUXPOS1).data,r.auxpos1,s,6),t.indices.get(T.AUXPOS2)&&t.vertexAttributes.get(T.AUXPOS2)&&G(t.indices.get(T.AUXPOS2),t.vertexAttributes.get(T.AUXPOS2).data,r.auxpos2,s,6)}}export{W as HUDMaterial};
5
+ import{clamp as e}from"../../../../core/mathUtils.js";import{isSome as t}from"../../../../core/maybe.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{f as s}from"../../../../chunks/mat3.js";import{c as i}from"../../../../chunks/mat3f64.js";import{a as n}from"../../../../chunks/mat4.js";import{c as a}from"../../../../chunks/mat4f64.js";import{c as o}from"../../../../chunks/vec2.js";import{a as c,f as l}from"../../../../chunks/vec2f64.js";import{s as f,m as u,n as p,f as m,a as h,g as d,l as g,i as O,t as S,d as v,b}from"../../../../chunks/vec3.js";import{c as A,f as P}from"../../../../chunks/vec3f64.js";import{isMat4 as x}from"../../../../core/libs/gl-matrix-2/types/mat4.js";import{create as C}from"../../../../geometry/support/aaBoundingRect.js";import{newLayout as y}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as I}from"../core/shaderLibrary/ShaderOutputOptions.js";import{HUDSpace as z}from"../core/shaderLibrary/hud/HUD.glsl.js";import{computeAttachmentOriginPoints as T}from"../lib/geometryDataUtils.js";import _ from"../lib/GLMaterialTexture.js";import{Material as E,DefaultMaterialParameters as U}from"../lib/Material.js";import{RenderSlot as j}from"../lib/RenderSlot.js";import{applyScaleFactor as q,applyPrecomputedScaleFactor as M,precomputeScaleFactor as w}from"../lib/screenSizePerspectiveUtils.js";import{assert as L}from"../lib/Util.js";import{VertexAttribute as D}from"../lib/VertexAttribute.js";import{writePosition as R,writeNormal as V,writeColor as N,writeBufferVec4 as G}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as B}from"./internal/MaterialUtil.js";import{isInstanceHidden as H}from"./renderers/utils.js";import{c as X}from"../../../../chunks/HUDMaterial.glsl.js";import{HUDMaterialTechniqueConfiguration as k,HUDMaterialTechnique as F}from"../shaders/HUDMaterialTechnique.js";class W extends E{constructor(e){super(e,ge),this.techniqueConfig=new k}getTechniqueConfig(e,t){return this.techniqueConfig.output=e,this.techniqueConfig.slicePlaneEnabled=this.parameters.slicePlaneEnabled,this.techniqueConfig.verticalOffset=!!this.parameters.verticalOffset,this.techniqueConfig.screenSizePerspective=!!this.parameters.screenSizePerspective,this.techniqueConfig.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits?z.Screen:z.World,this.techniqueConfig.polygonOffsetEnabled=this.parameters.polygonOffset,this.techniqueConfig.isDraped=this.parameters.isDraped,this.techniqueConfig.occlusionTestEnabled=this.parameters.occlusionTest,this.techniqueConfig.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,this.techniqueConfig.sdf=this.parameters.textureIsSignedDistanceField,this.techniqueConfig.vvSize=!!this.parameters.vvSizeEnabled,this.techniqueConfig.vvColor=!!this.parameters.vvColorEnabled,e===I.Color&&(this.techniqueConfig.debugDrawLabelBorder=!!this.parameters.debugDrawLabelBorder),e===I.Highlight&&(this.techniqueConfig.binaryHighlightOcclusion=this.parameters.binaryHighlightOcclusion),this.techniqueConfig.depthEnabled=this.parameters.depthEnabled,this.techniqueConfig.transparencyPassType=t.transparencyPassType,this.techniqueConfig.multipassGeometryEnabled=t.multipassGeometryEnabled,this.techniqueConfig.multipassTerrainEnabled=t.multipassTerrainEnabled,this.techniqueConfig.cullAboveGround=t.cullAboveGround,this.techniqueConfig}intersect(e,r,s,i,n,a,o,c,l){t(l)?this._intersectDrapedHudGeometry(e,a,o,c,l):this._intersectHudGeometry(e,r,s,i,o,c)}_intersectDrapedHudGeometry(e,r,s,i,n){const a=e.vertexAttributes.get(D.POSITION),o=e.vertexAttributes.get(D.SIZE),c=this.parameters,l=X(c);let f=1,u=1;if(t(i)){const e=i(ue);f=e[0],u=e[5]}f*=e.screenToWorldRatio,u*=e.screenToWorldRatio;const p=me*e.screenToWorldRatio;for(let t=0;t<a.data.length/a.size;t++){const i=t*a.size,m=a.data[i],h=a.data[i+1],d=t*o.size;let g;he[0]=o.data[d]*f,he[1]=o.data[d+1]*u,c.textureIsSignedDistanceField&&(g=c.outlineSize*e.screenToWorldRatio/2),Y(r,m,h,he,p,g,c,l)&&s(n.dist,n.normal,-1,!0)}}_intersectHudGeometry(e,r,i,a,o,c){if(!a.options.selectionMode||!a.options.hud||H(r))return;const l=this.parameters;let S=1,v=1;if(s(ae,i),t(c)){const e=c(ue);S=e[0],v=e[5],Q(ae)}const b=e.vertexAttributes.get(D.POSITION),P=e.vertexAttributes.get(D.SIZE),x=e.vertexAttributes.get(D.NORMAL),C=e.vertexAttributes.get(D.AUXPOS1);L(b.size>=3);const y=a.point,I=a.camera,z=X(l);S*=I.pixelRatio,v*=I.pixelRatio;const T="screen"===this.parameters.centerOffsetUnits;for(let t=0;t<b.data.length/b.size;t++){const e=t*b.size;f(te,b.data[e],b.data[e+1],b.data[e+2]),u(te,te,i);const r=t*P.size;he[0]=P.data[r]*S,he[1]=P.data[r+1]*v,u(te,te,I.viewMatrix);const s=t*C.size;if(f(le,C.data[s+0],C.data[s+1],C.data[s+2]),!T&&(te[0]+=le[0],te[1]+=le[1],0!==le[2])){const e=le[2];p(le,te),m(te,te,h(le,le,e))}const c=t*x.size;if(f(re,x.data[c],x.data[c+1],x.data[c+2]),this._normalAndViewAngle(re,ae,I,fe),this._applyVerticalOffsetTransformationView(te,fe,I,$),I.applyProjection(te,se),se[0]>-1){let e=Math.floor(se[0])+this.parameters.screenOffset[0],t=Math.floor(se[1])+this.parameters.screenOffset[1];T&&(e+=le[0],0!==le[1]&&(t+=q(le[1],$.factorAlignment))),M(he,$.factor,he);const r=pe*I.pixelRatio;let s;if(l.textureIsSignedDistanceField&&(s=l.outlineSize*I.pixelRatio/2),Y(y,e,t,he,r,s,l,z)){const e=a.ray;if(u(ne,te,n(ce,I.viewMatrix)),se[0]=y[0],se[1]=y[1],I.unprojectFromRenderScreen(se,te)){const t=A();d(t,e.direction);const r=1/g(t);h(t,t,r);o(O(e.origin,te)*r,t,-1,!0,1,ne)}}}}}computeAttachmentOrigin(e,t){const r=e.vertexAttributes;if(!r)return!1;const s=r.get(D.POSITION),i=e.indices.get(D.POSITION);return T(s,i,t)}createBufferWriter(){return new Se(this)}_normalAndViewAngle(e,t,r,i){return x(t)&&(t=s(oe,t)),S(i.normal,e,t),u(i.normal,i.normal,r.viewInverseTransposeMatrix),i.cosAngle=v(ie,de),i}_updateScaleInfo(e,t,r){const s=this.parameters;s.screenSizePerspective?w(r,t,s.screenSizePerspective,e.factor):(e.factor.scale=1,e.factor.factor=0,e.factor.minPixelSize=0,e.factor.paddingPixels=0),s.screenSizePerspectiveAlignment?w(r,t,s.screenSizePerspectiveAlignment,e.factorAlignment):(e.factorAlignment.factor=e.factor.factor,e.factorAlignment.scale=e.factor.scale,e.factorAlignment.minPixelSize=e.factor.minPixelSize,e.factorAlignment.paddingPixels=e.factor.paddingPixels)}applyShaderOffsetsView(e,t,r,s,i,n,a){const o=this._normalAndViewAngle(t,r,i,fe);return this._applyVerticalGroundOffsetView(e,o,i,a),this._applyVerticalOffsetTransformationView(a,o,i,n),this._applyPolygonOffsetView(a,o,s[3],i,a),this._applyCenterOffsetView(a,s,a),a}applyShaderOffsetsNDC(e,r,s,i,n){return this._applyCenterOffsetNDC(e,r,s,i),t(n)&&d(n,i),this._applyPolygonOffsetNDC(i,r,s,i),i}_applyPolygonOffsetView(t,r,s,i,n){const a=i.aboveGround?1:-1;let o=Math.sign(s);0===o&&(o=a);const c=a*o;if(this.parameters.shaderPolygonOffset<=0)return d(n,t);const l=e(Math.abs(r.cosAngle),.01,1),f=1-Math.sqrt(1-l*l)/l/i.viewport[2];return h(n,t,c>0?f:1/f),n}_applyVerticalGroundOffsetView(e,t,r,s){const i=g(e),n=r.aboveGround?1:-1,a=.5*r.computeRenderPixelSizeAtDist(i),o=h(te,t.normal,n*a);return b(s,e,o),s}_applyVerticalOffsetTransformationView(e,t,r,s){const i=this.parameters;if(!i.verticalOffset||!i.verticalOffset.screenLength){if(i.screenSizePerspective||i.screenSizePerspectiveAlignment){const r=g(e);this._updateScaleInfo(s,r,t.cosAngle)}else s.factor.scale=1,s.factorAlignment.scale=1;return e}const n=g(e),a=i.screenSizePerspectiveAlignment||i.screenSizePerspective,o=B(r,n,i.verticalOffset,t.cosAngle,a);return this._updateScaleInfo(s,n,t.cosAngle),h(t.normal,t.normal,o),b(e,e,t.normal)}_applyCenterOffsetView(e,t,r){const s="screen"!==this.parameters.centerOffsetUnits;return r!==e&&d(r,e),s&&(r[0]+=t[0],r[1]+=t[1],t[2]&&(p(re,r),b(r,r,h(re,re,t[2])))),r}_applyCenterOffsetNDC(e,t,r,s){const i="screen"!==this.parameters.centerOffsetUnits;return s!==e&&d(s,e),i||(s[0]+=t[0]/r.fullWidth*2,s[1]+=t[1]/r.fullHeight*2),s}_applyPolygonOffsetNDC(e,t,r,s){const i=this.parameters.shaderPolygonOffset;if(e!==s&&d(s,e),i){const e=r.aboveGround?1:-1,n=e*Math.sign(t[3]);s[2]-=(n||e)*i}return s}requiresSlot(e){if(e===j.DRAPED_MATERIAL)return!0;const{drawInSecondSlot:t,occlusionTest:r}=this.parameters;return e===(t?j.LABEL_MATERIAL:j.HUD_MATERIAL)||r&&e===j.OCCLUSION_PIXELS}createGLMaterial(e){return e.output===I.Color||e.output===I.Alpha?new J(e):e.output===I.Highlight?new Z(e):null}calculateRelativeScreenBounds(e,t,r=C()){return K(this.parameters,e,t,r),r[2]=r[0]+e[0],r[3]=r[1]+e[1],r}}class Z extends _{constructor(e){super({...e,...e.material.parameters})}updateParameters(e){return this.updateTexture(this._material.parameters.textureId),this.selectProgram(e)}selectProgram(e){return this.ensureTechnique(F,e)}beginSlot(e){return this.updateParameters(e)}bind(e,t){this.bindTextures(t.program),this.bindTextureScale(t.program),t.bindPass(this._material.parameters,e)}}class J extends Z{_isOcclusionSlot(e){return e.slot===j.OCCLUSION_PIXELS&&this._material.parameters.occlusionTest&&(this._output===I.Color||this._output===I.Alpha)}selectProgram(e){return this.ensureTechnique(F,e,this._isOcclusionSlot(e)?I.Occlusion:this._output)}bind(e,t){this._isOcclusionSlot(e)||(this.bindTextures(t.program),this.bindTextureScale(t.program)),t.bindPass(this._material.parameters,e)}}function K(e,t,r,s=ee){return o(s,e.anchorPos),s[0]*=-t[0],s[1]*=-t[1],s[0]+=e.screenOffset[0]*r,s[1]+=e.screenOffset[1]*r,s}function Q(e){const t=e[0],r=e[1],s=e[2],i=e[3],n=e[4],a=e[5],o=e[6],c=e[7],l=e[8],f=1/Math.sqrt(t*t+r*r+s*s),u=1/Math.sqrt(i*i+n*n+a*a),p=1/Math.sqrt(o*o+c*c+l*l);return e[0]=t*f,e[1]=r*f,e[2]=s*f,e[3]=i*u,e[4]=n*u,e[5]=a*u,e[6]=o*p,e[7]=c*p,e[8]=l*p,e}function Y(e,t,r,s,i,n,a,o){let c=t-i-(o[0]>0?s[0]*o[0]:0),l=c+s[0]+2*i,f=r-i-(o[1]>0?s[1]*o[1]:0),u=f+s[1]+2*i;if(a.textureIsSignedDistanceField){const e=a.distanceFieldBoundingBox;c+=s[0]*e[0],f+=s[1]*e[1],l-=s[0]*(1-e[2]),u-=s[1]*(1-e[3]),c-=n,l+=n,f-=n,u+=n}return e[0]>c&&e[0]<l&&e[1]>f&&e[1]<u}const $={factor:{scale:0,factor:0,minPixelSize:0,paddingPixels:0},factorAlignment:{scale:0,factor:0,minPixelSize:0,paddingPixels:0}},ee=c(),te=A(),re=A(),se=r(),ie=A(),ne=A(),ae=i(),oe=i(),ce=a(),le=A(),fe={normal:ie,cosAngle:0},ue=a(),pe=1,me=2,he=[0,0],de=P(0,0,1),ge={texCoordScale:[1,1],occlusionTest:!0,binaryHighlightOcclusion:!0,drawInSecondSlot:!1,color:[1,1,1,1],outlineColor:[1,1,1,1],outlineSize:0,textureIsSignedDistanceField:!1,distanceFieldBoundingBox:null,vvSizeEnabled:!1,vvSizeMinSize:[1,1,1],vvSizeMaxSize:[100,100,100],vvSizeOffset:[0,0,0],vvSizeFactor:[1,1,1],vvColorEnabled:!1,vvColorValues:[0,0,0,0,0,0,0,0],vvColorColors:[1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0],screenOffset:[0,0],verticalOffset:null,screenSizePerspective:null,screenSizePerspectiveAlignment:null,slicePlaneEnabled:!1,anchorPos:l(.5,.5),shaderPolygonOffset:1e-5,polygonOffset:!1,textureId:null,centerOffsetUnits:"world",depthEnabled:!0,pixelSnappingEnabled:!0,debugDrawLabelBorder:!1,isDraped:!1,...U},Oe=y().vec3f(D.POSITION).vec3f(D.NORMAL).vec2f(D.UV0).vec4u8(D.COLOR).vec2f(D.SIZE).vec4f(D.AUXPOS1).vec4f(D.AUXPOS2);class Se{constructor(e){this.material=e,this.vertexBufferLayout=Oe}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){return 6*e.indices.get(D.POSITION).length}write(e,t,r,s){R(t.indices.get(D.POSITION),t.vertexAttributes.get(D.POSITION).data,e.transformation,r.position,s,6),V(t.indices.get(D.NORMAL),t.vertexAttributes.get(D.NORMAL).data,e.invTranspTransformation,r.normal,s,6);{const e=t.vertexAttributes.get(D.UV0).data;let i,n,a,o;if(null==e||e.length<4){const e=this.material.parameters;i=0,n=0,a=e.texCoordScale[0],o=e.texCoordScale[1]}else i=e[0],n=e[1],a=e[2],o=e[3];a=Math.min(1.99999,a+1),o=Math.min(1.99999,o+1);const c=t.indices.get(D.POSITION).length,l=r.uv0;let f=s;for(let t=0;t<c;++t)l.set(f,0,i),l.set(f,1,n),f+=1,l.set(f,0,a),l.set(f,1,n),f+=1,l.set(f,0,a),l.set(f,1,o),f+=1,l.set(f,0,a),l.set(f,1,o),f+=1,l.set(f,0,i),l.set(f,1,o),f+=1,l.set(f,0,i),l.set(f,1,n),f+=1}N(t.indices.get(D.COLOR),t.vertexAttributes.get(D.COLOR).data,4,r.color,s,6);{const e=t.indices.get(D.SIZE),i=t.vertexAttributes.get(D.SIZE).data,n=e.length,a=r.size;let o=s;for(let t=0;t<n;++t){const r=i[2*e[t]],s=i[2*e[t]+1];for(let e=0;e<6;++e)a.set(o,0,r),a.set(o,1,s),o+=1}}t.indices.get(D.AUXPOS1)&&t.vertexAttributes.get(D.AUXPOS1)&&G(t.indices.get(D.AUXPOS1),t.vertexAttributes.get(D.AUXPOS1).data,r.auxpos1,s,6),t.indices.get(D.AUXPOS2)&&t.vertexAttributes.get(D.AUXPOS2)&&G(t.indices.get(D.AUXPOS2),t.vertexAttributes.get(D.AUXPOS2).data,r.auxpos2,s,6)}}export{W as HUDMaterial};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{ShaderOutput as e}from"../core/shaderLibrary/ShaderOutputOptions.js";import{CullFaceOptions as t}from"../lib/basicInterfaces.js";import{outputFromPass as r}from"../lib/GLMaterials.js";import i from"../lib/GLMaterialTexture.js";import{materialParametersDefaults as a,Material as s}from"../lib/Material.js";import{OITPolygonOffsetLimit as n}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as u}from"../lib/RenderSlot.js";import{DefaultBufferWriter as l,PositionUVLayout as o}from"./internal/DefaultBufferWriter.js";import{intersectTriangleGeometry as c}from"./internal/MaterialUtil.js";import{ImageMaterialTechniqueConfiguration as h,ImageMaterialTechnique as p}from"../shaders/ImageMaterialTechnique.js";class m extends s{constructor(e){super(e,f),this.supportsEdges=!0,this.techniqueConfig=new h}getTechniqueConfig(e,t){return this.techniqueConfig.output=e,this.techniqueConfig.cullFace=this.parameters.cullFace,this.techniqueConfig.slicePlaneEnabled=this.parameters.slicePlaneEnabled,this.techniqueConfig.transparent=this.parameters.transparent,this.techniqueConfig.writeDepth=this.parameters.writeDepth,this.techniqueConfig.sceneHasOcludees=this.parameters.sceneHasOcludees,this.techniqueConfig.transparencyPassType=t.transparencyPassType,this.techniqueConfig.enableOffset=t.camera.relativeElevation<n,this.techniqueConfig.multipassTerrainEnabled=t.multipassTerrainEnabled,this.techniqueConfig.cullAboveGround=t.cullAboveGround,this.techniqueConfig}intersect(e,t,r,i,a,s,n){c(e,t,i,a,s,void 0,n)}requiresSlot(t,i){if(t===u.DRAPED_MATERIAL)return!0;if(r(i)===e.Highlight)return t===u.OPAQUE_MATERIAL;return t===(this.parameters.transparent?this.parameters.writeDepth?u.TRANSPARENT_MATERIAL:u.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL:u.OPAQUE_MATERIAL)}createGLMaterial(t){return t.output===e.Color||t.output===e.Alpha||t.output===e.Highlight?new d(t):void 0}createBufferWriter(){return new l(o)}}class d extends i{constructor(e){super({...e,...e.material.parameters})}updateParameters(e){const t=this._material.parameters;return this.updateTexture(t.textureId),this.ensureTechnique(p,e)}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.sceneHasOcludees&&(this._material.setParameters({sceneHasOcludees:e.hasOccludees}),this.updateParameters(e))}beginSlot(t){return this._output!==e.Color&&this._output!==e.Alpha||this._updateOccludeeState(t),this.updateParameters(t)}bind(e,t){this.bindTextures(t.program),this.bindTextureScale(t.program),t.bindPass(this._material.parameters,e)}}const f={transparent:!1,writeDepth:!0,slicePlaneEnabled:!1,cullFace:t.None,sceneHasOcludees:!1,opacity:1,textureId:null,initTextureTransparent:!0,...a};export{m as ImageMaterial};
5
+ import{ShaderOutput as e}from"../core/shaderLibrary/ShaderOutputOptions.js";import{CullFaceOptions as t}from"../lib/basicInterfaces.js";import{outputFromPass as r}from"../lib/GLMaterials.js";import i from"../lib/GLMaterialTexture.js";import{DefaultMaterialParameters as a,Material as s}from"../lib/Material.js";import{OITPolygonOffsetLimit as n}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as u}from"../lib/RenderSlot.js";import{DefaultBufferWriter as l,PositionUVLayout as o}from"./internal/DefaultBufferWriter.js";import{intersectTriangleGeometry as c}from"./internal/MaterialUtil.js";import{ImageMaterialTechniqueConfiguration as h,ImageMaterialTechnique as p}from"../shaders/ImageMaterialTechnique.js";class m extends s{constructor(e){super(e,f),this.supportsEdges=!0,this.techniqueConfig=new h}getTechniqueConfig(e,t){return this.techniqueConfig.output=e,this.techniqueConfig.cullFace=this.parameters.cullFace,this.techniqueConfig.slicePlaneEnabled=this.parameters.slicePlaneEnabled,this.techniqueConfig.transparent=this.parameters.transparent,this.techniqueConfig.writeDepth=this.parameters.writeDepth,this.techniqueConfig.sceneHasOcludees=this.parameters.sceneHasOcludees,this.techniqueConfig.transparencyPassType=t.transparencyPassType,this.techniqueConfig.enableOffset=t.camera.relativeElevation<n,this.techniqueConfig.multipassTerrainEnabled=t.multipassTerrainEnabled,this.techniqueConfig.cullAboveGround=t.cullAboveGround,this.techniqueConfig}intersect(e,t,r,i,a,s,n){c(e,t,i,a,s,void 0,n)}requiresSlot(t,i){if(t===u.DRAPED_MATERIAL)return!0;if(r(i)===e.Highlight)return t===u.OPAQUE_MATERIAL;return t===(this.parameters.transparent?this.parameters.writeDepth?u.TRANSPARENT_MATERIAL:u.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL:u.OPAQUE_MATERIAL)}createGLMaterial(t){return t.output===e.Color||t.output===e.Alpha||t.output===e.Highlight?new d(t):void 0}createBufferWriter(){return new l(o)}}class d extends i{constructor(e){super({...e,...e.material.parameters})}updateParameters(e){const t=this._material.parameters;return this.updateTexture(t.textureId),this.ensureTechnique(p,e)}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.sceneHasOcludees&&(this._material.setParameters({sceneHasOcludees:e.hasOccludees}),this.updateParameters(e))}beginSlot(t){return this._output!==e.Color&&this._output!==e.Alpha||this._updateOccludeeState(t),this.updateParameters(t)}bind(e,t){this.bindTextures(t.program),this.bindTextureScale(t.program),t.bindPass(this._material.parameters,e)}}const f={transparent:!1,writeDepth:!0,slicePlaneEnabled:!1,cullFace:t.None,sceneHasOcludees:!1,opacity:1,textureId:null,initTextureTransparent:!0,...a};export{m as ImageMaterial};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{f as e}from"../../../../chunks/vec2f32.js";import{newLayout as t}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as r}from"../core/shaderLibrary/ShaderOutputOptions.js";import{HUDSpace as i}from"../core/shaderLibrary/hud/HUD.glsl.js";import{VertexAttribute as s}from"../lib/basicInterfaces.js";import n from"../lib/GLMaterial.js";import{Material as a,materialParametersDefaults as o}from"../lib/Material.js";import{RenderSlot as u}from"../lib/RenderSlot.js";import{writePosition as l,writeNormal as c,writeBufferVec4 as f}from"./internal/bufferWriterUtils.js";import{LineCalloutTechniqueConfiguration as h,LineCalloutTechnique as d}from"../shaders/LineCalloutTechnique.js";class m extends a{constructor(e){super(e,O),this.techniqueConfig=new h,this._uniqueMaterialIdentifier=m.uniqueMaterialIdentifier(this.parameters)}get uniqueMaterialIdentifier(){return this._uniqueMaterialIdentifier}getPassParameters(){return this.parameters}getTechniqueConfig(e,t){const r=(null==t?void 0:t.slot)!==u.LINE_CALLOUTS;return this.techniqueConfig.occlusionTestEnabled=this.parameters.occlusionTest,this.techniqueConfig.verticalOffset=!!this.parameters.verticalOffset,this.techniqueConfig.screenSizePerspective=!!this.parameters.screenSizePerspective,this.techniqueConfig.depthHudEnabled=r,this.techniqueConfig.depthHudAlignStartEnabled=!!this.parameters.depthHUDAlignStart,this.techniqueConfig.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits?i.Screen:i.World,this.techniqueConfig.slicePlaneEnabled=this.parameters.slicePlaneEnabled,this.techniqueConfig.multipassGeometryEnabled=!!t&&t.multipassGeometryEnabled,this.techniqueConfig}intersect(){}requiresSlot(e){switch(e){case u.LINE_CALLOUTS:case u.LINE_CALLOUTS_HUD_DEPTH:return!0}return!1}createGLMaterial(e){return e.output===r.Color?new p(e):null}createBufferWriter(){return new P}validateParameters(e){const t=m.uniqueMaterialIdentifier(e);t!==this._uniqueMaterialIdentifier&&(this._uniqueMaterialIdentifier=t)}static uniqueMaterialIdentifier(e){return JSON.stringify({screenOffset:e.screenOffset||[0,0],centerOffsetUnits:e.centerOffsetUnits||"world"})}}class p extends n{updateParameters(e){return this.ensureTechnique(d,e)}beginSlot(e){return this.updateParameters(e)}bind(e,t){t.bindPass(this._material.getPassParameters(),e)}}const O={verticalOffset:null,screenSizePerspective:null,screenOffset:[0,0],color:[0,0,0,1],size:1,borderColor:null,occlusionTest:!1,shaderPolygonOffset:1e-5,depthHUDAlignStart:!1,centerOffsetUnits:"world",slicePlaneEnabled:!1,...o},g=t().vec3f(s.POSITION).vec3f(s.NORMAL).vec2f(s.UV0).vec4f(s.AUXPOS1),b=[e(0,0),e(1,0),e(0,1),e(1,0),e(1,1),e(0,1)];class P{constructor(){this.vertexBufferLayout=g}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){return 6*e.indices.get(s.POSITION).length}write(e,t,r,i){l(t.indices.get(s.POSITION),t.vertexAttributes.get(s.POSITION).data,e.transformation,r.position,i,6),c(t.indices.get(s.NORMAL),t.vertexAttributes.get(s.NORMAL).data,e.invTranspTransformation,r.normal,i,6),f(t.indices.get(s.AUXPOS1),t.vertexAttributes.get(s.AUXPOS1).data,r.auxpos1,i,6);for(let s=0;s<b.length;++s)r.uv0.setVec(i+s,b[s])}}export{m as LineCalloutMaterial};
5
+ import{f as e}from"../../../../chunks/vec2f32.js";import{newLayout as t}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as r}from"../core/shaderLibrary/ShaderOutputOptions.js";import{HUDSpace as i}from"../core/shaderLibrary/hud/HUD.glsl.js";import s from"../lib/GLMaterial.js";import{Material as n,DefaultMaterialParameters as a}from"../lib/Material.js";import{RenderSlot as o}from"../lib/RenderSlot.js";import{VertexAttribute as u}from"../lib/VertexAttribute.js";import{writePosition as l,writeNormal as f,writeBufferVec4 as c}from"./internal/bufferWriterUtils.js";import{LineCalloutTechniqueConfiguration as h,LineCalloutTechnique as d}from"../shaders/LineCalloutTechnique.js";class m extends n{constructor(e){super(e,O),this.techniqueConfig=new h,this._uniqueMaterialIdentifier=m.uniqueMaterialIdentifier(this.parameters)}get uniqueMaterialIdentifier(){return this._uniqueMaterialIdentifier}getPassParameters(){return this.parameters}getTechniqueConfig(e,t){const r=(null==t?void 0:t.slot)!==o.LINE_CALLOUTS;return this.techniqueConfig.occlusionTestEnabled=this.parameters.occlusionTest,this.techniqueConfig.verticalOffset=!!this.parameters.verticalOffset,this.techniqueConfig.screenSizePerspective=!!this.parameters.screenSizePerspective,this.techniqueConfig.depthHudEnabled=r,this.techniqueConfig.depthHudAlignStartEnabled=!!this.parameters.depthHUDAlignStart,this.techniqueConfig.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits?i.Screen:i.World,this.techniqueConfig.slicePlaneEnabled=this.parameters.slicePlaneEnabled,this.techniqueConfig.multipassGeometryEnabled=!!t&&t.multipassGeometryEnabled,this.techniqueConfig}intersect(){}requiresSlot(e){switch(e){case o.LINE_CALLOUTS:case o.LINE_CALLOUTS_HUD_DEPTH:return!0}return!1}createGLMaterial(e){return e.output===r.Color?new p(e):null}createBufferWriter(){return new P}validateParameters(e){const t=m.uniqueMaterialIdentifier(e);t!==this._uniqueMaterialIdentifier&&(this._uniqueMaterialIdentifier=t)}static uniqueMaterialIdentifier(e){return JSON.stringify({screenOffset:e.screenOffset||[0,0],centerOffsetUnits:e.centerOffsetUnits||"world"})}}class p extends s{updateParameters(e){return this.ensureTechnique(d,e)}beginSlot(e){return this.updateParameters(e)}bind(e,t){t.bindPass(this._material.getPassParameters(),e)}}const O={verticalOffset:null,screenSizePerspective:null,screenOffset:[0,0],color:[0,0,0,1],size:1,borderColor:null,occlusionTest:!1,shaderPolygonOffset:1e-5,depthHUDAlignStart:!1,centerOffsetUnits:"world",slicePlaneEnabled:!1,...a},g=t().vec3f(u.POSITION).vec3f(u.NORMAL).vec2f(u.UV0).vec4f(u.AUXPOS1),b=[e(0,0),e(1,0),e(0,1),e(1,0),e(1,1),e(0,1)];class P{constructor(){this.vertexBufferLayout=g}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){return 6*e.indices.get(u.POSITION).length}write(e,t,r,i){l(t.indices.get(u.POSITION),t.vertexAttributes.get(u.POSITION).data,e.transformation,r.position,i,6),f(t.indices.get(u.NORMAL),t.vertexAttributes.get(u.NORMAL).data,e.invTranspTransformation,r.normal,i,6),c(t.indices.get(u.AUXPOS1),t.vertexAttributes.get(u.AUXPOS1).data,r.auxpos1,i,6);for(let s=0;s<b.length;++s)r.uv0.setVec(i+s,b[s])}}export{m as LineCalloutMaterial};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{s as e,n as t,f as r,c as s,i as n,m as o}from"../../../../chunks/vec3.js";import{c as i}from"../../../../chunks/vec3f64.js";import{newLayout as a}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as u}from"../core/shaderLibrary/ShaderOutputOptions.js";import{VertexAttribute as c,TransparencyPassType as l}from"../lib/basicInterfaces.js";import f from"../lib/GLMaterial.js";import{Material as p,materialParametersDefaults as m}from"../lib/Material.js";import{RenderSlot as h}from"../lib/RenderSlot.js";import{MeasurementArrowTechniqueConfiguration as d,MeasurementArrowTechnique as g}from"../shaders/MeasurementArrowTechnique.js";class O extends p{constructor(e){super(e,P),this.techniqueConfig=new d}getTechniqueConfig(e,t){var r;return this.techniqueConfig.polygonOffsetEnabled=this.parameters.polygonOffset,this.techniqueConfig.transparent=this.parameters.stripeEvenColor[3]<1||this.parameters.stripeOddColor[3]<1||this.parameters.outlineColor[3]<1,this.techniqueConfig.transparencyPassType=null!=(r=null==t?void 0:t.transparencyPassType)?r:l.NONE,this.techniqueConfig}dispose(){}getPassParameters(){return this.parameters}intersect(){}requiresSlot(e){return e===h.OPAQUE_MATERIAL}createGLMaterial(e){return e.output===u.Color?new v(e):null}createBufferWriter(){return new L}}class v extends f{updateParameters(e){return this.ensureTechnique(g,e)}beginSlot(e){return this.updateParameters(e)}bind(e,t){t.bindPass(this._material.getPassParameters(),e)}}const P={width:32,outlineSize:.2,outlineColor:[1,.5,0,1],stripeLength:1,stripeEvenColor:[1,1,1,1],stripeOddColor:[1,.5,0,1],polygonOffset:!1,...m},C=a().vec3f(c.POSITION).vec3f(c.NORMAL).vec2f(c.UV0).f32(c.AUXPOS1),b=i(),T=i(),y=i(),I=i(),A=i();class L{constructor(){this.vertexBufferLayout=C}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){return 2*(e.indices.get(c.POSITION).length/2+1)}write(i,a,u,l){const f=a.vertexAttributes.get(c.POSITION).data,p=a.vertexAttributes.get(c.NORMAL).data,m=f.length/3,h=a&&a.indices&&a.indices.get(c.POSITION);h&&h.length!==2*(m-1)&&console.warn("MeasurementArrowMaterial does not support indices");const d=b,g=T,O=y,v=I,P=A,C=i.transformation,L=i.invTranspTransformation,S=u.position,j=u.normal,q=u.uv0;let M=0;for(let c=0;c<m;++c){const i=3*c;if(e(d,f[i],f[i+1],f[i+2]),c<m-1){const n=3*(c+1);e(g,f[n],f[n+1],f[n+2]),e(P,p[n],p[n+1],p[n+2]),t(P,P),r(O,g,d),t(O,O),s(v,P,O),t(v,v)}const a=n(d,g);C&&L&&(o(d,d,C),o(g,g,C),o(v,v,L));const u=l+2*c,h=u+1;S.setVec(u,d),S.setVec(h,d),j.setVec(u,v),j.setVec(h,v),q.set(u,0,M),q.set(u,1,-1),q.set(h,0,M),q.set(h,1,1),c<m-1&&(M+=a)}const w=u.auxpos1;for(let e=0;e<2*m;++e)w.set(l+e,M)}}export{O as MeasurementArrowMaterial};
5
+ import{s as e,n as t,f as r,c as s,i as o,m as n}from"../../../../chunks/vec3.js";import{c as i}from"../../../../chunks/vec3f64.js";import{newLayout as a}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as u}from"../core/shaderLibrary/ShaderOutputOptions.js";import{TransparencyPassType as c}from"../lib/basicInterfaces.js";import l from"../lib/GLMaterial.js";import{Material as f,DefaultMaterialParameters as p}from"../lib/Material.js";import{RenderSlot as m}from"../lib/RenderSlot.js";import{VertexAttribute as h}from"../lib/VertexAttribute.js";import{MeasurementArrowTechniqueConfiguration as d,MeasurementArrowTechnique as g}from"../shaders/MeasurementArrowTechnique.js";class O extends f{constructor(e){super(e,b),this.techniqueConfig=new d}getTechniqueConfig(e,t){var r;return this.techniqueConfig.polygonOffsetEnabled=this.parameters.polygonOffset,this.techniqueConfig.transparent=this.parameters.stripeEvenColor[3]<1||this.parameters.stripeOddColor[3]<1||this.parameters.outlineColor[3]<1,this.techniqueConfig.transparencyPassType=null!=(r=null==t?void 0:t.transparencyPassType)?r:c.NONE,this.techniqueConfig}dispose(){}getPassParameters(){return this.parameters}intersect(){}requiresSlot(e){return e===m.OPAQUE_MATERIAL}createGLMaterial(e){return e.output===u.Color?new v(e):null}createBufferWriter(){return new j}}class v extends l{updateParameters(e){return this.ensureTechnique(g,e)}beginSlot(e){return this.updateParameters(e)}bind(e,t){t.bindPass(this._material.getPassParameters(),e)}}const b={width:32,outlineSize:.2,outlineColor:[1,.5,0,1],stripeLength:1,stripeEvenColor:[1,1,1,1],stripeOddColor:[1,.5,0,1],polygonOffset:!1,...p},P=a().vec3f(h.POSITION).vec3f(h.NORMAL).vec2f(h.UV0).f32(h.AUXPOS1),C=i(),T=i(),y=i(),A=i(),I=i();class j{constructor(){this.vertexBufferLayout=P}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){return 2*(e.indices.get(h.POSITION).length/2+1)}write(i,a,u,c){const l=a.vertexAttributes.get(h.POSITION).data,f=a.vertexAttributes.get(h.NORMAL).data,p=l.length/3,m=a&&a.indices&&a.indices.get(h.POSITION);m&&m.length!==2*(p-1)&&console.warn("MeasurementArrowMaterial does not support indices");const d=C,g=T,O=y,v=A,b=I,P=i.transformation,j=i.invTranspTransformation,L=u.position,S=u.normal,q=u.uv0;let x=0;for(let h=0;h<p;++h){const i=3*h;if(e(d,l[i],l[i+1],l[i+2]),h<p-1){const o=3*(h+1);e(g,l[o],l[o+1],l[o+2]),e(b,f[o],f[o+1],f[o+2]),t(b,b),r(O,g,d),t(O,O),s(v,b,O),t(v,v)}const a=o(d,g);P&&j&&(n(d,d,P),n(g,g,P),n(v,v,j));const u=c+2*h,m=u+1;L.setVec(u,d),L.setVec(m,d),S.setVec(u,v),S.setVec(m,v),q.set(u,0,x),q.set(u,1,-1),q.set(m,0,x),q.set(m,1,1),h<p-1&&(x+=a)}const M=u.auxpos1;for(let e=0;e<2*p;++e)M.set(c+e,x)}}export{O as MeasurementArrowMaterial};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/Logger.js";import{isSome as t,isNone as r}from"../../../../core/maybe.js";import{createRenderScreenPointArray3 as s}from"../../../../core/screenUtils.js";import{c as i}from"../../../../chunks/vec2.js";import{s as o,f as n,d as a,a as u,b as c,g as l,l as f,i as m,m as p}from"../../../../chunks/vec3.js";import{c as h}from"../../../../chunks/vec3f64.js";import{PlaneIndex as d}from"../../../../geometry/support/frustum.js";import{create as g,distance2 as O,fromPoints as A,closestLineSegmentPoint as P}from"../../../../geometry/support/lineSegment.js";import{create as T,fromPoints as b,signedDistance as S,normal as _}from"../../../../geometry/support/plane.js";import{BufferViewVec3f as j,BufferViewVec2f as C}from"../../../../geometry/support/buffer/BufferView.js";import{ShaderOutput as v}from"../core/shaderLibrary/ShaderOutputOptions.js";import{VertexAttribute as y}from"../lib/basicInterfaces.js";import{computeAttachmentOriginLines as E}from"../lib/geometryDataUtils.js";import I from"../lib/GLMaterial.js";import{Material as N,materialParametersDefaults as R}from"../lib/Material.js";import{RenderSlot as x}from"../lib/RenderSlot.js";import{isTranslationMatrix as L}from"../lib/Util.js";import{writeDefaultAttributes as q}from"./internal/bufferWriterUtils.js";import{PositionColorLayout as w,PositionLayout as U,DefaultBufferWriter as B}from"./internal/DefaultBufferWriter.js";import{intersectDrapedRenderLineGeometry as M}from"./internal/MaterialUtil.js";import{isInstanceHidden as D}from"./renderers/utils.js";import{NativeLineTechniqueConfiguration as V,NativeLineTechnique as H}from"../shaders/NativeLineTechnique.js";const G=e.getLogger("esri.views.3d.webgl-engine.materials.NativeLineMaterial");var X;!function(e){e[e.START=0]="START",e[e.END=1]="END"}(X||(X={}));class k extends N{constructor(e){super(e,Q),this._techniqueConfig=new V}getTechniqueConfig(e,r){this._techniqueConfig.output=e,this._techniqueConfig.slicePlaneEnabled=this.parameters.slicePlaneEnabled,this._techniqueConfig.vertexColors=this.parameters.vertexColors,this._techniqueConfig.transparent=this.parameters.color[3]<1||this.parameters.width<1,this._techniqueConfig.draped=r.slot===x.DRAPED_MATERIAL;const s=t(this.parameters.stipplePattern);return this._techniqueConfig.stippleEnabled=s,this._techniqueConfig.stippleOffColorEnabled=s&&t(this.parameters.stippleOffColor),this._techniqueConfig.sceneHasOcludees=this.parameters.sceneHasOcludees,this._techniqueConfig.stipplePreferContinuous=this.parameters.stipplePreferContinuous,this._techniqueConfig}getPassParameters(){return this.parameters}intersect(e,r,s,i,o,n,a,u,c){t(c)?M(e,i,c,n,1,a):this._intersectLineGeometry(e,r,s,i,a)}_intersectLineGeometry(e,t,r,s,p){if(!s.options.selectionMode||D(t))return;if(!L(r))return void G.error("intersection assumes a translation-only matrix");const h=e.vertexAttributes.get(y.POSITION).data,g=s.camera,T=ie;i(T,s.point);const j=2;o(oe[0],T[0]-j,T[1]+j,0),o(oe[1],T[0]+j,T[1]+j,0),o(oe[2],T[0]+j,T[1]-j,0),o(oe[3],T[0]-j,T[1]-j,0);for(let i=0;i<4;i++)if(!g.unprojectFromRenderScreen(oe[i],ne[i]))return;b(g.eye,ne[0],ne[1],ae),b(g.eye,ne[1],ne[2],ue),b(g.eye,ne[2],ne[3],ce),b(g.eye,ne[3],ne[0],le);let C=Number.MAX_VALUE,v=0;for(let i=0;i<h.length-5;i+=3){if(z[0]=h[i]+r[12],z[1]=h[i+1]+r[13],z[2]=h[i+2]+r[14],J[0]=h[i+3]+r[12],J[1]=h[i+4]+r[13],J[2]=h[i+5]+r[14],S(ae,z)<0&&S(ae,J)<0||S(ue,z)<0&&S(ue,J)<0||S(ce,z)<0&&S(ce,J)<0||S(le,z)<0&&S(le,J)<0)continue;if(g.projectToRenderScreen(z,Z),g.projectToRenderScreen(J,$),Z[2]<0&&$[2]>0){n(K,z,J);const e=g.frustum,t=-S(e[d.NEAR],z)/a(K,_(e[d.NEAR]));u(K,K,t),c(z,z,K),g.projectToRenderScreen(z,Z)}else if(Z[2]>0&&$[2]<0){n(K,J,z);const e=g.frustum,t=-S(e[d.NEAR],J)/a(K,_(e[d.NEAR]));u(K,K,t),c(J,J,K),g.projectToRenderScreen(J,$)}else if(Z[2]<0&&$[2]<0)continue;Z[2]=0,$[2]=0;const e=O(A(Z,$,re),T);e<C&&(C=e,l(ee,z),l(te,J),v=i/3)}const E=s.rayBegin,I=s.rayEnd;if(C<j*j){let e=Number.MAX_VALUE;if(P(A(ee,te,re),A(E,I,se),Y)){n(Y,Y,E);const t=f(Y);u(Y,Y,1/t),e=t/m(E,I)}p(e,Y,v,!1)}}computeAttachmentOrigin(e,t){const r=e.vertexAttributes;if(!r)return!1;const s=r.get(y.POSITION);return E(s,null,!1,t)}requiresSlot(e){return e===x.OPAQUE_MATERIAL||e===x.DRAPED_MATERIAL}createGLMaterial(e){return e.output===v.Color||e.output===v.Highlight?new F(e):null}createBufferWriter(){const e=this.parameters.vertexColors?w:U;return r(this.parameters.stipplePattern)?new B(e):new W(e.clone().vec3f(y.AUXPOS1).vec2f(y.UV0))}}class F extends I{updateParameters(e){return this.ensureTechnique(H,e)}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.sceneHasOcludees&&this._material.setParameters({sceneHasOcludees:e.hasOccludees})}beginSlot(e){return this._output===v.Color&&this._updateOccludeeState(e),this.updateParameters(e)}bind(e,t){t.bindPass(this._material.getPassParameters(),e)}}class W{constructor(e){this.vertexBufferLayout=e}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){return e.indices.get(y.POSITION).length}write(e,t,r,s){q(t,this.vertexBufferLayout,e.transformation,e.invTranspTransformation,r,s),this._writeAuxpos1(e,t,r,s),this._writeUV0(e,t,r,s)}_writeAuxpos1(e,t,r,s){const i=r.getField(y.AUXPOS1,j),o=t.indices.get(y.POSITION),n=t.vertexAttributes.get(y.POSITION).data,a=e.transformation,u=i.typedBufferStride,c=i.typedBuffer;s*=u;for(let l=0;l<o.length-1;l+=2)for(const e of[1,0]){const t=3*o[l+e],r=n[t],i=n[t+1],f=n[t+2],m=a[0]*r+a[4]*i+a[8]*f+a[12],p=a[1]*r+a[5]*i+a[9]*f+a[13],h=a[2]*r+a[6]*i+a[10]*f+a[14];c[s]=m,c[s+1]=p,c[s+2]=h,s+=u}}_writeUV0(e,t,r,s){var i;const n=r.getField(y.UV0,C),a=t.indices.get(y.POSITION),u=t.vertexAttributes.get(y.POSITION).data,c=null==(i=t.vertexAttributes.get(y.DISTANCETOSTART))?void 0:i.data,f=e.transformation,h=n.typedBufferStride,d=n.typedBuffer;let g=0;d[s*=h]=X.START,d[s+1]=g,s+=h;const O=3*a[0],A=o(z,u[O],u[O+1],u[O+2]);f&&p(A,A,f);const P=J,T=a.length-1;let b=1;const S=c?(e,t,r)=>g=c[r]:(e,t,r)=>g+=m(e,t);for(let m=1;m<T;m+=2){const e=3*a[m];o(P,u[e],u[e+1],u[e+2]),f&&p(P,P,f),S(A,P,b++);for(let t=0;t<2;++t)d[s]=1-t,d[s+1]=g,s+=h;l(A,P)}const _=3*a[T];o(P,u[_],u[_+1],u[_+2]),f&&p(P,P,f),S(A,P,b),d[s]=X.END,d[s+1]=g}}const Q={color:[1,1,1,1],vertexColors:!1,slicePlaneEnabled:!1,width:1,stipplePattern:null,stippleOffColor:null,stipplePreferContinuous:!0,sceneHasOcludees:!1,...R},z=h(),J=h(),K=h(),Y=h(),Z=s(),$=s(),ee=h(),te=h(),re=g(),se=g(),ie=h(),oe=[s(),s(),s(),s()],ne=[h(),h(),h(),h()],ae=T(),ue=T(),ce=T(),le=T();export{k as NativeLineMaterial};
5
+ import e from"../../../../core/Logger.js";import{isSome as t,isNone as r}from"../../../../core/maybe.js";import{createRenderScreenPointArray3 as s}from"../../../../core/screenUtils.js";import{c as i}from"../../../../chunks/vec2.js";import{s as o,f as n,d as a,a as u,b as l,g as c,l as f,i as m,m as p}from"../../../../chunks/vec3.js";import{c as h}from"../../../../chunks/vec3f64.js";import{PlaneIndex as d}from"../../../../geometry/support/frustum.js";import{create as g,distance2 as A,fromPoints as O,closestLineSegmentPoint as P}from"../../../../geometry/support/lineSegment.js";import{create as T,fromPoints as b,signedDistance as S,normal as _}from"../../../../geometry/support/plane.js";import{BufferViewVec3f as j,BufferViewVec2f as C}from"../../../../geometry/support/buffer/BufferView.js";import{ShaderOutput as v}from"../core/shaderLibrary/ShaderOutputOptions.js";import{computeAttachmentOriginLines as y}from"../lib/geometryDataUtils.js";import E from"../lib/GLMaterial.js";import{Material as x,DefaultMaterialParameters as N}from"../lib/Material.js";import{RenderSlot as R}from"../lib/RenderSlot.js";import{isTranslationMatrix as I}from"../lib/Util.js";import{VertexAttribute as L}from"../lib/VertexAttribute.js";import{writeDefaultAttributes as q}from"./internal/bufferWriterUtils.js";import{PositionColorLayout as w,PositionLayout as U,DefaultBufferWriter as B}from"./internal/DefaultBufferWriter.js";import{intersectDrapedRenderLineGeometry as M}from"./internal/MaterialUtil.js";import{isInstanceHidden as D}from"./renderers/utils.js";import{NativeLineTechniqueConfiguration as V,NativeLineTechnique as H}from"../shaders/NativeLineTechnique.js";const G=e.getLogger("esri.views.3d.webgl-engine.materials.NativeLineMaterial");var X;!function(e){e[e.START=0]="START",e[e.END=1]="END"}(X||(X={}));class k extends x{constructor(e){super(e,Q),this._techniqueConfig=new V}getTechniqueConfig(e,r){this._techniqueConfig.output=e,this._techniqueConfig.slicePlaneEnabled=this.parameters.slicePlaneEnabled,this._techniqueConfig.vertexColors=this.parameters.vertexColors,this._techniqueConfig.transparent=this.parameters.color[3]<1||this.parameters.width<1,this._techniqueConfig.draped=r.slot===R.DRAPED_MATERIAL;const s=t(this.parameters.stipplePattern);return this._techniqueConfig.stippleEnabled=s,this._techniqueConfig.stippleOffColorEnabled=s&&t(this.parameters.stippleOffColor),this._techniqueConfig.sceneHasOcludees=this.parameters.sceneHasOcludees,this._techniqueConfig.stipplePreferContinuous=this.parameters.stipplePreferContinuous,this._techniqueConfig}getPassParameters(){return this.parameters}intersect(e,r,s,i,o,n,a,u,l){t(l)?M(e,i,l,n,1,a):this._intersectLineGeometry(e,r,s,i,a)}_intersectLineGeometry(e,t,r,s,p){if(!s.options.selectionMode||D(t))return;if(!I(r))return void G.error("intersection assumes a translation-only matrix");const h=e.vertexAttributes.get(L.POSITION).data,g=s.camera,T=ie;i(T,s.point);const j=2;o(oe[0],T[0]-j,T[1]+j,0),o(oe[1],T[0]+j,T[1]+j,0),o(oe[2],T[0]+j,T[1]-j,0),o(oe[3],T[0]-j,T[1]-j,0);for(let i=0;i<4;i++)if(!g.unprojectFromRenderScreen(oe[i],ne[i]))return;b(g.eye,ne[0],ne[1],ae),b(g.eye,ne[1],ne[2],ue),b(g.eye,ne[2],ne[3],le),b(g.eye,ne[3],ne[0],ce);let C=Number.MAX_VALUE,v=0;for(let i=0;i<h.length-5;i+=3){if(z[0]=h[i]+r[12],z[1]=h[i+1]+r[13],z[2]=h[i+2]+r[14],J[0]=h[i+3]+r[12],J[1]=h[i+4]+r[13],J[2]=h[i+5]+r[14],S(ae,z)<0&&S(ae,J)<0||S(ue,z)<0&&S(ue,J)<0||S(le,z)<0&&S(le,J)<0||S(ce,z)<0&&S(ce,J)<0)continue;if(g.projectToRenderScreen(z,Z),g.projectToRenderScreen(J,$),Z[2]<0&&$[2]>0){n(K,z,J);const e=g.frustum,t=-S(e[d.NEAR],z)/a(K,_(e[d.NEAR]));u(K,K,t),l(z,z,K),g.projectToRenderScreen(z,Z)}else if(Z[2]>0&&$[2]<0){n(K,J,z);const e=g.frustum,t=-S(e[d.NEAR],J)/a(K,_(e[d.NEAR]));u(K,K,t),l(J,J,K),g.projectToRenderScreen(J,$)}else if(Z[2]<0&&$[2]<0)continue;Z[2]=0,$[2]=0;const e=A(O(Z,$,re),T);e<C&&(C=e,c(ee,z),c(te,J),v=i/3)}const y=s.rayBegin,E=s.rayEnd;if(C<j*j){let e=Number.MAX_VALUE;if(P(O(ee,te,re),O(y,E,se),Y)){n(Y,Y,y);const t=f(Y);u(Y,Y,1/t),e=t/m(y,E)}p(e,Y,v,!1)}}computeAttachmentOrigin(e,t){const r=e.vertexAttributes;if(!r)return!1;const s=r.get(L.POSITION);return y(s,null,!1,t)}requiresSlot(e){return e===R.OPAQUE_MATERIAL||e===R.DRAPED_MATERIAL}createGLMaterial(e){return e.output===v.Color||e.output===v.Highlight?new F(e):null}createBufferWriter(){const e=this.parameters.vertexColors?w:U;return r(this.parameters.stipplePattern)?new B(e):new W(e.clone().vec3f(L.AUXPOS1).vec2f(L.UV0))}}class F extends E{updateParameters(e){return this.ensureTechnique(H,e)}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.sceneHasOcludees&&this._material.setParameters({sceneHasOcludees:e.hasOccludees})}beginSlot(e){return this._output===v.Color&&this._updateOccludeeState(e),this.updateParameters(e)}bind(e,t){t.bindPass(this._material.getPassParameters(),e)}}class W{constructor(e){this.vertexBufferLayout=e}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){return e.indices.get(L.POSITION).length}write(e,t,r,s){q(t,this.vertexBufferLayout,e.transformation,e.invTranspTransformation,r,s),this._writeAuxpos1(e,t,r,s),this._writeUV0(e,t,r,s)}_writeAuxpos1(e,t,r,s){const i=r.getField(L.AUXPOS1,j),o=t.indices.get(L.POSITION),n=t.vertexAttributes.get(L.POSITION).data,a=e.transformation,u=i.typedBufferStride,l=i.typedBuffer;s*=u;for(let c=0;c<o.length-1;c+=2)for(const e of[1,0]){const t=3*o[c+e],r=n[t],i=n[t+1],f=n[t+2],m=a[0]*r+a[4]*i+a[8]*f+a[12],p=a[1]*r+a[5]*i+a[9]*f+a[13],h=a[2]*r+a[6]*i+a[10]*f+a[14];l[s]=m,l[s+1]=p,l[s+2]=h,s+=u}}_writeUV0(e,t,r,s){var i;const n=r.getField(L.UV0,C),a=t.indices.get(L.POSITION),u=t.vertexAttributes.get(L.POSITION).data,l=null==(i=t.vertexAttributes.get(L.DISTANCETOSTART))?void 0:i.data,f=e.transformation,h=n.typedBufferStride,d=n.typedBuffer;let g=0;d[s*=h]=X.START,d[s+1]=g,s+=h;const A=3*a[0],O=o(z,u[A],u[A+1],u[A+2]);f&&p(O,O,f);const P=J,T=a.length-1;let b=1;const S=l?(e,t,r)=>g=l[r]:(e,t,r)=>g+=m(e,t);for(let m=1;m<T;m+=2){const e=3*a[m];o(P,u[e],u[e+1],u[e+2]),f&&p(P,P,f),S(O,P,b++);for(let t=0;t<2;++t)d[s]=1-t,d[s+1]=g,s+=h;c(O,P)}const _=3*a[T];o(P,u[_],u[_+1],u[_+2]),f&&p(P,P,f),S(O,P,b),d[s]=X.END,d[s+1]=g}}const Q={color:[1,1,1,1],vertexColors:!1,slicePlaneEnabled:!1,width:1,stipplePattern:null,stippleOffColor:null,stipplePreferContinuous:!0,sceneHasOcludees:!1,...N},z=h(),J=h(),K=h(),Y=h(),Z=s(),$=s(),ee=h(),te=h(),re=g(),se=g(),ie=h(),oe=[s(),s(),s(),s()],ne=[h(),h(),h(),h()],ae=T(),ue=T(),le=T(),ce=T();export{k as NativeLineMaterial};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{clamp as e}from"../../../../core/mathUtils.js";import{isNone as t}from"../../../../core/maybe.js";import{fromValues as r}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewVec4f as i}from"../../../../geometry/support/buffer/BufferView.js";import{newLayout as s}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as a}from"../core/shaderLibrary/ShaderOutputOptions.js";import{Normals as o}from"../core/shaderLibrary/shading/Normals.glsl.js";import{VertexAttribute as n}from"../lib/basicInterfaces.js";import{computeAttachmentOriginLines as u}from"../lib/geometryDataUtils.js";import l from"../lib/GLMaterial.js";import{materialParametersDefaults as h,Material as c}from"../lib/Material.js";import{isPathGeometry as d}from"../lib/PathGeometry.js";import{RenderPass as p}from"../lib/RenderPass.js";import{RenderSlot as m}from"../lib/RenderSlot.js";import{assert as f}from"../lib/Util.js";import{pathVertexAttributeLocations as b,PathTechniqueConfiguration as v,PathTechnique as S}from"./PathTechnique.js";import E from"./VisualVariableMaterialParameters.js";import{writeDefaultAttributes as A,writeBufferVec4 as g}from"./internal/bufferWriterUtils.js";import{intersectAabbInvDir as P}from"./internal/MaterialUtil.js";const O=f;class T extends c{constructor(e){super(e,M),this.supportsEdges=!0,this._vertexAttributeLocations=b,this.techniqueConfig=new v,this.vertexBufferLayout=T.getVertexBufferLayout(this.parameters)}getTechniqueConfig(e,t){return this.techniqueConfig.output=e,this.techniqueConfig.vvSize=this.parameters.vvSizeEnabled,this.techniqueConfig.vvColor=this.parameters.vvColorEnabled,this.techniqueConfig.vvOpacity=this.parameters.vvOpacityEnabled,this.techniqueConfig.slicePlaneEnabled=this.parameters.slicePlaneEnabled,this.techniqueConfig.transparent=this.parameters.transparent,this.techniqueConfig.sceneHasOcludees=this.parameters.sceneHasOcludees,e!==a.Color&&e!==a.Alpha||(this.techniqueConfig.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?o.DoubleSidedMode.View:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?o.DoubleSidedMode.WindingOrder:o.DoubleSidedMode.None,this.techniqueConfig.receiveShadows=this.parameters.receiveShadows,this.techniqueConfig.receiveSSAO=!!t.ssaoEnabled&&this.parameters.receiveSSAO),this.techniqueConfig.transparencyPassType=t.transparencyPassType,this.techniqueConfig.multipassTerrainEnabled=t.multipassTerrainEnabled,this.techniqueConfig.cullAboveGround=t.cullAboveGround,this.techniqueConfig}getPassParameters(){return this.parameters}isVisibleInPass(e){return e!==p.MATERIAL_DEPTH_SHADOWMAP_ALL&&e!==p.MATERIAL_DEPTH_SHADOWMAP_DEFAULT&&e!==p.MATERIAL_DEPTH_SHADOWMAP_HIGHLIGHT||this.parameters.castShadows}isVisible(){const e=this.parameters;return!!super.isVisible()&&e.opacity>0}intersect(i,s,a,o,n,u,l){const h=i;if(!d(h))return;const c=h.path,p=[this.parameters.size[0],this.parameters.size[1]];if(this.parameters.vvSizeEnabled){const t=this.parameters.vvSizeOffset,r=this.parameters.vvSizeFactor,i=this.parameters.vvSizeMinSize,s=this.parameters.vvSizeMaxSize,a=c.sizeAttributeValue;p[0]*=e(t[0]+a*r[0],i[0],s[0]),p[1]*=e(t[2]+a*r[2],i[2],s[2])}const m=Math.max(p[0],p[1]),f=i.boundingInfo;if(t(f))return void this._intersectTriangles(c,p,n,u,l);const b=r(f.bbMin[0]-m,f.bbMin[1]-m,f.bbMin[2]-m,f.bbMax[0]+m,f.bbMax[1]+m,f.bbMax[2]+m),v=[u[0]-n[0],u[1]-n[1],u[2]-n[2]],S=Math.sqrt(v[0]*v[0]+v[1]*v[1]+v[2]*v[2]),E=[S/v[0],S/v[1],S/v[2]];P(b,n,E,o.tolerance)&&this._intersectTriangles(c,p,n,u,l)}_intersectTriangles(e,t,r,i,s){e.baked.size&&e.baked.size[0]===t[0]&&e.baked.size[1]===t[1]||e.baked.bake(t),e.baked.intersect(r,i,s)}computeAttachmentOrigin(e,t){const r=e.vertexAttributes;if(!r)return null;const i=r.get(n.POSITION);return u(i,null,!1,t)}createBufferWriter(){return new y(this.vertexBufferLayout)}requiresSlot(e){return e===(this.parameters.transparent?m.TRANSPARENT_MATERIAL:m.OPAQUE_MATERIAL)||e===m.DRAPED_MATERIAL}createGLMaterial(e){return e.output===a.Color||e.output===a.Alpha||e.output===a.Depth||e.output===a.Normal||e.output===a.Highlight||e.output===a.Shadow&&this.parameters.castShadows?new L(e):null}static getVertexBufferLayout(e){let t=s().vec3f(n.POSITION).vec4f(n.PROFILERIGHT).vec4f(n.PROFILEUP).vec4f(n.PROFILEVERTEXANDNORMAL);return(e.vvColorEnabled||e.vvSizeEnabled||e.vvOpacityEnabled)&&(t=t.vec4f(n.FEATUREVALUE)),t}}class L extends l{updateParameters(e){return this.ensureTechnique(S,e)}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.sceneHasOcludees&&this._material.setParameters({sceneHasOcludees:e.hasOccludees})}_updateShadowState(e){(t(this.technique)||e.shadowMappingEnabled!==this.technique.configuration.receiveShadows)&&this._material.setParameters({receiveShadows:e.shadowMappingEnabled})}beginSlot(e){return this._output!==a.Color&&this._output!==a.Alpha||(this._updateShadowState(e),this._updateOccludeeState(e)),this.updateParameters(e)}bind(e,t){t.bindPass(this._material.getPassParameters(),e)}}const M={size:[1,1,1],ambient:[.2,.2,.2],diffuse:[.8,.8,.8],specular:[0,0,0],opacity:1,doubleSided:!1,doubleSidedType:"normal",receiveSSAO:!0,receiveShadows:!1,castShadows:!0,slicePlaneEnabled:!1,transparent:!1,sceneHasOcludees:!1,...E.Default,...h};class y{constructor(e){this.vertexBufferLayout=e}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){return e.indices.get(n.POSITION).length}write(e,t,r,s){const a=e=>{if(t.vertexAttributes.has(e)){const a=t.vertexAttributes.get(e),o=t.indices.get(e);O(4===a.size);const n=r.getField(e,i);if(!n)throw new Error("unable to acquire view for "+e);g(o,a.data,n,s)}};a(n.PROFILERIGHT),a(n.PROFILEUP),a(n.PROFILEVERTEXANDNORMAL),this.vertexBufferLayout.hasField(n.FEATUREVALUE)&&a(n.FEATUREVALUE),A(t,this.vertexBufferLayout,e.transformation,e.invTranspTransformation,r,s)}}export{T as PathMaterial};
5
+ import{clamp as e}from"../../../../core/mathUtils.js";import{isNone as t}from"../../../../core/maybe.js";import{fromValues as r}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewVec4f as i}from"../../../../geometry/support/buffer/BufferView.js";import{newLayout as s}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as a}from"../core/shaderLibrary/ShaderOutputOptions.js";import{NormalsDoubleSidedMode as n}from"../core/shaderLibrary/shading/Normals.glsl.js";import{computeAttachmentOriginLines as o}from"../lib/geometryDataUtils.js";import u from"../lib/GLMaterial.js";import{Material as h,DefaultMaterialParameters as l}from"../lib/Material.js";import{isPathGeometry as c}from"../lib/PathGeometry.js";import{RenderPass as p}from"../lib/RenderPass.js";import{RenderSlot as d}from"../lib/RenderSlot.js";import{assert as m}from"../lib/Util.js";import{VertexAttribute as f}from"../lib/VertexAttribute.js";import{pathVertexAttributeLocations as b,PathTechniqueConfiguration as v,PathTechnique as A}from"./PathTechnique.js";import{VisualVariableDefaultMaterialParameters as E}from"./VisualVariableMaterialParameters.js";import{writeDefaultAttributes as S,writeBufferVec4 as g}from"./internal/bufferWriterUtils.js";import{intersectAabbInvDir as P}from"./internal/MaterialUtil.js";class O extends h{constructor(e){super(e,L),this.supportsEdges=!0,this._vertexAttributeLocations=b,this.techniqueConfig=new v,this.vertexBufferLayout=O.getVertexBufferLayout(this.parameters)}getTechniqueConfig(e,t){return this.techniqueConfig.output=e,this.techniqueConfig.vvSize=this.parameters.vvSizeEnabled,this.techniqueConfig.vvColor=this.parameters.vvColorEnabled,this.techniqueConfig.vvOpacity=this.parameters.vvOpacityEnabled,this.techniqueConfig.slicePlaneEnabled=this.parameters.slicePlaneEnabled,this.techniqueConfig.transparent=this.parameters.transparent,this.techniqueConfig.sceneHasOcludees=this.parameters.sceneHasOcludees,e!==a.Color&&e!==a.Alpha||(this.techniqueConfig.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?n.View:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?n.WindingOrder:n.None,this.techniqueConfig.receiveShadows=this.parameters.receiveShadows,this.techniqueConfig.receiveSSAO=!!t.ssaoEnabled&&this.parameters.receiveSSAO),this.techniqueConfig.transparencyPassType=t.transparencyPassType,this.techniqueConfig.multipassTerrainEnabled=t.multipassTerrainEnabled,this.techniqueConfig.cullAboveGround=t.cullAboveGround,this.techniqueConfig}getPassParameters(){return this.parameters}isVisibleInPass(e){return e!==p.MATERIAL_DEPTH_SHADOWMAP_ALL&&e!==p.MATERIAL_DEPTH_SHADOWMAP_DEFAULT&&e!==p.MATERIAL_DEPTH_SHADOWMAP_HIGHLIGHT||this.parameters.castShadows}isVisible(){const e=this.parameters;return!!super.isVisible()&&e.opacity>0}intersect(i,s,a,n,o,u,h){const l=i;if(!c(l))return;const p=l.path,d=[this.parameters.size[0],this.parameters.size[1]];if(this.parameters.vvSizeEnabled){const t=this.parameters.vvSizeOffset,r=this.parameters.vvSizeFactor,i=this.parameters.vvSizeMinSize,s=this.parameters.vvSizeMaxSize,a=p.sizeAttributeValue;d[0]*=e(t[0]+a*r[0],i[0],s[0]),d[1]*=e(t[2]+a*r[2],i[2],s[2])}const m=Math.max(d[0],d[1]),f=i.boundingInfo;if(t(f))return void this._intersectTriangles(p,d,o,u,h);const b=r(f.bbMin[0]-m,f.bbMin[1]-m,f.bbMin[2]-m,f.bbMax[0]+m,f.bbMax[1]+m,f.bbMax[2]+m),v=[u[0]-o[0],u[1]-o[1],u[2]-o[2]],A=Math.sqrt(v[0]*v[0]+v[1]*v[1]+v[2]*v[2]),E=[A/v[0],A/v[1],A/v[2]];P(b,o,E,n.tolerance)&&this._intersectTriangles(p,d,o,u,h)}_intersectTriangles(e,t,r,i,s){e.baked.size&&e.baked.size[0]===t[0]&&e.baked.size[1]===t[1]||e.baked.bake(t),e.baked.intersect(r,i,s)}computeAttachmentOrigin(e,t){const r=e.vertexAttributes;if(!r)return null;const i=r.get(f.POSITION);return o(i,null,!1,t)}createBufferWriter(){return new M(this.vertexBufferLayout)}requiresSlot(e){return e===(this.parameters.transparent?d.TRANSPARENT_MATERIAL:d.OPAQUE_MATERIAL)||e===d.DRAPED_MATERIAL}createGLMaterial(e){return e.output===a.Color||e.output===a.Alpha||e.output===a.Depth||e.output===a.Normal||e.output===a.Highlight||e.output===a.Shadow&&this.parameters.castShadows?new T(e):null}static getVertexBufferLayout(e){let t=s().vec3f(f.POSITION).vec4f(f.PROFILERIGHT).vec4f(f.PROFILEUP).vec4f(f.PROFILEVERTEXANDNORMAL);return(e.vvColorEnabled||e.vvSizeEnabled||e.vvOpacityEnabled)&&(t=t.vec4f(f.FEATUREVALUE)),t}}class T extends u{updateParameters(e){return this.ensureTechnique(A,e)}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.sceneHasOcludees&&this._material.setParameters({sceneHasOcludees:e.hasOccludees})}_updateShadowState(e){(t(this.technique)||e.shadowMappingEnabled!==this.technique.configuration.receiveShadows)&&this._material.setParameters({receiveShadows:e.shadowMappingEnabled})}beginSlot(e){return this._output!==a.Color&&this._output!==a.Alpha||(this._updateShadowState(e),this._updateOccludeeState(e)),this.updateParameters(e)}bind(e,t){t.bindPass(this._material.getPassParameters(),e)}}const L={size:[1,1,1],ambient:[.2,.2,.2],diffuse:[.8,.8,.8],specular:[0,0,0],opacity:1,doubleSided:!1,doubleSidedType:"normal",receiveSSAO:!0,receiveShadows:!1,castShadows:!0,slicePlaneEnabled:!1,transparent:!1,sceneHasOcludees:!1,...E,...l};class M{constructor(e){this.vertexBufferLayout=e}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){return e.indices.get(f.POSITION).length}write(e,t,r,s){const a=e=>{if(t.vertexAttributes.has(e)){const a=t.vertexAttributes.get(e),n=t.indices.get(e);m(4===a.size);const o=r.getField(e,i);if(!o)throw new Error("unable to acquire view for "+e);g(n,a.data,o,s)}};a(f.PROFILERIGHT),a(f.PROFILEUP),a(f.PROFILEVERTEXANDNORMAL),this.vertexBufferLayout.hasField(f.FEATUREVALUE)&&a(f.FEATUREVALUE),S(t,this.vertexBufferLayout,e.transformation,e.invTranspTransformation,r,s)}}export{O as PathMaterial};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import{ShaderOutput as r}from"../core/shaderLibrary/ShaderOutputOptions.js";import{bindSliceUniformsWithOrigin as o}from"../core/shaderLibrary/Slice.glsl.js";import{setVVUniforms as i}from"../core/shaderLibrary/attributes/PathVertexPosition.glsl.js";import{bindVertexNormalUniforms as t}from"../core/shaderLibrary/attributes/VertexNormal.glsl.js";import{bindMultipassTerrainTexture as s}from"../core/shaderLibrary/shading/MultipassTerrainTest.glsl.js";import{Normals as a}from"../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as n}from"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{bindReadShadowMapView as l}from"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{bindProjectionMatrix as p,bindNearFar as d,bindView as u,bindCameraPosition as c}from"../core/shaderLibrary/util/View.glsl.js";import{ReloadableShaderModule as h}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as m}from"../core/shaderTechnique/ShaderTechnique.js";import{parameter as g,ShaderTechniqueConfiguration as v}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{VertexAttribute as f,TransparencyPassType as b}from"../lib/basicInterfaces.js";import{blendingDefault as y,oitBlending as S,oitDepthTest as T,OITPolygonOffset as O}from"../lib/OrderIndependentTransparency.js";import{Program as P}from"../lib/Program.js";import{stencilWriteMaskOn as E,stencilBaseAllZerosParams as j}from"../lib/StencilUtils.js";import{P as M}from"../../../../chunks/Path.glsl.js";import{makePipelineState as w,frontFaceCullingParams as C,defaultDepthWriteParams as N,defaultColorWriteParams as U}from"../../../webgl/renderState.js";const A=new Map([[f.POSITION,0],[f.PROFILERIGHT,1],[f.PROFILEUP,2],[f.PROFILEVERTEXANDNORMAL,3],[f.FEATUREVALUE,4]]);class L extends m{initializeProgram(e){const r=L.shader.get(),o=this.configuration,i=r.build({OITEnabled:o.transparencyPassType===b.Color,output:o.output,viewingMode:e.viewingMode,slicePlaneEnabled:o.slicePlaneEnabled,sliceHighlightDisabled:!1,sliceEnabledForVertexPrograms:!1,receiveShadows:o.receiveShadows,vvSize:o.vvSize,vvColor:o.vvColor,vvInstancingEnabled:!0,vvOpacity:o.vvOpacity,pbrMode:n.Disabled,useCustomDTRExponentForWater:!1,receiveAmbientOcclusion:o.receiveSSAO,doubleSidedMode:o.doubleSidedMode,multipassTerrainEnabled:o.multipassTerrainEnabled,cullAboveGround:o.cullAboveGround});return new P(e.rctx,i,A)}bindPass(e,o){var t,a;p(this.program,o.camera.projectionMatrix),this.program.setUniform3fv("size",e.size),o.multipassTerrainEnabled&&(this.program.setUniform2fv("cameraNearFar",o.camera.nearFar),this.program.setUniform2fv("inverseViewport",o.inverseViewport),s(this.program,o)),this.configuration.output!==r.Color&&this.configuration.output!==r.Alpha||this.program.setUniform1f("opacity",e.opacity),this.configuration.output===r.Color?(o.lighting.setUniforms(this.program,!1),this.program.setUniform3fv("ambient",e.ambient),this.program.setUniform3fv("diffuse",e.diffuse),this.program.setUniform3fv("specular",e.specular),this.program.setUniform1f("opacity",e.opacity)):this.configuration.output!==r.Depth&&this.configuration.output!==r.Shadow||d(this.program,o.camera.nearFar),i(this.program,e),null==(t=o.shadowMap)||t.bind(this.program),null==(a=o.ssaoHelper)||a.bind(this.program,o.camera)}bindDraw(e){u(this.program,e),o(this.program,this.configuration,e),this.program.rebindTextures(),this.configuration.output!==r.Color&&this.configuration.output!==r.Alpha||c(this.program,e.origin,e.camera.viewInverseTransposeMatrix),this.configuration.output===r.Color&&l(this.program,e),this.configuration.output===r.Normal&&t(this.program,e.camera.viewInverseTransposeMatrix)}_setPipelineState(e){const o=this.configuration,i=e===b.NONE,t=e===b.FrontFace,s=e=>!e.slicePlaneEnabled&&!(e.transparent||e.doubleSidedMode===a.DoubleSidedMode.None);return w({blending:o.output!==r.Color&&o.output!==r.Alpha||!o.transparent?null:i?y:S(e),culling:s(o)&&C,depthTest:{func:T(e)},depthWrite:i||t?N:null,colorWrite:U,stencilWrite:o.sceneHasOcludees?E:null,stencilTest:o.sceneHasOcludees?j:null,polygonOffset:i||t?null:O})}initializePipeline(){return this._setPipelineState(this.configuration.transparencyPassType)}}L.shader=new h(M,(()=>import("../shaders/Path.glsl.js")));class x extends v{constructor(){super(...arguments),this.output=r.Color,this.doubleSidedMode=a.DoubleSidedMode.None,this.receiveShadows=!1,this.receiveSSAO=!1,this.vvSize=!1,this.vvColor=!1,this.vvOpacity=!1,this.slicePlaneEnabled=!1,this.transparent=!1,this.sceneHasOcludees=!1,this.transparencyPassType=b.NONE,this.multipassTerrainEnabled=!1,this.cullAboveGround=!1}}e([g({count:r.COUNT})],x.prototype,"output",void 0),e([g({count:a.DoubleSidedMode.COUNT})],x.prototype,"doubleSidedMode",void 0),e([g()],x.prototype,"receiveShadows",void 0),e([g()],x.prototype,"receiveSSAO",void 0),e([g()],x.prototype,"vvSize",void 0),e([g()],x.prototype,"vvColor",void 0),e([g()],x.prototype,"vvOpacity",void 0),e([g()],x.prototype,"slicePlaneEnabled",void 0),e([g()],x.prototype,"transparent",void 0),e([g()],x.prototype,"sceneHasOcludees",void 0),e([g({count:b.COUNT})],x.prototype,"transparencyPassType",void 0),e([g()],x.prototype,"multipassTerrainEnabled",void 0),e([g()],x.prototype,"cullAboveGround",void 0);export{L as PathTechnique,x as PathTechniqueConfiguration,A as pathVertexAttributeLocations};
5
+ import{_ as r}from"../../../../chunks/tslib.es6.js";import{ShaderOutput as e}from"../core/shaderLibrary/ShaderOutputOptions.js";import{bindSliceUniformsWithOrigin as i}from"../core/shaderLibrary/Slice.glsl.js";import{setVVUniforms as o}from"../core/shaderLibrary/attributes/PathVertexPosition.glsl.js";import{bindVertexNormalUniforms as t}from"../core/shaderLibrary/attributes/VertexNormal.glsl.js";import{bindMultipassTerrainTexture as s}from"../core/shaderLibrary/shading/MultipassTerrainTest.glsl.js";import{NormalsDoubleSidedMode as a}from"../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as n}from"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{bindReadShadowMapView as l}from"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{bindProjectionMatrix as p,bindView as d,bindCameraPosition as u}from"../core/shaderLibrary/util/View.glsl.js";import{ReloadableShaderModule as c}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as h}from"../core/shaderTechnique/ShaderTechnique.js";import{parameter as m,ShaderTechniqueConfiguration as v}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{TransparencyPassType as g}from"../lib/basicInterfaces.js";import{blendingDefault as f,oitBlending as b,oitDepthTest as y,OITPolygonOffset as S}from"../lib/OrderIndependentTransparency.js";import{Program as T}from"../lib/Program.js";import{stencilWriteMaskOn as P,stencilBaseAllZerosParams as O}from"../lib/StencilUtils.js";import{VertexAttribute as E}from"../lib/VertexAttribute.js";import{P as j}from"../../../../chunks/Path.glsl.js";import{makePipelineState as w,frontFaceCullingParams as M,defaultDepthWriteParams as U,defaultColorWriteParams as A}from"../../../webgl/renderState.js";const C=new Map([[E.POSITION,0],[E.PROFILERIGHT,1],[E.PROFILEUP,2],[E.PROFILEVERTEXANDNORMAL,3],[E.FEATUREVALUE,4]]);class N extends h{initializeProgram(r){const e=N.shader.get(),i=this.configuration,o=e.build({oitEnabled:i.transparencyPassType===g.Color,output:i.output,viewingMode:r.viewingMode,slicePlaneEnabled:i.slicePlaneEnabled,sliceHighlightDisabled:!1,sliceEnabledForVertexPrograms:!1,receiveShadows:i.receiveShadows,vvSize:i.vvSize,vvColor:i.vvColor,vvInstancingEnabled:!0,vvOpacity:i.vvOpacity,pbrMode:n.Disabled,useCustomDTRExponentForWater:!1,receiveAmbientOcclusion:i.receiveSSAO,doubleSidedMode:i.doubleSidedMode,multipassTerrainEnabled:i.multipassTerrainEnabled,cullAboveGround:i.cullAboveGround});return new T(r.rctx,o,C)}bindPass(r,i){var t,a;p(this.program,i.camera.projectionMatrix),this.program.setUniform3fv("size",r.size),i.multipassTerrainEnabled&&(this.program.setUniform2fv("nearFar",i.camera.nearFar),this.program.setUniform2fv("inverseViewport",i.inverseViewport),s(this.program,i)),this.configuration.output!==e.Color&&this.configuration.output!==e.Alpha||this.program.setUniform1f("opacity",r.opacity),this.configuration.output===e.Color?(i.lighting.setUniforms(this.program,!1),this.program.setUniform3fv("ambient",r.ambient),this.program.setUniform3fv("diffuse",r.diffuse),this.program.setUniform3fv("specular",r.specular),this.program.setUniform1f("opacity",r.opacity)):this.configuration.output!==e.Depth&&this.configuration.output!==e.Shadow||this.program.setUniform2fv("nearFar",i.camera.nearFar),o(this.program,r),null==(t=i.shadowMap)||t.bind(this.program),null==(a=i.ssaoHelper)||a.bind(this.program,i.camera)}bindDraw(r){d(this.program,r),i(this.program,this.configuration,r),this.program.rebindTextures(),this.configuration.output!==e.Color&&this.configuration.output!==e.Alpha||u(this.program,r.origin,r.camera.viewInverseTransposeMatrix),this.configuration.output===e.Color&&l(this.program,r),this.configuration.output===e.Normal&&t(this.program,r.camera.viewInverseTransposeMatrix)}_setPipelineState(r){const i=this.configuration,o=r===g.NONE,t=r===g.FrontFace,s=r=>!r.slicePlaneEnabled&&!(r.transparent||r.doubleSidedMode===a.None);return w({blending:i.output!==e.Color&&i.output!==e.Alpha||!i.transparent?null:o?f:b(r),culling:s(i)&&M,depthTest:{func:y(r)},depthWrite:o||t?U:null,colorWrite:A,stencilWrite:i.sceneHasOcludees?P:null,stencilTest:i.sceneHasOcludees?O:null,polygonOffset:o||t?null:S})}initializePipeline(){return this._setPipelineState(this.configuration.transparencyPassType)}}N.shader=new c(j,(()=>import("../shaders/Path.glsl.js")));class L extends v{constructor(){super(...arguments),this.output=e.Color,this.doubleSidedMode=a.None,this.receiveShadows=!1,this.receiveSSAO=!1,this.vvSize=!1,this.vvColor=!1,this.vvOpacity=!1,this.slicePlaneEnabled=!1,this.transparent=!1,this.sceneHasOcludees=!1,this.transparencyPassType=g.NONE,this.multipassTerrainEnabled=!1,this.cullAboveGround=!1}}r([m({count:e.COUNT})],L.prototype,"output",void 0),r([m({count:a.COUNT})],L.prototype,"doubleSidedMode",void 0),r([m()],L.prototype,"receiveShadows",void 0),r([m()],L.prototype,"receiveSSAO",void 0),r([m()],L.prototype,"vvSize",void 0),r([m()],L.prototype,"vvColor",void 0),r([m()],L.prototype,"vvOpacity",void 0),r([m()],L.prototype,"slicePlaneEnabled",void 0),r([m()],L.prototype,"transparent",void 0),r([m()],L.prototype,"sceneHasOcludees",void 0),r([m({count:g.COUNT})],L.prototype,"transparencyPassType",void 0),r([m()],L.prototype,"multipassTerrainEnabled",void 0),r([m()],L.prototype,"cullAboveGround",void 0);export{N as PathTechnique,L as PathTechniqueConfiguration,C as pathVertexAttributeLocations};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{BufferViewMat3f as e,BufferViewVec4f as t,BufferViewVec4u8 as r,BufferViewVec3f as i}from"../../../../geometry/support/buffer/BufferView.js";import{newLayout as s}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as a}from"../core/shaderLibrary/ShaderOutputOptions.js";import{CullFaceOptions as n,VertexAttribute as o}from"../lib/basicInterfaces.js";import l from"../lib/GLMaterial.js";import{outputFromPass as u}from"../lib/GLMaterials.js";import{materialParametersDefaults as c,Material as h}from"../lib/Material.js";import{OITPolygonOffsetLimit as p}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as f}from"../lib/RenderSlot.js";import{assert as m}from"../lib/Util.js";import{Style as d}from"./PatternStyle.js";import{writeBufferVec4 as g,writeColor as b,writePosition as C}from"./internal/bufferWriterUtils.js";import{DefaultBufferWriter as P}from"./internal/DefaultBufferWriter.js";import{intersectTriangleGeometry as A}from"./internal/MaterialUtil.js";import{patternVertexAttributeLocations as O,PatternTechniqueConfiguration as E,PatternTechnique as T}from"../shaders/PatternTechnique.js";class q extends h{constructor(e){super(e,R),this.supportsEdges=!0,this._vertexAttributeLocations=O,this.techniqueConfig=new E}getTechniqueConfig(e,t){return this.techniqueConfig.output=e,this.techniqueConfig.cullFace=this.parameters.cullFace,this.techniqueConfig.vertexColors=this.parameters.vertexColors,this.techniqueConfig.slicePlaneEnabled=this.parameters.slicePlaneEnabled,this.techniqueConfig.polygonOffset=this.parameters.polygonOffset,this.techniqueConfig.writeDepth=this.parameters.writeDepth,this.techniqueConfig.style=this.parameters.style,this.techniqueConfig.patternSpacing=this.parameters.patternSpacing,this.techniqueConfig.lineWidth=this.parameters.lineWidth,this.techniqueConfig.draped=this.parameters.draped,this.techniqueConfig.transparencyPassType=t.transparencyPassType,this.techniqueConfig.enableOffset=t.camera.relativeElevation<p,this.techniqueConfig.multipassTerrainEnabled=t.multipassTerrainEnabled,this.techniqueConfig.cullAboveGround=t.cullAboveGround,this.techniqueConfig}getPassParameters(){return this.parameters}intersect(e,t,r,i,s,a,n){A(e,t,i,s,a,void 0,n)}requiresSlot(e,t){if(e===f.DRAPED_MATERIAL)return!0;if(u(t)===a.Highlight)return e===f.OPAQUE_MATERIAL;return e===(this.parameters.writeDepth?f.TRANSPARENT_MATERIAL:f.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL)}createGLMaterial(e){return e.output===a.Color||e.output===a.Alpha||e.output===a.Highlight||e.output===a.Depth&&this.parameters.writeLinearDepth?new y(e):null}createBufferWriter(){const e=s().vec3f(o.POSITION).vec4u8(o.COLOR).vec4f(o.UVMAPSPACE);return this.parameters.draped||e.mat3f(o.BOUNDINGRECT),new S(e)}}class y extends l{updateParameters(e){return this.ensureTechnique(T,e)}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.sceneHasOcludees&&this._material.setParameters({sceneHasOcludees:e.hasOccludees})}beginSlot(e){return this._output!==a.Color&&this._output!==a.Alpha||this._updateOccludeeState(e),this.updateParameters(e)}bind(e,t){t.bindPass(this._material.getPassParameters(),e)}}class S extends P{write(s,a,n,l){for(const u of this.vertexBufferLayout.fieldNames){const c=a.vertexAttributes.get(u),h=a.indices.get(u);if(c&&h)switch(u){case o.POSITION:{m(3===c.size);const e=n.getField(u,i);e&&C(h,c.data,s.transformation,e,l);break}case o.COLOR:{m(3===c.size||4===c.size);const e=n.getField(u,r);e&&b(h,c.data,c.size,e,l);break}case o.UVMAPSPACE:{m(4===c.size);const e=n.getField(u,t);e&&g(h,c.data,e,l);break}case o.BOUNDINGRECT:{m(9===c.size);const t=n.getField(u,e);t&&this.writeBoundingRect(h,c.data,s.transformation,t,l);break}}}}writeBoundingRect(e,t,r,i,s){const a=r,n=i.typedBuffer,o=i.typedBufferStride,l=e.length;s*=o;for(let u=0;u<l;++u){const r=9*e[u],i=t[r],l=t[r+1],c=t[r+2];n[s]=a[0]*i+a[4]*l+a[8]*c+a[12],n[s+1]=a[1]*i+a[5]*l+a[9]*c+a[13],n[s+2]=a[2]*i+a[6]*l+a[10]*c+a[14];for(let e=3;e<9;++e)n[s+e]=t[r+e];s+=o}}}const R={color:[1,1,1,1],writeDepth:!0,writeLinearDepth:!1,vertexColors:!1,polygonOffset:!1,slicePlaneEnabled:!1,cullFace:n.None,sceneHasOcludees:!1,style:d.Cross,patternSpacing:10,lineWidth:1,draped:!0,...c};export{q as PatternMaterial};
5
+ import{BufferViewMat3f as e,BufferViewVec4f as t,BufferViewVec4u8 as r,BufferViewVec3f as i}from"../../../../geometry/support/buffer/BufferView.js";import{newLayout as s}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as a}from"../core/shaderLibrary/ShaderOutputOptions.js";import{CullFaceOptions as n}from"../lib/basicInterfaces.js";import o from"../lib/GLMaterial.js";import{outputFromPass as l}from"../lib/GLMaterials.js";import{DefaultMaterialParameters as u,Material as c}from"../lib/Material.js";import{OITPolygonOffsetLimit as h}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as p}from"../lib/RenderSlot.js";import{assert as f}from"../lib/Util.js";import{VertexAttribute as m}from"../lib/VertexAttribute.js";import{Style as d}from"./PatternStyle.js";import{writeBufferVec4 as g,writeColor as b,writePosition as C}from"./internal/bufferWriterUtils.js";import{DefaultBufferWriter as A}from"./internal/DefaultBufferWriter.js";import{intersectTriangleGeometry as P}from"./internal/MaterialUtil.js";import{patternVertexAttributeLocations as O,PatternTechniqueConfiguration as E,PatternTechnique as T}from"../shaders/PatternTechnique.js";class q extends c{constructor(e){super(e,R),this.supportsEdges=!0,this._vertexAttributeLocations=O,this.techniqueConfig=new E}getTechniqueConfig(e,t){return this.techniqueConfig.output=e,this.techniqueConfig.cullFace=this.parameters.cullFace,this.techniqueConfig.vertexColors=this.parameters.vertexColors,this.techniqueConfig.slicePlaneEnabled=this.parameters.slicePlaneEnabled,this.techniqueConfig.polygonOffset=this.parameters.polygonOffset,this.techniqueConfig.writeDepth=this.parameters.writeDepth,this.techniqueConfig.style=this.parameters.style,this.techniqueConfig.patternSpacing=this.parameters.patternSpacing,this.techniqueConfig.lineWidth=this.parameters.lineWidth,this.techniqueConfig.draped=this.parameters.draped,this.techniqueConfig.transparencyPassType=t.transparencyPassType,this.techniqueConfig.enableOffset=t.camera.relativeElevation<h,this.techniqueConfig.multipassTerrainEnabled=t.multipassTerrainEnabled,this.techniqueConfig.cullAboveGround=t.cullAboveGround,this.techniqueConfig}getPassParameters(){return this.parameters}intersect(e,t,r,i,s,a,n){P(e,t,i,s,a,void 0,n)}requiresSlot(e,t){if(e===p.DRAPED_MATERIAL)return!0;if(l(t)===a.Highlight)return e===p.OPAQUE_MATERIAL;return e===(this.parameters.writeDepth?p.TRANSPARENT_MATERIAL:p.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL)}createGLMaterial(e){return e.output===a.Color||e.output===a.Alpha||e.output===a.Highlight||e.output===a.Depth&&this.parameters.writeLinearDepth?new y(e):null}createBufferWriter(){const e=s().vec3f(m.POSITION).vec4u8(m.COLOR).vec4f(m.UVMAPSPACE);return this.parameters.draped||e.mat3f(m.BOUNDINGRECT),new S(e)}}class y extends o{updateParameters(e){return this.ensureTechnique(T,e)}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.sceneHasOcludees&&this._material.setParameters({sceneHasOcludees:e.hasOccludees})}beginSlot(e){return this._output!==a.Color&&this._output!==a.Alpha||this._updateOccludeeState(e),this.updateParameters(e)}bind(e,t){t.bindPass(this._material.getPassParameters(),e)}}class S extends A{write(s,a,n,o){for(const l of this.vertexBufferLayout.fieldNames){const u=a.vertexAttributes.get(l),c=a.indices.get(l);if(u&&c)switch(l){case m.POSITION:{f(3===u.size);const e=n.getField(l,i);e&&C(c,u.data,s.transformation,e,o);break}case m.COLOR:{f(3===u.size||4===u.size);const e=n.getField(l,r);e&&b(c,u.data,u.size,e,o);break}case m.UVMAPSPACE:{f(4===u.size);const e=n.getField(l,t);e&&g(c,u.data,e,o);break}case m.BOUNDINGRECT:{f(9===u.size);const t=n.getField(l,e);t&&this.writeBoundingRect(c,u.data,s.transformation,t,o);break}}}}writeBoundingRect(e,t,r,i,s){const a=r,n=i.typedBuffer,o=i.typedBufferStride,l=e.length;s*=o;for(let u=0;u<l;++u){const r=9*e[u],i=t[r],l=t[r+1],c=t[r+2];n[s]=a[0]*i+a[4]*l+a[8]*c+a[12],n[s+1]=a[1]*i+a[5]*l+a[9]*c+a[13],n[s+2]=a[2]*i+a[6]*l+a[10]*c+a[14];for(let e=3;e<9;++e)n[s+e]=t[r+e];s+=o}}}const R={color:[1,1,1,1],writeDepth:!0,writeLinearDepth:!1,vertexColors:!1,polygonOffset:!1,slicePlaneEnabled:!1,cullFace:n.None,sceneHasOcludees:!1,style:d.Cross,patternSpacing:10,lineWidth:1,draped:!0,...u};export{q as PatternMaterial};