@arcgis/core 5.2.0-next.32 → 5.2.0-next.34

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 (210) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{4e803d12486c8de4c901.js → 0087ad36f7d38fc7fe11.js} +18 -18
  3. package/assets/esri/core/workers/chunks/{39c994536ce6c1e5c956.js → 03350a56f840cffe5459.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{2628136bf9f47d238a24.js → 050aba7089318e1c7d53.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{dd5dddf7e422216d3806.js → 0a2f08298a3c932614f2.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{a844c4e031e77db11478.js → 0df978697328b6453c94.js} +1 -1
  7. package/assets/esri/core/workers/chunks/0f8fcbd0650b6a924f75.js +1 -0
  8. package/assets/esri/core/workers/chunks/{83ae56c7fa8d84865605.js → 0f976bfb7db98c2c0e05.js} +1 -1
  9. package/assets/esri/core/workers/chunks/10510f76f8538c2dfb84.js +1 -0
  10. package/assets/esri/core/workers/chunks/{3f63b14b53b5ca716e3a.js → 18c4c437ded8bfbd3305.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{b60f24a6c777301803f4.js → 1958facb000b6c16bfe4.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{1664434dc7a67c8ce453.js → 1ad5fcae6d6a9801cf58.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{390fda094fa8695d98cf.js → 22c447fcc9a28afeb6e3.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{7656900713e55036c3c1.js → 29542a3d7f3fa8d42380.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{1e386475937e02b3f523.js → 2b669473aa2c7cfb63c7.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{c8091e8fd7ca43a4490a.js → 2bb3494659609594c4ca.js} +1 -1
  17. package/assets/esri/core/workers/chunks/2c00f89030c7a4201033.js +2 -0
  18. package/assets/esri/core/workers/chunks/{b75a4753cea6544da8bb.js → 2c61bb25578f73ba49bc.js} +1 -1
  19. package/assets/esri/core/workers/chunks/2d92f0042facb55edcff.js +1 -0
  20. package/assets/esri/core/workers/chunks/2da797ae5af9d2ede42d.js +1 -0
  21. package/assets/esri/core/workers/chunks/{34eb22ee13df24271532.js → 2e495a28494c2351837b.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{a0b78cbeb0e53107d819.js → 367a3031abbeff0c0090.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{aba7a053015a9738d8a0.js → 368db1420b8520beae05.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{7832d94f35b79e27ee51.js → 37dc6a8495f1f44e2d45.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{92458803531fdfe1557a.js → 38a6a7c56c592f336a12.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{c63b315c6b76b4860fc5.js → 39ff5b2a05a90e1cb214.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{0a52373c4ba652e0ee0f.js → 3b914ca36e7e2b00cfe6.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{f6afc597eaf2afa9a4a0.js → 3dd8145ef89f32920177.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{b289c46ce2dc04d32e81.js → 3e8fa2a7a36881234479.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{4ecc345c3732f7fc130f.js → 42b1c526c4c9636a169d.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{9508fa53da5f92a0ab70.js → 4316b78fc36bfd893a90.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{5bf01e0eff8a78b65e9e.js → 4656a4bf430d7eed1465.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{43ef6dee2e1d9ed7885e.js → 472ec242cd3070e6acfe.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{1bbf5f5da5842b93f638.js → 4f08b69f4a33a114c5f7.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{c60b4f2dd5fccdf362a7.js → 514ab968c0d75062e6ab.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{ba1c4a8794ac55942e35.js → 51d7145f748b4865de7f.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{2f40193d1b2e534c5226.js → 570a4725b2a4a19c5148.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{1305690054214a9cf48d.js → 586ca90e46f5cbdfeece.js} +1 -1
  39. package/assets/esri/core/workers/chunks/595401947e74a0a67144.js +1 -0
  40. package/assets/esri/core/workers/chunks/{70cb825bb37f1977d2ab.js → 59c22bab85f9cdbb9948.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{b624796ff4a9d4c406bf.js → 61efc7f5fab1c2b1f764.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{c593539c2cce7a2b9d44.js → 6596b12bb286a0b45a68.js} +1 -1
  43. package/assets/esri/core/workers/chunks/{bb1fad01d9f070e7d795.js → 661f50cb97604453f942.js} +1 -1
  44. package/assets/esri/core/workers/chunks/{51a53011478e0cf96e0b.js → 6c02493a1c1deff49c7e.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{71f09e34d56c9fe5c307.js → 6d72a1bdc2664df62c4c.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{4ea325c829d3b82854b1.js → 7085b4c655a19694da04.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{9f3d37e5f42bf1529673.js → 71b672259bac2befd9c7.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{a536904fe6f3b16fdbdc.js → 757982a73174aa7ab0d1.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{d0321dd4b5b2d863eecd.js → 777b16b76db406c99c69.js} +1 -1
  50. package/assets/esri/core/workers/chunks/7a59d39010ed33b8fabb.js +1 -0
  51. package/assets/esri/core/workers/chunks/{32b5d2537feefe6e94a3.js → 7d65a8ec5e1f871b9321.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{fe42fa2144691b9186fd.js → 828b64624c76156a6416.js} +1 -1
  53. package/assets/esri/core/workers/chunks/857532de88f21e8c3466.js +1 -0
  54. package/assets/esri/core/workers/chunks/85a280ee915010a8da3c.js +1 -0
  55. package/assets/esri/core/workers/chunks/{3d1e5bfd88771d4a0bf6.js → 866950e9ab96aebc6b32.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{8c62e2dabd1f1e13d244.js → 86731e276b31453bc235.js} +1 -1
  57. package/assets/esri/core/workers/chunks/{977e6f589bd266d6067d.js → 87c7092282214f5b78b8.js} +4 -4
  58. package/assets/esri/core/workers/chunks/{25932fa010f9a32475c1.js → 88ec63501fa2f6fdadca.js} +1 -1
  59. package/assets/esri/core/workers/chunks/{af3b060fdfa3b6174340.js → 8aa5bbf9a9b09815725a.js} +1 -1
  60. package/assets/esri/core/workers/chunks/{2353fbc1ff4481dcfb1f.js → 8b68a69ab8fb1679e7b2.js} +1 -1
  61. package/assets/esri/core/workers/chunks/{35b3ff25f5fe24fe15e2.js → 96860b6035e0b06672dd.js} +1 -1
  62. package/assets/esri/core/workers/chunks/{e2f33945d838183a2192.js → 98685bd149dee1d6dc99.js} +1 -1
  63. package/assets/esri/core/workers/chunks/{122892f365f5327d290c.js → 9de9cec5c644bc452294.js} +1 -1
  64. package/assets/esri/core/workers/chunks/a0f7e37d385fc68b138d.js +1 -0
  65. package/assets/esri/core/workers/chunks/{940ebb13618d38c6b459.js → a2a688dd2ed4565e01ff.js} +1 -1
  66. package/assets/esri/core/workers/chunks/{47f21b65065558d583ca.js → a2e754df3215e8b00a8f.js} +1 -1
  67. package/assets/esri/core/workers/chunks/{f59b76fde2cbd17f64b3.js → a3ae7c41832c7a8b0570.js} +1 -1
  68. package/assets/esri/core/workers/chunks/{6dc60afb0c39bbb001a3.js → a3e86830460e52706a4d.js} +1 -1
  69. package/assets/esri/core/workers/chunks/{c030a974a63155f450e9.js → a58b8903ae17acf117d6.js} +1 -1
  70. package/assets/esri/core/workers/chunks/{c4a2ec2e5897300163ac.js → ab3d1c00ef514b61ce0b.js} +1 -1
  71. package/assets/esri/core/workers/chunks/{b324bdb9c74fc3f956db.js → add79af151e3eb560599.js} +1 -1
  72. package/assets/esri/core/workers/chunks/{3b3f91a61e3f29af1fb2.js → ae5363956b4467208e04.js} +1 -1
  73. package/assets/esri/core/workers/chunks/{38b69fba9ae4ccbae6b7.js → afaf6874a645854c3357.js} +1 -1
  74. package/assets/esri/core/workers/chunks/{36913f0f944a9eb82cd3.js → b24b7411a73d1da87c30.js} +1 -1
  75. package/assets/esri/core/workers/chunks/b7d7bfcb089a3f1a38b6.js +1 -0
  76. package/assets/esri/core/workers/chunks/{a3393780655152102c45.js → b97b83159fec34f383af.js} +1 -1
  77. package/assets/esri/core/workers/chunks/{8ade399db21938822a7c.js → bec660ee2e7828f965e2.js} +1 -1
  78. package/assets/esri/core/workers/chunks/{6b56971783bf4c31a563.js → c19fe4f31e4ef84bbcf6.js} +1 -1
  79. package/assets/esri/core/workers/chunks/{5cccb8b06014ccef30f8.js → c228b058dd91bf0e1102.js} +1 -1
  80. package/assets/esri/core/workers/chunks/c2a02c33462bcdabd39d.js +1 -0
  81. package/assets/esri/core/workers/chunks/{cb30e8a66d6dcfebd439.js → cda2bae39135e5519d8c.js} +1 -1
  82. package/assets/esri/core/workers/chunks/{de83c177f8a1234a5b2e.js → cffef41791f0cfa6c26c.js} +1 -1
  83. package/assets/esri/core/workers/chunks/{70c94bcfa20453134037.js → d1928a8c86a8966e5582.js} +1 -1
  84. package/assets/esri/core/workers/chunks/{58e0e50b6c3abaa4798f.js → d26b1a9f47b4b2744c89.js} +1 -1
  85. package/assets/esri/core/workers/chunks/{2baee42e1797a709fe4b.js → d4a96f0402172787823a.js} +1 -1
  86. package/assets/esri/core/workers/chunks/d7e17df1c3675bf3633e.js +1 -0
  87. package/assets/esri/core/workers/chunks/dfae4440afe0ca7c5b25.js +1 -0
  88. package/assets/esri/core/workers/chunks/{bd260798b8de09a1eeb2.js → e3a4695c31d3f9d55213.js} +1 -1
  89. package/assets/esri/core/workers/chunks/{197b9f8483fad2258650.js → e6263e1983e703befe48.js} +1 -1
  90. package/assets/esri/core/workers/chunks/{6991ba1b204668e7d4da.js → e67a9f9298d63026e7f6.js} +1 -1
  91. package/assets/esri/core/workers/chunks/{6f240fe78b299e6c4fcc.js → eeee7421f64a52074ff4.js} +1 -1
  92. package/assets/esri/core/workers/chunks/{1e109a521ca8772fdf04.js → eef7e0bee19c4258ba55.js} +1 -1
  93. package/assets/esri/core/workers/chunks/{49a45083a9a155614c1c.js → ef32e454012f3b0e3f77.js} +1 -1
  94. package/assets/esri/core/workers/chunks/{83ce38342796bd6d73ce.js → f137e544076482e348ad.js} +1 -1
  95. package/assets/esri/core/workers/chunks/{e181d0f5562878b3dc01.js → f72f38e7609756a7f8ea.js} +1 -1
  96. package/assets/esri/core/workers/chunks/{ef5d11581a98fb333ad2.js → f83e3ad67b60744afd6d.js} +1 -1
  97. package/assets/esri/core/workers/chunks/{456b77b8f13933a75b68.js → fe8032905992e6574714.js} +3 -3
  98. package/assets/esri/core/workers/chunks/{2f02880a7f081eb210cd.js → fec9ce6ad634c904ffdf.js} +1 -1
  99. package/assets/esri/layers/raster/formats/lerc-wasm.wasm +0 -0
  100. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_lt.json +1 -1
  101. package/chunks/GaussianSplatComposition.glsl.js +4 -4
  102. package/chunks/OITAddEmission.glsl.js +6 -0
  103. package/chunks/OITFilterOpaque.glsl.js +4 -0
  104. package/chunks/lerc-wasm.js +1 -1
  105. package/config.js +1 -1
  106. package/core/workers/workerFactory.js +1 -1
  107. package/form/elements/inputs/attachments/AttachmentInput.js +1 -1
  108. package/geometry/support/frustum.js +1 -1
  109. package/geometry/support/plane.js +1 -1
  110. package/kernel.js +1 -1
  111. package/layers/AnnotationFeatureLayer.d.ts +110 -67
  112. package/layers/CSVLayer.d.ts +144 -175
  113. package/layers/CatalogLayer.d.ts +129 -132
  114. package/layers/DimensionFeatureLayer.d.ts +106 -63
  115. package/layers/FeatureLayer.d.ts +77 -150
  116. package/layers/GeoJSONLayer.d.ts +111 -168
  117. package/layers/OrientedImageryLayer.d.ts +125 -79
  118. package/layers/ParquetLayer.d.ts +116 -75
  119. package/layers/SubtypeGroupLayer.d.ts +86 -111
  120. package/layers/WFSLayer.d.ts +157 -127
  121. package/layers/catalog/CatalogFootprintLayer.d.ts +142 -129
  122. package/layers/graphics/sources/FeatureLayerSource.js +1 -1
  123. package/layers/graphics/sources/support/QueryTask.js +1 -1
  124. package/layers/mixins/EditBusLayer.js +1 -1
  125. package/layers/pointCloudFilters/PointCloudBitfieldFilter.d.ts +1 -1
  126. package/layers/video/VideoController.js +1 -1
  127. package/package.json +2 -2
  128. package/support/revision.js +1 -1
  129. package/views/2d/engine/webgl/definitions.js +1 -1
  130. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
  131. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
  132. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  133. package/views/2d/input/MapViewInputManager.js +1 -1
  134. package/views/2d/layers/support/annodime/DimensionInfo.js +1 -1
  135. package/views/2d/layers/support/annodime/virtualFields.js +1 -1
  136. package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
  137. package/views/3d/input/SceneInputManager.js +1 -1
  138. package/views/3d/interactive/manipulators/RotateManipulator.js +1 -1
  139. package/views/3d/interactive/visualElements/MeasurementAreaVisualElement.js +1 -1
  140. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  141. package/views/3d/terrain/PatchRenderData.js +1 -1
  142. package/views/3d/webgl-engine/core/shaderLibrary/util/emissionFilter.glsl.js +2 -0
  143. package/views/3d/webgl-engine/effects/transparency/OITAddEmission.glsl.js +2 -0
  144. package/views/3d/webgl-engine/effects/transparency/OITAddEmissionTechnique.js +2 -0
  145. package/views/3d/webgl-engine/effects/transparency/OITBlend.js +1 -1
  146. package/views/3d/webgl-engine/effects/transparency/OITFilterOpaque.glsl.js +2 -0
  147. package/views/3d/webgl-engine/effects/transparency/OITFilterOpaqueTechnique.js +2 -0
  148. package/views/3d/webgl-engine/lib/Intersector.js +1 -1
  149. package/views/3d/webgl-engine/lib/Octree.js +1 -1
  150. package/views/3d/webgl-engine/lib/RayIntersections.js +1 -1
  151. package/views/3d/webgl-engine/lib/intersectorUtils.js +1 -1
  152. package/views/3d/webgl-engine/lib/screenPolygonOverlapUtils.js +1 -1
  153. package/views/3d/webgl-engine/lib/screenPolygonTriangleIntersections.js +1 -1
  154. package/views/3d/webgl-engine/lib/verticalOffsetUtils.js +1 -1
  155. package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
  156. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  157. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  158. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  159. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  160. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  161. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  162. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  163. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  164. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  165. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  166. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  167. package/views/3d/webgl-engine/materials/TriangleMaterial.js +1 -1
  168. package/views/3d/webgl-engine/materials/intersectWithPolygonOffset.js +1 -1
  169. package/views/3d/webgl-engine/shaders/CheckerBoardTechnique.js +1 -1
  170. package/views/3d/webgl-engine/shaders/CheckerBoardTechniqueConfiguration.js +1 -1
  171. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  172. package/views/3d/webgl-engine/shaders/GaussianSplatComposition.glsl.js +1 -1
  173. package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
  174. package/views/3d/webgl-engine/shaders/ImageMaterialTechniqueConfiguration.js +1 -1
  175. package/views/3d/webgl-engine/shaders/LineMarkerTechniqueConfiguration.js +1 -1
  176. package/views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js +3 -3
  177. package/views/input/BrowserEventSource.js +1 -1
  178. package/views/input/handlers/PreventTouchSelection.js +2 -0
  179. package/views/layers/FeatureLikeLayerView.d.ts +9 -64
  180. package/views/layers/GraphicsLayerView.d.ts +1 -1
  181. package/views/layers/types.d.ts +8 -1
  182. package/widgets/BatchAttributeForm/VisibleElements.js +1 -1
  183. package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
  184. package/widgets/BatchAttributeForm.js +1 -1
  185. package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
  186. package/widgets/Editor/VisibleElements.d.ts +14 -1
  187. package/widgets/FeatureForm.js +1 -1
  188. package/assets/esri/core/workers/chunks/209460f8aae3f9f8c9b8.js +0 -1
  189. package/assets/esri/core/workers/chunks/4be31fcc5482a2526d2b.js +0 -1
  190. package/assets/esri/core/workers/chunks/58acc18b92533166135d.js +0 -1
  191. package/assets/esri/core/workers/chunks/6162f6735ea4622e54d8.js +0 -1
  192. package/assets/esri/core/workers/chunks/718d2d430c1a5a940b83.js +0 -1
  193. package/assets/esri/core/workers/chunks/a6379a8df8c08b729b9c.js +0 -1
  194. package/assets/esri/core/workers/chunks/b0253fe7b3529bc22270.js +0 -1
  195. package/assets/esri/core/workers/chunks/bd0829eb79efff5b7223.js +0 -1
  196. package/assets/esri/core/workers/chunks/c193b4a175a544c4fcd6.js +0 -1
  197. package/assets/esri/core/workers/chunks/d28169816c768d55aa09.js +0 -1
  198. package/assets/esri/core/workers/chunks/d7c0ab622caf495dbcef.js +0 -1
  199. package/assets/esri/core/workers/chunks/f10a339b16d84b650012.js +0 -2
  200. package/assets/esri/core/workers/chunks/f69d3ff8a69c1985bca3.js +0 -1
  201. package/assets/esri/core/workers/chunks/f847a4846c427f671455.js +0 -1
  202. package/chunks/OITBlendEmission.glsl.js +0 -6
  203. package/chunks/OITDimOpaque.glsl.js +0 -4
  204. package/views/2d/layers/support/annodime/fields.js +0 -2
  205. package/views/3d/webgl-engine/core/shaderLibrary/util/EmissionDimming.glsl.js +0 -2
  206. package/views/3d/webgl-engine/effects/transparency/OITBlendEmission.glsl.js +0 -2
  207. package/views/3d/webgl-engine/effects/transparency/OITBlendEmissionTechnique.js +0 -2
  208. package/views/3d/webgl-engine/effects/transparency/OITDimOpaque.glsl.js +0 -2
  209. package/views/3d/webgl-engine/effects/transparency/OITDimOpaqueTechnique.js +0 -2
  210. /package/assets/esri/core/workers/chunks/{f10a339b16d84b650012.js.LICENSE.txt → 2c00f89030c7a4201033.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{createScreenPointArray as t,createRenderScreenPointArray3 as n}from"../../../../core/screenUtils.js";import{transformMat4 as r,copy as e,distance as o,set as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as s,create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as u,empty as f,expandPointInPlace as a,clone as p,containsPoint as l,intersects as m,fromValues as h}from"../../../../geometry/support/aaBoundingRect.js";import{create as d,distance2 as g,fromPoints as M}from"../../../../geometry/support/lineSegment.js";import{signedDistance as b,intersectLineSegment as j}from"../../../../geometry/support/plane.js";import{containsPoint2dFromValues as x}from"../../../../geometry/support/triangle.js";class I{constructor(t,n,r){this.bounds=t,this.nearestDistance=n,this.nearestPoint=r}}function N(t,n){return t.isRectangle?l(t.bounds,n):O(n,t.points)}function T(t,n){if(!m(t.bounds,n))return!1;if(t.isRectangle)return!0;for(const r of t.points)if(l(n,r))return!0;for(let r=0;r<4;r++)if(O(k(z,n,r),t.points))return!0;for(let r=0;r<t.points.length;r++){const e=t.points[r],o=r===t.points.length-1?t.points[0]:t.points[r+1];for(let t=0;t<4;t++){if(V(e,o,k(z,n,t),k(A,n,(t+1)%4)))return!0}}return!1}function S(t,n,r,e){const o=Math.min(n[0],r[0],e[0]),i=Math.min(n[1],r[1],e[1]),s=Math.max(n[0],r[0],e[0]),c=Math.max(n[1],r[1],e[1]);if(!T(t,h(o,i,s,c,q)))return!1;if(N(t,n)||N(t,r)||N(t,e))return!0;for(const u of t.points)if(x(n,r,e,u,nt))return!0;for(let u=0;u<t.points.length;u++){const o=t.points[u],i=t.points[(u+1)%t.points.length];if(V(n,r,o,i)||V(r,e,o,i)||V(e,n,o,i))return!0}return!1}function R(t,n,r,e){const o=Math.min(n[0],r[0])-e,i=Math.min(n[1],r[1])-e,s=Math.max(n[0],r[0])+e,c=Math.max(n[1],r[1])+e;if(!m(t.bounds,h(o,i,s,c,q)))return!1;if(N(t,n)||N(t,r))return!0;const u=e*e;for(const f of t.points)if(B(f,n,r)<=u)return!0;for(let f=0;f<t.points.length;f++){const e=t.points[f],o=t.points[(f+1)%t.points.length];if(V(n,r,e,o)||Y(n,r,e,o)<=u)return!0}return!1}function y(t,n,r){return _(t,n.bbMin,n.bbMax,r)}function _(t,n,o,i){const c=f(q);tt.reset(t.eye);let u=0;for(let s=0;s<2;s++)for(let f=0;f<2;f++)for(let p=0;p<2;p++)J[0]=0===s?n[0]:o[0],J[1]=0===f?n[1]:o[1],J[2]=0===p?n[2]:o[2],i&&r(J,J,i),e(X[u++],J),F(t,J)||(t.projectToScreen(J,z),a(c,z),tt.addNearestCandidate(J));return v(t,c,X,tt),tt.valid?new I(p(c),tt.distance,s(tt.point)):null}function v(t,n,r,e){for(let o=0;o<r.length;o++)for(const i of Z){const s=o|i;if(s===o)continue;E(t,r[o],r[s],K)&&(t.projectToScreen(K,z),a(n,z),e.addNearestCandidate(K))}}function C(t,n,r,o,i){e(K,n),e(L,r);const s=t.projectToRenderScreen(K,G),c=t.projectToRenderScreen(L,H);if(null==s||null==c)return!1;const u=F(t,K),f=F(t,L);if(u&&f)return!1;if(u!==f){const n=u?K:L,r=u?s:c;if(!w(t,n,u?L:K))return!1;if(!t.projectToRenderScreen(n,r))return!1}return o[0]=s[0],o[1]=s[1],o[2]=0,i[0]=c[0],i[1]=c[1],i[2]=0,!0}function F(t,n){return P(t,n)>0}function P(t,n){return b(t.frustum[4],n)}function w(t,n,r){return E(t,n,r,n)}function E(t,n,r,e){return j(t.frustum[4],M(n,r,W),e)}function O(t,n){let r=!1;for(let e=0,o=n.length-1;e<n.length;o=e++){const i=n[e],s=n[o];if(!(i[1]>t[1]!=s[1]>t[1]))continue;const c=(s[0]-i[0])*(t[1]-i[1])/(s[1]-i[1])+i[0];t[0]<c&&(r=!r)}return r}function V(t,n,r,e){const o=D(t,n,r),i=D(t,n,e),s=D(r,e,t),c=D(r,e,n);return o!==i&&s!==c||(0===o&&U(t,n,r)||0===i&&U(t,n,e)||0===s&&U(r,e,t)||0===c&&U(r,e,n))}function Y(t,n,r,e){return V(t,n,r,e)?0:Math.min(B(t,r,e),B(n,r,e),B(r,t,n),B(e,t,n))}function B(t,n,r){return g(M(i(K,n[0],n[1],0),i(L,r[0],r[1],0),W),i(Q,t[0],t[1],0))}function D(t,n,r){const e=(n[1]-t[1])*(r[0]-n[0])-(n[0]-t[0])*(r[1]-n[1]);return Math.abs(e)<=nt?0:Math.sign(e)}function U(t,n,r){return r[0]>=Math.min(t[0],n[0])-nt&&r[0]<=Math.max(t[0],n[0])+nt&&r[1]>=Math.min(t[1],n[1])-nt&&r[1]<=Math.max(t[1],n[1])+nt}function k(t,n,r){return t[0]=0===r||3===r?n[0]:n[2],t[1]=r<2?n[1]:n[3],t}const q=u(),z=t(),A=t(),G=n(),H=n(),J=c(),K=c(),L=c(),Q=c(),W=d(),X=[c(),c(),c(),c(),c(),c(),c(),c()],Z=[1,2,4];class ${constructor(){this._origin=c(),this.point=c(),this.distance=Number.POSITIVE_INFINITY}get valid(){return Number.isFinite(this.distance)}addNearestCandidate(t){const n=o(this._origin,t);n<this.distance&&(this.distance=n,e(this.point,t))}reset(t){this.distance=Number.POSITIVE_INFINITY,e(this._origin,t)}}const tt=new $,nt=1e-9;export{I as ProjectedScreenBounds,F as isBehindNearPlane,_ as projectAabbToScreenBounds,y as projectBoundingInfoToScreenBounds,C as projectWorldLineSegmentToRenderScreen,N as screenPolygonContainsPoint,T as screenPolygonIntersectsBounds,R as screenPolygonIntersectsBufferedSegment,S as screenPolygonIntersectsTriangle};
2
+ import{createScreenPointArray as t,createRenderScreenPointArray3 as n}from"../../../../core/screenUtils.js";import{transformMat4 as r,copy as e,distance as o,set as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as s,create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as u,expandPointInPlace as f,clone as a,intersects as p,containsPoint as l,create as m,fromValues as h}from"../../../../geometry/support/aaBoundingRect.js";import{fromPoints as d,create as g,distance2 as M}from"../../../../geometry/support/lineSegment.js";import{signedDistance as b,intersectLineSegment as j}from"../../../../geometry/support/plane.js";import{containsPoint2dFromValues as x}from"../../../../geometry/support/triangle.js";class I{constructor(t,n,r){this.bounds=t,this.nearestDistance=n,this.nearestPoint=r}}function N(t,n){return t.isRectangle?l(t.bounds,n):O(n,t.points)}function T(t,n){if(!p(t.bounds,n))return!1;if(t.isRectangle)return!0;for(const r of t.points)if(l(n,r))return!0;for(let r=0;r<4;r++)if(O(k(z,n,r),t.points))return!0;for(let r=0;r<t.points.length;r++){const e=t.points[r],o=r===t.points.length-1?t.points[0]:t.points[r+1];for(let t=0;t<4;t++){if(V(e,o,k(z,n,t),k(A,n,(t+1)%4)))return!0}}return!1}function S(t,n,r,e){const o=Math.min(n[0],r[0],e[0]),i=Math.min(n[1],r[1],e[1]),s=Math.max(n[0],r[0],e[0]),c=Math.max(n[1],r[1],e[1]);if(!T(t,h(o,i,s,c,q)))return!1;if(N(t,n)||N(t,r)||N(t,e))return!0;for(const u of t.points)if(x(n,r,e,u,nt))return!0;for(let u=0;u<t.points.length;u++){const o=t.points[u],i=t.points[(u+1)%t.points.length];if(V(n,r,o,i)||V(r,e,o,i)||V(e,n,o,i))return!0}return!1}function R(t,n,r,e){const o=Math.min(n[0],r[0])-e,i=Math.min(n[1],r[1])-e,s=Math.max(n[0],r[0])+e,c=Math.max(n[1],r[1])+e;if(!p(t.bounds,h(o,i,s,c,q)))return!1;if(N(t,n)||N(t,r))return!0;const u=e*e;for(const f of t.points)if(B(f,n,r)<=u)return!0;for(let f=0;f<t.points.length;f++){const e=t.points[f],o=t.points[(f+1)%t.points.length];if(V(n,r,e,o)||Y(n,r,e,o)<=u)return!0}return!1}function y(t,n,r){return _(t,n.bbMin,n.bbMax,r)}function _(t,n,o,i){const c=u(q);tt.reset(t.eye);let p=0;for(let s=0;s<2;s++)for(let u=0;u<2;u++)for(let a=0;a<2;a++)J[0]=0===s?n[0]:o[0],J[1]=0===u?n[1]:o[1],J[2]=0===a?n[2]:o[2],i&&r(J,J,i),e(X[p++],J),F(t,J)||(t.projectToScreen(J,z),f(c,z),tt.addNearestCandidate(J));return v(t,c,X,tt),tt.valid?new I(a(c),tt.distance,s(tt.point)):null}function v(t,n,r,e){for(let o=0;o<r.length;o++)for(const i of Z){const s=o|i;if(s===o)continue;E(t,r[o],r[s],K)&&(t.projectToScreen(K,z),f(n,z),e.addNearestCandidate(K))}}function C(t,n,r,o,i){e(K,n),e(L,r);const s=t.projectToRenderScreen(K,G),c=t.projectToRenderScreen(L,H);if(null==s||null==c)return!1;const u=F(t,K),f=F(t,L);if(u&&f)return!1;if(u!==f){const n=u?K:L,r=u?s:c;if(!w(t,n,u?L:K))return!1;if(!t.projectToRenderScreen(n,r))return!1}return o[0]=s[0],o[1]=s[1],o[2]=0,i[0]=c[0],i[1]=c[1],i[2]=0,!0}function F(t,n){return P(t,n)>0}function P(t,n){return b(t.frustum[4],n)}function w(t,n,r){return E(t,n,r,n)}function E(t,n,r,e){return j(t.frustum[4],d(n,r,W),e)}function O(t,n){let r=!1;for(let e=0,o=n.length-1;e<n.length;o=e++){const i=n[e],s=n[o];if(!(i[1]>t[1]!=s[1]>t[1]))continue;const c=(s[0]-i[0])*(t[1]-i[1])/(s[1]-i[1])+i[0];t[0]<c&&(r=!r)}return r}function V(t,n,r,e){const o=D(t,n,r),i=D(t,n,e),s=D(r,e,t),c=D(r,e,n);return o!==i&&s!==c||(0===o&&U(t,n,r)||0===i&&U(t,n,e)||0===s&&U(r,e,t)||0===c&&U(r,e,n))}function Y(t,n,r,e){return V(t,n,r,e)?0:Math.min(B(t,r,e),B(n,r,e),B(r,t,n),B(e,t,n))}function B(t,n,r){return M(d(i(K,n[0],n[1],0),i(L,r[0],r[1],0),W),i(Q,t[0],t[1],0))}function D(t,n,r){const e=(n[1]-t[1])*(r[0]-n[0])-(n[0]-t[0])*(r[1]-n[1]);return Math.abs(e)<=nt?0:Math.sign(e)}function U(t,n,r){return r[0]>=Math.min(t[0],n[0])-nt&&r[0]<=Math.max(t[0],n[0])+nt&&r[1]>=Math.min(t[1],n[1])-nt&&r[1]<=Math.max(t[1],n[1])+nt}function k(t,n,r){return t[0]=0===r||3===r?n[0]:n[2],t[1]=r<2?n[1]:n[3],t}const q=m(),z=t(),A=t(),G=n(),H=n(),J=c(),K=c(),L=c(),Q=c(),W=g(),X=[c(),c(),c(),c(),c(),c(),c(),c()],Z=[1,2,4];class ${constructor(){this._origin=c(),this.point=c(),this.distance=Number.POSITIVE_INFINITY}get valid(){return Number.isFinite(this.distance)}addNearestCandidate(t){const n=o(this._origin,t);n<this.distance&&(this.distance=n,e(this.point,t))}reset(t){this.distance=Number.POSITIVE_INFINITY,e(this._origin,t)}}const tt=new $,nt=1e-9;export{I as ProjectedScreenBounds,F as isBehindNearPlane,_ as projectAabbToScreenBounds,y as projectBoundingInfoToScreenBounds,C as projectWorldLineSegmentToRenderScreen,N as screenPolygonContainsPoint,T as screenPolygonIntersectsBounds,R as screenPolygonIntersectsBufferedSegment,S as screenPolygonIntersectsTriangle};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{createScreenPointArray as t}from"../../../../core/screenUtils.js";import{copy as n,set as e,transformMat4 as i,lerp as o,distance as r,squaredDistance as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as c,setMin as u,setMax as a,getMax as f,getMin as m}from"../../../../geometry/support/aaBoundingBox.js";import{signedDistance as p}from"../../../../geometry/support/plane.js";import{normalFromValues as d,closestPointFromValues as h}from"../../../../geometry/support/triangle.js";import{boundingInfoSubdivisionThreshold as I}from"./intersectionConstants.js";import{projectAabbToScreenBounds as b,projectBoundingInfoToScreenBounds as g,screenPolygonIntersectsBounds as v,screenPolygonIntersectsTriangle as y}from"./screenPolygonOverlapUtils.js";class N{constructor(){this.distance=Number.POSITIVE_INFINITY,this.primitiveIndex=0,this.hasNormal=!1,this.point=l(),this.normal=l()}update(t,e,i,o){this.distance=t,this.primitiveIndex=e,n(this.point,i),this.hasNormal=null!=o,null!=o&&n(this.normal,o)}updateIfCloser(t){const{distance:n,primitiveIndex:e,point:i,normal:o}=t;n<this.distance&&this.update(n,e,i,t.hasNormal?o:null)}get valid(){return Number.isFinite(this.distance)}}function j(t,n,e,i,o){if(!t.visible||0!==t.type)return null;const r=new N;let s;if(t.boundingInfo)s=P(t.boundingInfo,n,e,i,o);else{const r=t.positionAttribute,l=t.primitivePositionIndices;s=T(n,e,i,0,l.length/3,l,r.data,r.stride,o)}for(const l of s)r.updateIfCloser(l);return r.valid?r:null}function x(t,n,e,i,o,r,s,l,c){const u=new N;for(const a of T(t,n,e,i,o,r,s,l,c))u.updateIfCloser(a);return u.valid?u:null}function*T(t,n,e,i,o,s,l,c,u,a=null,f=0){if(null==t.camera)return;const m=t.camera;for(let p=i;p<o;++p){const t=(a?.[p]??p)+f,i=null==a?t:p,o=3*t;w(A[0],s,l,c,o+0,u,i,n),w(A[1],s,l,c,o+1,u,i,n),w(A[2],s,l,c,o+2,u,i,n);const h=F(m,A,B);if(!(h<3)){for(let t=0;t<h;t++)m.projectToScreen(B[t],E[t]);O(e,E,h)&&(S(m.eye,B,h,M),C.update(r(m.eye,M),t,M,d(U,A[0],A[1],A[2])?U:null),yield C)}}}const C=new N;function*P(t,n,e,i,o){const r=n.camera,s=null!=o?(u(V,t.bbMin),a(V,t.bbMax),o.applyToAabb(V),b(r,m(V,A[0]),f(V,A[1]),e)):g(r,t,e);if(null==s||!v(i,s.bounds))return;const{primitiveIndices:l,position:c}=t,p=l?l.length:c.indices.length/3;if(p>I){const r=t.getChildren();if(void 0!==r){for(const t of r)yield*P(t,n,e,i,o);return}}yield*T(n,e,i,0,p,c.indices,c.data,c.stride,o,l)}function w(t,o,r,s,l,c,u,a){const f=s*o[l],m=r[f+0],p=r[f+1],d=r[f+2];null!=c?n(t,c.applyToVertex(m,p,d,u)):e(t,m,p,d),a&&i(t,t,a)}function F(t,e,i){let r=0;for(let s=0;s<3;s++){const l=e[s],c=e[(s+1)%3],u=p(t.frustum[4],l),a=p(t.frustum[4],c),f=u<=0,m=a<=0;f&&m?n(i[r++],c):f&&!m?o(i[r++],l,c,u/(u-a)):!f&&m&&(o(i[r++],l,c,u/(u-a)),n(i[r++],c))}return r}function O(t,n,e){for(let i=1;i<e-1;i++)if(y(t,n[0],n[i],n[i+1]))return!0;return!1}function S(t,e,i,o){let r=Number.POSITIVE_INFINITY;for(let l=1;l<i-1;l++){h(U,t,e[0],e[l],e[l+1]);const i=s(t,U);i<r&&(r=i,n(o,U))}}const V=c(),A=[l(),l(),l()],B=[l(),l(),l(),l()],E=[t(),t(),t(),t()],M=l(),U=l();export{N as Hit,T as forEachTriangleRangeScreenPolygonHit,j as intersectTriangleGeometryScreenPolygon,x as intersectTriangleRangeScreenPolygon};
2
+ import{createScreenPointArray as t}from"../../../../core/screenUtils.js";import{copy as e,set as n,transformMat4 as o,distance as r,squaredDistance as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{setMin as l,setMax as a,getMax as u,getMin as c,create as f}from"../../../../geometry/support/aaBoundingBox.js";import{clipPolygon as m}from"../../../../geometry/support/plane.js";import{normalFromValues as p,closestPointFromValues as d}from"../../../../geometry/support/triangle.js";import{boundingInfoSubdivisionThreshold as I}from"./intersectionConstants.js";import{projectAabbToScreenBounds as h,projectBoundingInfoToScreenBounds as g,screenPolygonIntersectsBounds as b,screenPolygonIntersectsTriangle as y}from"./screenPolygonOverlapUtils.js";class v{constructor(){this.distance=Number.POSITIVE_INFINITY,this.primitiveIndex=0,this.hasNormal=!1,this.point=s(),this.normal=s()}reset(){this.distance=Number.POSITIVE_INFINITY}update(t,n,o,r){this.distance=t,this.primitiveIndex=n,e(this.point,o),this.hasNormal=null!=r,null!=r&&e(this.normal,r)}updateIfCloserFromValues(t,e,n,o){t<this.distance&&this.update(t,e,n,o)}updateIfCloser(t){const{distance:e,primitiveIndex:n,point:o,normal:r}=t;this.updateIfCloserFromValues(e,n,o,t.hasNormal?r:null)}get valid(){return Number.isFinite(this.distance)}}function N(t,e,n,o,r){if(!t.visible||0!==t.type)return null;const i=new v;let s;if(t.boundingInfo)s=x(t.boundingInfo,e,n,o,r);else{const i=t.positionAttribute,l=t.primitivePositionIndices;s=j(e,n,o,0,l.length/3,l,i.data,i.stride,r,null,0)}for(const l of s)i.updateIfCloser(l);return i.valid?i:null}function T(t,e,n,o,r,i,s,l,a){const u=new v;for(const c of j(t,e,n,o,r,i,s,l,a,null,0))u.updateIfCloser(c);return u.valid?u:null}function*j(t,e,n,o,i,s,l,a,u,c=null,f=0){if(null==t.camera)return;const{camera:d,screenPolygonTriangleProcessor:I}=t;for(let h=o;h<i;++h){const t=(c?.[h]??h)+f,o=null==c?t:h,i=3*t;C(O[0],s,l,a,i+0,u,o,e),C(O[1],s,l,a,i+1,u,o,e),C(O[2],s,l,a,i+2,u,o,e);const g=Y;let b;B.reset();for(const{list:e,count:s}of I.processTriangle(M,O)){const o=m(d.frustum[4],e,s,S,!1);if(!(o<3)){for(let t=0;t<o;t++)d.projectToScreen(S[t],w[t]);F(n,w,o)&&(P(d.eye,S,o,E),null==b&&(b=p(Y,O[0],O[1],O[2])),B.updateIfCloserFromValues(r(d.eye,E),t,E,b?g:null))}}B.valid&&(yield B)}}function*x(t,e,n,o,r){const i=e.camera,s=null!=r?(l(V,t.bbMin),a(V,t.bbMax),r.applyToAabb(V),h(i,c(V,O[0]),u(V,O[1]),n)):g(i,t,n);if(null==s||!b(o,s.bounds))return;const{primitiveIndices:f,position:m}=t,p=f?f.length:m.indices.length/3;if(p>I){const i=t.getChildren();if(void 0!==i){for(const t of i)yield*x(t,e,n,o,r);return}}yield*j(e,n,o,0,p,m.indices,m.data,m.stride,r,f,0)}function C(t,e,r,i,s,l,a,u){const c=i*e[s],f=r[c+0],m=r[c+1],p=r[c+2];null!=l?l.applyToVertex(t,f,m,p,a):n(t,f,m,p),u&&o(t,t,u)}function F(t,e,n){for(let o=1;o<n-1;o++)if(y(t,e[0],e[o],e[o+1]))return!0;return!1}function P(t,n,o,r){let s=Number.POSITIVE_INFINITY;for(let l=1;l<o-1;l++){d(_,t,n[0],n[l],n[l+1]);const o=i(t,_);o<s&&(s=o,e(r,_))}}const V=f(),A=12,O=[s(),s(),s()],S=Array.from({length:A},()=>s()),w=Array.from({length:A},()=>t()),E=s(),Y=s(),_=s(),B=new v,M={list:[],count:0};export{v as Hit,j as forEachTriangleRangeScreenPolygonHit,N as intersectTriangleGeometryScreenPolygon,T as intersectTriangleRangeScreenPolygon};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{normalFromMat4Legacy as t}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as r,transpose as e,copy as i,multiply as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as n,transformMat4 as h,length as f,scaleAndAdd as m,add as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Sphere as c}from"../../../../geometry/support/sphere.js";import{Obb as _,computeOffsetObb as u}from"../../support/orientedBoundingBox.js";class g{constructor(){this._transform=a(),this._transformInverse=new M({value:this._transform},r,a),this._transformInverseTranspose=new M(this._transformInverse,e,a),this._transformTranspose=new M({value:this._transform},e,a),this._transformInverseRotation=new M({value:this._transform},t,s)}_invalidateLazyTransforms(){this._transformInverse.invalidate(),this._transformInverseTranspose.invalidate(),this._transformTranspose.invalidate(),this._transformInverseRotation.invalidate()}get transform(){return this._transform}get inverse(){return this._transformInverse.value}get inverseTranspose(){return this._transformInverseTranspose.value}get inverseRotation(){return this._transformInverseRotation.value}get transpose(){return this._transformTranspose.value}setTransformMatrix(t){i(this._transform,t)}multiplyTransform(t){o(this._transform,this._transform,t)}set(t){i(this._transform,t),this._invalidateLazyTransforms()}setAndInvalidateLazyTransforms(t,s){this.setTransformMatrix(t),this.multiplyTransform(s),this._invalidateLazyTransforms()}}class M{constructor(t,s,r){this._original=t,this._update=s,this._dirty=!0,this._transform=r()}invalidate(){this._dirty=!0}get value(){return this._dirty&&(this._update(this._transform,this._original.value),this._dirty=!1),this._transform}}class v{constructor(t=0){this.offset=t,this.tmpVertex=p()}applyToVertex(t,s,r){const e=n(j,t,s,r),i=l(w,e,this.localOrigin),o=this.offset/f(i);return m(this.tmpVertex,e,i,o),this.tmpVertex}applyToAabb(t){const s=S,r=q,e=z;for(let n=0;n<3;++n)s[n]=t[0+n]+this.localOrigin[n],r[n]=t[3+n]+this.localOrigin[n],e[n]=s[n];const i=this.applyToVertex(s[0],s[1],s[2]);for(let n=0;n<3;++n)t[n]=i[n],t[n+3]=i[n];const o=s=>{const r=this.applyToVertex(s[0],s[1],s[2]);for(let e=0;e<3;++e)t[e]=Math.min(t[e],r[e]),t[e+3]=Math.max(t[e+3],r[e])};for(let n=1;n<8;++n){for(let t=0;t<3;++t)e[t]=n&1<<t?r[t]:s[t];o(e)}let a=0;for(let n=0;n<3;++n){s[n]*r[n]<0&&(a|=1<<n)}if(0!==a&&7!==a)for(let n=0;n<8;++n)if(0===(a&n)){for(let t=0;t<3;++t)e[t]=a&1<<t?0:n&1<<t?s[t]:r[t];o(e)}for(let n=0;n<3;++n)t[n]-=this.localOrigin[n],t[n+3]-=this.localOrigin[n];return t}}class b{constructor(t=0){this.componentLocalOriginLength=0,this._totalOffset=0,this._offset=0,this._tmpVertex=p(),this._tmpMbs=new c,this._tmpObb=new _,this._resetOffset(t)}_resetOffset(t){this._offset=t,this._totalOffset=t}set offset(t){this._resetOffset(t)}get offset(){return this._offset}set componentOffset(t){this._totalOffset=this._offset+t}set localOrigin(t){this.componentLocalOriginLength=f(t)}applyToVertex(t,s,r){const e=n(j,t,s,r),i=n(w,t,s,r+this.componentLocalOriginLength),o=this._totalOffset/f(i);return m(this._tmpVertex,e,i,o),this._tmpVertex}applyToAabb(t){const s=this.componentLocalOriginLength,r=t[0],e=t[1],i=t[2]+s,o=t[3],a=t[4],n=t[5]+s,h=Math.abs(r),f=Math.abs(e),m=Math.abs(i),l=Math.abs(o),p=Math.abs(a),c=Math.abs(n),_=.5*(1+Math.sign(r*o))*Math.min(h,l),u=.5*(1+Math.sign(e*a))*Math.min(f,p),g=.5*(1+Math.sign(i*n))*Math.min(m,c),M=Math.sqrt(_*_+u*u+g*g),v=Math.sign(h+r),b=Math.sign(f+e),x=Math.sign(m+i),T=Math.sign(l+o),O=Math.sign(p+a),d=Math.sign(c+n),y=this._totalOffset;if(M<y)return t[0]-=(1-v)*y,t[1]-=(1-b)*y,t[2]-=(1-x)*y,t[3]+=T*y,t[4]+=O*y,t[5]+=d*y,t;const V=Math.max(h,l),L=Math.max(f,p),I=Math.max(m,c),j=y/Math.sqrt(V*V+L*L+I*I),w=y/M,S=w-j,q=-S;return t[0]+=r*(v*q+w),t[1]+=e*(b*q+w),t[2]+=i*(x*q+w),t[3]+=o*(T*S+j),t[4]+=a*(O*S+j),t[5]+=n*(d*S+j),t}applyToMbs(t){const s=t.center,r=f(s),e=this._totalOffset/r;return m(this._tmpMbs.center,s,s,e),this._tmpMbs.radius=t.radius+t.radius*this._totalOffset/r,this._tmpMbs}applyToObb(t){return u(t,this._totalOffset,this._totalOffset,1,this._tmpObb),this._tmpObb}}class x{constructor(t=0){this.offset=t,this.tmpVertex=p(),this._tmpSphere=new c}applyToVertex(t,s,r){const e=this.objectTransform.transform,i=n(j,t,s,r),o=h(i,i,e),a=this.offset/f(o);m(o,o,o,a);const l=this.objectTransform.inverse;return h(this.tmpVertex,o,l),this.tmpVertex}applyToMinMax(t,s){const r=this.offset/f(t);m(t,t,t,r);const e=this.offset/f(s);m(s,s,s,e)}applyToAabb(t){const s=this.offset/Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]+=t[0]*s,t[1]+=t[1]*s,t[2]+=t[2]*s;const r=this.offset/Math.sqrt(t[3]*t[3]+t[4]*t[4]+t[5]*t[5]);return t[3]+=t[3]*r,t[4]+=t[4]*r,t[5]+=t[5]*r,t}applyToBoundingSphere(t){const s=t.center,r=f(s),e=this.offset/r;return m(this._tmpSphere.center,s,s,e),this._tmpSphere.radius=t.radius+t.radius*this.offset/r,this._tmpSphere}}const T=new x;function O(t){return null!=t?(T.offset=t,T):null}const d=new b;function y(t){return null!=t?(d.offset=t,d):null}const V=new v;function L(t){return null!=t?(V.offset=t,V):null}const I="terrain",j=p(),w=p(),S=p(),q=p(),z=p();export{b as I3SVerticalOffsetGlobalViewingMode,g as IntersectorTransform,x as Object3DVerticalOffsetGlobalViewingMode,v as TerrainVerticalOffsetGlobalViewingMode,y as getVerticalOffsetI3S,O as getVerticalOffsetObject3D,L as getVerticalOffsetTerrain,I as terrainId};
2
+ import{normalFromMat4Legacy as t}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as r,transpose as e,copy as i,multiply as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as n,transformMat4 as f,length as h,scaleAndAdd as l,add as m}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Sphere as c}from"../../../../geometry/support/sphere.js";import{Obb as _,computeOffsetObb as u}from"../../support/orientedBoundingBox.js";class g{constructor(){this._transform=a(),this._transformInverse=new M({value:this._transform},r,a),this._transformInverseTranspose=new M(this._transformInverse,e,a),this._transformTranspose=new M({value:this._transform},e,a),this._transformInverseRotation=new M({value:this._transform},t,s)}_invalidateLazyTransforms(){this._transformInverse.invalidate(),this._transformInverseTranspose.invalidate(),this._transformTranspose.invalidate(),this._transformInverseRotation.invalidate()}get transform(){return this._transform}get inverse(){return this._transformInverse.value}get inverseTranspose(){return this._transformInverseTranspose.value}get inverseRotation(){return this._transformInverseRotation.value}get transpose(){return this._transformTranspose.value}setTransformMatrix(t){i(this._transform,t)}multiplyTransform(t){o(this._transform,this._transform,t)}set(t){i(this._transform,t),this._invalidateLazyTransforms()}setAndInvalidateLazyTransforms(t,s){this.setTransformMatrix(t),this.multiplyTransform(s),this._invalidateLazyTransforms()}}class M{constructor(t,s,r){this._original=t,this._update=s,this._dirty=!0,this._transform=r()}invalidate(){this._dirty=!0}get value(){return this._dirty&&(this._update(this._transform,this._original.value),this._dirty=!1),this._transform}}class v{constructor(t=0){this.offset=t,this._tmpVertex=p()}applyToVertex(t,s,r,e){const i=n(w,s,r,e),o=m(V,i,this.localOrigin),a=this.offset/h(o);return l(t,i,o,a),t}applyToAabb(t){const s=S,r=q,e=z;for(let n=0;n<3;++n)s[n]=t[0+n]+this.localOrigin[n],r[n]=t[3+n]+this.localOrigin[n],e[n]=s[n];const i=this.applyToVertex(this._tmpVertex,s[0],s[1],s[2]);for(let n=0;n<3;++n)t[n]=i[n],t[n+3]=i[n];const o=s=>{const r=this.applyToVertex(this._tmpVertex,s[0],s[1],s[2]);for(let e=0;e<3;++e)t[e]=Math.min(t[e],r[e]),t[e+3]=Math.max(t[e+3],r[e])};for(let n=1;n<8;++n){for(let t=0;t<3;++t)e[t]=n&1<<t?r[t]:s[t];o(e)}let a=0;for(let n=0;n<3;++n){s[n]*r[n]<0&&(a|=1<<n)}if(0!==a&&7!==a)for(let n=0;n<8;++n)if(0===(a&n)){for(let t=0;t<3;++t)e[t]=a&1<<t?0:n&1<<t?s[t]:r[t];o(e)}for(let n=0;n<3;++n)t[n]-=this.localOrigin[n],t[n+3]-=this.localOrigin[n];return t}}class b{constructor(t=0){this.componentLocalOriginLength=0,this._totalOffset=0,this._offset=0,this._tmpMbs=new c,this._tmpObb=new _,this._resetOffset(t)}_resetOffset(t){this._offset=t,this._totalOffset=t}set offset(t){this._resetOffset(t)}get offset(){return this._offset}set componentOffset(t){this._totalOffset=this._offset+t}set localOrigin(t){this.componentLocalOriginLength=h(t)}applyToVertex(t,s,r,e){const i=n(w,s,r,e),o=n(V,s,r,e+this.componentLocalOriginLength),a=this._totalOffset/h(o);return l(t,i,o,a),t}applyToAabb(t){const s=this.componentLocalOriginLength,r=t[0],e=t[1],i=t[2]+s,o=t[3],a=t[4],n=t[5]+s,f=Math.abs(r),h=Math.abs(e),l=Math.abs(i),m=Math.abs(o),p=Math.abs(a),c=Math.abs(n),_=.5*(1+Math.sign(r*o))*Math.min(f,m),u=.5*(1+Math.sign(e*a))*Math.min(h,p),g=.5*(1+Math.sign(i*n))*Math.min(l,c),M=Math.sqrt(_*_+u*u+g*g),v=Math.sign(f+r),b=Math.sign(h+e),T=Math.sign(l+i),O=Math.sign(m+o),d=Math.sign(p+a),x=Math.sign(c+n),y=this._totalOffset;if(M<y)return t[0]-=(1-v)*y,t[1]-=(1-b)*y,t[2]-=(1-T)*y,t[3]+=O*y,t[4]+=d*y,t[5]+=x*y,t;const L=Math.max(f,m),I=Math.max(h,p),j=Math.max(l,c),w=y/Math.sqrt(L*L+I*I+j*j),V=y/M,S=V-w,q=-S;return t[0]+=r*(v*q+V),t[1]+=e*(b*q+V),t[2]+=i*(T*q+V),t[3]+=o*(O*S+w),t[4]+=a*(d*S+w),t[5]+=n*(x*S+w),t}applyToMbs(t){const s=t.center,r=h(s),e=this._totalOffset/r;return l(this._tmpMbs.center,s,s,e),this._tmpMbs.radius=t.radius+t.radius*this._totalOffset/r,this._tmpMbs}applyToObb(t){return u(t,this._totalOffset,this._totalOffset,1,this._tmpObb),this._tmpObb}}class T{constructor(t=0){this.offset=t,this._tmpSphere=new c}applyToVertex(t,s,r,e){const i=this.objectTransform.transform,o=n(w,s,r,e),a=f(o,o,i),m=this.offset/h(a);l(a,a,a,m);const p=this.objectTransform.inverse;return f(t,a,p),t}applyToMinMax(t,s){const r=this.offset/h(t);l(t,t,t,r);const e=this.offset/h(s);l(s,s,s,e)}applyToAabb(t){const s=this.offset/Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]+=t[0]*s,t[1]+=t[1]*s,t[2]+=t[2]*s;const r=this.offset/Math.sqrt(t[3]*t[3]+t[4]*t[4]+t[5]*t[5]);return t[3]+=t[3]*r,t[4]+=t[4]*r,t[5]+=t[5]*r,t}applyToBoundingSphere(t){const s=t.center,r=h(s),e=this.offset/r;return l(this._tmpSphere.center,s,s,e),this._tmpSphere.radius=t.radius+t.radius*this.offset/r,this._tmpSphere}}const O=new T;function d(t){return null!=t?(O.offset=t,O):null}const x=new b;function y(t){return null!=t?(x.offset=t,x):null}const L=new v;function I(t){return null!=t?(L.offset=t,L):null}const j="terrain",w=p(),V=p(),S=p(),q=p(),z=p();export{b as I3SVerticalOffsetGlobalViewingMode,g as IntersectorTransform,T as Object3DVerticalOffsetGlobalViewingMode,v as TerrainVerticalOffsetGlobalViewingMode,y as getVerticalOffsetI3S,d as getVerticalOffsetObject3D,I as getVerticalOffsetTerrain,j as terrainId};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{fromValues as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColor as e}from"../core/shaderLibrary/ShaderOutput.js";import s from"../lib/GLMaterial.js";import{DefaultBufferWriter as i}from"./DefaultBufferWriter.js";import{PositionUvLayout as o}from"./DefaultLayouts.js";import{TriangleMaterial as a,TriangleMaterialParameters as n}from"./TriangleMaterial.js";import{CheckerBoardTechnique as p}from"../shaders/CheckerBoardTechnique.js";import{CheckerBoardTechniqueConfiguration as h}from"../shaders/CheckerBoardTechniqueConfiguration.js";import{alphaCutoff as c}from"../../../../webscene/support/AlphaCutoff.js";class u extends a{constructor(r){super(r,m),this._configuration=new h,this.produces=new Map([[2,r=>e(r)&&!this.transparent],[4,r=>e(r)&&this.transparent&&this.parameters.writeDepth],[8,r=>e(r)&&this.transparent&&!this.parameters.writeDepth]])}updateConfiguration(r){super.updateConfiguration(r),this._configuration.writeDepth=this.parameters.writeDepth}get visible(){return this.parameters.color1[3]>=c||this.parameters.color2[3]>=c}get transparent(){return this.parameters.color1[3]<1||this.parameters.color2[3]<1}createGLMaterial(r){return new f(r)}createBufferWriter(){return new i(o)}}class f extends s{beginSlot(r){return this.getTechnique(p,r)}}class m extends n{constructor(){super(...arguments),this.size=r(1,1),this.color1=t(.75,.75,.75,1),this.color2=t(.5,.5,.5,1),this.writeDepth=!0,this.polygonOffset=4}}export{u as CheckerBoardMaterial,m as Parameters};
2
+ import{fromValues as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as e}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColor as t}from"../core/shaderLibrary/ShaderOutput.js";import s from"../lib/GLMaterial.js";import{DefaultBufferWriter as o}from"./DefaultBufferWriter.js";import{PositionUvLayout as i}from"./DefaultLayouts.js";import{TriangleMaterial as a,TriangleMaterialParameters as n}from"./TriangleMaterial.js";import{CheckerBoardTechnique as c}from"../shaders/CheckerBoardTechnique.js";import{CheckerBoardTechniqueConfiguration as p}from"../shaders/CheckerBoardTechniqueConfiguration.js";import{alphaCutoff as u}from"../../../../webscene/support/AlphaCutoff.js";class f extends a{constructor(r){super(r,l),this._configuration=new p,this.produces=new Map([[2,r=>t(r)&&!this.transparent],[8,r=>t(r)&&this.transparent]])}updateConfiguration(r){super.updateConfiguration(r)}get visible(){return this.parameters.color1[3]>=u||this.parameters.color2[3]>=u}get transparent(){return this.parameters.color1[3]<1||this.parameters.color2[3]<1}createGLMaterial(r){return new m(r)}createBufferWriter(){return new o(i)}}class m extends s{beginSlot(r){return this.getTechnique(c,r)}}class l extends n{constructor(){super(...arguments),this.size=r(1,1),this.color1=e(.75,.75,.75,1),this.color2=e(.5,.5,.5,1),this.polygonOffset=4}}export{f as CheckerBoardMaterial,l as Parameters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{exactEquals as e,set as t,copy as r,normalize as s,subtract as i,length as a,scale as o,dot as n,transformMat3 as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as u,create as c,fromValues as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{is3DGeometryOrShadowLike as m,isColor as p}from"../core/shaderLibrary/ShaderOutput.js";import{GLTextureMaterial as d}from"../lib/GLTextureMaterial.js";import{Material as f}from"../lib/Material.js";import{intersectTriangleGeometry as x}from"../lib/RayIntersections.js";import{getVerticalOffsetObject3D as T}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as g}from"./DefaultBufferWriter.js";import{intersectWithPolygonOffset as v}from"./intersectWithPolygonOffset.js";import{verticalOffsetAtDistance as S}from"./internal/MaterialUtil.js";import{getLayout as b,DefaultMaterialPassParameters as M,DefaultMaterialTechnique as O}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as w}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as y}from"../shaders/RealisticTreeTechnique.js";import{hasShadowHighlights as C}from"../shaders/ReceiveShadowsConfiguration.js";import{alphaCutoff as R}from"../../../../webscene/support/AlphaCutoff.js";class P extends f{constructor(e,t){super(e,I),this.materialType="default",this.supportsEdges=!0,this.intersectRayDraped=void 0,this.produces=new Map([[2,e=>m(e)&&!this.transparent],[4,e=>m(e)&&this.transparent&&this.parameters.writeDepth],[8,e=>m(e)&&this.transparent&&!this.parameters.writeDepth]]),this._layout=b(this.parameters),this._configuration=new w(t.spherical)}isVisibleForOutput(e){return 5!==e&&7!==e&&6!==e||this.parameters.castShadows}get visible(){const{layerOpacity:e,colorMixMode:t,opacity:r,externalColor:s}=this.parameters;return e*("replace"===t?1:r)*("ignore"===t||isNaN(s[3])?1:s[3])>=R}get _hasEmissiveBase(){return!!this.parameters.emissiveTextureId||!e(this.parameters.emissiveBaseColor,u)}get emissions(){return this.parameters.emissiveStrength>0&&(0===this.parameters.emissiveSource&&this._hasEmissiveBase||1===this.parameters.emissiveSource)?this.transparent?2:1:0}updateConfiguration(e){super.updateConfiguration(e);const{parameters:t,_configuration:r}=this;r.hasNormalTexture=t.hasNormalTexture,r.hasColorTexture=t.hasColorTexture,r.hasMetallicRoughnessTexture=t.hasMetallicRoughnessTexture,r.hasOcclusionTexture=t.hasOcclusionTexture;const{treeRendering:s,doubleSided:i,doubleSidedType:a}=t;r.hasVertexTangents=!s&&t.hasVertexTangents,r.instanced=t.instanced,r.instancedDoublePrecision=t.instancedDoublePrecision,r.hasVVColor=!!t.vvColor,r.hasVVSize=!!t.vvSize,r.hasVerticalOffset=null!=t.verticalOffset,r.hasScreenSizePerspective=null!=t.screenSizePerspective,r.hasSlicePlane=t.hasSlicePlane,r.alphaDiscardMode=t.textureAlphaMode,r.normalType=s?0:t.normalType,r.transparent=this.transparent,r.enableOITOffset=e.enableOITOffset,r.writeDepth=t.writeDepth,r.customDepthTest=t.customDepthTest??0,r.hasOccludees=e.hasOccludees,r.cullFace=t.hasSlicePlane?0:t.cullFace,r.hasModelTransformation=!s&&null!=t.modelTransformation,r.hasVertexColors=t.hasVertexColors,r.hasSymbolColors=t.hasSymbolColors,r.doubleSidedMode=s?2:i&&"normal"===a?1:i&&"winding-order"===a?2:0,r.instancedFeatureAttribute=t.instancedFeatureAttribute,r.instancedColor=t.instancedColor,p(e.output)?(r.receiveShadows=t.receiveShadows,r.hasShadowHighlights=C(r,e),r.receiveAmbientOcclusion=t.receiveAmbientOcclusion&&null!=e.ssao,r.receiveGlobalIllumination=t.receiveAmbientOcclusion&&e.globalIlluminationEnabled):r.receiveShadows=r.hasShadowHighlights=r.receiveAmbientOcclusion=!1,r.textureAlphaPremultiplied=!!t.textureAlphaPremultiplied,r.pbrMode=t.usePBR?t.isSchematic?2:1:0,r.emissionSource=t.emissionSource,r.offsetBackfaces=!(!this.transparent||!t.offsetTransparentBackfaces),r.snowCover=e.snowCover>0,r.hasColorTextureTransform=!!t.colorTextureTransformMatrix,r.hasNormalTextureTransform=!!t.normalTextureTransformMatrix,r.hasEmissionTextureTransform=!!t.emissiveTextureTransformMatrix,r.hasOcclusionTextureTransform=!!t.occlusionTextureTransformMatrix,r.hasMetallicRoughnessTextureTransform=!!t.metallicRoughnessTextureTransformMatrix}intersectRay(e,u,c,h,m,p){if(null!=this.parameters.verticalOffset){const e=c.camera;t(N,u[12],u[13],u[14]);let p=null;switch(c.viewingMode){case 1:p=s(_,N);break;case 2:p=r(_,V)}const d=i(z,N,e.eye),f=a(d),x=o(d,d,1/f);let T=null;this.parameters.screenSizePerspective&&(T=n(p,x));const g=S(e,f,this.parameters.verticalOffset,T??0,this.parameters.screenSizePerspective,null);o(p,p,g),l(B,p,c.transform.inverseRotation),h=i(D,h,B),m=i(A,m,B)}p=v(p,this._configuration,h,m),x(e,c,h,m,T(c.verticalOffset),p)}intersectScreenPolygon(){}createGLMaterial(e){return new j(e)}createBufferWriter(){return new g(this._layout)}get transparent(){const{drivenOpacity:e,opacity:t,externalColor:r,layerOpacity:s,texture:i,textureId:a,textureAlphaMode:o,colorMixMode:n}=this.parameters,l=r[3];return e||t<1&&"replace"!==n||l<1&&"ignore"!==n||s<1||(null!=i||null!=a)&&1!==o&&2!==o&&"replace"!==n}}class j extends d{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){this._material.setParameters({receiveShadows:e.shadowMap.enabled});const r=this._material.parameters;this.updateTexture(r.textureId);const s=e.camera.viewInverseTransposeMatrix;return t(r.origin,s[3],s[7],s[11]),this._material.setParameters(this.textureBindParameters),this.getTechnique(r.treeRendering?y:O,e)}}class I extends M{constructor(){super(...arguments),this.treeRendering=!1,this.useIndexing=!1,this.hasVertexTangents=!1}get hasNormalTexture(){return!this.treeRendering&&!!this.normalTextureId}get hasColorTexture(){return!!this.textureId}get hasMetallicRoughnessTexture(){return!this.treeRendering&&!!this.metallicRoughnessTextureId}get hasOcclusionTexture(){return!this.treeRendering&&!!this.occlusionTextureId}get emissiveStrength(){return this.emissiveStrengthFromSymbol*this.emissiveStrengthKHR}get emissionSource(){return null!=this.emissiveTextureId&&0===this.emissiveSource?3:0===this.emissiveSource?2:1}get hasTextures(){return this.hasColorTexture||this.hasNormalTexture||this.hasMetallicRoughnessTexture||3===this.emissionSource||this.hasOcclusionTexture}}const D=c(),A=c(),V=h(0,0,1),_=c(),B=c(),N=c(),z=c();export{j as DefaultGLMaterial,P as DefaultMaterial,I as DefaultMaterialParameters};
2
+ import{exactEquals as e,subtract as t,add as r,set as s,copy as i,normalize as a,length as o,scale as n,dot as l,transformMat3 as c}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as u,create as h,fromValues as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{setMin as p,getMin as f,setMax as d,getMax as x}from"../../../../geometry/support/aaBoundingBox.js";import{is3DGeometryOrShadowLike as T,isColor as g}from"../core/shaderLibrary/ShaderOutput.js";import{GLTextureMaterial as v}from"../lib/GLTextureMaterial.js";import{Material as S}from"../lib/Material.js";import{intersectTriangleGeometry as b}from"../lib/RayIntersections.js";import{intersectTriangleGeometryScreenPolygon as M}from"../lib/screenPolygonTriangleIntersections.js";import{getVerticalOffsetObject3D as y}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as O}from"./DefaultBufferWriter.js";import{intersectWithPolygonOffset as C,applyPolygonOffsetToHit as R}from"./intersectWithPolygonOffset.js";import{verticalOffsetAtDistance as w}from"./internal/MaterialUtil.js";import{getLayout as P,DefaultMaterialPassParameters as j,DefaultMaterialTechnique as V}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as I}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as _}from"../shaders/RealisticTreeTechnique.js";import{hasShadowHighlights as A}from"../shaders/ReceiveShadowsConfiguration.js";import{alphaCutoff as B}from"../../../../webscene/support/AlphaCutoff.js";class D extends S{constructor(e,t){super(e,z),this.materialType="default",this.supportsEdges=!0,this.intersectRayDraped=void 0,this.produces=new Map([[2,e=>T(e)&&!this.transparent],[4,e=>T(e)&&this.transparent]]),this._layout=P(this.parameters),this._configuration=new I(t.spherical)}isVisibleForOutput(e){return 5!==e&&7!==e&&6!==e||this.parameters.castShadows}get visible(){const{layerOpacity:e,colorMixMode:t,opacity:r,externalColor:s}=this.parameters;return e*("replace"===t?1:r)*("ignore"===t||isNaN(s[3])?1:s[3])>=B}get _hasEmissiveBase(){return!!this.parameters.emissiveTextureId||!e(this.parameters.emissiveBaseColor,u)}get emissions(){return this.parameters.emissiveStrength>0&&(0===this.parameters.emissiveSource&&this._hasEmissiveBase||1===this.parameters.emissiveSource)?this.transparent?2:1:0}updateConfiguration(e){super.updateConfiguration(e);const{parameters:t,_configuration:r}=this;r.hasNormalTexture=t.hasNormalTexture,r.hasColorTexture=t.hasColorTexture,r.hasMetallicRoughnessTexture=t.hasMetallicRoughnessTexture,r.hasOcclusionTexture=t.hasOcclusionTexture;const{treeRendering:s,doubleSided:i,doubleSidedType:a}=t;r.hasVertexTangents=!s&&t.hasVertexTangents,r.instanced=t.instanced,r.instancedDoublePrecision=t.instancedDoublePrecision,r.hasVVColor=!!t.vvColor,r.hasVVSize=!!t.vvSize,r.hasVerticalOffset=null!=t.verticalOffset,r.hasScreenSizePerspective=null!=t.screenSizePerspective,r.hasSlicePlane=t.hasSlicePlane,r.alphaDiscardMode=t.textureAlphaMode,r.normalType=s?0:t.normalType,r.transparent=this.transparent,r.enableOITOffset=e.enableOITOffset,r.customDepthTest=t.customDepthTest??0,r.hasOccludees=e.hasOccludees,r.cullFace=t.hasSlicePlane?0:t.cullFace,r.hasModelTransformation=!s&&null!=t.modelTransformation,r.hasVertexColors=t.hasVertexColors,r.hasSymbolColors=t.hasSymbolColors,r.doubleSidedMode=s?2:i&&"normal"===a?1:i&&"winding-order"===a?2:0,r.instancedFeatureAttribute=t.instancedFeatureAttribute,r.instancedColor=t.instancedColor,g(e.output)?(r.receiveShadows=t.receiveShadows,r.hasShadowHighlights=A(r,e),r.receiveAmbientOcclusion=t.receiveAmbientOcclusion&&null!=e.ssao,r.receiveGlobalIllumination=t.receiveAmbientOcclusion&&e.globalIlluminationEnabled):r.receiveShadows=r.hasShadowHighlights=r.receiveAmbientOcclusion=!1,r.textureAlphaPremultiplied=!!t.textureAlphaPremultiplied,r.pbrMode=t.usePBR?t.isSchematic?2:1:0,r.emissionSource=t.emissionSource,r.offsetBackfaces=!(!this.transparent||!t.offsetTransparentBackfaces),r.snowCover=e.snowCover>0,r.hasColorTextureTransform=!!t.colorTextureTransformMatrix,r.hasNormalTextureTransform=!!t.normalTextureTransformMatrix,r.hasEmissionTextureTransform=!!t.emissiveTextureTransformMatrix,r.hasOcclusionTextureTransform=!!t.occlusionTextureTransformMatrix,r.hasMetallicRoughnessTextureTransform=!!t.metallicRoughnessTextureTransformMatrix}intersectRay(e,r,s,i,a,o){const n=this._getMaterialVerticalOffset(r,s);null!=n&&(i=t(F,i,n),a=t(E,a,n)),o=C(o,this._configuration,i,a),b(e,s,i,a,y(s.verticalOffset),o)}intersectScreenPolygon(e,t,r,s){return R(M(e,r,t,s,this._createScreenPolygonVertexDisplacement(t,r)),this._configuration,r.camera.eye)}createGLMaterial(e){return new N(e)}createBufferWriter(){return new O(this._layout)}get transparent(){const{drivenOpacity:e,opacity:t,externalColor:r,layerOpacity:s,texture:i,textureId:a,textureAlphaMode:o,colorMixMode:n}=this.parameters,l=r[3];return e||t<1&&"replace"!==n||l<1&&"ignore"!==n||s<1||(null!=i||null!=a)&&1!==o&&2!==o&&"replace"!==n}_createScreenPolygonVertexDisplacement(e,t){const s=this._getMaterialVerticalOffset(e,t);return null==s?null:{applyToVertex:(e,t,r,i)=>(e[0]=t+s[0],e[1]=r+s[1],e[2]=i+s[2],e),applyToAabb:e=>(p(e,r(W,f(e,W),s)),d(e,r(W,x(e,W),s)),e)}}_getMaterialVerticalOffset(e,r){if(null==this.parameters.verticalOffset)return null;const u=r.camera;s(G,e[12],e[13],e[14]);let h=null;switch(r.viewingMode){case 1:h=a(k,G);break;case 2:h=i(k,q)}const m=t(H,G,u.eye),p=o(m),f=n(m,m,1/p);let d=null;this.parameters.screenSizePerspective&&(d=l(h,f));const x=w(u,p,this.parameters.verticalOffset,d??0,this.parameters.screenSizePerspective,null);return n(h,h,x),c(L,h,r.transform.inverseRotation)}}class N extends v{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){this._material.setParameters({receiveShadows:e.shadowMap.enabled});const t=this._material.parameters;this.updateTexture(t.textureId);const r=e.camera.viewInverseTransposeMatrix;return s(t.origin,r[3],r[7],r[11]),this._material.setParameters(this.textureBindParameters),this.getTechnique(t.treeRendering?_:V,e)}}class z extends j{constructor(){super(...arguments),this.treeRendering=!1,this.useIndexing=!1,this.hasVertexTangents=!1}get hasNormalTexture(){return!this.treeRendering&&!!this.normalTextureId}get hasColorTexture(){return!!this.textureId}get hasMetallicRoughnessTexture(){return!this.treeRendering&&!!this.metallicRoughnessTextureId}get hasOcclusionTexture(){return!this.treeRendering&&!!this.occlusionTextureId}get emissiveStrength(){return this.emissiveStrengthFromSymbol*this.emissiveStrengthKHR}get emissionSource(){return null!=this.emissiveTextureId&&0===this.emissiveSource?3:0===this.emissiveSource?2:1}get hasTextures(){return this.hasColorTexture||this.hasNormalTexture||this.hasMetallicRoughnessTexture||3===this.emissionSource||this.hasOcclusionTexture}}const F=h(),E=h(),q=m(0,0,1),k=h(),G=h(),H=h(),L=h(),W=h();export{N as DefaultGLMaterial,D as DefaultMaterial,z as DefaultMaterialParameters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{clamp as e,deg2rad as t}from"../../../../core/mathUtils.js";import{fromMat4 as s}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as n,rotate as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{ONES as l,fromValues as c,create as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as f,transformMat4 as u,normalize as h,subtract as m,scale as d,transformMat3 as g,scaleAndAdd as b,copy as v,length as x,distance as S,sub as O,dot as z}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as y,fromValues as V}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromArray as P,ONES as C,create as j}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as R}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec4u8 as D}from"../../../../geometry/support/buffer/BufferView.js";import{evaluateModelTransformScale as w}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as A}from"../../support/debugFlags.js";import{isColorHighlightOrOLID as M,isColor as F,isOIT as U}from"../core/shaderLibrary/ShaderOutput.js";import{HUDVerticalPixelOffset as _}from"../core/shaderLibrary/hud/HUD.glsl.js";import{GLTextureMaterialBindParameters as L,GLTextureMaterial as T}from"../lib/GLTextureMaterial.js";import{Material as B}from"../lib/Material.js";import{SeparateScreenSizePerspectiveEvaluators as E}from"../lib/screenSizePerspectiveUtils.js";import{assert as I}from"../lib/Util.js";import{writePosition as W,writeNormal as H,writeColor as N,writeBufferVec2 as G,writeBufferFloat as q,writeBufferVec3 as X,writeBufferZeros as Y,writeBufferVec4 as k,writeOlidColor as J}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as K}from"./internal/MaterialUtil.js";import{a as Q}from"../../../../chunks/HUDMaterial.glsl.js";import{baseLayout as Z,getInstanceLayout as $,HUDMaterialTechnique as ee}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as te}from"../shaders/HUDMaterialTechniqueConfiguration.js";import{alphaCutoff as se}from"../../../../webscene/support/AlphaCutoff.js";class re extends B{constructor(e,t,s=!1){super(e,Ce),this.produces=new Map([[12,e=>M(e)&&!this.parameters.drawAsLabel&&!this._configuration.transparentOccluded],[13,e=>M(e)&&!this.parameters.drawAsLabel&&this._configuration.transparentOccluded],[14,e=>M(e)&&this.parameters.drawAsLabel],[18,e=>this.parameters.draped&&M(e)]]),this._visible=!0,this._configuration=new te(t,s)}updateConfiguration(e){super.updateConfiguration(e);const{parameters:t,_configuration:s}=this,r=t.draped;s.enableOITOffset=e.enableOITOffset,s.hasSlicePlane=this.parameters.hasSlicePlane,s.hasVerticalOffset=!!this.parameters.verticalOffset,s.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,s.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,s.polygonOffset=this.parameters.polygonOffset,s.draped=r,s.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,s.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,s.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,s.hasRotation=this.parameters.hasRotation,s.hasVVSize=!!this.parameters.vvSize,s.hasVVColor=!!this.parameters.vvColor,s.occludedFragmentFade=!r&&!!this.parameters.occludedFragmentOpacity,s.hasFocusAreaStyle=null!=this.parameters.focusAreaStyle,s.depthTestEnabled=this.parameters.depthEnabled,s.hasVertexColor=this.parameters.hasVertexColor,s.hasVertexSize=this.parameters.hasVertexSize,s.hasVertexRotation=this.parameters.hasVertexRotation,s.hasVertexUVi=this.parameters.hasVertexUVi,s.hasVertexCenterOffset=this.parameters.hasVertexCenterOffset,F(e.output)&&(s.debugDrawLabelBorder=!!A.LABELS_SHOW_BORDER),s.hasOcclusionTexture=!t.drawAsLabel&&s.transparentOccluded&&U(e.output)}intersectRay(e,t,r,a,n,o){const{options:{selectionMode:l,hud:c,excludeLabels:p},point:O,camera:z}=r,{parameters:V}=this;if(!l||!c||p&&V.isLabel||!e.visible||!O||!z)return;const C=e.attributes.get("featureAttribute"),j=null==C?null:P(C.data,Se),{scaleX:R,scaleY:D}=Re(j,V,z.pixelRatio),w=e.attributes.get("position"),A=e.attributes.get("size"),M=e.attributes.get("normal"),F=e.attributes.get("rotation"),U=e.attributes.get("centerOffset"),_=this.parameters.size;I(w.size>=3);const L="screen"===this.parameters.centerOffsetUnits;for(let P=0;P<w.data.length/w.size;P++){const e=P*w.size;if(f(ce,w.data[e],w.data[e+1],w.data[e+2]),u(ce,ce,t),u(ce,ce,z.viewMatrix),U){const e=P*U.size;f(ve,U.data[e],U.data[e+1],U.data[e+2])}else f(ve,0,0,0);if(!L&&(ce[0]+=ve[0],ce[1]+=ve[1],0!==ve[2])){const e=ve[2];h(ve,ce),m(ce,ce,d(ve,ve,e))}const a=P*M.size;f(pe,M.data[a],M.data[a+1],M.data[a+2]),g(pe,pe,s(ge,t));const{normal:n,cosAngle:l}=ne(pe,z,Oe),c=we(this.parameters,ce,l,z,le);if(b(ce,ce,n,c),z.applyProjection(ce,fe),fe[0]>-1){if(L&&(ve[0]||ve[1])&&(fe[0]+=ve[0]*z.pixelRatio,0!==ve[1]&&(fe[1]+=le.alignmentEvaluator.apply(ve[1])*z.pixelRatio),z.unapplyProjection(fe,ce)),fe[0]+=this.parameters.screenOffset[0]*z.pixelRatio,fe[1]+=this.parameters.screenOffset[1]*z.pixelRatio,fe[0]=Math.floor(fe[0]),fe[1]=Math.floor(fe[1]),Ve[0]=_[0],Ve[1]=_[1],null!=A){const e=P*A.size;Ve[0]*=A.data[e],Ve[1]*=A.data[e+1]}le.evaluator.applyVec2(Ve,Ve);const e=ze*z.pixelRatio;let t=0;if(V.textureIsSignedDistanceField){t=Math.min(V.outlineSize,.5*Ve[0])*z.pixelRatio/2}Ve[0]*=R,Ve[1]*=D;const s=V.rotation+(null!=F?F.data[P*F.size]:0),a=Q(V);if(oe(O,fe[0],fe[1],Ve,e,t,s,V,a)){const e=r.ray;if(u(he,ce,i(be,z.viewMatrix)),fe[0]=O[0],fe[1]=O[1],z.unprojectFromRenderScreen(fe,ce)){const t=y();v(t,e.direction);const s=1/x(t);d(t,t,s);o(S(e.origin,ce)*s,t,-1,he)}}}}}intersectScreenPolygon(){}intersectRayDraped(e,t,s,r,i){const a=e.attributes.get("position"),n=e.attributes.get("size"),o=e.attributes.get("rotation"),l=this.parameters,c=l.size,p=e.attributes.get("featureAttribute"),f=null==p?null:P(p.data,Se),{scaleX:u,scaleY:h}=Re(f,l,e.screenToWorldRatio),m=ye*e.screenToWorldRatio;for(let d=0;d<a.data.length/a.size;d++){const t=d*a.size,p=a.data[t],f=a.data[t+1];if(Ve[0]=c[0],Ve[1]=c[1],null!=n){const e=d*n.size;Ve[0]*=n.data[e],Ve[1]*=n.data[e+1]}let g=0;if(l.textureIsSignedDistanceField){g=Math.min(l.outlineSize,.5*Ve[0])*e.screenToWorldRatio/2}Ve[0]*=u,Ve[1]*=h;const b=l.rotation+(null!=o?o.data[d*o.size]:0),v=Q(l);oe(s,p,f,Ve,m,g,b,l,v)&&r(i.distance,i.normal,-1)}}createBufferWriter(){return new je(this.parameters)}applyShaderOffsets(e,t,r,i,a,n,o,l){g(ue,r,s(ge,i));const c=ne(ue,o,Oe),p=De(x(t),o),f=we(this.parameters,t,c.cosAngle,o,l);b(t,t,c.normal,f+p),b(e,e,ue,f+p);const u=n+f;this._applyPolygonOffsetView(t,c,u,o,t),this._applyCenterOffsetView(t,a,t)}applyShaderOffsetsNDC(e,t,s,r,i,a){return this._applyCenterOffsetNDC(e,t,r,i),null!=a&&v(a,i),this._applyPolygonOffsetNDC(i,s,r,i),i}_applyPolygonOffsetView(t,s,r,i,a){const n=i.aboveGround?1:-1;let o=Math.sign(r);0===o&&(o=n);const l=n*o;if(this.parameters.shaderPolygonOffset<=0)return v(a,t);const c=e(Math.abs(s.cosAngle),.01,1),p=1-Math.sqrt(1-c*c)/c/i.viewport[2];return d(a,t,l>0?p:1/p),a}_applyCenterOffsetView(e,t,s){const r="screen"!==this.parameters.centerOffsetUnits;return s!==e&&v(s,e),r&&(s[0]+=t[0],s[1]+=t[1],t[2]&&(h(pe,s),O(s,s,d(pe,pe,t[2])))),s}_applyCenterOffsetNDC(e,t,s,r){const i="screen"!==this.parameters.centerOffsetUnits;return r!==e&&v(r,e),i||(r[0]+=t[0]/s.fullWidth*2,r[1]+=t[1]/s.fullHeight*2),r}_applyPolygonOffsetNDC(e,t,s,r){const i=this.parameters.shaderPolygonOffset;if(e!==r&&v(r,e),i){const e=s.aboveGround?1:-1,a=e*Math.sign(t);r[2]-=(a||e)*i}return r}set visible(e){this._visible=e}get visible(){const{color:e,outlineSize:t,outlineColor:s}=this.parameters,r=e[3]>=se||t>=se&&s[3]>=se;return this._visible&&r}createGLMaterial(e){return new ie(e)}calculateRelativeScreenBounds(e,t,s=R()){return ae(this.parameters,e,t,s),s[2]=s[0]+e[0],s[3]=s[1]+e[1],s}}class ie extends T{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.getTechnique(ee,e)}}function ae(e,t,s,r){r[0]=e.anchorPosition[0]*-t[0]+e.screenOffset[0]*s,r[1]=e.anchorPosition[1]*-t[1]+e.screenOffset[1]*s}function ne(e,t,s){return u(s.normal,e,t.viewInverseTransposeMatrix),s.cosAngle=z(s.normal,Pe),s}function oe(e,s,r,i,a,l,c,p,f){let u=s-a-i[0]*f[0],h=u+i[0]+2*a,m=r-a-i[1]*f[1],d=m+i[1]+2*a;const g=p.distanceFieldBoundingBox;return p.textureIsSignedDistanceField&&null!=g&&(u+=i[0]*g[0],m+=i[1]*g[1],h-=i[0]*(1-g[2]),d-=i[1]*(1-g[3]),u-=l,h+=l,m-=l,d+=l),n(de,s,r),o(me,e,de,t(c)),me[0]>u&&me[0]<h&&me[1]>m&&me[1]<d}const le=new E,ce=y(),pe=y(),fe=j(),ue=y(),he=y(),me=p(),de=p(),ge=r(),be=a(),ve=y(),xe=y(),Se=j(),Oe={normal:y(),cosAngle:0},ze=1,ye=2,Ve=c(0,0),Pe=V(0,0,1);class Ce extends L{constructor(){super(...arguments),this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.isDecoration=!1,this.color=C,this.size=l,this.polygonOffset=0,this.anchorPosition=c(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=C,this.outlineSize=0,this.distanceFieldBoundingBox=j(),this.rotation=0,this.hasRotation=!1,this.vvSizeEnabled=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.hasVertexColor=!1,this.hasVertexSize=!1,this.hasVertexRotation=!1,this.hasVertexUVi=!1,this.hasVertexCenterOffset=!1,this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.centerOffsetUnits="world",this.drawAsLabel=!1,this.depthEnabled=!0,this.focusAreaStyle=null,this.draped=!1,this.isLabel=!1}get hasVVSize(){return!!this.vvSize}get hasVVColor(){return!!this.vvColor}get hasVVOpacity(){return!!this.vvOpacity}}class je{constructor(e){this.baseInstanceLayout=Z,this.layout=$(e)}elementCount(e){return e.get("position").indices.length}elementCountBaseInstance(e){return e.get("uv0").indices.length}write(e,t,s,r,i){const{buffer:a,offset:n}=i,{position:o,normal:l,color:c,size:p,rotation:f,centerOffset:u,groundDistance:h,featureAttribute:m,uvi:d}=a;W(s.get("position"),e,o,n),H(s.get("normal"),t,l,n);const g=s.get("position").indices.length;if(d){const e=s.get("uvi")?.data;if(e&&e.length>=4){const[t,s,r,i]=e;for(let e=0;e<g;++e){const a=n+e;d.setValues(a,t,s,r,i)}}}if(c&&N(s.get("color"),4,c,n),p&&G(s.get("size"),p,n),f&&q(s.get("rotation"),f,n),u&&(s.get("centerOffset")?X(s.get("centerOffset"),u,n):Y(u,n,g)),s.get("groundDistance")?q(s.get("groundDistance"),h,n):Y(h,n,g),m&&(s.get("featureAttribute")?k(s.get("featureAttribute"),m,n):Y(m,n,g)),null!=r){const e=s.get("position")?.indices;if(e){const t=e.length,s=a.getField("olidColor",D);J(r,s,t,n)}}}writeBaseInstance(e,t){const{uv0:s}=t;G(e.get("uv0"),s,0)}}function Re(e,t,s){return null==e||null==t.vvSize?{scaleX:s,scaleY:s}:(w(xe,t,e),{scaleX:xe[0]*s,scaleY:xe[1]*s})}function De(e,t){const s=t.computeRenderPixelSizeAtDist(e)*_;return(t.aboveGround?1:-1)*s}function we(e,t,s,r,i){if(!e.verticalOffset?.screenLength){const r=x(t);return i.update(s,r,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),0}const a=x(t),n=e.screenSizePerspectiveAlignment??e.screenSizePerspective,o=K(r,a,e.verticalOffset,s,n,e.screenSizePerspectiveMinPixelReferenceSize);return i.update(s,a,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),o}export{re as HUDMaterial,Ce as Parameters};
2
+ import{clamp as e,deg2rad as t}from"../../../../core/mathUtils.js";import{fromMat4 as s}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as n,rotate as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{ONES as l,fromValues as c,create as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as f,transformMat4 as u,normalize as h,subtract as m,scale as d,transformMat3 as g,scaleAndAdd as b,copy as v,length as x,distance as S,sub as O,dot as z}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as y,fromValues as V}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromArray as P,ONES as C,create as j}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as R}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec4u8 as D}from"../../../../geometry/support/buffer/BufferView.js";import{evaluateModelTransformScale as w}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as A}from"../../support/debugFlags.js";import{isColorHighlightOrOLID as M,isColor as F,isOIT as U}from"../core/shaderLibrary/ShaderOutput.js";import{HUDVerticalPixelOffset as _}from"../core/shaderLibrary/hud/HUD.glsl.js";import{GLTextureMaterialBindParameters as L,GLTextureMaterial as T}from"../lib/GLTextureMaterial.js";import{Material as B}from"../lib/Material.js";import{SeparateScreenSizePerspectiveEvaluators as E}from"../lib/screenSizePerspectiveUtils.js";import{assert as I}from"../lib/Util.js";import{writePosition as W,writeNormal as H,writeColor as N,writeBufferVec2 as G,writeBufferFloat as q,writeBufferVec3 as X,writeBufferZeros as Y,writeBufferVec4 as k,writeOlidColor as J}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as K}from"./internal/MaterialUtil.js";import{a as Q}from"../../../../chunks/HUDMaterial.glsl.js";import{baseLayout as Z,getInstanceLayout as $,HUDMaterialTechnique as ee}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as te}from"../shaders/HUDMaterialTechniqueConfiguration.js";import{alphaCutoff as se}from"../../../../webscene/support/AlphaCutoff.js";class re extends B{constructor(e,t,s=!1){super(e,Ce),this.produces=new Map([[12,e=>M(e)&&!this.parameters.drawAsLabel&&!this._configuration.transparentOccluded],[13,e=>M(e)&&!this.parameters.drawAsLabel&&this._configuration.transparentOccluded],[14,e=>M(e)&&this.parameters.drawAsLabel],[18,e=>this.parameters.draped&&M(e)]]),this._visible=!0,this._configuration=new te(t,s)}updateConfiguration(e){super.updateConfiguration(e);const{parameters:t,_configuration:s}=this,r=t.draped;s.enableOITOffset=e.enableOITOffset,s.hasSlicePlane=this.parameters.hasSlicePlane,s.hasVerticalOffset=!!this.parameters.verticalOffset,s.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,s.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,s.polygonOffset=this.parameters.polygonOffset,s.draped=r,s.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,s.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,s.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,s.hasRotation=this.parameters.hasRotation,s.hasVVSize=!!this.parameters.vvSize,s.hasVVColor=!!this.parameters.vvColor,s.occludedFragmentFade=!r&&!!this.parameters.occludedFragmentOpacity,s.hasFocusAreaStyle=null!=this.parameters.focusAreaStyle,s.depthTestEnabled=this.parameters.depthEnabled,s.hasVertexColor=this.parameters.hasVertexColor,s.hasVertexSize=this.parameters.hasVertexSize,s.hasVertexRotation=this.parameters.hasVertexRotation,s.hasVertexUVi=this.parameters.hasVertexUVi,s.hasVertexCenterOffset=this.parameters.hasVertexCenterOffset,F(e.output)&&(s.debugDrawLabelBorder=!!A.LABELS_SHOW_BORDER),s.hasOcclusionTexture=!t.drawAsLabel&&s.transparentOccluded&&U(e.output)}intersectRay(e,t,r,a,n,o){const{options:{selectionMode:l,hud:c,excludeLabels:p},point:O,camera:z}=r,{parameters:V}=this;if(!l||!c||p&&V.isLabel||!e.visible||!O||!z)return;const C=e.attributes.get("featureAttribute"),j=null==C?null:P(C.data,Se),{scaleX:R,scaleY:D}=Re(j,V,z.pixelRatio),w=e.attributes.get("position"),A=e.attributes.get("size"),M=e.attributes.get("normal"),F=e.attributes.get("rotation"),U=e.attributes.get("centerOffset"),_=this.parameters.size;I(w.size>=3);const L="screen"===this.parameters.centerOffsetUnits;for(let P=0;P<w.data.length/w.size;P++){const e=P*w.size;if(f(ce,w.data[e],w.data[e+1],w.data[e+2]),u(ce,ce,t),u(ce,ce,z.viewMatrix),U){const e=P*U.size;f(ve,U.data[e],U.data[e+1],U.data[e+2])}else f(ve,0,0,0);if(!L&&(ce[0]+=ve[0],ce[1]+=ve[1],0!==ve[2])){const e=ve[2];h(ve,ce),m(ce,ce,d(ve,ve,e))}const a=P*M.size;f(pe,M.data[a],M.data[a+1],M.data[a+2]),g(pe,pe,s(ge,t));const{normal:n,cosAngle:l}=ne(pe,z,Oe),c=we(this.parameters,ce,l,z,le);if(b(ce,ce,n,c),z.applyProjection(ce,fe),fe[0]>-1){if(L&&(ve[0]||ve[1])&&(fe[0]+=ve[0]*z.pixelRatio,0!==ve[1]&&(fe[1]+=le.alignmentEvaluator.apply(ve[1])*z.pixelRatio),z.unapplyProjection(fe,ce)),fe[0]+=this.parameters.screenOffset[0]*z.pixelRatio,fe[1]+=this.parameters.screenOffset[1]*z.pixelRatio,fe[0]=Math.floor(fe[0]),fe[1]=Math.floor(fe[1]),Ve[0]=_[0],Ve[1]=_[1],null!=A){const e=P*A.size;Ve[0]*=A.data[e],Ve[1]*=A.data[e+1]}le.evaluator.applyVec2(Ve,Ve);const e=ze*z.pixelRatio;let t=0;if(V.textureIsSignedDistanceField){t=Math.min(V.outlineSize,.5*Ve[0])*z.pixelRatio/2}Ve[0]*=R,Ve[1]*=D;const s=V.rotation+(null!=F?F.data[P*F.size]:0),a=Q(V);if(oe(O,fe[0],fe[1],Ve,e,t,s,V,a)){const e=r.ray;if(u(he,ce,i(be,z.viewMatrix)),fe[0]=O[0],fe[1]=O[1],z.unprojectFromRenderScreen(fe,ce)){const t=y();v(t,e.direction);const s=1/x(t);d(t,t,s);o(S(e.origin,ce)*s,t,-1,he)}}}}}intersectScreenPolygon(){return null}intersectRayDraped(e,t,s,r,i){const a=e.attributes.get("position"),n=e.attributes.get("size"),o=e.attributes.get("rotation"),l=this.parameters,c=l.size,p=e.attributes.get("featureAttribute"),f=null==p?null:P(p.data,Se),{scaleX:u,scaleY:h}=Re(f,l,e.screenToWorldRatio),m=ye*e.screenToWorldRatio;for(let d=0;d<a.data.length/a.size;d++){const t=d*a.size,p=a.data[t],f=a.data[t+1];if(Ve[0]=c[0],Ve[1]=c[1],null!=n){const e=d*n.size;Ve[0]*=n.data[e],Ve[1]*=n.data[e+1]}let g=0;if(l.textureIsSignedDistanceField){g=Math.min(l.outlineSize,.5*Ve[0])*e.screenToWorldRatio/2}Ve[0]*=u,Ve[1]*=h;const b=l.rotation+(null!=o?o.data[d*o.size]:0),v=Q(l);oe(s,p,f,Ve,m,g,b,l,v)&&r(i.distance,i.normal,-1)}}createBufferWriter(){return new je(this.parameters)}applyShaderOffsets(e,t,r,i,a,n,o,l){g(ue,r,s(ge,i));const c=ne(ue,o,Oe),p=De(x(t),o),f=we(this.parameters,t,c.cosAngle,o,l);b(t,t,c.normal,f+p),b(e,e,ue,f+p);const u=n+f;this._applyPolygonOffsetView(t,c,u,o,t),this._applyCenterOffsetView(t,a,t)}applyShaderOffsetsNDC(e,t,s,r,i,a){return this._applyCenterOffsetNDC(e,t,r,i),null!=a&&v(a,i),this._applyPolygonOffsetNDC(i,s,r,i),i}_applyPolygonOffsetView(t,s,r,i,a){const n=i.aboveGround?1:-1;let o=Math.sign(r);0===o&&(o=n);const l=n*o;if(this.parameters.shaderPolygonOffset<=0)return v(a,t);const c=e(Math.abs(s.cosAngle),.01,1),p=1-Math.sqrt(1-c*c)/c/i.viewport[2];return d(a,t,l>0?p:1/p),a}_applyCenterOffsetView(e,t,s){const r="screen"!==this.parameters.centerOffsetUnits;return s!==e&&v(s,e),r&&(s[0]+=t[0],s[1]+=t[1],t[2]&&(h(pe,s),O(s,s,d(pe,pe,t[2])))),s}_applyCenterOffsetNDC(e,t,s,r){const i="screen"!==this.parameters.centerOffsetUnits;return r!==e&&v(r,e),i||(r[0]+=t[0]/s.fullWidth*2,r[1]+=t[1]/s.fullHeight*2),r}_applyPolygonOffsetNDC(e,t,s,r){const i=this.parameters.shaderPolygonOffset;if(e!==r&&v(r,e),i){const e=s.aboveGround?1:-1,a=e*Math.sign(t);r[2]-=(a||e)*i}return r}set visible(e){this._visible=e}get visible(){const{color:e,outlineSize:t,outlineColor:s}=this.parameters,r=e[3]>=se||t>=se&&s[3]>=se;return this._visible&&r}createGLMaterial(e){return new ie(e)}calculateRelativeScreenBounds(e,t,s=R()){return ae(this.parameters,e,t,s),s[2]=s[0]+e[0],s[3]=s[1]+e[1],s}}class ie extends T{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.getTechnique(ee,e)}}function ae(e,t,s,r){r[0]=e.anchorPosition[0]*-t[0]+e.screenOffset[0]*s,r[1]=e.anchorPosition[1]*-t[1]+e.screenOffset[1]*s}function ne(e,t,s){return u(s.normal,e,t.viewInverseTransposeMatrix),s.cosAngle=z(s.normal,Pe),s}function oe(e,s,r,i,a,l,c,p,f){let u=s-a-i[0]*f[0],h=u+i[0]+2*a,m=r-a-i[1]*f[1],d=m+i[1]+2*a;const g=p.distanceFieldBoundingBox;return p.textureIsSignedDistanceField&&null!=g&&(u+=i[0]*g[0],m+=i[1]*g[1],h-=i[0]*(1-g[2]),d-=i[1]*(1-g[3]),u-=l,h+=l,m-=l,d+=l),n(de,s,r),o(me,e,de,t(c)),me[0]>u&&me[0]<h&&me[1]>m&&me[1]<d}const le=new E,ce=y(),pe=y(),fe=j(),ue=y(),he=y(),me=p(),de=p(),ge=r(),be=a(),ve=y(),xe=y(),Se=j(),Oe={normal:y(),cosAngle:0},ze=1,ye=2,Ve=c(0,0),Pe=V(0,0,1);class Ce extends L{constructor(){super(...arguments),this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.isDecoration=!1,this.color=C,this.size=l,this.polygonOffset=0,this.anchorPosition=c(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=C,this.outlineSize=0,this.distanceFieldBoundingBox=j(),this.rotation=0,this.hasRotation=!1,this.vvSizeEnabled=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.hasVertexColor=!1,this.hasVertexSize=!1,this.hasVertexRotation=!1,this.hasVertexUVi=!1,this.hasVertexCenterOffset=!1,this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.centerOffsetUnits="world",this.drawAsLabel=!1,this.depthEnabled=!0,this.focusAreaStyle=null,this.draped=!1,this.isLabel=!1}get hasVVSize(){return!!this.vvSize}get hasVVColor(){return!!this.vvColor}get hasVVOpacity(){return!!this.vvOpacity}}class je{constructor(e){this.baseInstanceLayout=Z,this.layout=$(e)}elementCount(e){return e.get("position").indices.length}elementCountBaseInstance(e){return e.get("uv0").indices.length}write(e,t,s,r,i){const{buffer:a,offset:n}=i,{position:o,normal:l,color:c,size:p,rotation:f,centerOffset:u,groundDistance:h,featureAttribute:m,uvi:d}=a;W(s.get("position"),e,o,n),H(s.get("normal"),t,l,n);const g=s.get("position").indices.length;if(d){const e=s.get("uvi")?.data;if(e&&e.length>=4){const[t,s,r,i]=e;for(let e=0;e<g;++e){const a=n+e;d.setValues(a,t,s,r,i)}}}if(c&&N(s.get("color"),4,c,n),p&&G(s.get("size"),p,n),f&&q(s.get("rotation"),f,n),u&&(s.get("centerOffset")?X(s.get("centerOffset"),u,n):Y(u,n,g)),s.get("groundDistance")?q(s.get("groundDistance"),h,n):Y(h,n,g),m&&(s.get("featureAttribute")?k(s.get("featureAttribute"),m,n):Y(m,n,g)),null!=r){const e=s.get("position")?.indices;if(e){const t=e.length,s=a.getField("olidColor",D);J(r,s,t,n)}}}writeBaseInstance(e,t){const{uv0:s}=t;G(e.get("uv0"),s,0)}}function Re(e,t,s){return null==e||null==t.vvSize?{scaleX:s,scaleY:s}:(w(xe,t,e),{scaleX:xe[0]*s,scaleY:xe[1]*s})}function De(e,t){const s=t.computeRenderPixelSizeAtDist(e)*_;return(t.aboveGround?1:-1)*s}function we(e,t,s,r,i){if(!e.verticalOffset?.screenLength){const r=x(t);return i.update(s,r,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),0}const a=x(t),n=e.screenSizePerspectiveAlignment??e.screenSizePerspective,o=K(r,a,e.verticalOffset,s,n,e.screenSizePerspectiveMinPixelReferenceSize);return i.update(s,a,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),o}export{re as HUDMaterial,Ce as Parameters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{set as t,squaredDistance as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{isColor as r}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{Material as a}from"../lib/Material.js";import{writePosition as n,writeBufferFloat as o}from"./internal/bufferWriterUtils.js";import{attributeDrivenInstanceLayout as u,instanceLayout as c,HeatmapDensityPassParameters as l,HeatmapDensityTechnique as f,baseLayout as m}from"../shaders/HeatmapDensityTechnique.js";import{HeatmapDensityTechniqueConfiguration as p}from"../shaders/HeatmapDensityTechniqueConfiguration.js";const h=2;class b extends l{constructor(){super(...arguments),this.isAttributeDriven=!1,this.usesHalfFloats=!1}}class d extends a{constructor(t){super(t,b),this.visible=!0,this.produces=new Map([[18,t=>r(t)]]),this._configuration=new p}updateConfiguration(t){super.updateConfiguration(t),this._configuration.isAttributeDriven=this.parameters.isAttributeDriven,this._configuration.usesHalfFloat=this.parameters.usesHalfFloats}createGLMaterial(t){return new g(t)}intersectRay(){}intersectRayDraped(s,r,i,a,n){const o=s.attributes.get("position"),{parameters:u}=this,{searchRadius:c}=u,{screenToWorldRatio:l}=s,f=c*l+h*l,m=f*f,p=o.data.length/o.size;for(let h=0;h<p;h++){const s=h*o.size,r=t(v,o.data[s],o.data[s+1]);e(r,i)<m&&a(n.distance,n.normal,-1)}}intersectScreenPolygon(){}createBufferWriter(){return new j(this.parameters.isAttributeDriven?u:c)}}class g extends i{beginSlot(t){return this.getTechnique(f,t)}}class j{constructor(t){this.layout=t,this.baseInstanceLayout=m}elementCount(t){return t.get("position").indices.length}elementCountBaseInstance(){return 4}write(t,e,s,r,i){const{buffer:a,offset:u}=i;n(s.get("position"),t,a.position,u);const c="featureAttribute"in a?a.featureAttribute:null;c&&o(s.get("featureAttribute"),c,u)}writeBaseInstance(t,e){const s=e.uv0;s.setValues(0,-1,-1),s.setValues(1,-1,1),s.setValues(2,1,-1),s.setValues(3,1,1)}}const v=s();export{d as HeatmapDensityMaterial,b as Parameters};
2
+ import{set as t,squaredDistance as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{isColor as s}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{Material as a}from"../lib/Material.js";import{writePosition as n,writeBufferFloat as o}from"./internal/bufferWriterUtils.js";import{attributeDrivenInstanceLayout as u,instanceLayout as c,HeatmapDensityPassParameters as l,HeatmapDensityTechnique as f,baseLayout as m}from"../shaders/HeatmapDensityTechnique.js";import{HeatmapDensityTechniqueConfiguration as p}from"../shaders/HeatmapDensityTechniqueConfiguration.js";const h=2;class b extends l{constructor(){super(...arguments),this.isAttributeDriven=!1,this.usesHalfFloats=!1}}class d extends a{constructor(t){super(t,b),this.visible=!0,this.produces=new Map([[18,t=>s(t)]]),this._configuration=new p}updateConfiguration(t){super.updateConfiguration(t),this._configuration.isAttributeDriven=this.parameters.isAttributeDriven,this._configuration.usesHalfFloat=this.parameters.usesHalfFloats}createGLMaterial(t){return new g(t)}intersectRay(){}intersectRayDraped(r,s,i,a,n){const o=r.attributes.get("position"),{parameters:u}=this,{searchRadius:c}=u,{screenToWorldRatio:l}=r,f=c*l+h*l,m=f*f,p=o.data.length/o.size;for(let h=0;h<p;h++){const r=h*o.size,s=t(v,o.data[r],o.data[r+1]);e(s,i)<m&&a(n.distance,n.normal,-1)}}intersectScreenPolygon(){return null}createBufferWriter(){return new j(this.parameters.isAttributeDriven?u:c)}}class g extends i{beginSlot(t){return this.getTechnique(f,t)}}class j{constructor(t){this.layout=t,this.baseInstanceLayout=m}elementCount(t){return t.get("position").indices.length}elementCountBaseInstance(){return 4}write(t,e,r,s,i){const{buffer:a,offset:u}=i;n(r.get("position"),t,a.position,u);const c="featureAttribute"in a?a.featureAttribute:null;c&&o(r.get("featureAttribute"),c,u)}writeBaseInstance(t,e){const r=e.uv0;r.setValues(0,-1,-1),r.setValues(1,-1,1),r.setValues(2,1,-1),r.setValues(3,1,1)}}const v=r();export{d as HeatmapDensityMaterial,b as Parameters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{BufferViewFloat as e}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOLID as t,isColor as r}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{isUpdatableTexture as s}from"../lib/IManagedTexture.js";import{assert as a}from"../lib/Util.js";import{DefaultBufferWriter as o}from"./DefaultBufferWriter.js";import{TriangleMaterialParameters as n,TriangleMaterial as p}from"./TriangleMaterial.js";import{writeBufferFloat as u,writeAttribute as h}from"./internal/bufferWriterUtils.js";import{getLayout as c,ImageMaterialTechnique as l}from"../shaders/ImageMaterialTechnique.js";import{ImageMaterialTechniqueConfiguration as m}from"../shaders/ImageMaterialTechniqueConfiguration.js";class f extends p{constructor(e){super(e,x),this.supportsEdges=!0,this.transparent=!0,this.visible=!0,this.produces=new Map([[2,e=>t(e)],[4,e=>r(e)&&this.parameters.writeDepth],[8,e=>r(e)&&!this.parameters.writeDepth],[18,e=>r(e)||t(e)]]),this._configuration=new m(e.draped)}updateConfiguration(e){super.updateConfiguration(e),this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=e.hasOccludees,this._configuration.perspectiveInterpolation=this.parameters.perspectiveInterpolation}createGLMaterial(e){return new d(e)}createBufferWriter(){return new g(c(this.parameters))}}class d extends i{constructor(e){super({...e,...e.material.parameters}),this.parameters=e;const t=this._material.parameters.managedTexture;s(t)&&e.textures.updater.add(t)}dispose(){this.parameters.textures.updater.remove(this._material.parameters.managedTexture)}beginSlot(e){return this.getTechnique(l,e)}}class g extends o{write(t,r,i,s,o){const{buffer:n,offset:p}=o;for(const c of this.layout.fields.keys()){const s=i.get(c);if(s)if("perspectiveDivide"===c){a(1===s.size);const t=n.getField(c,e);t&&u(s,t,p)}else h(c,s,t,r,n,p)}}}class x extends n{constructor(e,t){super(),this.managedTexture=e,this.draped=t,this.writeDepth=!0,this.hasSlicePlane=!1,this.cullFace=0,this.opacity=1,this.perspectiveInterpolation=!1}get texture(){return this.managedTexture.texture}}export{f as ImageMaterial,x as Parameters};
2
+ import{BufferViewFloat as e}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOLID as t,isColor as r}from"../core/shaderLibrary/ShaderOutput.js";import s from"../lib/GLMaterial.js";import{isUpdatableTexture as i}from"../lib/IManagedTexture.js";import{assert as a}from"../lib/Util.js";import{DefaultBufferWriter as o}from"./DefaultBufferWriter.js";import{TriangleMaterialParameters as n,TriangleMaterial as u}from"./TriangleMaterial.js";import{writeBufferFloat as p,writeAttribute as c}from"./internal/bufferWriterUtils.js";import{getLayout as l,ImageMaterialTechnique as m}from"../shaders/ImageMaterialTechnique.js";import{ImageMaterialTechniqueConfiguration as f}from"../shaders/ImageMaterialTechniqueConfiguration.js";class h extends u{constructor(e){super(e,x),this.supportsEdges=!0,this.transparent=!0,this.visible=!0,this.produces=new Map([[2,e=>t(e)],[8,e=>r(e)],[18,e=>r(e)||t(e)]]),this._configuration=new f(e.draped)}updateConfiguration(e){super.updateConfiguration(e),this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=e.hasOccludees,this._configuration.perspectiveInterpolation=this.parameters.perspectiveInterpolation}createGLMaterial(e){return new d(e)}createBufferWriter(){return new g(l(this.parameters))}}class d extends s{constructor(e){super({...e,...e.material.parameters}),this.parameters=e;const t=this._material.parameters.managedTexture;i(t)&&e.textures.updater.add(t)}dispose(){this.parameters.textures.updater.remove(this._material.parameters.managedTexture)}beginSlot(e){return this.getTechnique(m,e)}}class g extends o{write(t,r,s,i,o){const{buffer:n,offset:u}=o;for(const l of this.layout.fields.keys()){const i=s.get(l);if(i)if("perspectiveDivide"===l){a(1===i.size);const t=n.getField(l,e);t&&p(i,t,u)}else c(l,i,t,r,n,u)}}}class x extends n{constructor(e,t){super(),this.managedTexture=e,this.draped=t,this.hasSlicePlane=!1,this.cullFace=0,this.opacity=1,this.perspectiveInterpolation=!1}get texture(){return this.managedTexture.texture}}export{h as ImageMaterial,x as Parameters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{safeToString as e}from"../../../../core/string.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColor as r}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{Material as s,MaterialParameters as n}from"../lib/Material.js";import{writeBufferVec2 as a,writePosition as o,writeNormal as c,writeBufferVec3 as l,writeBufferFloat as u}from"./internal/bufferWriterUtils.js";import{LineCalloutTechnique as h,layout as f,baseLayout as p}from"../shaders/LineCalloutTechnique.js";import{LineCalloutTechniqueConfiguration as d}from"../shaders/LineCalloutTechniqueConfiguration.js";import{alphaCutoff as g}from"../../../../webscene/support/AlphaCutoff.js";class m extends s{constructor(e,t){super(e,$),this.intersectRayDraped=void 0,this.produces=new Map([[15,e=>r(e)],[16,e=>r(e)]]),this._configuration=new d(t),this._uniqueMaterialIdentifier=S(this.parameters)}passParameters(){return this.parameters}updateConfiguration(e){super.updateConfiguration(e),this._configuration.hasVerticalOffset=null!=this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective,this._configuration.hudDepth=16===e.slot,this._configuration.hudDepthAlignStart=!!this.parameters.hudDepthAlignStart,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane}get visible(){return this.parameters.color[3]>=g||(this.parameters.borderColor?.[3]??0)>=g}intersectRay(){}intersectScreenPolygon(){}createGLMaterial(e){return new O(e)}createBufferWriter(){return new b}validateParameters(e){this._uniqueMaterialIdentifier=S(e)}get uniqueMaterialIdentifier(){return this._uniqueMaterialIdentifier}}function S({renderOccluded:t,isDecoration:r,horizontalScreenOffset:i,color:s,size:n,shaderPolygonOffset:a,hudDepthAlignStart:o,centerOffsetUnits:c,hasSlicePlane:l,screenSizePerspective:u,verticalOffset:h,borderColor:f}){return e`${t}:${r}:${i}:[${s}]:${n}:${a}:${o}:${c}:${l}:${null!=u}:{${h?.screenLength}:${h?.minWorldLength}:${h?.maxWorldLength}}:[${f}]`}class O extends i{beginSlot(e){return this.getTechnique(h,e)}}class $ extends n{constructor(){super(...arguments),this.horizontalScreenOffset=0,this.color=t(0,0,0,1),this.size=1,this.shaderPolygonOffset=1e-5,this.hudDepthAlignStart=!1,this.centerOffsetUnits="world",this.hasSlicePlane=!1}}class b{constructor(){this.layout=f,this.baseInstanceLayout=p}elementCount(e){return e.get("position").indices.length}elementCountBaseInstance(e){return e.get("uv0").indices.length}writeBaseInstance(e,t){const{uv0:r}=t;a(e.get("uv0"),r,0)}write(e,t,r,i,s){const{buffer:n,offset:a}=s;o(r.get("position"),e,n.position,a),c(r.get("normal"),t,n.normal,a),l(r.get("centerOffset"),n.centerOffset,a),u(r.get("groundDistance"),n.groundDistance,a)}}export{m as LineCalloutMaterial,$ as Parameters,S as uniqueMaterialIdentifier};
2
+ import{safeToString as e}from"../../../../core/string.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColor as r}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{Material as s,MaterialParameters as n}from"../lib/Material.js";import{writeBufferVec2 as a,writePosition as o,writeNormal as c,writeBufferVec3 as l,writeBufferFloat as u}from"./internal/bufferWriterUtils.js";import{LineCalloutTechnique as h,layout as f,baseLayout as p}from"../shaders/LineCalloutTechnique.js";import{LineCalloutTechniqueConfiguration as d}from"../shaders/LineCalloutTechniqueConfiguration.js";import{alphaCutoff as g}from"../../../../webscene/support/AlphaCutoff.js";class m extends s{constructor(e,t){super(e,$),this.intersectRayDraped=void 0,this.produces=new Map([[15,e=>r(e)],[16,e=>r(e)]]),this._configuration=new d(t),this._uniqueMaterialIdentifier=S(this.parameters)}passParameters(){return this.parameters}updateConfiguration(e){super.updateConfiguration(e),this._configuration.hasVerticalOffset=null!=this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective,this._configuration.hudDepth=16===e.slot,this._configuration.hudDepthAlignStart=!!this.parameters.hudDepthAlignStart,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane}get visible(){return this.parameters.color[3]>=g||(this.parameters.borderColor?.[3]??0)>=g}intersectRay(){}intersectScreenPolygon(){return null}createGLMaterial(e){return new O(e)}createBufferWriter(){return new b}validateParameters(e){this._uniqueMaterialIdentifier=S(e)}get uniqueMaterialIdentifier(){return this._uniqueMaterialIdentifier}}function S({renderOccluded:t,isDecoration:r,horizontalScreenOffset:i,color:s,size:n,shaderPolygonOffset:a,hudDepthAlignStart:o,centerOffsetUnits:c,hasSlicePlane:l,screenSizePerspective:u,verticalOffset:h,borderColor:f}){return e`${t}:${r}:${i}:[${s}]:${n}:${a}:${o}:${c}:${l}:${null!=u}:{${h?.screenLength}:${h?.minWorldLength}:${h?.maxWorldLength}}:[${f}]`}class O extends i{beginSlot(e){return this.getTechnique(h,e)}}class $ extends n{constructor(){super(...arguments),this.horizontalScreenOffset=0,this.color=t(0,0,0,1),this.size=1,this.shaderPolygonOffset=1e-5,this.hudDepthAlignStart=!1,this.centerOffsetUnits="world",this.hasSlicePlane=!1}}class b{constructor(){this.layout=f,this.baseInstanceLayout=p}elementCount(e){return e.get("position").indices.length}elementCountBaseInstance(e){return e.get("uv0").indices.length}writeBaseInstance(e,t){const{uv0:r}=t;a(e.get("uv0"),r,0)}write(e,t,r,i,s){const{buffer:n,offset:a}=s;o(r.get("position"),e,n.position,a),c(r.get("normal"),t,n.normal,a),l(r.get("centerOffset"),n.centerOffset,a),u(r.get("groundDistance"),n.groundDistance,a)}}export{m as LineCalloutMaterial,$ as Parameters,S as uniqueMaterialIdentifier};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{set as e,equals as t,transformMat4 as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{makeFloat16Array as s}from"../../../../geometry/support/float16.js";import{isColor as a,isDepth as o,isColorHighlightOLIDOrDepth as h}from"../core/shaderLibrary/ShaderOutput.js";import n from"../lib/GLMaterial.js";import{Material as c}from"../lib/Material.js";import{VisualVariablePassParameters as p}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as m}from"./internal/bufferWriterUtils.js";import{getLayout as l,LineMarkerTechnique as u}from"../shaders/LineMarkerTechnique.js";import{LineMarkerTechniqueConfiguration as d}from"../shaders/LineMarkerTechniqueConfiguration.js";import{alphaCutoff as f}from"../../../../webscene/support/AlphaCutoff.js";class g extends c{constructor(e,t){super(e,v),this.produces=new Map([[2,e=>10===e||a(e)&&8===this.parameters.renderOccluded],[3,e=>o(e)],[10,e=>h(e)&&8===this.parameters.renderOccluded],[11,e=>h(e)&&8===this.parameters.renderOccluded],[4,e=>a(e)&&this.parameters.writeDepth],[8,e=>a(e)&&!this.parameters.writeDepth],[18,e=>a(e)||10===e]]),this.intersectRayDraped=void 0,this._configuration=new d(t)}updateConfiguration(e){super.updateConfiguration(e),this._configuration.space=18===e.slot?0:this.parameters.worldSpace?2:1,this._configuration.hideOnShortSegments=this.parameters.hideOnShortSegments,this._configuration.hasCap=0!==this.parameters.cap,this._configuration.anchor=this.parameters.anchor,this._configuration.hasTip=this.parameters.hasTip,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=e.hasOccludees,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective}get visible(){return this.parameters.color[3]>=f}intersectRay(){}intersectScreenPolygon(){}createBufferWriter(){return new S(l(this.parameters),this.parameters)}createGLMaterial(e){return new _(e)}}class _ extends n{dispose(){super.dispose(),this._markerTextures?.release(this._markerPrimitive),this._markerPrimitive=null}beginSlot(e){const t=this._material.parameters.markerPrimitive;return t!==this._markerPrimitive&&(this._material.setParameters({markerTexture:this._markerTextures.swap(t,this._markerPrimitive)}),this._markerPrimitive=t),this.getTechnique(u,e)}}class v extends p{constructor(){super(...arguments),this.width=0,this.color=[1,1,1,1],this.markerPrimitive="arrow",this.placement="end",this.cap=0,this.anchor=0,this.hasTip=!1,this.worldSpace=!1,this.hideOnShortSegments=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.stipplePattern=null,this.markerTexture=null}}class S{constructor(e,t){this.layout=e,this._parameters=t}elementCount(){return"begin-end"===this._parameters.placement?12:6}write(i,a,o,h,n){const{buffer:c,offset:p}=n,l=o.get("position").data,u=l.length/3;let d=[1,0,0];const f=o.get("normal");this._parameters.worldSpace&&null!=f&&(d=f.data);let g=1,_=0;this._parameters.vvSize?_=o.get("sizeFeatureAttribute").data[0]:o.has("size")&&(g=o.get("size").data[0]);let v=[1,1,1,1],S=0;this._parameters.vvColor?S=o.get("colorFeatureAttribute").data[0]:o.has("color")&&(v=o.get("color").data);let P=0;this._parameters.vvOpacity&&(P=o.get("opacityFeatureAttribute").data[0]);const y=new Float32Array(c.buffer),O=s(c.buffer),T=new Uint8Array(c.buffer);let V=p*(this.layout.stride/4);const k=y.BYTES_PER_ELEMENT/O.BYTES_PER_ELEMENT,j=4/k,M=(e,t,r,i)=>{y[V++]=e[0],y[V++]=e[1],y[V++]=e[2],m(t,e,O,V*k),V+=j;let s=V*k;if(O[s++]=r[0],O[s++]=r[1],V=Math.ceil(s/k),this._parameters.vvColor)y[V++]=S;else{const e=Math.min(4*i,v.length-4),t=4*V++;T[t]=255*v[e],T[t+1]=255*v[e+1],T[t+2]=255*v[e+2],T[t+3]=255*v[e+3]}this._parameters.vvOpacity&&(y[V++]=P),s=V*k,this._parameters.vvSize?(y[V++]=_,s+=2):O[s++]=g,this._parameters.worldSpace&&(O[s++]=d[0],O[s++]=d[1],O[s++]=d[2]),V=Math.ceil(s/k)},x=(s,a)=>{const o=e(b,l[3*s],l[3*s+1],l[3*s+2]),h=w;let n=s+a;do{e(h,l[3*n],l[3*n+1],l[3*n+2]),n+=a}while(t(o,h)&&n>=0&&n<u);i&&(r(o,o,i),r(h,h,i)),M(o,h,[-1,-1],s),M(o,h,[1,-1],s),M(o,h,[1,1],s),M(o,h,[-1,-1],s),M(o,h,[1,1],s),M(o,h,[-1,1],s)},C=this._parameters.placement;"begin"!==C&&"begin-end"!==C||x(0,1),"end"!==C&&"begin-end"!==C||x(u-1,-1)}}const b=i(),w=i();export{g as LineMarkerMaterial,v as Parameters};
2
+ import{set as e,equals as t,transformMat4 as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{makeFloat16Array as s}from"../../../../geometry/support/float16.js";import{isColor as a,isDepth as o,isColorHighlightOLIDOrDepth as n}from"../core/shaderLibrary/ShaderOutput.js";import h from"../lib/GLMaterial.js";import{Material as c}from"../lib/Material.js";import{VisualVariablePassParameters as l}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as m}from"./internal/bufferWriterUtils.js";import{getLayout as p,LineMarkerTechnique as u}from"../shaders/LineMarkerTechnique.js";import{LineMarkerTechniqueConfiguration as d}from"../shaders/LineMarkerTechniqueConfiguration.js";import{alphaCutoff as f}from"../../../../webscene/support/AlphaCutoff.js";class g extends c{constructor(e,t){super(e,v),this.produces=new Map([[2,e=>10===e||a(e)&&8===this.parameters.renderOccluded],[3,e=>o(e)],[10,e=>n(e)&&8===this.parameters.renderOccluded],[11,e=>n(e)&&8===this.parameters.renderOccluded],[4,e=>a(e)],[18,e=>a(e)||10===e]]),this.intersectRayDraped=void 0,this._configuration=new d(t)}updateConfiguration(e){super.updateConfiguration(e),this._configuration.space=18===e.slot?0:this.parameters.worldSpace?2:1,this._configuration.hideOnShortSegments=this.parameters.hideOnShortSegments,this._configuration.hasCap=0!==this.parameters.cap,this._configuration.anchor=this.parameters.anchor,this._configuration.hasTip=this.parameters.hasTip,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=e.hasOccludees,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective}get visible(){return this.parameters.color[3]>=f}intersectRay(){}intersectScreenPolygon(){return null}createBufferWriter(){return new S(p(this.parameters),this.parameters)}createGLMaterial(e){return new _(e)}}class _ extends h{dispose(){super.dispose(),this._markerTextures?.release(this._markerPrimitive),this._markerPrimitive=null}beginSlot(e){const t=this._material.parameters.markerPrimitive;return t!==this._markerPrimitive&&(this._material.setParameters({markerTexture:this._markerTextures.swap(t,this._markerPrimitive)}),this._markerPrimitive=t),this.getTechnique(u,e)}}class v extends l{constructor(){super(...arguments),this.width=0,this.color=[1,1,1,1],this.markerPrimitive="arrow",this.placement="end",this.cap=0,this.anchor=0,this.hasTip=!1,this.worldSpace=!1,this.hideOnShortSegments=!1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.stipplePattern=null,this.markerTexture=null}}class S{constructor(e,t){this.layout=e,this._parameters=t}elementCount(){return"begin-end"===this._parameters.placement?12:6}write(i,a,o,n,h){const{buffer:c,offset:l}=h,p=o.get("position").data,u=p.length/3;let d=[1,0,0];const f=o.get("normal");this._parameters.worldSpace&&null!=f&&(d=f.data);let g=1,_=0;this._parameters.vvSize?_=o.get("sizeFeatureAttribute").data[0]:o.has("size")&&(g=o.get("size").data[0]);let v=[1,1,1,1],S=0;this._parameters.vvColor?S=o.get("colorFeatureAttribute").data[0]:o.has("color")&&(v=o.get("color").data);let w=0;this._parameters.vvOpacity&&(w=o.get("opacityFeatureAttribute").data[0]);const y=new Float32Array(c.buffer),O=s(c.buffer),T=new Uint8Array(c.buffer);let V=l*(this.layout.stride/4);const k=y.BYTES_PER_ELEMENT/O.BYTES_PER_ELEMENT,j=4/k,M=(e,t,r,i)=>{y[V++]=e[0],y[V++]=e[1],y[V++]=e[2],m(t,e,O,V*k),V+=j;let s=V*k;if(O[s++]=r[0],O[s++]=r[1],V=Math.ceil(s/k),this._parameters.vvColor)y[V++]=S;else{const e=Math.min(4*i,v.length-4),t=4*V++;T[t]=255*v[e],T[t+1]=255*v[e+1],T[t+2]=255*v[e+2],T[t+3]=255*v[e+3]}this._parameters.vvOpacity&&(y[V++]=w),s=V*k,this._parameters.vvSize?(y[V++]=_,s+=2):O[s++]=g,this._parameters.worldSpace&&(O[s++]=d[0],O[s++]=d[1],O[s++]=d[2]),V=Math.ceil(s/k)},x=(s,a)=>{const o=e(b,p[3*s],p[3*s+1],p[3*s+2]),n=P;let h=s+a;do{e(n,p[3*h],p[3*h+1],p[3*h+2]),h+=a}while(t(o,n)&&h>=0&&h<u);i&&(r(o,o,i),r(n,n,i)),M(o,n,[-1,-1],s),M(o,n,[1,-1],s),M(o,n,[1,1],s),M(o,n,[-1,-1],s),M(o,n,[1,1],s),M(o,n,[-1,1],s)},C=this._parameters.placement;"begin"!==C&&"begin-end"!==C||x(0,1),"end"!==C&&"begin-end"!==C||x(u-1,-1)}}const b=i(),P=i();export{g as LineMarkerMaterial,v as Parameters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{set as t,normalize as e,subtract as r,cross as s,distance as o,transformMat4 as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColor as c}from"../core/shaderLibrary/ShaderOutput.js";import l from"../lib/GLMaterial.js";import{Material as p,MaterialParameters as u}from"../lib/Material.js";import{MeasurementArrowTechnique as f,layout as h}from"../shaders/MeasurementArrowTechnique.js";import{MeasurementArrowTechniqueConfiguration as m}from"../shaders/MeasurementArrowTechniqueConfiguration.js";import{alphaCutoff as d}from"../../../../webscene/support/AlphaCutoff.js";class g extends p{constructor(t){super(t,b),this._configuration=new m,this.intersectRayDraped=void 0,this.produces=new Map([[2,t=>!this._transparent&&c(t)],[8,t=>this._transparent&&c(t)]])}updateConfiguration(t){super.updateConfiguration(t),this._configuration.enableOITOffset=t.enableOITOffset,this._configuration.transparent=this._transparent,this._configuration.writeDepth=2===t.slot}get visible(){const{outlineColor:t,stripeEvenColor:e,stripeOddColor:r}=this.parameters;return t[3]>=d||e[3]>=d||r[3]>=d}intersectRay(){}intersectScreenPolygon(){}createGLMaterial(t){return new C(t)}createBufferWriter(){return new _}get _transparent(){const{parameters:t}=this;return t.outlineColor[3]<1||t.stripeEvenColor[3]<1||t.stripeOddColor[3]<1}}class C extends l{beginSlot(t){return this.getTechnique(f,t)}}class b extends u{constructor(){super(...arguments),this.width=32,this.outlineSize=.2,this.outlineColor=a(1,.5,0,1),this.stripeEvenColor=a(1,1,1,1),this.stripeOddColor=a(1,.5,0,1),this.stripeLength=1}}const w=n(),j=n(),v=n(),M=n(),O=n();class _{constructor(){this.layout=h}elementCount(t){return 2*(t.get("position").indices.length/2+1)}write(n,a,c,l,p){const{buffer:u,offset:f}=p,{data:h,indices:m}=c.get("position"),d=c.get("normal").data,g=h.length/3;m&&m.length!==2*(g-1)&&console.warn("MeasurementArrowMaterial does not support indices");const C=w,b=j,_=v,x=M,y=O,T=u.position,A=u.normal,L=u.uv0;let S=0;for(let w=0;w<g;++w){const c=3*w;if(t(C,h[c],h[c+1],h[c+2]),w<g-1){const o=3*(w+1);t(b,h[o],h[o+1],h[o+2]),t(y,d[o],d[o+1],d[o+2]),e(y,y),r(_,b,C),e(_,_),s(x,y,_),e(x,x)}const l=o(C,b);n&&a&&(i(C,C,n),i(b,b,n),i(x,x,a));const p=f+2*w,u=p+1;T.setVec(p,C),T.setVec(u,C),A.setVec(p,x),A.setVec(u,x),L.set(p,0,S),L.set(p,1,-1),L.set(u,0,S),L.set(u,1,1),w<g-1&&(S+=l)}const V=u.length;for(let t=0;t<2*g;++t)V.set(f+t,S)}}export{g as MeasurementArrowMaterial,b as Parameters};
2
+ import{set as t,normalize as e,subtract as r,cross as s,distance as o,transformMat4 as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColor as c}from"../core/shaderLibrary/ShaderOutput.js";import l from"../lib/GLMaterial.js";import{Material as u,MaterialParameters as p}from"../lib/Material.js";import{MeasurementArrowTechnique as f,layout as h}from"../shaders/MeasurementArrowTechnique.js";import{MeasurementArrowTechniqueConfiguration as m}from"../shaders/MeasurementArrowTechniqueConfiguration.js";import{alphaCutoff as d}from"../../../../webscene/support/AlphaCutoff.js";class g extends u{constructor(t){super(t,b),this._configuration=new m,this.intersectRayDraped=void 0,this.produces=new Map([[2,t=>!this._transparent&&c(t)],[8,t=>this._transparent&&c(t)]])}updateConfiguration(t){super.updateConfiguration(t),this._configuration.enableOITOffset=t.enableOITOffset,this._configuration.transparent=this._transparent,this._configuration.writeDepth=2===t.slot}get visible(){const{outlineColor:t,stripeEvenColor:e,stripeOddColor:r}=this.parameters;return t[3]>=d||e[3]>=d||r[3]>=d}intersectRay(){}intersectScreenPolygon(){return null}createGLMaterial(t){return new C(t)}createBufferWriter(){return new _}get _transparent(){const{parameters:t}=this;return t.outlineColor[3]<1||t.stripeEvenColor[3]<1||t.stripeOddColor[3]<1}}class C extends l{beginSlot(t){return this.getTechnique(f,t)}}class b extends p{constructor(){super(...arguments),this.width=32,this.outlineSize=.2,this.outlineColor=a(1,.5,0,1),this.stripeEvenColor=a(1,1,1,1),this.stripeOddColor=a(1,.5,0,1),this.stripeLength=1}}const w=n(),j=n(),v=n(),M=n(),O=n();class _{constructor(){this.layout=h}elementCount(t){return 2*(t.get("position").indices.length/2+1)}write(n,a,c,l,u){const{buffer:p,offset:f}=u,{data:h,indices:m}=c.get("position"),d=c.get("normal").data,g=h.length/3;m&&m.length!==2*(g-1)&&console.warn("MeasurementArrowMaterial does not support indices");const C=w,b=j,_=v,x=M,y=O,T=p.position,A=p.normal,L=p.uv0;let S=0;for(let w=0;w<g;++w){const c=3*w;if(t(C,h[c],h[c+1],h[c+2]),w<g-1){const o=3*(w+1);t(b,h[o],h[o+1],h[o+2]),t(y,d[o],d[o+1],d[o+2]),e(y,y),r(_,b,C),e(_,_),s(x,y,_),e(x,x)}const l=o(C,b);n&&a&&(i(C,C,n),i(b,b,n),i(x,x,a));const u=f+2*w,p=u+1;T.setVec(u,C),T.setVec(p,C),A.setVec(u,x),A.setVec(p,x),L.set(u,0,S),L.set(u,1,-1),L.set(p,0,S),L.set(p,1,1),w<g-1&&(S+=l)}const V=p.length;for(let t=0;t<2*g;++t)V.set(f+t,S)}}export{g as MeasurementArrowMaterial,b as Parameters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{copy as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{set as i,subtract as s,dot as n,scale as a,add as c,copy as l,length as m,distance as u}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as p}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{distance2 as h,fromPoints as g,closestLineSegmentPoint as d,create as j}from"../../../../geometry/support/lineSegment.js";import{fromPoints as b,signedDistance as y,getNormal as x,create as L}from"../../../../geometry/support/plane.js";import{isColorHighlightOrOLID as S}from"../core/shaderLibrary/ShaderOutput.js";import v from"../lib/GLMaterial.js";import{Material as M,MaterialParameters as w}from"../lib/Material.js";import{isTranslationMatrix as C}from"../lib/Util.js";import{DefaultBufferWriter as R}from"./DefaultBufferWriter.js";import{PositionColorLayout as T,PositionLayout as _}from"./DefaultLayouts.js";import{NativeLineTechnique as A}from"../shaders/NativeLineTechnique.js";import{NativeLineTechniqueConfiguration as V}from"../shaders/NativeLineTechniqueConfiguration.js";import{alphaCutoff as N}from"../../../../webscene/support/AlphaCutoff.js";class U extends M{constructor(e){super(e,E),this._configuration=new V,this.produces=new Map([[2,e=>S(e)]])}updateConfiguration(e){super.updateConfiguration(e),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVertexColors=this.parameters.hasVertexColors,this._configuration.transparent=this.parameters.color[3]<1||this.parameters.width<1,this._configuration.hasOccludees=e.hasOccludees}get visible(){return this.parameters.color[3]>=N}intersectRay(t,r,f,p,j,L){const{options:S,camera:v,rayBegin:M,rayEnd:w}=f;if(!S.selectionMode||!t.visible||!v)return;if(!C(r))return void e.getLogger("esri.views.3d.webgl-engine.materials.NativeLineMaterial").error("intersection assumes a translation-only matrix");const R=t.attributes.get("position").data,T=H;o(T,f.point);const _=2;i(I[0],T[0]-_,T[1]+_,0),i(I[1],T[0]+_,T[1]+_,0),i(I[2],T[0]+_,T[1]-_,0),i(I[3],T[0]-_,T[1]-_,0);for(let e=0;e<4;e++)if(!v.unprojectFromRenderScreen(I[e],J[e]))return;b(v.eye,J[0],J[1],K),b(v.eye,J[1],J[2],Q),b(v.eye,J[2],J[3],Y),b(v.eye,J[3],J[0],Z);let A=Number.MAX_VALUE,V=0;for(let e=0;e<R.length-5;e+=3){if(q[0]=R[e]+r[12],q[1]=R[e+1]+r[13],q[2]=R[e+2]+r[14],B[0]=R[e+3]+r[12],B[1]=R[e+4]+r[13],B[2]=R[e+5]+r[14],y(K,q)<0&&y(K,B)<0||y(Q,q)<0&&y(Q,B)<0||y(Y,q)<0&&y(Y,B)<0||y(Z,q)<0&&y(Z,B)<0)continue;const t=v.projectToRenderScreen(q,W),o=v.projectToRenderScreen(B,X);if(null==t||null==o)continue;if(t[2]<0&&o[2]>0){s(D,q,B);const e=v.frustum,r=-y(e[4],q)/n(D,x(e[4]));if(a(D,D,r),c(q,q,D),!v.projectToRenderScreen(q,t))continue}else if(t[2]>0&&o[2]<0){s(D,B,q);const e=v.frustum,t=-y(e[4],B)/n(D,x(e[4]));if(a(D,D,t),c(B,B,D),!v.projectToRenderScreen(B,o))continue}else if(t[2]<0&&o[2]<0)continue;t[2]=0,o[2]=0;const i=h(g(t,o,F),T);i<A&&(A=i,l(G,q),l(z,B),V=e/3)}if(A<_*_){let e=Number.MAX_VALUE;if(d(g(G,z,F),g(M,w,k),O)){s(O,O,M);const t=m(O);a(O,O,1/t),e=t/u(M,w)}L(e,O,V)}}intersectScreenPolygon(){}intersectRayDraped(e,r,o,i,s){if(!r.options.selectionMode)return;const n=e.attributes.get("position").data,a=e.attributes.get("size"),c=a?a.data[0]:0,l=o[0],m=o[1],u=((c+1)/2+4)*e.screenToWorldRatio;let f=Number.MAX_VALUE,p=0;for(let h=0;h<n.length-5;h+=3){const e=n[h],r=n[h+1],o=l-e,i=m-r,s=n[h+3]-e,a=n[h+4]-r,c=t((s*o+a*i)/(s*s+a*a),0,1),u=s*c-o,g=a*c-i,d=u*u+g*g;d<f&&(f=d,p=h/3)}f<u*u&&i(s.distance,s.normal,p)}createGLMaterial(e){return new P(e)}createBufferWriter(){const e=this.parameters.hasVertexColors?T:_;return new R(e)}}class P extends v{beginSlot(e){return this.getTechnique(A,e)}}class E extends w{constructor(){super(...arguments),this.color=p,this.hasVertexColors=!1,this.hasSlicePlane=!1,this.width=1}}const q=f(),B=f(),D=f(),O=f(),W=r(),X=r(),G=f(),z=f(),F=j(),k=j(),H=f(),I=[r(),r(),r(),r()],J=[f(),f(),f(),f()],K=L(),Q=L(),Y=L(),Z=L();export{U as NativeLineMaterial,E as Parameters};
2
+ import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{copy as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{set as i,subtract as s,dot as n,scale as a,add as c,copy as l,length as m,distance as u}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as p}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{distance2 as h,fromPoints as g,closestLineSegmentPoint as d,create as j}from"../../../../geometry/support/lineSegment.js";import{fromPoints as b,signedDistance as y,getNormal as x,create as L}from"../../../../geometry/support/plane.js";import{isColorHighlightOrOLID as S}from"../core/shaderLibrary/ShaderOutput.js";import v from"../lib/GLMaterial.js";import{Material as M,MaterialParameters as w}from"../lib/Material.js";import{isTranslationMatrix as C}from"../lib/Util.js";import{DefaultBufferWriter as R}from"./DefaultBufferWriter.js";import{PositionColorLayout as T,PositionLayout as _}from"./DefaultLayouts.js";import{NativeLineTechnique as A}from"../shaders/NativeLineTechnique.js";import{NativeLineTechniqueConfiguration as V}from"../shaders/NativeLineTechniqueConfiguration.js";import{alphaCutoff as N}from"../../../../webscene/support/AlphaCutoff.js";class U extends M{constructor(e){super(e,E),this._configuration=new V,this.produces=new Map([[2,e=>S(e)]])}updateConfiguration(e){super.updateConfiguration(e),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVertexColors=this.parameters.hasVertexColors,this._configuration.transparent=this.parameters.color[3]<1||this.parameters.width<1,this._configuration.hasOccludees=e.hasOccludees}get visible(){return this.parameters.color[3]>=N}intersectRay(t,r,f,p,j,L){const{options:S,camera:v,rayBegin:M,rayEnd:w}=f;if(!S.selectionMode||!t.visible||!v)return;if(!C(r))return void e.getLogger("esri.views.3d.webgl-engine.materials.NativeLineMaterial").error("intersection assumes a translation-only matrix");const R=t.attributes.get("position").data,T=H;o(T,f.point);const _=2;i(I[0],T[0]-_,T[1]+_,0),i(I[1],T[0]+_,T[1]+_,0),i(I[2],T[0]+_,T[1]-_,0),i(I[3],T[0]-_,T[1]-_,0);for(let e=0;e<4;e++)if(!v.unprojectFromRenderScreen(I[e],J[e]))return;b(v.eye,J[0],J[1],K),b(v.eye,J[1],J[2],Q),b(v.eye,J[2],J[3],Y),b(v.eye,J[3],J[0],Z);let A=Number.MAX_VALUE,V=0;for(let e=0;e<R.length-5;e+=3){if(q[0]=R[e]+r[12],q[1]=R[e+1]+r[13],q[2]=R[e+2]+r[14],B[0]=R[e+3]+r[12],B[1]=R[e+4]+r[13],B[2]=R[e+5]+r[14],y(K,q)<0&&y(K,B)<0||y(Q,q)<0&&y(Q,B)<0||y(Y,q)<0&&y(Y,B)<0||y(Z,q)<0&&y(Z,B)<0)continue;const t=v.projectToRenderScreen(q,W),o=v.projectToRenderScreen(B,X);if(null==t||null==o)continue;if(t[2]<0&&o[2]>0){s(D,q,B);const e=v.frustum,r=-y(e[4],q)/n(D,x(e[4]));if(a(D,D,r),c(q,q,D),!v.projectToRenderScreen(q,t))continue}else if(t[2]>0&&o[2]<0){s(D,B,q);const e=v.frustum,t=-y(e[4],B)/n(D,x(e[4]));if(a(D,D,t),c(B,B,D),!v.projectToRenderScreen(B,o))continue}else if(t[2]<0&&o[2]<0)continue;t[2]=0,o[2]=0;const i=h(g(t,o,F),T);i<A&&(A=i,l(G,q),l(z,B),V=e/3)}if(A<_*_){let e=Number.MAX_VALUE;if(d(g(G,z,F),g(M,w,k),O)){s(O,O,M);const t=m(O);a(O,O,1/t),e=t/u(M,w)}L(e,O,V)}}intersectScreenPolygon(){return null}intersectRayDraped(e,r,o,i,s){if(!r.options.selectionMode)return;const n=e.attributes.get("position").data,a=e.attributes.get("size"),c=a?a.data[0]:0,l=o[0],m=o[1],u=((c+1)/2+4)*e.screenToWorldRatio;let f=Number.MAX_VALUE,p=0;for(let h=0;h<n.length-5;h+=3){const e=n[h],r=n[h+1],o=l-e,i=m-r,s=n[h+3]-e,a=n[h+4]-r,c=t((s*o+a*i)/(s*s+a*a),0,1),u=s*c-o,g=a*c-i,d=u*u+g*g;d<f&&(f=d,p=h/3)}f<u*u&&i(s.distance,s.normal,p)}createGLMaterial(e){return new P(e)}createBufferWriter(){const e=this.parameters.hasVertexColors?T:_;return new R(e)}}class P extends v{beginSlot(e){return this.getTechnique(A,e)}}class E extends w{constructor(){super(...arguments),this.color=p,this.hasVertexColors=!1,this.hasSlicePlane=!1,this.width=1}}const q=f(),B=f(),D=f(),O=f(),W=r(),X=r(),G=f(),z=f(),F=j(),k=j(),H=f(),I=[r(),r(),r(),r()],J=[f(),f(),f(),f()],K=L(),Q=L(),Y=L(),Z=L();export{U as NativeLineMaterial,E as Parameters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{clamp as t}from"../../../../core/mathUtils.js";import{clone as e}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as r}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewUint32 as s,BufferViewVec3f as a,BufferViewVec2Snorm16 as o,BufferViewSnorm16 as n,BufferViewFloat16 as h,BufferViewFloat as p}from"../../../../geometry/support/buffer/BufferView.js";import{maxPathFrameIndex as c}from"../../layers/graphics/Graphics3DPathSymbolLayerConstants.js";import{isShadowLike as u,is3DGeometry as f,isColor as l}from"../core/shaderLibrary/ShaderOutput.js";import m from"../lib/GLMaterial.js";import{isPathGeometry as g}from"../lib/PathGeometry.js";import{offsetPathVertexInfoFrameIndex as b}from"../lib/PathVertexInfo.js";import{MeshIntersectionOptions as d,intersectAabbInvDir as _}from"../lib/RayIntersections.js";import{assert as y}from"../lib/Util.js";import{getLayout as S,getTextureLayout as x}from"./PathLayouts.js";import{PathPassParameters as V,PathTechnique as w}from"./PathTechnique.js";import{PathTechniqueConfiguration as z}from"./PathTechniqueConfiguration.js";import{TriangleMaterial as F}from"./TriangleMaterial.js";import{writeAttributes as j,writePosition as v,writeBufferVec2 as M,writeBufferInt16 as C,writeBufferFloat16 as R,writeBufferFloat as P}from"./internal/bufferWriterUtils.js";import{hasShadowHighlights as A}from"../shaders/ReceiveShadowsConfiguration.js";import{alphaCutoff as B}from"../../../../webscene/support/AlphaCutoff.js";class O extends F{constructor(t,e){super(t,I),this.supportsEdges=!0,this._pp0=i(0,0,1),this._pp1=i(0,0,0),this.produces=new Map([[2,t=>(this.parameters.castShadows&&u(t)||f(t))&&!this.transparent],[4,t=>(this.parameters.castShadows&&u(t)||f(t))&&this.transparent]]),this._configuration=new z(e.spherical)}get emissions(){return this.parameters.emissiveStrength>0?this.transparent?2:1:0}updateConfiguration(t){super.updateConfiguration(t),this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.transparent,this._configuration.hasOccludees=t.hasOccludees,this._configuration.cullFace=this.parameters.hasSlicePlane?0:this.parameters.cullFace,this._configuration.offsetBackfaces=this.transparent,l(t.output)?(this._configuration.receiveShadows=t.shadowMap.enabled,this._configuration.hasShadowHighlights=A(this._configuration,t),this._configuration.receiveAmbientOcclusion=null!=t.ssao):this._configuration.receiveShadows=this._configuration.hasShadowHighlights=this._configuration.receiveAmbientOcclusion=!1,this._configuration.pbrMode=this.parameters.usePBR?2:0,this._configuration.emissionSource=this.parameters.usePBR?1:0,this._configuration.snowCover=t.snowCover>0,this._configuration.upVectorAlignment=this.parameters.upVectorAlignment,this._configuration.pathCapType=this.parameters.pathCapType,this._configuration.pathProfileType=this.parameters.profile.type}isVisibleForOutput(t){return 5!==t&&7!==t&&6!==t||this.parameters.castShadows}get visible(){return this.parameters.opacity>=B}intersectRay(t,e,i,r,s,a){this._intersect(t,i,r,s,a)}intersectRayDraped(t,e,i,r){return this._pp0[0]=this._pp1[0]=i[0],this._pp0[1]=this._pp1[1]=i[1],this._intersect(t,e,this._pp0,this._pp1,r)}_intersect(i,s,a,o,n){const h=i;if(!g(h))return;const p=h.path,c=e(this.parameters.size);if(this.parameters.vvSize){const{offset:e,factor:i,minSize:r,maxSize:s,fallback:a}=this.parameters.vvSize,o=p.sizeAttributeValue;Number.isNaN(o)?(c[0]*=a[0],c[1]*=a[2]):(c[0]*=t(e[0]+o*i[0],r[0],s[0]),c[1]*=t(e[2]+o*i[2],r[2],s[2]))}const u=new d(s.tolerance,!1,s.options.normalRequired),f=Math.max(c[0],c[1]),l=i.boundingInfo;if(null==l)return void k(p,c,a,o,u,n);const m=r(l.bbMin[0]-f,l.bbMin[1]-f,l.bbMin[2]-f,l.bbMax[0]+f,l.bbMax[1]+f,l.bbMax[2]+f),b=[o[0]-a[0],o[1]-a[1],o[2]-a[2]],y=Math.sqrt(b[0]*b[0]+b[1]*b[1]+b[2]*b[2]),S=[y/b[0],y/b[1],y/b[2]];_(m,a,S,s.tolerance)&&k(p,c,a,o,u,n)}createBufferWriter(){return new U(S(),x(this.parameters))}createGLMaterial(t){return new T(t)}get transparent(){const{parameters:t}=this;return t.drivenOpacity||t.opacity<1}}class T extends m{beginSlot(t){return this.getTechnique(w,t)}}function k(t,e,i,r,s,a){t.baked.size&&t.baked.size[0]===e[0]&&t.baked.size[1]===e[1]||t.baked.bake(e),t.baked.intersect(i,r,s,a)}class I extends V{constructor(){super(...arguments),this.polygonOffset=0,this.castShadows=!0,this.hasSlicePlane=!1,this.drivenOpacity=!1,this.usePBR=!1,this.upVectorAlignment=0,this.pathCapType=1,this.cullFace=2}}class U{constructor(t,e){this.layout=t,this.textureBufferLayout=e,this.maxTextureBufferItemIndex=c}elementCount(t){return t.get("pathVertexInfo")?.indices.length??0}elementCountTextureBuffer(t){return t.get("position")?.indices.length??0}write(t,e,i,r,c,u){y(null!=u,"Texture buffer is required for path material"),j(i,r,this.layout,t,e,c);const f=u.offset,l=u.textureBufferRange.from,m=c.buffer.getField("pathVertexInfo",s),g=i.get("pathVertexInfo");if(m&&g){y(1===g.size);const{data:t,stride:e,indices:i}=g;for(let r=0;r<i.length;++r){const s=t[e*i[r]];m.set(c.offset+r,b(s,l))}}const d=u.buffer.getField("position",a),_=i.get("position");d&&_&&(y(3===_.size),v(_,t,d,f));const S=u.buffer.getField("profileRight",o),x=i.get("profileRight");S&&x&&(y(2===x.size),M(x,S,f));const V=u.buffer.getField("profileUp",o),w=i.get("profileUp");V&&w&&(y(2===w.size),M(w,V,f));const z=u.buffer.getField("profileRotation",n),F=i.get("profileRotation");z&&F&&(y(1===F.size),C(F,z,f));const A=u.buffer.getField("pathRotationUp",o),B=i.get("pathRotationUp");A&&B&&(y(2===B.size),M(B,A,f));const O=u.buffer.getField("pathMaxStretchDistance",h),T=i.get("pathMaxStretchDistance");O&&T&&(y(1===T.size),R(T,O,f));const k=u.buffer.getField("sizeFeatureAttribute",p),I=i.get("sizeFeatureAttribute");k&&I&&P(I,k,f);const U=u.buffer.getField("opacityFeatureAttribute",p),q=i.get("opacityFeatureAttribute");U&&q&&P(q,U,f);const L=u.buffer.getField("colorFeatureAttribute",p),D=i.get("colorFeatureAttribute");L&&D&&P(D,L,f)}}export{I as Parameters,U as PathBufferWriter,O as PathMaterial};
2
+ import{clamp as t}from"../../../../core/mathUtils.js";import{clone as e}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as r}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewUint32 as s,BufferViewVec3f as o,BufferViewVec2Snorm16 as a,BufferViewSnorm16 as n,BufferViewFloat16 as c,BufferViewFloat as h}from"../../../../geometry/support/buffer/BufferView.js";import{maxPathFrameIndex as u}from"../../layers/graphics/Graphics3DPathSymbolLayerConstants.js";import{isShadowLike as p,is3DGeometry as f,isColor as l}from"../core/shaderLibrary/ShaderOutput.js";import m from"../lib/GLMaterial.js";import{isPathGeometry as g}from"../lib/PathGeometry.js";import{offsetPathVertexInfoFrameIndex as b}from"../lib/PathVertexInfo.js";import{MeshIntersectionOptions as d,intersectAabbInvDir as _}from"../lib/RayIntersections.js";import{intersectTriangleRangeScreenPolygon as y}from"../lib/screenPolygonTriangleIntersections.js";import{assert as S}from"../lib/Util.js";import{applyPolygonOffsetToHit as x}from"./intersectWithPolygonOffset.js";import{getLayout as z,getTextureLayout as V}from"./PathLayouts.js";import{PathPassParameters as j,PathTechnique as w}from"./PathTechnique.js";import{PathTechniqueConfiguration as F}from"./PathTechniqueConfiguration.js";import{TriangleMaterial as v}from"./TriangleMaterial.js";import{writeAttributes as R,writePosition as P,writeBufferVec2 as M,writeBufferInt16 as C,writeBufferFloat16 as A,writeBufferFloat as B}from"./internal/bufferWriterUtils.js";import{hasShadowHighlights as O}from"../shaders/ReceiveShadowsConfiguration.js";import{alphaCutoff as T}from"../../../../webscene/support/AlphaCutoff.js";class I extends v{constructor(t,e){super(t,D),this.supportsEdges=!0,this._pp0=i(0,0,1),this._pp1=i(0,0,0),this.produces=new Map([[2,t=>(this.parameters.castShadows&&p(t)||f(t))&&!this.transparent],[4,t=>(this.parameters.castShadows&&p(t)||f(t))&&this.transparent]]),this._configuration=new F(e.spherical)}get emissions(){return this.parameters.emissiveStrength>0?this.transparent?2:1:0}updateConfiguration(t){super.updateConfiguration(t),this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.transparent,this._configuration.hasOccludees=t.hasOccludees,this._configuration.cullFace=this.parameters.hasSlicePlane?0:this.parameters.cullFace,this._configuration.offsetBackfaces=this.transparent,l(t.output)?(this._configuration.receiveShadows=t.shadowMap.enabled,this._configuration.hasShadowHighlights=O(this._configuration,t),this._configuration.receiveAmbientOcclusion=null!=t.ssao):this._configuration.receiveShadows=this._configuration.hasShadowHighlights=this._configuration.receiveAmbientOcclusion=!1,this._configuration.pbrMode=this.parameters.usePBR?2:0,this._configuration.emissionSource=this.parameters.usePBR?1:0,this._configuration.snowCover=t.snowCover>0,this._configuration.upVectorAlignment=this.parameters.upVectorAlignment,this._configuration.pathCapType=this.parameters.pathCapType,this._configuration.pathProfileType=this.parameters.profile.type}isVisibleForOutput(t){return 5!==t&&7!==t&&6!==t||this.parameters.castShadows}get visible(){return this.parameters.opacity>=T}intersectRay(t,e,i,r,s,o){this._intersectRay(t,i,r,s,o)}intersectRayDraped(t,e,i,r){return this._pp0[0]=this._pp1[0]=i[0],this._pp0[1]=this._pp1[1]=i[1],this._intersectRay(t,e,this._pp0,this._pp1,r)}intersectScreenPolygon(t,e,i,r){const s=L(t);return null==s?null:x(q(s,this._computeSize(s),e,i,r),this._configuration,i.camera.eye)}_intersectRay(t,e,i,s,o){const a=L(t);if(null==a)return;const n=this._computeSize(a),c=new d(e.tolerance,!1,e.options.normalRequired),h=Math.max(n[0],n[1]),u=t.boundingInfo;if(null==u)return void k(a,n,i,s,c,o);const p=r(u.bbMin[0]-h,u.bbMin[1]-h,u.bbMin[2]-h,u.bbMax[0]+h,u.bbMax[1]+h,u.bbMax[2]+h),f=[s[0]-i[0],s[1]-i[1],s[2]-i[2]],l=Math.sqrt(f[0]*f[0]+f[1]*f[1]+f[2]*f[2]),m=[l/f[0],l/f[1],l/f[2]];_(p,i,m,e.tolerance)&&k(a,n,i,s,c,o)}_computeSize(i){const r=e(this.parameters.size);if(this.parameters.vvSize){const{offset:e,factor:s,minSize:o,maxSize:a,fallback:n}=this.parameters.vvSize,c=i.sizeAttributeValue;Number.isNaN(c)?(r[0]*=n[0],r[1]*=n[2]):(r[0]*=t(e[0]+c*s[0],o[0],a[0]),r[1]*=t(e[2]+c*s[2],o[2],a[2]))}return r}createBufferWriter(){return new G(z(),V(this.parameters))}createGLMaterial(t){return new U(t)}get transparent(){const{parameters:t}=this;return t.drivenOpacity||t.opacity<1}}class U extends m{beginSlot(t){return this.getTechnique(w,t)}}function k({baked:t},e,i,r,s,o){t.size&&t.size[0]===e[0]&&t.size[1]===e[1]||t.bake(e),t.intersect(i,r,s,o)}function q({baked:t},e,i,r,s){t.size&&t.size[0]===e[0]&&t.size[1]===e[1]||t.bake(e);const{vertexIndices:o}=t.builder;return y(r,i,s,0,o.length/3,o,t.positions,3,null)}function L(t){const e=t;return g(e)?e.path:null}class D extends j{constructor(){super(...arguments),this.polygonOffset=0,this.castShadows=!0,this.hasSlicePlane=!1,this.drivenOpacity=!1,this.usePBR=!1,this.upVectorAlignment=0,this.pathCapType=1,this.cullFace=2}}class G{constructor(t,e){this.layout=t,this.textureBufferLayout=e,this.maxTextureBufferItemIndex=u}elementCount(t){return t.get("pathVertexInfo")?.indices.length??0}elementCountTextureBuffer(t){return t.get("position")?.indices.length??0}write(t,e,i,r,u,p){S(null!=p,"Texture buffer is required for path material"),R(i,r,this.layout,t,e,u);const f=p.offset,l=p.textureBufferRange.from,m=u.buffer.getField("pathVertexInfo",s),g=i.get("pathVertexInfo");if(m&&g){S(1===g.size);const{data:t,stride:e,indices:i}=g;for(let r=0;r<i.length;++r){const s=t[e*i[r]];m.set(u.offset+r,b(s,l))}}const d=p.buffer.getField("position",o),_=i.get("position");d&&_&&(S(3===_.size),P(_,t,d,f));const y=p.buffer.getField("profileRight",a),x=i.get("profileRight");y&&x&&(S(2===x.size),M(x,y,f));const z=p.buffer.getField("profileUp",a),V=i.get("profileUp");z&&V&&(S(2===V.size),M(V,z,f));const j=p.buffer.getField("profileRotation",n),w=i.get("profileRotation");j&&w&&(S(1===w.size),C(w,j,f));const F=p.buffer.getField("pathRotationUp",a),v=i.get("pathRotationUp");F&&v&&(S(2===v.size),M(v,F,f));const O=p.buffer.getField("pathMaxStretchDistance",c),T=i.get("pathMaxStretchDistance");O&&T&&(S(1===T.size),A(T,O,f));const I=p.buffer.getField("sizeFeatureAttribute",h),U=i.get("sizeFeatureAttribute");I&&U&&B(U,I,f);const k=p.buffer.getField("opacityFeatureAttribute",h),q=i.get("opacityFeatureAttribute");k&&q&&B(q,k,f);const L=p.buffer.getField("colorFeatureAttribute",h),D=i.get("colorFeatureAttribute");L&&D&&B(D,L,f)}}export{D as Parameters,G as PathBufferWriter,I as PathMaterial};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as i,Seconds as s}from"../../../../core/time.js";import{copy as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{set as n,subtract as o,dot as l,scale as p,add as c,copy as h,length as m,distance as u,lerp as f,transformMat4 as d,normalize as g}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as S}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{ONES as _,create as v}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeFloat16Array as P}from"../../../../geometry/support/float16.js";import{fromPoints as y,distance2 as E,closestLineSegmentPoint as x,projectPointFraction as w,create as j}from"../../../../geometry/support/lineSegment.js";import{fromPoints as z,signedDistance as T,getNormal as A,create as L}from"../../../../geometry/support/plane.js";import{BufferViewUint32 as C,BufferViewVec3f as M}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOLID as R,isColor as O,isDepth as V,isColorHighlightOLIDOrDepth as F,is2DGeometryOutput as B}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as U}from"../effects/geometry/olidUtils.js";import N from"../lib/GLMaterial.js";import{Material as k}from"../lib/Material.js";import{ScreenSizePerspectiveEvaluator as W}from"../lib/screenSizePerspectiveUtils.js";import{isTranslationMatrix as I,assert as D}from"../lib/Util.js";import{isImagePattern as Y}from"./lineStippleUtils.js";import{VisualVariablePassParameters as J}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as q}from"./internal/bufferWriterUtils.js";import{r as X}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as G,getTextureBufferLayout as H}from"../shaders/RibbonLineLayouts.js";import{RibbonLineTechnique as K}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as Q}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as Z}from"../../../../webscene/support/AlphaCutoff.js";class $ extends k{constructor(e,t){super(e,te),this.produces=new Map([[2,e=>R(e)||O(e)&&8===this.parameters.renderOccluded],[3,e=>V(e)],[10,e=>F(e)&&8===this.parameters.renderOccluded],[11,e=>F(e)&&8===this.parameters.renderOccluded],[4,e=>O(e)&&this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[8,e=>O(e)&&!this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[18,e=>B(e)]]),this._configuration=new Q(t)}updateConfiguration(e){super.updateConfiguration(e);const t=18===e.slot,r=null!=this.parameters.stipplePattern&&null!=this.parameters.stippleTexture&&10!==e.output,i=r&&t&&this.parameters.isImagePattern();this._configuration.draped=t,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.stippleEnabled=r,this._configuration.stippleOffColorEnabled=r&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=r&&this.parameters.stipplePreferContinuous,this._configuration.numJoinSubdivisions=ne(this.parameters.join,r),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&ae(this.parameters.markerParameters),this._configuration.polygonOffsetIndex=this.parameters.polygonOffsetIndex,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.hasOccludees=e.hasOccludees,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=this.emissions?1:0,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective&&!i,this._configuration.worldSizedImagePattern=i}get visible(){return this.parameters.color[3]>=Z||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>Z}get emissions(){return this.parameters.emissiveStrength>0?8!==this.parameters.renderOccluded?2:1:0}setParameters(e,t){e.animation=this.parameters.animation,super.setParameters(e,t)}intersectScreenPolygon(){}intersectRayDraped({attributes:e,screenToWorldRatio:r},i,s,a,n){if(!i.options.selectionMode)return;const o=e.get("size");let l=this.parameters.width;if(this.parameters.vvSize){const r=e.get("sizeFeatureAttribute").data[0];Number.isNaN(r)?l*=this.parameters.vvSize.fallback[0]:l*=t(this.parameters.vvSize.offset[0]+r*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else o&&(l*=o.data[0]);const p=s[0],c=s[1],h=(l/2+4)*r;let m=Number.MAX_VALUE,u=0;const f=e.get("position").data,d=se(this.parameters,e)?f.length-2:f.length-5;for(let g=0;g<d;g+=3){const e=f[g],r=f[g+1],i=(g+3)%f.length,s=p-e,a=c-r,n=f[i]-e,o=f[i+1]-r,l=t((n*s+o*a)/(n*n+o*o),0,1),h=n*l-s,d=o*l-a,b=h*h+d*d;b<m&&(m=b,u=g/3)}m<h*h&&a(n.distance,n.normal,u)}intersectRay(r,i,s,f,d,g){const{options:b,camera:S,rayBegin:_,rayEnd:v}=s;if(!b.selectionMode||!r.visible||!S)return;if(!I(i))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const P=r.attributes,w=P.get("position").data;let j=this.parameters.width;if(this.parameters.vvSize){const e=P.get("sizeFeatureAttribute").data[0];Number.isNaN(e)||(j*=t(this.parameters.vvSize.offset[0]+e*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0]))}else P.has("size")&&(j*=P.get("size").data[0]);const L=de;a(L,s.point);const C=j*S.pixelRatio,M=4*S.pixelRatio,R=C/2+M;n(je[0],L[0]-R,L[1]+R,0),n(je[1],L[0]+R,L[1]+R,0),n(je[2],L[0]+R,L[1]-R,0),n(je[3],L[0]-R,L[1]-R,0);for(let e=0;e<4;e++)if(!S.unprojectFromRenderScreen(je[e],ze[e]))return;z(S.eye,ze[0],ze[1],Te),z(S.eye,ze[1],ze[2],Ae),z(S.eye,ze[2],ze[3],Le),z(S.eye,ze[3],ze[0],Ce);let O=Number.MAX_VALUE,V=0;const F=se(this.parameters,P)?w.length-2:w.length-5;for(let e=0;e<F;e+=3){le[0]=w[e]+i[12],le[1]=w[e+1]+i[13],le[2]=w[e+2]+i[14];const t=(e+3)%w.length;if(pe[0]=w[t]+i[12],pe[1]=w[t+1]+i[13],pe[2]=w[t+2]+i[14],T(Te,le)<0&&T(Te,pe)<0||T(Ae,le)<0&&T(Ae,pe)<0||T(Le,le)<0&&T(Le,pe)<0||T(Ce,le)<0&&T(Ce,pe)<0)continue;const r=S.projectToRenderScreen(le,ge),s=S.projectToRenderScreen(pe,be);if(null==r||null==s)continue;if(r[2]<0&&s[2]>0){o(ue,le,pe);const e=S.frustum,t=-T(e[4],le)/l(ue,A(e[4]));if(p(ue,ue,t),c(le,le,ue),!S.projectToRenderScreen(le,r))continue}else if(r[2]>0&&s[2]<0){o(ue,pe,le);const e=S.frustum,t=-T(e[4],pe)/l(ue,A(e[4]));if(p(ue,ue,t),c(pe,pe,ue),!S.projectToRenderScreen(pe,s))continue}else if(r[2]<0&&s[2]<0)continue;r[2]=0,s[2]=0;const a=y(r,s,ve),n=E(a,L);if(!(n>=O)){if(this.parameters.screenSizePerspective){const e=this.computeScreenSizePerspectiveWidth(a,le,pe,L,S,j,M);if(n>=e*e)continue}O=n,h(Se,le),h(_e,pe),V=e/3}}if(O<R*R){let e=Number.MAX_VALUE;if(x(y(Se,_e,ve),y(_,v,Pe),fe)){o(fe,fe,_);const t=m(fe);p(fe,fe,1/t),e=t/u(_,v)}g(e,fe,V)}}createBufferWriter(){return new re(G(this.parameters),H(this.parameters),this.parameters)}createGLMaterial(e){return new ee(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}update(e){return!!this.parameters.hasAnimation&&(this.setParameters({timeElapsed:i(e.time)},!1),0!==e.dt)}computeScreenSizePerspectiveWidth(e,t,r,i,s,a,n){const o=w(e,i);f(ce,t,r,o),d(he,ce,s.viewMatrix);const l=m(he),p=this.computeCameraAbsCosAngle(ce,s,this._configuration.spherical);oe.update(p,l,this.parameters.screenSizePerspective,this.parameters.screenSizePerspectiveMinPixelReferenceSize);return oe.apply(a)*s.pixelRatio/2+n}computeCameraAbsCosAngle(e,t,r){return r?g(fe,e):n(fe,0,0,1),o(me,e,t.eye),g(me,me),Math.abs(l(fe,me))}}class ee extends N{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){const{stipplePattern:t}=this._material.parameters;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(K,e)}}class te extends J{constructor(){super(...arguments),this._width=0,this.color=_,this.join="miter",this.cap=0,this.miterLimit=5,this.writeDepth=!0,this.polygonOffset=0,this.polygonOffsetIndex=0,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1,this.timeElapsed=s(0),this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=s(0),this.endTime=s(1/0),this.emissiveStrength=0}get width(){return this.isImagePattern()?this.stipplePattern.width:this._width}set width(e){this._width=e}get transparent(){return this.color[3]<1||this.hasAnimation||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return 0!==this.animation}isImagePattern(){return Y(this.stipplePattern)&&null!=this.stippleTexture}}class re{constructor(e,t,r){this.layout=e,this.textureBufferLayout=t,this._parameters=r,this.numJoinSubdivisions=ne(this._parameters.join,null!=this._parameters.stipplePattern)}_isClosed(e){return se(this._parameters,e)}allocate(e){return this.layout.createBuffer(e)}elementCountTextureBuffer(e){return e.get("position").data.length/3}elementCount(e){const t=2,r=e.get("position").indices.length/2+1,i=this._isClosed(e);let s=i?2:2*t;return s+=((i?r:r-1)-(i?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(e,t,r,i,s,a){const{buffer:o,offset:l}=s,{layout:p,textureBufferLayout:c}=this,m=r.get("position"),f=m.indices,g=m.data.length/3,b=g,_=r.get("distanceToStart")?.data;f&&f.length!==2*(g-1)&&console.warn("RibbonLineMaterial does not support indices");const v=o.getField("textureElementIndex",C);D(null!=v,"Missing texture buffer index field"),D(null!==a,"Expected texture buffer target"),D(null!==c,"Expected valid textureBufferLayout");const{textureBufferRange:y,offset:E}=a;D(null!=y,"Using a texture layout, but the texture range for this instance was not provided");const x=y.from;D(y.numElements===b,"Expected number of elements in TextureBuffer to equal number of points");const{buffer:w}=a,j=w.getField("position",M);D(null!==j,"Expected valid position field in texture buffer");const z=p.fields.has("sizeFeatureAttribute");let T=1,A=null;if(z){const e=r.get("sizeFeatureAttribute");1===e.data.length?T=e.data[0]:A=e.data}else T=r.get("size")?.data[0]??1;let L=[1,1,1,1],R=0,O=null;const V=p.fields.has("colorFeatureAttribute");if(V){const e=r.get("colorFeatureAttribute");1===e.data.length?R=e.data[0]:O=e.data}else L=r.get("color")?.data??L;const F=r.get("timeStamps")?.data,B=F&&p.fields.has("timeStamps"),N=p.fields.has("opacityFeatureAttribute");let k=0,W=null;if(N){const e=r.get("opacityFeatureAttribute");1===e.data.length?k=e.data[0]:W=e.data}const I=new Float32Array(o.buffer),Y=P(o.buffer),J=new Uint8Array(o.buffer),X=new Uint32Array(o.buffer),G=p.stride/4;let H=l*G;const K=H;let Q=0;const Z=_?(e,t,r)=>Q=_[r]:(e,t,r)=>Q+=u(e,t),$=I.BYTES_PER_ELEMENT/Y.BYTES_PER_ELEMENT,ee=4/$,te=U(),re=(e,t,r,s,a,n,o,l)=>{const p=o;X[H]=x+p,H++,j.setVec(E+p,t),q(e,t,Y,H*$),H+=ee,q(r,t,Y,H*$),H+=ee,I[H++]=l;let c=H*$;if(Y[c++]=a,Y[c++]=n,H=Math.ceil(c/$),V)I[H]=O?.[o]??R;else{const e=Math.min(4*o,L.length-4),t=4*H;J[t]=255*L[e],J[t+1]=255*L[e+1],J[t+2]=255*L[e+2],J[t+3]=255*L[e+3]}if(H++,I[H++]=A?.[o]??T,N&&(I[H++]=W?.[o]??k),te){let e=4*H;i?(J[e++]=i[0],J[e++]=i[1],J[e++]=i[2],J[e++]=i[3]):(J[e++]=0,J[e++]=0,J[e++]=0,J[e++]=0),H=Math.ceil(.25*e)}B&&(c=H*$,Y[c++]=s[0],Y[c++]=s[1],Y[c++]=s[2],Y[c++]=s[3],H=Math.ceil(c/$))};H+=G,n(Ee,m.data[0],m.data[1],m.data[2]),B&&S(we,F[0],F[1],F[2],F[3]),e&&d(Ee,Ee,e);const se=this._isClosed(r);if(se){const t=m.data.length-3;n(ye,m.data[t],m.data[t+1],m.data[t+2]),e&&d(ye,ye,e)}else n(xe,m.data[3],m.data[4],m.data[5]),e&&d(xe,xe,e),re(Ee,Ee,xe,we,1,-4,0,0),re(Ee,Ee,xe,we,1,4,0,0),h(ye,Ee),h(Ee,xe),B&&S(we,F[4],F[5],F[6],F[7]);const ae=se?0:1,ne=se?g:g-1;for(let u=ae;u<ne;u++){const t=(u+1)%g*3;n(xe,m.data[t],m.data[t+1],m.data[t+2]),e&&d(xe,xe,e),Z(ye,Ee,u),re(ye,Ee,xe,we,0,-1,u,Q),re(ye,Ee,xe,we,0,1,u,Q);const r=this.numJoinSubdivisions;for(let e=0;e<r;++e){const t=(e+1)/(r+1);re(ye,Ee,xe,we,t,-1,u,Q),re(ye,Ee,xe,we,t,1,u,Q)}if(re(ye,Ee,xe,we,1,-2,u,Q),re(ye,Ee,xe,we,1,2,u,Q),h(ye,Ee),h(Ee,xe),B){const e=(u+1)%g*4;S(we,F[e],F[e+1],F[e+2],F[e+3])}}se?(n(xe,m.data[3],m.data[4],m.data[5]),e&&d(xe,xe,e),Q=Z(ye,Ee,ne),re(ye,Ee,xe,we,0,-1,ae,Q),re(ye,Ee,xe,we,0,1,ae,Q)):(Q=Z(ye,Ee,ne),re(ye,Ee,Ee,we,0,-5,ne,Q),re(ye,Ee,Ee,we,0,5,ne,Q)),ie(I,K+G,I,K,G);H=ie(I,H-G,I,H,G),this._parameters.wireframe&&this._addWireframeVertices(o,K,H,G)}_addWireframeVertices(e,t,r,i){const s=new Uint8Array(e.buffer,r*Float32Array.BYTES_PER_ELEMENT),a=new Uint8Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,(r-t)*Float32Array.BYTES_PER_ELEMENT),n=i*Float32Array.BYTES_PER_ELEMENT;let o=0;const l=e=>o=ie(a,e,s,o,n);for(let p=0;p<=a.length-4*n;p+=2*n)l(p),l(p+2*n),l(p+1*n),l(p+2*n),l(p+1*n),l(p+3*n)}}function ie(e,t,r,i,s){for(let a=0;a<s;a++)r[i++]=e[t++];return i}function se(e,t){if(!e.isClosed)return!1;return t.get("position").indices.length>2}function ae(e){return 1===e.anchor&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}function ne(e,t){const r=t?1:0;switch(e){case"miter":case"bevel":return r;case"round":return X+r}}const oe=new W,le=b(),pe=b(),ce=b(),he=b(),me=b(),ue=b(),fe=b(),de=b(),ge=r(),be=r(),Se=b(),_e=b(),ve=j(),Pe=j(),ye=b(),Ee=b(),xe=b(),we=v(),je=[r(),r(),r(),r()],ze=[b(),b(),b(),b()],Te=L(),Ae=L(),Le=L(),Ce=L();export{te as Parameters,$ as RibbonLineMaterial};
2
+ import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as i,Seconds as s}from"../../../../core/time.js";import{copy as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{set as n,subtract as o,dot as l,scale as p,add as c,copy as h,length as m,distance as u,lerp as f,transformMat4 as d,normalize as g}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as S}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{ONES as _,create as v}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeFloat16Array as P}from"../../../../geometry/support/float16.js";import{fromPoints as y,distance2 as E,closestLineSegmentPoint as x,projectPointFraction as w,create as j}from"../../../../geometry/support/lineSegment.js";import{fromPoints as z,signedDistance as T,getNormal as A,create as L}from"../../../../geometry/support/plane.js";import{BufferViewUint32 as C,BufferViewVec3f as M}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOLID as R,isColor as O,isDepth as V,isColorHighlightOLIDOrDepth as F,is2DGeometryOutput as B}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as U}from"../effects/geometry/olidUtils.js";import N from"../lib/GLMaterial.js";import{Material as k}from"../lib/Material.js";import{ScreenSizePerspectiveEvaluator as W}from"../lib/screenSizePerspectiveUtils.js";import{isTranslationMatrix as I,assert as D}from"../lib/Util.js";import{isImagePattern as Y}from"./lineStippleUtils.js";import{VisualVariablePassParameters as J}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as q}from"./internal/bufferWriterUtils.js";import{r as X}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as G,getTextureBufferLayout as H}from"../shaders/RibbonLineLayouts.js";import{RibbonLineTechnique as K}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as Q}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as Z}from"../../../../webscene/support/AlphaCutoff.js";class $ extends k{constructor(e,t){super(e,te),this.produces=new Map([[2,e=>R(e)||O(e)&&8===this.parameters.renderOccluded],[3,e=>V(e)],[10,e=>F(e)&&8===this.parameters.renderOccluded],[11,e=>F(e)&&8===this.parameters.renderOccluded],[4,e=>O(e)&&this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[8,e=>O(e)&&!this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[18,e=>B(e)]]),this._configuration=new Q(t)}updateConfiguration(e){super.updateConfiguration(e);const t=18===e.slot,r=null!=this.parameters.stipplePattern&&null!=this.parameters.stippleTexture&&10!==e.output,i=r&&t&&this.parameters.isImagePattern();this._configuration.draped=t,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.stippleEnabled=r,this._configuration.stippleOffColorEnabled=r&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=r&&this.parameters.stipplePreferContinuous,this._configuration.numJoinSubdivisions=ne(this.parameters.join,r),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&ae(this.parameters.markerParameters),this._configuration.polygonOffsetIndex=this.parameters.polygonOffsetIndex,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.hasOccludees=e.hasOccludees,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=this.emissions?1:0,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective&&!i,this._configuration.worldSizedImagePattern=i}get visible(){return this.parameters.color[3]>=Z||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>Z}get emissions(){return this.parameters.emissiveStrength>0?8!==this.parameters.renderOccluded?2:1:0}setParameters(e,t){e.animation=this.parameters.animation,super.setParameters(e,t)}intersectScreenPolygon(){return null}intersectRayDraped({attributes:e,screenToWorldRatio:r},i,s,a,n){if(!i.options.selectionMode)return;const o=e.get("size");let l=this.parameters.width;if(this.parameters.vvSize){const r=e.get("sizeFeatureAttribute").data[0];Number.isNaN(r)?l*=this.parameters.vvSize.fallback[0]:l*=t(this.parameters.vvSize.offset[0]+r*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else o&&(l*=o.data[0]);const p=s[0],c=s[1],h=(l/2+4)*r;let m=Number.MAX_VALUE,u=0;const f=e.get("position").data,d=se(this.parameters,e)?f.length-2:f.length-5;for(let g=0;g<d;g+=3){const e=f[g],r=f[g+1],i=(g+3)%f.length,s=p-e,a=c-r,n=f[i]-e,o=f[i+1]-r,l=t((n*s+o*a)/(n*n+o*o),0,1),h=n*l-s,d=o*l-a,b=h*h+d*d;b<m&&(m=b,u=g/3)}m<h*h&&a(n.distance,n.normal,u)}intersectRay(r,i,s,f,d,g){const{options:b,camera:S,rayBegin:_,rayEnd:v}=s;if(!b.selectionMode||!r.visible||!S)return;if(!I(i))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const P=r.attributes,w=P.get("position").data;let j=this.parameters.width;if(this.parameters.vvSize){const e=P.get("sizeFeatureAttribute").data[0];Number.isNaN(e)||(j*=t(this.parameters.vvSize.offset[0]+e*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0]))}else P.has("size")&&(j*=P.get("size").data[0]);const L=de;a(L,s.point);const C=j*S.pixelRatio,M=4*S.pixelRatio,R=C/2+M;n(je[0],L[0]-R,L[1]+R,0),n(je[1],L[0]+R,L[1]+R,0),n(je[2],L[0]+R,L[1]-R,0),n(je[3],L[0]-R,L[1]-R,0);for(let e=0;e<4;e++)if(!S.unprojectFromRenderScreen(je[e],ze[e]))return;z(S.eye,ze[0],ze[1],Te),z(S.eye,ze[1],ze[2],Ae),z(S.eye,ze[2],ze[3],Le),z(S.eye,ze[3],ze[0],Ce);let O=Number.MAX_VALUE,V=0;const F=se(this.parameters,P)?w.length-2:w.length-5;for(let e=0;e<F;e+=3){le[0]=w[e]+i[12],le[1]=w[e+1]+i[13],le[2]=w[e+2]+i[14];const t=(e+3)%w.length;if(pe[0]=w[t]+i[12],pe[1]=w[t+1]+i[13],pe[2]=w[t+2]+i[14],T(Te,le)<0&&T(Te,pe)<0||T(Ae,le)<0&&T(Ae,pe)<0||T(Le,le)<0&&T(Le,pe)<0||T(Ce,le)<0&&T(Ce,pe)<0)continue;const r=S.projectToRenderScreen(le,ge),s=S.projectToRenderScreen(pe,be);if(null==r||null==s)continue;if(r[2]<0&&s[2]>0){o(ue,le,pe);const e=S.frustum,t=-T(e[4],le)/l(ue,A(e[4]));if(p(ue,ue,t),c(le,le,ue),!S.projectToRenderScreen(le,r))continue}else if(r[2]>0&&s[2]<0){o(ue,pe,le);const e=S.frustum,t=-T(e[4],pe)/l(ue,A(e[4]));if(p(ue,ue,t),c(pe,pe,ue),!S.projectToRenderScreen(pe,s))continue}else if(r[2]<0&&s[2]<0)continue;r[2]=0,s[2]=0;const a=y(r,s,ve),n=E(a,L);if(!(n>=O)){if(this.parameters.screenSizePerspective){const e=this.computeScreenSizePerspectiveWidth(a,le,pe,L,S,j,M);if(n>=e*e)continue}O=n,h(Se,le),h(_e,pe),V=e/3}}if(O<R*R){let e=Number.MAX_VALUE;if(x(y(Se,_e,ve),y(_,v,Pe),fe)){o(fe,fe,_);const t=m(fe);p(fe,fe,1/t),e=t/u(_,v)}g(e,fe,V)}}createBufferWriter(){return new re(G(this.parameters),H(this.parameters),this.parameters)}createGLMaterial(e){return new ee(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}update(e){return!!this.parameters.hasAnimation&&(this.setParameters({timeElapsed:i(e.time)},!1),0!==e.dt)}computeScreenSizePerspectiveWidth(e,t,r,i,s,a,n){const o=w(e,i);f(ce,t,r,o),d(he,ce,s.viewMatrix);const l=m(he),p=this.computeCameraAbsCosAngle(ce,s,this._configuration.spherical);oe.update(p,l,this.parameters.screenSizePerspective,this.parameters.screenSizePerspectiveMinPixelReferenceSize);return oe.apply(a)*s.pixelRatio/2+n}computeCameraAbsCosAngle(e,t,r){return r?g(fe,e):n(fe,0,0,1),o(me,e,t.eye),g(me,me),Math.abs(l(fe,me))}}class ee extends N{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){const{stipplePattern:t}=this._material.parameters;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(K,e)}}class te extends J{constructor(){super(...arguments),this._width=0,this.color=_,this.join="miter",this.cap=0,this.miterLimit=5,this.writeDepth=!0,this.polygonOffset=0,this.polygonOffsetIndex=0,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1,this.timeElapsed=s(0),this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=s(0),this.endTime=s(1/0),this.emissiveStrength=0}get width(){return this.isImagePattern()?this.stipplePattern.width:this._width}set width(e){this._width=e}get transparent(){return this.color[3]<1||this.hasAnimation||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return 0!==this.animation}isImagePattern(){return Y(this.stipplePattern)&&null!=this.stippleTexture}}class re{constructor(e,t,r){this.layout=e,this.textureBufferLayout=t,this._parameters=r,this.numJoinSubdivisions=ne(this._parameters.join,null!=this._parameters.stipplePattern)}_isClosed(e){return se(this._parameters,e)}allocate(e){return this.layout.createBuffer(e)}elementCountTextureBuffer(e){return e.get("position").data.length/3}elementCount(e){const t=2,r=e.get("position").indices.length/2+1,i=this._isClosed(e);let s=i?2:2*t;return s+=((i?r:r-1)-(i?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(e,t,r,i,s,a){const{buffer:o,offset:l}=s,{layout:p,textureBufferLayout:c}=this,m=r.get("position"),f=m.indices,g=m.data.length/3,b=g,_=r.get("distanceToStart")?.data;f&&f.length!==2*(g-1)&&console.warn("RibbonLineMaterial does not support indices");const v=o.getField("textureElementIndex",C);D(null!=v,"Missing texture buffer index field"),D(null!==a,"Expected texture buffer target"),D(null!==c,"Expected valid textureBufferLayout");const{textureBufferRange:y,offset:E}=a;D(null!=y,"Using a texture layout, but the texture range for this instance was not provided");const x=y.from;D(y.numElements===b,"Expected number of elements in TextureBuffer to equal number of points");const{buffer:w}=a,j=w.getField("position",M);D(null!==j,"Expected valid position field in texture buffer");const z=p.fields.has("sizeFeatureAttribute");let T=1,A=null;if(z){const e=r.get("sizeFeatureAttribute");1===e.data.length?T=e.data[0]:A=e.data}else T=r.get("size")?.data[0]??1;let L=[1,1,1,1],R=0,O=null;const V=p.fields.has("colorFeatureAttribute");if(V){const e=r.get("colorFeatureAttribute");1===e.data.length?R=e.data[0]:O=e.data}else L=r.get("color")?.data??L;const F=r.get("timeStamps")?.data,B=F&&p.fields.has("timeStamps"),N=p.fields.has("opacityFeatureAttribute");let k=0,W=null;if(N){const e=r.get("opacityFeatureAttribute");1===e.data.length?k=e.data[0]:W=e.data}const I=new Float32Array(o.buffer),Y=P(o.buffer),J=new Uint8Array(o.buffer),X=new Uint32Array(o.buffer),G=p.stride/4;let H=l*G;const K=H;let Q=0;const Z=_?(e,t,r)=>Q=_[r]:(e,t,r)=>Q+=u(e,t),$=I.BYTES_PER_ELEMENT/Y.BYTES_PER_ELEMENT,ee=4/$,te=U(),re=(e,t,r,s,a,n,o,l)=>{const p=o;X[H]=x+p,H++,j.setVec(E+p,t),q(e,t,Y,H*$),H+=ee,q(r,t,Y,H*$),H+=ee,I[H++]=l;let c=H*$;if(Y[c++]=a,Y[c++]=n,H=Math.ceil(c/$),V)I[H]=O?.[o]??R;else{const e=Math.min(4*o,L.length-4),t=4*H;J[t]=255*L[e],J[t+1]=255*L[e+1],J[t+2]=255*L[e+2],J[t+3]=255*L[e+3]}if(H++,I[H++]=A?.[o]??T,N&&(I[H++]=W?.[o]??k),te){let e=4*H;i?(J[e++]=i[0],J[e++]=i[1],J[e++]=i[2],J[e++]=i[3]):(J[e++]=0,J[e++]=0,J[e++]=0,J[e++]=0),H=Math.ceil(.25*e)}B&&(c=H*$,Y[c++]=s[0],Y[c++]=s[1],Y[c++]=s[2],Y[c++]=s[3],H=Math.ceil(c/$))};H+=G,n(Ee,m.data[0],m.data[1],m.data[2]),B&&S(we,F[0],F[1],F[2],F[3]),e&&d(Ee,Ee,e);const se=this._isClosed(r);if(se){const t=m.data.length-3;n(ye,m.data[t],m.data[t+1],m.data[t+2]),e&&d(ye,ye,e)}else n(xe,m.data[3],m.data[4],m.data[5]),e&&d(xe,xe,e),re(Ee,Ee,xe,we,1,-4,0,0),re(Ee,Ee,xe,we,1,4,0,0),h(ye,Ee),h(Ee,xe),B&&S(we,F[4],F[5],F[6],F[7]);const ae=se?0:1,ne=se?g:g-1;for(let u=ae;u<ne;u++){const t=(u+1)%g*3;n(xe,m.data[t],m.data[t+1],m.data[t+2]),e&&d(xe,xe,e),Z(ye,Ee,u),re(ye,Ee,xe,we,0,-1,u,Q),re(ye,Ee,xe,we,0,1,u,Q);const r=this.numJoinSubdivisions;for(let e=0;e<r;++e){const t=(e+1)/(r+1);re(ye,Ee,xe,we,t,-1,u,Q),re(ye,Ee,xe,we,t,1,u,Q)}if(re(ye,Ee,xe,we,1,-2,u,Q),re(ye,Ee,xe,we,1,2,u,Q),h(ye,Ee),h(Ee,xe),B){const e=(u+1)%g*4;S(we,F[e],F[e+1],F[e+2],F[e+3])}}se?(n(xe,m.data[3],m.data[4],m.data[5]),e&&d(xe,xe,e),Q=Z(ye,Ee,ne),re(ye,Ee,xe,we,0,-1,ae,Q),re(ye,Ee,xe,we,0,1,ae,Q)):(Q=Z(ye,Ee,ne),re(ye,Ee,Ee,we,0,-5,ne,Q),re(ye,Ee,Ee,we,0,5,ne,Q)),ie(I,K+G,I,K,G);H=ie(I,H-G,I,H,G),this._parameters.wireframe&&this._addWireframeVertices(o,K,H,G)}_addWireframeVertices(e,t,r,i){const s=new Uint8Array(e.buffer,r*Float32Array.BYTES_PER_ELEMENT),a=new Uint8Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,(r-t)*Float32Array.BYTES_PER_ELEMENT),n=i*Float32Array.BYTES_PER_ELEMENT;let o=0;const l=e=>o=ie(a,e,s,o,n);for(let p=0;p<=a.length-4*n;p+=2*n)l(p),l(p+2*n),l(p+1*n),l(p+2*n),l(p+1*n),l(p+3*n)}}function ie(e,t,r,i,s){for(let a=0;a<s;a++)r[i++]=e[t++];return i}function se(e,t){if(!e.isClosed)return!1;return t.get("position").indices.length>2}function ae(e){return 1===e.anchor&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}function ne(e,t){const r=t?1:0;switch(e){case"miter":case"bevel":return r;case"round":return X+r}}const oe=new W,le=b(),pe=b(),ce=b(),he=b(),me=b(),ue=b(),fe=b(),de=b(),ge=r(),be=r(),Se=b(),_e=b(),ve=j(),Pe=j(),ye=b(),Ee=b(),xe=b(),we=v(),je=[r(),r(),r(),r()],ze=[b(),b(),b(),b()],Te=L(),Ae=L(),Le=L(),Ce=L();export{te as Parameters,$ as RibbonLineMaterial};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{normalize as e,set as t,scale as r,add as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as i,create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as o}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{center as n,scale as p}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as c}from"../../../../geometry/support/buffer/BufferView.js";import{isColorOrOLID as h}from"../core/shaderLibrary/ShaderOutput.js";import l from"../lib/GLMaterial.js";import{Material as f,MaterialParameters as m}from"../lib/Material.js";import{intersectTriangleGeometry as u}from"../lib/RayIntersections.js";import{assert as d}from"../lib/Util.js";import{intersectWithPolygonOffset as g}from"./intersectWithPolygonOffset.js";import{writeAttributes as b,writePosition as S}from"./internal/bufferWriterUtils.js";import{getLayout as _,ShadedColorMaterialTechnique as j}from"../shaders/ShadedColorMaterialTechnique.js";import{ShadedColorMaterialTechniqueConfiguration as w}from"../shaders/ShadedColorMaterialTechniqueConfiguration.js";import{alphaCutoff as y}from"../../../../webscene/support/AlphaCutoff.js";class x extends f{constructor(e){super(e,E),this._configuration=new w,this.supportsEdges=!0,this._pp0=i(0,0,1),this._pp1=i(0,0,0),this.produces=new Map([[2,e=>10===e||h(e)&&!this.parameters.transparent],[4,e=>h(e)&&this.parameters.transparent&&this.parameters.writeDepth],[8,e=>h(e)&&this.parameters.transparent&&!this.parameters.writeDepth]])}updateConfiguration(e){super.updateConfiguration(e),this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.screenSizeEnabled=this.parameters.screenSizeEnabled,this._configuration.shadingEnabled=this.parameters.shadingEnabled}get visible(){return this.parameters.color[3]>=y}intersectRay(e,t,r,s,i,a){this._intersect(e,r,s,i,a)}intersectScreenPolygon(){}intersectRayDraped(e,t,r,s){return this._pp0[0]=this._pp1[0]=r[0],this._pp0[1]=this._pp1[1]=r[1],this._intersect(e,t,this._pp0,this._pp1,s)}_intersect(e,i,a,o,c){const h=g(c,this._configuration,a,o);if(this.parameters.screenSizeEnabled){const c=e.attributes.get("offset"),l={applyToVertex:(e,a,o,n)=>{const p=t(T,c.data[3*n],c.data[3*n+1],c.data[3*n+2]),h=t(C,e,a,o);return r(p,p,this.parameters.screenSizeScale*(i.camera?.computeScreenPixelSizeAt(p)??1)),s(h,h,p),[h[0],h[1],h[2]]},applyToAabb:e=>{const t=n(e,T);return p(e,this.parameters.screenSizeScale*(i.camera?.computeScreenPixelSizeAt(t)??1))}};u(e,i,a,o,l,h)}else u(e,i,a,o,void 0,h)}createGLMaterial(e){return new z(e)}createBufferWriter(){return new M(_(this.parameters))}}class z extends l{beginSlot(e){return this.getTechnique(j,e)}}class E extends m{constructor(){super(...arguments),this.color=o(1,1,1,1),this.shadingTint=o(0,0,0,.25),this.shadingDirection=e(a(),[.5,-.5,-.5]),this.screenSizeScale=14,this.forceTransparentMode=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.cullFace=0,this.screenSizeEnabled=!1,this.shadingEnabled=!0}get transparent(){return this.color[3]<1||this.forceTransparentMode}}class M{constructor(e){this.layout=e}elementCount(e){return e.get("position").indices.length}write(e,t,r,s,i){const{buffer:a,offset:o}=i;b(r,s,this.layout,e,t,i);const n=a.getField("offset",c);if(n&&r.has("offset")){const e=r.get("offset");d(3===e.size),S(e,t,n,o)}}}const T=a(),C=a();export{E as Parameters,x as ShadedColorMaterial};
2
+ import{set as e,scale as t,add as r,normalize as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as i,create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as n}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{center as o,scale as c}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as p}from"../../../../geometry/support/buffer/BufferView.js";import{isColorOrOLID as h}from"../core/shaderLibrary/ShaderOutput.js";import l from"../lib/GLMaterial.js";import{Material as m,MaterialParameters as f}from"../lib/Material.js";import{intersectTriangleGeometry as u}from"../lib/RayIntersections.js";import{intersectTriangleGeometryScreenPolygon as g}from"../lib/screenPolygonTriangleIntersections.js";import{assert as d}from"../lib/Util.js";import{applyPolygonOffsetToHit as b,intersectWithPolygonOffset as _}from"./intersectWithPolygonOffset.js";import{writeAttributes as S,writePosition as y}from"./internal/bufferWriterUtils.js";import{getLayout as j,ShadedColorMaterialTechnique as x}from"../shaders/ShadedColorMaterialTechnique.js";import{ShadedColorMaterialTechniqueConfiguration as w}from"../shaders/ShadedColorMaterialTechniqueConfiguration.js";import{alphaCutoff as z}from"../../../../webscene/support/AlphaCutoff.js";class D extends m{constructor(e){super(e,E),this._configuration=new w,this.supportsEdges=!0,this._pp0=i(0,0,1),this._pp1=i(0,0,0),this.produces=new Map([[2,e=>10===e||h(e)&&!this.parameters.transparent],[4,e=>h(e)&&this.parameters.transparent&&this.parameters.writeDepth],[8,e=>h(e)&&this.parameters.transparent&&!this.parameters.writeDepth]])}updateConfiguration(e){super.updateConfiguration(e),this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.screenSizeEnabled=this.parameters.screenSizeEnabled,this._configuration.shadingEnabled=this.parameters.shadingEnabled}get visible(){return this.parameters.color[3]>=z}intersectRay(e,t,r,s,i,a){this._intersectRay(e,r,s,i,a)}intersectRayDraped(e,t,r,s){return this._pp0[0]=this._pp1[0]=r[0],this._pp0[1]=this._pp1[1]=r[1],this._intersectRay(e,t,this._pp0,this._pp1,s)}intersectScreenPolygon(e,t,r,s){return b(g(e,r,t,s,this._createVertexDisplacement(e,r)),this._configuration,r.camera.eye)}_intersectRay(e,t,r,s,i){const a=_(i,this._configuration,r,s);u(e,t,r,s,this._createVertexDisplacement(e,t),a)}_createVertexDisplacement(s,i){if(!this.parameters.screenSizeEnabled)return;const a=s.attributes.get("offset").data;return{applyToVertex:(s,n,o,c,p)=>{const h=e(P,a[3*p],a[3*p+1],a[3*p+2]);e(s,n,o,c);const l=this.parameters.screenSizeScale*(i.camera?.computeScreenPixelSizeAt(h)??1);return t(h,h,l),r(s,s,h),s},applyToAabb:e=>{const t=o(e,P);return c(e,this.parameters.screenSizeScale*(i.camera?.computeScreenPixelSizeAt(t)??1))}}}createGLMaterial(e){return new T(e)}createBufferWriter(){return new M(j(this.parameters))}}class T extends l{beginSlot(e){return this.getTechnique(x,e)}}class E extends f{constructor(){super(...arguments),this.color=n(1,1,1,1),this.shadingTint=n(0,0,0,.25),this.shadingDirection=s(a(),[.5,-.5,-.5]),this.screenSizeScale=14,this.forceTransparentMode=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.cullFace=0,this.screenSizeEnabled=!1,this.shadingEnabled=!0}get transparent(){return this.color[3]<1||this.forceTransparentMode}}class M{constructor(e){this.layout=e}elementCount(e){return e.get("position").indices.length}write(e,t,r,s,i){const{buffer:a,offset:n}=i;S(r,s,this.layout,e,t,i);const o=a.getField("offset",p);if(o&&r.has("offset")){const e=r.get("offset");d(3===e.size),y(e,t,o,n)}}}const P=a();export{E as Parameters,D as ShadedColorMaterial};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{Material as t,MaterialParameters as e}from"../lib/Material.js";import{intersectTriangleGeometry as n,intersectTriangleGeometry2D as r}from"../lib/RayIntersections.js";import{intersectWithPolygonOffset as s}from"./intersectWithPolygonOffset.js";class o extends t{updateConfiguration(t){super.updateConfiguration(t),this._configuration.transparent=this.transparent,this._configuration.enableOITOffset=t.enableOITOffset,this._configuration.polygonOffset=this.parameters.polygonOffset}intersectRay(t,e,r,o,i,a){return a=s(a,this._configuration,o,i),n(t,r,o,i,null,a)}intersectScreenPolygon(){}intersectRayDraped(t,e,n,s){return r(n[0],n[1],t,s)}}class i extends e{constructor(){super(...arguments),this.polygonOffset=0}}export{o as TriangleMaterial,i as TriangleMaterialParameters};
2
+ import{Material as t,MaterialParameters as e}from"../lib/Material.js";import{intersectTriangleGeometry as n,intersectTriangleGeometry2D as r}from"../lib/RayIntersections.js";import{intersectTriangleGeometryScreenPolygon as o}from"../lib/screenPolygonTriangleIntersections.js";import{intersectWithPolygonOffset as s,applyPolygonOffsetToHit as i}from"./intersectWithPolygonOffset.js";class a extends t{updateConfiguration(t){super.updateConfiguration(t),this._configuration.transparent=this.transparent,this._configuration.enableOITOffset=t.enableOITOffset,this._configuration.polygonOffset=this.parameters.polygonOffset}intersectRay(t,e,r,o,i,a){return a=s(a,this._configuration,o,i),n(t,r,o,i,null,a)}intersectRayDraped(t,e,n,o){return r(n[0],n[1],t,o)}intersectScreenPolygon(t,e,n,r){return i(o(t,n,e,r,null),this._configuration,n.camera.eye)}}class f extends e{constructor(){super(...arguments),this.polygonOffset=0}}export{a as TriangleMaterial,f as TriangleMaterialParameters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{normalize as t,sub as o,dot as e}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{polygonOffset as n}from"./PolygonOffset.js";import{TriangleTechniqueConfiguration as f}from"./TriangleTechniqueConfiguration.js";function s(r,f,s,l){i.output=f.transparent?1:0,i.polygonOffset=f.polygonOffset,i.enableOITOffset=f.enableOITOffset;const p=n(i);if(!p)return r;const u=c*p.units,g=t(m,o(m,l,s));return(t,o,n)=>{const f=(o?1-Math.abs(e(g,o)):0)*p.factor*a+u;return r(t+f,o,n)}}const i=new f,a=2e-5,c=2e-6,m=r();export{s as intersectWithPolygonOffset};
2
+ import{direction as t,dot as n}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{polygonOffset as r}from"./PolygonOffset.js";import{TriangleTechniqueConfiguration as e}from"./TriangleTechniqueConfiguration.js";function f(n,o,e,f){c.output=o.transparent?1:0,c.polygonOffset=o.polygonOffset,c.enableOITOffset=o.enableOITOffset;const s=r(c);if(!s)return n;const i=t(m,f,e);return(t,o,r)=>n(a(s,i,t,o),o,r)}function s(n,o,e,f,s){const i=r(e);return i?a(i,t(m,s,f),n,o):n}function i(t,n,o){return null==t?null:(t.distance=s(t.distance,t.hasNormal?t.normal:null,n,o,t.point),t)}function a({units:t,factor:o},r,e,f){const s=u*t;return e+((f?1-Math.abs(n(r,f)):0)*o*l+s)}const c=new e,l=2e-5,u=2e-6,m=o();export{s as applyPolygonOffsetToDistance,i as applyPolygonOffsetToHit,f as intersectWithPolygonOffset};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{subclass as r}from"../../../../core/accessorSupport/decorators.js";import{ReloadableShader as o}from"../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as s}from"../core/shaderTechnique/ShaderTechnique.js";import{depthWrite as t,depthTest as i,blending as n}from"../lib/OrderIndependentTransparency.js";import{PositionUvGLLayout as a}from"../materials/DefaultLayouts.js";import{polygonOffset as m}from"../materials/PolygonOffset.js";import{C as l}from"../../../../chunks/CheckerBoard.glsl.js";import{makePipelineState as p,defaultColorWrite as c}from"../../../webgl/renderState.js";let d=class extends s{constructor(e,r){super(e,r,a),this.shader=new o(l,()=>import("./CheckerBoard.glsl.js"))}initializePipeline(e){const{output:r,transparent:o}=e;return p({blending:o?n(r,!1,e.emissionDimmingPass):null,depthTest:i(r),depthWrite:t(e),colorWrite:c,polygonOffset:m(e)})}};d=e([r("esri.views.3d.webgl-engine.shaders.CheckerBoardTechnique")],d);export{d as CheckerBoardTechnique};
2
+ import{__decorate as e}from"tslib";import{subclass as r}from"../../../../core/accessorSupport/decorators.js";import{ReloadableShader as o}from"../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as s}from"../core/shaderTechnique/ShaderTechnique.js";import{depthTest as t,blending as i}from"../lib/OrderIndependentTransparency.js";import{PositionUvGLLayout as n}from"../materials/DefaultLayouts.js";import{polygonOffset as a}from"../materials/PolygonOffset.js";import{C as m}from"../../../../chunks/CheckerBoard.glsl.js";import{makePipelineState as l,defaultColorWrite as p}from"../../../webgl/renderState.js";let c=class extends s{constructor(e,r){super(e,r,n),this.shader=new o(m,()=>import("./CheckerBoard.glsl.js"))}initializePipeline(e){const{output:r,transparent:o}=e;return l({blending:o?i(r,!1,e.emissionDimmingPass):null,depthTest:t(r),colorWrite:p,polygonOffset:a(e)})}};c=e([r("esri.views.3d.webgl-engine.shaders.CheckerBoardTechnique")],c);export{c as CheckerBoardTechnique};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{parameter as t}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{TriangleTechniqueConfiguration as i}from"../materials/TriangleTechniqueConfiguration.js";class r extends i{constructor(){super(...arguments),this.writeDepth=!0,this.textureCoordinateType=0,this.emissionSource=0,this.output=0,this.olidColorInstanced=!1,this.overlayEnabled=!1,this.draped=!1,this.snowCover=!1,this.renderOccluded=!1}}e([t()],r.prototype,"writeDepth",void 0);export{r as CheckerBoardTechniqueConfiguration};
2
+ import{TriangleTechniqueConfiguration as e}from"../materials/TriangleTechniqueConfiguration.js";class t extends e{constructor(){super(...arguments),this.textureCoordinateType=0,this.emissionSource=0,this.output=0,this.olidColorInstanced=!1,this.overlayEnabled=!1,this.draped=!1,this.snowCover=!1,this.renderOccluded=!1,this.writeDepth=!1}}export{t as CheckerBoardTechniqueConfiguration};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{subclass as t}from"../../../../core/accessorSupport/decorators.js";import{ZEROS as i,freeze as s,create as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as o}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{glLayout as l}from"../../support/buffer/glUtil.js";import{newLayout as n}from"../../support/buffer/InterleavedLayout.js";import{VertexNormalPassParameters as a,VertexNormalDrawParameters as c}from"../core/shaderLibrary/attributes/VertexNormal.glsl.js";import{ReloadableShader as h}from"../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as u}from"../core/shaderTechnique/ShaderTechnique.js";import{olidEnabled as m}from"../effects/geometry/olidUtils.js";import{depthWrite as p,blending as d,depthTest as f}from"../lib/OrderIndependentTransparency.js";import{stencilToolMaskBase as g,stencilBaseAllZeros as v,stencilWriteMaskOn as b}from"../lib/StencilUtils.js";import{getRenderInstanceDataLayout as S}from"../lib/lodRendering/RenderInstanceData.js";import{advancedMRRFactors as y}from"../materials/pbrUtils.js";import{polygonOffset as j}from"../materials/PolygonOffset.js";import{D as P}from"../../../../chunks/DefaultMaterial.glsl.js";import{makePipelineState as T,cullingParams as x,defaultColorWrite as C}from"../../../webgl/renderState.js";import{alphaCutoff as O}from"../../../../webscene/support/AlphaCutoff.js";class D extends a{constructor(){super(...arguments),this.isSchematic=!1,this.usePBR=!1,this.mrrFactors=y,this.hasVertexColors=!1,this.hasSymbolColors=!1,this.doubleSided=!1,this.doubleSidedType="normal",this.cullFace=2,this.instanced=!1,this.instancedFeatureAttribute=!1,this.instancedColor=!1,this.instanceColorEncodesAlphaIgnore=!1,this.emissiveStrengthFromSymbol=0,this.emissiveStrengthKHR=1,this.emissiveSource=1,this.emissiveBaseColor=i,this.instancedDoublePrecision=!1,this.normalType=0,this.receiveShadows=!0,this.receiveAmbientOcclusion=!0,this.castShadows=!0,this.ambient=s(.2,.2,.2),this.diffuse=s(.8,.8,.8),this.externalColor=o(1,1,1,1),this.colorMixMode="multiply",this.opacity=1,this.layerOpacity=1,this.origin=r(),this.hasSlicePlane=!1,this.offsetTransparentBackfaces=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.modelTransformation=null,this.drivenOpacity=!1,this.writeDepth=!0,this.customDepthTest=0,this.textureAlphaMode=0,this.textureAlphaCutoff=O,this.textureAlphaPremultiplied=!1,this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.isDecoration=!1}get hasVVSize(){return!!this.vvSize}get hasVVColor(){return!!this.vvColor}get hasVVOpacity(){return!!this.vvOpacity}}class V extends c{constructor(){super(...arguments),this.origin=r(),this.slicePlaneLocalOrigin=this.origin}}let w=class extends u{constructor(e,t){let i=l(z(t));t.instanced&&t.instancedDoublePrecision&&(i=i.concat(l(S(t)))),super(e,t,i),this.shader=new h(P,()=>import("./DefaultMaterial.glsl.js")),this.ignoreUnused=!0}_makePipeline(e,t){const{output:i,transparent:s,cullFace:r,customDepthTest:o,hasOccludees:l}=e;return T({blending:s?d(i,!1,e.emissionDimmingPass):null,culling:M(e)?x(r):null,depthTest:f(i,A(o)),depthWrite:p(e),colorWrite:C,stencilWrite:l?b:null,stencilTest:l?t?g:v:null,polygonOffset:j(e)})}initializePipeline(e){return this._occludeePipelineState=this._makePipeline(e,!0),this._makePipeline(e,!1)}getPipeline(e,t,i){return i?this._occludeePipelineState:super.getPipeline(e,t,i)}};function A(e){switch(e){case 1:return 515;case 0:case 3:return 513;case 2:return 516}}function M(e){return 0!==e.cullFace||!e.hasSlicePlane&&(!e.transparent&&!e.doubleSidedMode)}function z(e){const t=n().vec3f("position");return 1===e.normalType?t.vec2i16("normalCompressed",{glNormalized:!0}):t.vec3f("normal"),e.hasVertexTangents&&t.vec4f("tangent"),e.hasTextures&&t.vec2f16("uv0"),e.hasVertexColors&&t.vec4u8("color",{glNormalized:!0}),e.hasSymbolColors&&t.vec4u8("symbolColor"),!e.instanced&&m()&&t.vec4u8("olidColor"),t}w=e([t("esri.views.3d.webgl-engine.shaders.DefaultMaterialTechnique")],w);export{V as DefaultMaterialDrawParameters,D as DefaultMaterialPassParameters,w as DefaultMaterialTechnique,z as getLayout,M as isCullingRequired};
2
+ import{__decorate as e}from"tslib";import{subclass as t}from"../../../../core/accessorSupport/decorators.js";import{ZEROS as i,freeze as s,create as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as o}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{glLayout as l}from"../../support/buffer/glUtil.js";import{newLayout as n}from"../../support/buffer/InterleavedLayout.js";import{VertexNormalPassParameters as a,VertexNormalDrawParameters as c}from"../core/shaderLibrary/attributes/VertexNormal.glsl.js";import{ReloadableShader as h}from"../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as u}from"../core/shaderTechnique/ShaderTechnique.js";import{olidEnabled as m}from"../effects/geometry/olidUtils.js";import{depthWrite as p,blending as d,depthTest as f}from"../lib/OrderIndependentTransparency.js";import{stencilToolMaskBase as g,stencilBaseAllZeros as v,stencilWriteMaskOn as b}from"../lib/StencilUtils.js";import{getRenderInstanceDataLayout as S}from"../lib/lodRendering/RenderInstanceData.js";import{advancedMRRFactors as y}from"../materials/pbrUtils.js";import{polygonOffset as j}from"../materials/PolygonOffset.js";import{D as P}from"../../../../chunks/DefaultMaterial.glsl.js";import{makePipelineState as T,cullingParams as x,defaultColorWrite as C}from"../../../webgl/renderState.js";import{alphaCutoff as O}from"../../../../webscene/support/AlphaCutoff.js";class D extends a{constructor(){super(...arguments),this.isSchematic=!1,this.usePBR=!1,this.mrrFactors=y,this.hasVertexColors=!1,this.hasSymbolColors=!1,this.doubleSided=!1,this.doubleSidedType="normal",this.cullFace=2,this.instanced=!1,this.instancedFeatureAttribute=!1,this.instancedColor=!1,this.instanceColorEncodesAlphaIgnore=!1,this.emissiveStrengthFromSymbol=0,this.emissiveStrengthKHR=1,this.emissiveSource=1,this.emissiveBaseColor=i,this.instancedDoublePrecision=!1,this.normalType=0,this.receiveShadows=!0,this.receiveAmbientOcclusion=!0,this.castShadows=!0,this.ambient=s(.2,.2,.2),this.diffuse=s(.8,.8,.8),this.externalColor=o(1,1,1,1),this.colorMixMode="multiply",this.opacity=1,this.layerOpacity=1,this.origin=r(),this.hasSlicePlane=!1,this.offsetTransparentBackfaces=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.modelTransformation=null,this.drivenOpacity=!1,this.customDepthTest=0,this.textureAlphaMode=0,this.textureAlphaCutoff=O,this.textureAlphaPremultiplied=!1,this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.isDecoration=!1}get hasVVSize(){return!!this.vvSize}get hasVVColor(){return!!this.vvColor}get hasVVOpacity(){return!!this.vvOpacity}}class V extends c{constructor(){super(...arguments),this.origin=r(),this.slicePlaneLocalOrigin=this.origin}}let w=class extends u{constructor(e,t){let i=l(z(t));t.instanced&&t.instancedDoublePrecision&&(i=i.concat(l(S(t)))),super(e,t,i),this.shader=new h(P,()=>import("./DefaultMaterial.glsl.js")),this.ignoreUnused=!0}_makePipeline(e,t){const{output:i,transparent:s,cullFace:r,customDepthTest:o,hasOccludees:l}=e;return T({blending:s?d(i,!1,e.emissionDimmingPass):null,culling:M(e)?x(r):null,depthTest:f(i,A(o)),depthWrite:p(e),colorWrite:C,stencilWrite:l?b:null,stencilTest:l?t?g:v:null,polygonOffset:j(e)})}initializePipeline(e){return this._occludeePipelineState=this._makePipeline(e,!0),this._makePipeline(e,!1)}getPipeline(e,t,i){return i?this._occludeePipelineState:super.getPipeline(e,t,i)}};function A(e){switch(e){case 1:return 515;case 0:case 3:return 513;case 2:return 516}}function M(e){return 0!==e.cullFace||!e.hasSlicePlane&&(!e.transparent&&!e.doubleSidedMode)}function z(e){const t=n().vec3f("position");return 1===e.normalType?t.vec2i16("normalCompressed",{glNormalized:!0}):t.vec3f("normal"),e.hasVertexTangents&&t.vec4f("tangent"),e.hasTextures&&t.vec2f16("uv0"),e.hasVertexColors&&t.vec4u8("color",{glNormalized:!0}),e.hasSymbolColors&&t.vec4u8("symbolColor"),!e.instanced&&m()&&t.vec4u8("olidColor"),t}w=e([t("esri.views.3d.webgl-engine.shaders.DefaultMaterialTechnique")],w);export{V as DefaultMaterialDrawParameters,D as DefaultMaterialPassParameters,w as DefaultMaterialTechnique,z as getLayout,M as isCullingRequired};