@antv/l7-layers 2.20.5 → 2.20.6

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 (447) hide show
  1. package/es/canvas/index.d.ts +3 -3
  2. package/es/citybuliding/models/build.d.ts +7 -12
  3. package/es/citybuliding/models/build.js +22 -11
  4. package/es/citybuliding/shaders/build_frag.glsl +26 -23
  5. package/es/citybuliding/shaders/build_vert.glsl +24 -16
  6. package/es/core/BaseLayer.d.ts +14 -2
  7. package/es/core/BaseLayer.js +53 -9
  8. package/es/core/BaseModel.d.ts +1 -1
  9. package/es/core/BaseModel.js +41 -15
  10. package/es/core/CommonStyleAttribute.d.ts +4 -2
  11. package/es/core/CommonStyleAttribute.js +3 -0
  12. package/es/core/LayerPickService.d.ts +1 -1
  13. package/es/core/TextureService.d.ts +2 -2
  14. package/es/core/interface.d.ts +7 -3
  15. package/es/core/interface.js +0 -1
  16. package/es/core/line_trangluation.d.ts +1 -1
  17. package/es/core/shape/arrow.d.ts +1 -1
  18. package/es/core/shape/extrude.d.ts +1 -1
  19. package/es/core/triangulation.d.ts +1 -1
  20. package/es/core/triangulation.js +13 -7
  21. package/es/core/utils.js +1 -1
  22. package/es/earth/index.d.ts +1 -1
  23. package/es/earth/models/atmosphere.d.ts +8 -2
  24. package/es/earth/models/atmosphere.js +15 -8
  25. package/es/earth/models/base.d.ts +8 -2
  26. package/es/earth/models/base.js +21 -12
  27. package/es/earth/models/bloomsphere.d.ts +8 -2
  28. package/es/earth/models/bloomsphere.js +15 -8
  29. package/es/earth/shaders/{atmosphere_frag.glsl → atmosphere/atmosphere_frag.glsl} +9 -6
  30. package/es/earth/shaders/atmosphere/atmosphere_vert.glsl +22 -0
  31. package/es/earth/shaders/base/base_frag.glsl +11 -0
  32. package/es/earth/shaders/base/base_vert.glsl +52 -0
  33. package/es/earth/shaders/bloomshpere/bloomsphere_frag.glsl +16 -0
  34. package/es/earth/shaders/bloomshpere/bloomsphere_vert.glsl +19 -0
  35. package/es/geometry/index.d.ts +2 -2
  36. package/es/geometry/models/billboard.d.ts +8 -1
  37. package/es/geometry/models/billboard.js +26 -11
  38. package/es/geometry/models/plane.d.ts +8 -1
  39. package/es/geometry/models/plane.js +23 -6
  40. package/es/geometry/models/sprite.d.ts +12 -2
  41. package/es/geometry/models/sprite.js +44 -18
  42. package/es/geometry/shaders/billboard_frag.glsl +11 -6
  43. package/es/geometry/shaders/billboard_vert.glsl +12 -15
  44. package/es/geometry/shaders/plane_frag.glsl +14 -10
  45. package/es/geometry/shaders/plane_vert.glsl +11 -10
  46. package/es/geometry/shaders/sprite_frag.glsl +11 -7
  47. package/es/geometry/shaders/sprite_vert.glsl +10 -9
  48. package/es/heatmap/index.d.ts +3 -3
  49. package/es/heatmap/models/grid.d.ts +8 -1
  50. package/es/heatmap/models/grid.js +25 -12
  51. package/es/heatmap/models/grid3d.d.ts +8 -1
  52. package/es/heatmap/models/grid3d.js +29 -13
  53. package/es/heatmap/models/heatmap.d.ts +6 -4
  54. package/es/heatmap/models/heatmap.js +123 -75
  55. package/es/heatmap/models/hexagon.d.ts +8 -1
  56. package/es/heatmap/models/hexagon.js +25 -12
  57. package/es/heatmap/shaders/grid/grid_frag.glsl +8 -0
  58. package/es/heatmap/shaders/{grid_vert.glsl → grid/grid_vert.glsl} +15 -15
  59. package/es/heatmap/shaders/grid3d/grid_3d_frag.glsl +8 -0
  60. package/{lib/heatmap/shaders/hexagon_3d_vert.glsl → es/heatmap/shaders/grid3d/grid_3d_vert.glsl} +13 -16
  61. package/es/heatmap/shaders/heatmap/heatmap_3d_frag.glsl +24 -0
  62. package/es/heatmap/shaders/{heatmap_3d_vert.glsl → heatmap/heatmap_3d_vert.glsl} +19 -9
  63. package/es/heatmap/shaders/heatmap/heatmap_frag.glsl +52 -0
  64. package/es/heatmap/shaders/heatmap/heatmap_framebuffer_frag.glsl +16 -0
  65. package/{lib/heatmap/shaders → es/heatmap/shaders/heatmap}/heatmap_framebuffer_vert.glsl +14 -9
  66. package/es/heatmap/shaders/heatmap/heatmap_vert.glsl +19 -0
  67. package/es/heatmap/shaders/hexagon/hexagon_frag.glsl +8 -0
  68. package/es/heatmap/shaders/{hexagon_vert.glsl → hexagon/hexagon_vert.glsl} +12 -13
  69. package/es/image/index.d.ts +2 -2
  70. package/es/image/models/image.d.ts +9 -2
  71. package/es/image/models/image.js +83 -44
  72. package/es/image/shaders/image_frag.glsl +34 -7
  73. package/es/image/shaders/image_vert.glsl +11 -5
  74. package/es/line/index.d.ts +4 -4
  75. package/es/line/index.js +2 -1
  76. package/es/line/models/arc.d.ts +8 -3
  77. package/es/line/models/arc.js +57 -76
  78. package/es/line/models/arc_3d.d.ts +8 -3
  79. package/es/line/models/arc_3d.js +46 -57
  80. package/es/line/models/flow.d.ts +8 -2
  81. package/es/line/models/flow.js +14 -12
  82. package/es/line/models/great_circle.d.ts +8 -3
  83. package/es/line/models/great_circle.js +40 -29
  84. package/es/line/models/index.d.ts +1 -1
  85. package/es/line/models/index.js +3 -6
  86. package/es/line/models/line.d.ts +8 -3
  87. package/es/line/models/line.js +67 -140
  88. package/es/line/models/{simpleLine.d.ts → simple_line.d.ts} +8 -2
  89. package/es/line/models/simple_line.js +204 -0
  90. package/es/line/models/wall.d.ts +8 -3
  91. package/es/line/models/wall.js +35 -27
  92. package/es/line/shaders/{line_arc_frag.glsl → arc/line_arc_frag.glsl} +36 -26
  93. package/es/line/shaders/{line_arc_vert.glsl → arc/line_arc_vert.glsl} +52 -22
  94. package/es/line/shaders/{line_arc_3d_frag.glsl → arc3d/line_arc_3d_frag.glsl} +32 -24
  95. package/{lib/line/shaders → es/line/shaders/arc3d}/line_arc_3d_vert.glsl +37 -27
  96. package/es/line/shaders/flow/flow_line_frag.glsl +5 -4
  97. package/es/line/shaders/flow/flow_line_vert.glsl +17 -18
  98. package/es/line/shaders/{line_arc_great_circle_frag.glsl → greatCircle/line_arc_great_circle_frag.glsl} +30 -30
  99. package/{lib/line/shaders → es/line/shaders/greatCircle}/line_arc_great_circle_vert.glsl +43 -40
  100. package/es/line/shaders/{line_frag.glsl → line/line_frag.glsl} +55 -28
  101. package/es/line/shaders/line/line_vert.glsl +114 -0
  102. package/es/line/shaders/simple/simpleline_frag.glsl +27 -3
  103. package/es/line/shaders/simple/simpleline_vert.glsl +20 -20
  104. package/es/line/shaders/wall/wall_frag.glsl +31 -26
  105. package/es/line/shaders/wall/wall_vert.glsl +29 -22
  106. package/es/mask/index.d.ts +2 -2
  107. package/es/mask/models/fill.d.ts +1 -1
  108. package/es/plugins/DataMappingPlugin.d.ts +1 -1
  109. package/es/plugins/DataMappingPlugin.js +1 -3
  110. package/es/plugins/DataSourcePlugin.d.ts +1 -1
  111. package/es/plugins/FeatureScalePlugin.d.ts +1 -1
  112. package/es/plugins/FeatureScalePlugin.js +14 -3
  113. package/es/plugins/LayerAnimateStylePlugin.d.ts +1 -1
  114. package/es/plugins/LayerMaskPlugin.d.ts +1 -1
  115. package/es/plugins/LayerModelPlugin.d.ts +1 -1
  116. package/es/plugins/LayerStylePlugin.d.ts +1 -1
  117. package/es/plugins/LightingPlugin.d.ts +1 -1
  118. package/es/plugins/MultiPassRendererPlugin.d.ts +1 -1
  119. package/es/plugins/PixelPickingPlugin.d.ts +6 -2
  120. package/es/plugins/PixelPickingPlugin.js +36 -49
  121. package/es/plugins/RegisterStyleAttributePlugin.d.ts +1 -1
  122. package/es/plugins/ShaderUniformPlugin.d.ts +1 -1
  123. package/es/plugins/ShaderUniformPlugin.js +11 -6
  124. package/es/plugins/UpdateModelPlugin.d.ts +1 -1
  125. package/es/plugins/UpdateStyleAttributePlugin.d.ts +1 -1
  126. package/es/point/index.d.ts +2 -2
  127. package/es/point/index.js +1 -0
  128. package/es/point/models/billboard_point.d.ts +9 -3
  129. package/es/point/models/billboard_point.js +18 -18
  130. package/es/point/models/earthExtrude.d.ts +7 -12
  131. package/es/point/models/earthExtrude.js +21 -13
  132. package/es/point/models/earthFill.d.ts +8 -3
  133. package/es/point/models/earthFill.js +18 -30
  134. package/es/point/models/extrude.d.ts +1 -4
  135. package/es/point/models/extrude.js +2 -11
  136. package/es/point/models/fill.d.ts +8 -2
  137. package/es/point/models/fill.js +33 -84
  138. package/es/point/models/{fillmage.d.ts → fillImage.d.ts} +8 -2
  139. package/es/point/models/{fillmage.js → fillImage.js} +23 -15
  140. package/es/point/models/image.d.ts +8 -1
  141. package/es/point/models/image.js +31 -17
  142. package/es/point/models/index.js +1 -1
  143. package/es/point/models/normal.d.ts +9 -3
  144. package/es/point/models/normal.js +13 -30
  145. package/es/point/models/radar.d.ts +8 -2
  146. package/es/point/models/radar.js +23 -45
  147. package/es/point/models/text.d.ts +9 -2
  148. package/es/point/models/text.js +31 -32
  149. package/{lib/point/shaders → es/point/shaders/billboard}/billboard_point_frag.glsl +17 -13
  150. package/{lib/point/shaders → es/point/shaders/billboard}/billboard_point_vert.glsl +13 -14
  151. package/es/point/shaders/earthExtrude/earthExtrude_frag.glsl +36 -0
  152. package/{lib/point/shaders/earth/extrude_vert.glsl → es/point/shaders/earthExtrude/earthExtrude_vert.glsl} +25 -22
  153. package/{lib/point/shaders/earth/fill_frag.glsl → es/point/shaders/earthFill/earthFill_frag.glsl} +20 -18
  154. package/{lib/point/shaders/earth/fill_vert.glsl → es/point/shaders/earthFill/earthFill_vert.glsl} +17 -22
  155. package/es/point/shaders/extrude/extrude_vert.glsl +0 -3
  156. package/{lib/point/shaders → es/point/shaders/fill}/fill_frag.glsl +18 -1
  157. package/es/point/shaders/{fill_vert.glsl → fill/fill_vert.glsl} +5 -4
  158. package/es/point/shaders/fillImage/fillImage_frag.glsl +24 -0
  159. package/{lib/point/shaders/image → es/point/shaders/fillImage}/fillImage_vert.glsl +15 -17
  160. package/es/point/shaders/image/image_frag.glsl +42 -0
  161. package/{lib/point/shaders → es/point/shaders/image}/image_vert.glsl +14 -13
  162. package/es/point/shaders/radar/radar_frag.glsl +19 -14
  163. package/es/point/shaders/radar/radar_vert.glsl +21 -24
  164. package/es/point/shaders/text/text_frag.glsl +44 -0
  165. package/es/point/shaders/{text_vert.glsl → text/text_vert.glsl} +19 -17
  166. package/es/point/shape/extrude.d.ts +1 -1
  167. package/es/polygon/index.d.ts +2 -2
  168. package/es/polygon/models/extrude.d.ts +9 -9
  169. package/es/polygon/models/extrude.js +38 -15
  170. package/es/polygon/models/extrusion.d.ts +8 -1
  171. package/es/polygon/models/extrusion.js +24 -7
  172. package/es/polygon/models/fill.d.ts +9 -4
  173. package/es/polygon/models/fill.js +26 -13
  174. package/es/polygon/models/ocean.d.ts +9 -7
  175. package/es/polygon/models/ocean.js +30 -14
  176. package/es/polygon/models/water.d.ts +9 -4
  177. package/es/polygon/models/water.js +26 -10
  178. package/es/polygon/shaders/extrude/polygon_extrude_frag.glsl +14 -14
  179. package/es/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +17 -15
  180. package/es/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +18 -18
  181. package/es/polygon/shaders/extrude/polygon_extrude_vert.glsl +18 -24
  182. package/es/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +19 -15
  183. package/es/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +20 -24
  184. package/es/polygon/shaders/extrusion/polygon_extrusion_frag.glsl +4 -8
  185. package/es/polygon/shaders/extrusion/polygon_extrusion_vert.glsl +7 -16
  186. package/es/polygon/shaders/fill/fill_frag.glsl +7 -0
  187. package/es/polygon/shaders/fill/fill_linear_frag.glsl +20 -0
  188. package/{lib/polygon/shaders/polygon_linear_vert.glsl → es/polygon/shaders/fill/fill_linear_vert.glsl} +12 -11
  189. package/es/polygon/shaders/{polygon_vert.glsl → fill/fill_vert.glsl} +6 -6
  190. package/es/polygon/shaders/{water/polygon_ocean_frag.glsl → ocean/ocean_frag.glsl} +13 -13
  191. package/es/polygon/shaders/ocean/ocean_vert.glsl +22 -0
  192. package/es/polygon/shaders/water/polygon_water_frag.glsl +14 -12
  193. package/es/polygon/shaders/water/polygon_water_vert.glsl +10 -10
  194. package/es/raster/buffers/triangulation.d.ts +1 -1
  195. package/es/raster/index.d.ts +2 -2
  196. package/es/raster/models/raster.d.ts +9 -8
  197. package/es/raster/models/raster.js +54 -38
  198. package/es/raster/models/rasterRgb.d.ts +9 -7
  199. package/es/raster/models/rasterRgb.js +36 -19
  200. package/es/raster/models/rasterTerrainRgb.d.ts +1 -1
  201. package/es/raster/models/rasterTerrainRgb.js +2 -2
  202. package/es/raster/shaders/raster/raster_2d_frag.glsl +34 -0
  203. package/es/raster/shaders/raster/raster_2d_vert.glsl +21 -0
  204. package/es/raster/shaders/rgb/raster_rgb_frag.glsl +26 -0
  205. package/es/raster/shaders/rgb/raster_rgb_vert.glsl +21 -0
  206. package/es/tile/core/BaseLayer.d.ts +2 -2
  207. package/es/tile/core/TileDebugLayer.d.ts +1 -1
  208. package/es/tile/interaction/getRasterData.d.ts +2 -2
  209. package/es/tile/interaction/utils.d.ts +1 -1
  210. package/es/tile/interface.d.ts +2 -2
  211. package/es/tile/service/TileLayerService.d.ts +2 -2
  212. package/es/tile/service/TilePickService.d.ts +2 -2
  213. package/es/tile/service/TileSourceService.d.ts +1 -1
  214. package/es/tile/tile/Tile.d.ts +2 -3
  215. package/es/tile/tile/VectorTile.d.ts +1 -1
  216. package/es/tile/tile/index.d.ts +1 -1
  217. package/es/tile/utils/constants.js +1 -1
  218. package/es/tile/utils/utils.d.ts +1 -1
  219. package/es/utils/blend.d.ts +1 -1
  220. package/es/utils/multiPassRender.d.ts +1 -1
  221. package/es/utils/stencil.d.ts +1 -1
  222. package/es/wind/index.d.ts +3 -3
  223. package/es/wind/models/wind.d.ts +1 -1
  224. package/lib/citybuliding/models/build.js +22 -11
  225. package/lib/citybuliding/shaders/build_frag.glsl +26 -23
  226. package/lib/citybuliding/shaders/build_vert.glsl +24 -16
  227. package/lib/core/BaseLayer.js +53 -9
  228. package/lib/core/BaseModel.js +41 -15
  229. package/lib/core/CommonStyleAttribute.js +3 -0
  230. package/lib/core/triangulation.js +12 -6
  231. package/lib/core/utils.js +1 -1
  232. package/lib/earth/models/atmosphere.js +15 -8
  233. package/lib/earth/models/base.js +21 -12
  234. package/lib/earth/models/bloomsphere.js +15 -8
  235. package/lib/earth/shaders/{atmosphere_frag.glsl → atmosphere/atmosphere_frag.glsl} +9 -6
  236. package/lib/earth/shaders/atmosphere/atmosphere_vert.glsl +22 -0
  237. package/lib/earth/shaders/base/base_frag.glsl +11 -0
  238. package/lib/earth/shaders/base/base_vert.glsl +52 -0
  239. package/lib/earth/shaders/bloomshpere/bloomsphere_frag.glsl +16 -0
  240. package/lib/earth/shaders/bloomshpere/bloomsphere_vert.glsl +19 -0
  241. package/lib/geometry/models/billboard.js +26 -11
  242. package/lib/geometry/models/plane.js +23 -6
  243. package/lib/geometry/models/sprite.js +44 -18
  244. package/lib/geometry/shaders/billboard_frag.glsl +11 -6
  245. package/lib/geometry/shaders/billboard_vert.glsl +12 -15
  246. package/lib/geometry/shaders/plane_frag.glsl +14 -10
  247. package/lib/geometry/shaders/plane_vert.glsl +11 -10
  248. package/lib/geometry/shaders/sprite_frag.glsl +11 -7
  249. package/lib/geometry/shaders/sprite_vert.glsl +10 -9
  250. package/lib/heatmap/models/grid.js +25 -12
  251. package/lib/heatmap/models/grid3d.js +29 -13
  252. package/lib/heatmap/models/heatmap.js +122 -74
  253. package/lib/heatmap/models/hexagon.js +25 -12
  254. package/lib/heatmap/shaders/grid/grid_frag.glsl +8 -0
  255. package/lib/heatmap/shaders/{grid_vert.glsl → grid/grid_vert.glsl} +15 -15
  256. package/lib/heatmap/shaders/grid3d/grid_3d_frag.glsl +8 -0
  257. package/{es/heatmap/shaders/hexagon_3d_vert.glsl → lib/heatmap/shaders/grid3d/grid_3d_vert.glsl} +13 -16
  258. package/lib/heatmap/shaders/heatmap/heatmap_3d_frag.glsl +24 -0
  259. package/lib/heatmap/shaders/{heatmap_3d_vert.glsl → heatmap/heatmap_3d_vert.glsl} +19 -9
  260. package/lib/heatmap/shaders/heatmap/heatmap_frag.glsl +52 -0
  261. package/lib/heatmap/shaders/heatmap/heatmap_framebuffer_frag.glsl +16 -0
  262. package/{es/heatmap/shaders → lib/heatmap/shaders/heatmap}/heatmap_framebuffer_vert.glsl +14 -9
  263. package/lib/heatmap/shaders/heatmap/heatmap_vert.glsl +19 -0
  264. package/lib/heatmap/shaders/hexagon/hexagon_frag.glsl +8 -0
  265. package/lib/heatmap/shaders/{hexagon_vert.glsl → hexagon/hexagon_vert.glsl} +12 -13
  266. package/lib/image/models/image.js +83 -44
  267. package/lib/image/shaders/image_frag.glsl +34 -7
  268. package/lib/image/shaders/image_vert.glsl +11 -5
  269. package/lib/line/index.js +2 -1
  270. package/lib/line/models/arc.js +57 -76
  271. package/lib/line/models/arc_3d.js +47 -59
  272. package/lib/line/models/flow.js +14 -12
  273. package/lib/line/models/great_circle.js +40 -29
  274. package/lib/line/models/index.js +4 -7
  275. package/lib/line/models/line.js +67 -142
  276. package/lib/line/models/{simpleLine.js → simple_line.js} +84 -74
  277. package/lib/line/models/wall.js +35 -27
  278. package/lib/line/shaders/{line_arc_frag.glsl → arc/line_arc_frag.glsl} +36 -26
  279. package/lib/line/shaders/{line_arc_vert.glsl → arc/line_arc_vert.glsl} +52 -22
  280. package/lib/line/shaders/{line_arc_3d_frag.glsl → arc3d/line_arc_3d_frag.glsl} +32 -24
  281. package/{es/line/shaders → lib/line/shaders/arc3d}/line_arc_3d_vert.glsl +37 -27
  282. package/lib/line/shaders/flow/flow_line_frag.glsl +5 -4
  283. package/lib/line/shaders/flow/flow_line_vert.glsl +17 -18
  284. package/lib/line/shaders/{line_arc_great_circle_frag.glsl → greatCircle/line_arc_great_circle_frag.glsl} +30 -30
  285. package/{es/line/shaders → lib/line/shaders/greatCircle}/line_arc_great_circle_vert.glsl +43 -40
  286. package/lib/line/shaders/{line_frag.glsl → line/line_frag.glsl} +55 -28
  287. package/lib/line/shaders/line/line_vert.glsl +114 -0
  288. package/lib/line/shaders/simple/simpleline_frag.glsl +27 -3
  289. package/lib/line/shaders/simple/simpleline_vert.glsl +20 -20
  290. package/lib/line/shaders/wall/wall_frag.glsl +31 -26
  291. package/lib/line/shaders/wall/wall_vert.glsl +29 -22
  292. package/lib/plugins/DataMappingPlugin.js +1 -3
  293. package/lib/plugins/FeatureScalePlugin.js +14 -3
  294. package/lib/plugins/PixelPickingPlugin.js +35 -48
  295. package/lib/plugins/ShaderUniformPlugin.js +11 -6
  296. package/lib/point/index.js +1 -0
  297. package/lib/point/models/billboard_point.js +18 -18
  298. package/lib/point/models/earthExtrude.js +21 -13
  299. package/lib/point/models/earthFill.js +18 -30
  300. package/lib/point/models/extrude.js +2 -11
  301. package/lib/point/models/fill.js +33 -84
  302. package/lib/point/models/{fillmage.js → fillImage.js} +24 -17
  303. package/lib/point/models/image.js +31 -17
  304. package/lib/point/models/index.js +2 -2
  305. package/lib/point/models/normal.js +13 -30
  306. package/lib/point/models/radar.js +23 -45
  307. package/lib/point/models/text.js +31 -32
  308. package/{es/point/shaders → lib/point/shaders/billboard}/billboard_point_frag.glsl +17 -13
  309. package/{es/point/shaders → lib/point/shaders/billboard}/billboard_point_vert.glsl +13 -14
  310. package/lib/point/shaders/earthExtrude/earthExtrude_frag.glsl +36 -0
  311. package/{es/point/shaders/earth/extrude_vert.glsl → lib/point/shaders/earthExtrude/earthExtrude_vert.glsl} +25 -22
  312. package/{es/point/shaders/earth/fill_frag.glsl → lib/point/shaders/earthFill/earthFill_frag.glsl} +20 -18
  313. package/{es/point/shaders/earth/fill_vert.glsl → lib/point/shaders/earthFill/earthFill_vert.glsl} +17 -22
  314. package/lib/point/shaders/extrude/extrude_vert.glsl +0 -3
  315. package/{es/point/shaders → lib/point/shaders/fill}/fill_frag.glsl +18 -1
  316. package/lib/point/shaders/{fill_vert.glsl → fill/fill_vert.glsl} +5 -4
  317. package/lib/point/shaders/fillImage/fillImage_frag.glsl +24 -0
  318. package/{es/point/shaders/image → lib/point/shaders/fillImage}/fillImage_vert.glsl +15 -17
  319. package/lib/point/shaders/image/image_frag.glsl +42 -0
  320. package/{es/point/shaders → lib/point/shaders/image}/image_vert.glsl +14 -13
  321. package/lib/point/shaders/radar/radar_frag.glsl +19 -14
  322. package/lib/point/shaders/radar/radar_vert.glsl +21 -24
  323. package/lib/point/shaders/text/text_frag.glsl +44 -0
  324. package/lib/point/shaders/{text_vert.glsl → text/text_vert.glsl} +19 -17
  325. package/lib/polygon/models/extrude.js +38 -15
  326. package/lib/polygon/models/extrusion.js +24 -7
  327. package/lib/polygon/models/fill.js +26 -13
  328. package/lib/polygon/models/ocean.js +30 -14
  329. package/lib/polygon/models/water.js +26 -10
  330. package/lib/polygon/shaders/extrude/polygon_extrude_frag.glsl +14 -14
  331. package/lib/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +17 -15
  332. package/lib/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +18 -18
  333. package/lib/polygon/shaders/extrude/polygon_extrude_vert.glsl +18 -24
  334. package/lib/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +19 -15
  335. package/lib/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +20 -24
  336. package/lib/polygon/shaders/extrusion/polygon_extrusion_frag.glsl +4 -8
  337. package/lib/polygon/shaders/extrusion/polygon_extrusion_vert.glsl +7 -16
  338. package/lib/polygon/shaders/fill/fill_frag.glsl +7 -0
  339. package/lib/polygon/shaders/fill/fill_linear_frag.glsl +20 -0
  340. package/{es/polygon/shaders/polygon_linear_vert.glsl → lib/polygon/shaders/fill/fill_linear_vert.glsl} +12 -11
  341. package/lib/polygon/shaders/{polygon_vert.glsl → fill/fill_vert.glsl} +6 -6
  342. package/lib/polygon/shaders/{water/polygon_ocean_frag.glsl → ocean/ocean_frag.glsl} +13 -13
  343. package/lib/polygon/shaders/ocean/ocean_vert.glsl +22 -0
  344. package/lib/polygon/shaders/water/polygon_water_frag.glsl +14 -12
  345. package/lib/polygon/shaders/water/polygon_water_vert.glsl +10 -10
  346. package/lib/raster/models/raster.js +54 -38
  347. package/lib/raster/models/rasterRgb.js +36 -19
  348. package/lib/raster/models/rasterTerrainRgb.js +2 -2
  349. package/lib/raster/shaders/raster/raster_2d_frag.glsl +34 -0
  350. package/lib/raster/shaders/raster/raster_2d_vert.glsl +21 -0
  351. package/lib/raster/shaders/rgb/raster_rgb_frag.glsl +26 -0
  352. package/lib/raster/shaders/rgb/raster_rgb_vert.glsl +21 -0
  353. package/lib/tile/utils/constants.js +1 -1
  354. package/package.json +7 -7
  355. package/es/earth/shaders/atmosphere_vert.glsl +0 -26
  356. package/es/earth/shaders/base_frag.glsl +0 -13
  357. package/es/earth/shaders/base_vert.glsl +0 -52
  358. package/es/earth/shaders/bloomsphere_frag.glsl +0 -15
  359. package/es/earth/shaders/bloomsphere_vert.glsl +0 -20
  360. package/es/heatmap/shaders/heatmap_3d_frag.glsl +0 -14
  361. package/es/heatmap/shaders/heatmap_frag.glsl +0 -47
  362. package/es/heatmap/shaders/heatmap_framebuffer_frag.glsl +0 -10
  363. package/es/heatmap/shaders/heatmap_vert.glsl +0 -10
  364. package/es/heatmap/shaders/hexagon_frag.glsl +0 -12
  365. package/es/line/models/earthArc_3d.d.ts +0 -17
  366. package/es/line/models/earthArc_3d.js +0 -285
  367. package/es/line/models/linearline.d.ts +0 -11
  368. package/es/line/models/linearline.js +0 -241
  369. package/es/line/models/simpleLine.js +0 -194
  370. package/es/line/shaders/arc_chunks.vert.glsl +0 -21
  371. package/es/line/shaders/dash/arc_dash_frag.glsl +0 -21
  372. package/es/line/shaders/dash/arc_dash_vert.glsl +0 -102
  373. package/es/line/shaders/dash/line_dash_frag.glsl +0 -27
  374. package/es/line/shaders/dash/line_dash_vert.glsl +0 -82
  375. package/es/line/shaders/line_arc2d_vert.glsl +0 -114
  376. package/es/line/shaders/line_bezier_vert.glsl +0 -85
  377. package/es/line/shaders/line_vert.glsl +0 -165
  378. package/es/line/shaders/linear/arc3d_linear_frag.glsl +0 -32
  379. package/es/line/shaders/linear/arc3d_linear_vert.glsl +0 -161
  380. package/es/line/shaders/linear/arc_linear_frag.glsl +0 -10
  381. package/es/line/shaders/linear/arc_linear_vert.glsl +0 -98
  382. package/es/line/shaders/linear/line_linear_frag.glsl +0 -25
  383. package/es/line/shaders/linearLine/line_linear_frag.glsl +0 -8
  384. package/es/line/shaders/linearLine/line_linear_vert.glsl +0 -93
  385. package/es/line/shaders/simple/simpleline_linear_frag.glsl +0 -8
  386. package/es/point/shaders/animate/wave_frag.glsl +0 -55
  387. package/es/point/shaders/earth/extrude_frag.glsl +0 -32
  388. package/es/point/shaders/image/fillImage_frag.glsl +0 -18
  389. package/es/point/shaders/image_frag.glsl +0 -37
  390. package/es/point/shaders/text_frag.glsl +0 -39
  391. package/es/polygon/shaders/polygon_frag.glsl +0 -7
  392. package/es/polygon/shaders/polygon_linear_frag.glsl +0 -15
  393. package/es/polygon/shaders/water/polygon_ocean_vert.glsl +0 -16
  394. package/es/raster/shaders/raster_2d_frag.glsl +0 -32
  395. package/es/raster/shaders/raster_2d_vert.glsl +0 -13
  396. package/es/raster/shaders/raster_frag.glsl +0 -11
  397. package/es/raster/shaders/raster_rgb_frag.glsl +0 -20
  398. package/es/raster/shaders/raster_vert.glsl +0 -34
  399. package/lib/earth/shaders/atmosphere_vert.glsl +0 -26
  400. package/lib/earth/shaders/base_frag.glsl +0 -13
  401. package/lib/earth/shaders/base_vert.glsl +0 -52
  402. package/lib/earth/shaders/bloomsphere_frag.glsl +0 -15
  403. package/lib/earth/shaders/bloomsphere_vert.glsl +0 -20
  404. package/lib/heatmap/shaders/heatmap_3d_frag.glsl +0 -14
  405. package/lib/heatmap/shaders/heatmap_frag.glsl +0 -47
  406. package/lib/heatmap/shaders/heatmap_framebuffer_frag.glsl +0 -10
  407. package/lib/heatmap/shaders/heatmap_vert.glsl +0 -10
  408. package/lib/heatmap/shaders/hexagon_frag.glsl +0 -12
  409. package/lib/line/models/earthArc_3d.js +0 -291
  410. package/lib/line/models/linearline.js +0 -247
  411. package/lib/line/shaders/arc_chunks.vert.glsl +0 -21
  412. package/lib/line/shaders/dash/arc_dash_frag.glsl +0 -21
  413. package/lib/line/shaders/dash/arc_dash_vert.glsl +0 -102
  414. package/lib/line/shaders/dash/line_dash_frag.glsl +0 -27
  415. package/lib/line/shaders/dash/line_dash_vert.glsl +0 -82
  416. package/lib/line/shaders/line_arc2d_vert.glsl +0 -114
  417. package/lib/line/shaders/line_bezier_vert.glsl +0 -85
  418. package/lib/line/shaders/line_vert.glsl +0 -165
  419. package/lib/line/shaders/linear/arc3d_linear_frag.glsl +0 -32
  420. package/lib/line/shaders/linear/arc3d_linear_vert.glsl +0 -161
  421. package/lib/line/shaders/linear/arc_linear_frag.glsl +0 -10
  422. package/lib/line/shaders/linear/arc_linear_vert.glsl +0 -98
  423. package/lib/line/shaders/linear/line_linear_frag.glsl +0 -25
  424. package/lib/line/shaders/linearLine/line_linear_frag.glsl +0 -8
  425. package/lib/line/shaders/linearLine/line_linear_vert.glsl +0 -93
  426. package/lib/line/shaders/simple/simpleline_linear_frag.glsl +0 -8
  427. package/lib/point/shaders/animate/wave_frag.glsl +0 -55
  428. package/lib/point/shaders/earth/extrude_frag.glsl +0 -32
  429. package/lib/point/shaders/image/fillImage_frag.glsl +0 -18
  430. package/lib/point/shaders/image_frag.glsl +0 -37
  431. package/lib/point/shaders/text_frag.glsl +0 -39
  432. package/lib/polygon/shaders/polygon_frag.glsl +0 -7
  433. package/lib/polygon/shaders/polygon_linear_frag.glsl +0 -15
  434. package/lib/polygon/shaders/water/polygon_ocean_vert.glsl +0 -16
  435. package/lib/raster/shaders/raster_2d_frag.glsl +0 -32
  436. package/lib/raster/shaders/raster_2d_vert.glsl +0 -13
  437. package/lib/raster/shaders/raster_frag.glsl +0 -11
  438. package/lib/raster/shaders/raster_rgb_frag.glsl +0 -20
  439. package/lib/raster/shaders/raster_vert.glsl +0 -34
  440. /package/es/point/shaders/{normal_frag.glsl → normal/normal_frag.glsl} +0 -0
  441. /package/es/point/shaders/{normal_vert.glsl → normal/normal_vert.glsl} +0 -0
  442. /package/es/raster/shaders/{raster_terrain_rgb_frag.glsl → terrain/terrain_rgb_frag.glsl} +0 -0
  443. /package/es/raster/shaders/{rater_terrain_rgb_vert.glsl → terrain/terrain_rgb_vert.glsl} +0 -0
  444. /package/lib/point/shaders/{normal_frag.glsl → normal/normal_frag.glsl} +0 -0
  445. /package/lib/point/shaders/{normal_vert.glsl → normal/normal_vert.glsl} +0 -0
  446. /package/lib/raster/shaders/{raster_terrain_rgb_frag.glsl → terrain/terrain_rgb_frag.glsl} +0 -0
  447. /package/lib/raster/shaders/{rater_terrain_rgb_vert.glsl → terrain/terrain_rgb_vert.glsl} +0 -0
@@ -1,47 +1,57 @@
1
- import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
3
3
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
4
4
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
5
5
  import _createClass from "@babel/runtime/helpers/esm/createClass";
6
+ import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
6
7
  import _inherits from "@babel/runtime/helpers/esm/inherits";
7
8
  import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
8
9
  import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
10
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
9
11
  var _dec, _class;
10
12
  import _regeneratorRuntime from "@babel/runtime/regenerator";
11
13
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
12
14
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
13
- import { AttributeType, gl } from '@antv/l7-core';
15
+ import { AttributeType, gl, TextureUsage } from '@antv/l7-core';
14
16
  import { generateColorRamp, getCullFace, lodashUtil } from '@antv/l7-utils';
15
17
  import { mat4 } from 'gl-matrix';
16
18
  import { injectable } from 'inversify';
17
19
  import 'reflect-metadata';
18
20
  import BaseModel from "../../core/BaseModel";
19
21
  import { HeatmapTriangulation } from "../../core/triangulation";
20
- /* babel-plugin-inline-import '../shaders/heatmap_3d_frag.glsl' */
21
- var heatmap3DFrag = "uniform sampler2D u_texture;\nuniform sampler2D u_colorTexture;\nuniform float u_opacity;\nvarying vec2 v_texCoord;\nvarying float v_intensity;\n\nvoid main(){\n \n float intensity = texture2D(u_texture, v_texCoord).r;\n vec4 color = texture2D(u_colorTexture,vec2(intensity, 0));\n gl_FragColor = color;\n // gl_FragColor.a = color.a * smoothstep(0.1,0.2,intensity)* u_opacity;\n gl_FragColor.a = color.a * smoothstep(0.,0.1,intensity) * u_opacity;\n}\n";
22
- /* babel-plugin-inline-import '../shaders/heatmap_3d_vert.glsl' */
23
- var heatmap3DVert = "precision highp float;\nattribute vec3 a_Position;\nattribute vec2 a_Uv;\nuniform sampler2D u_texture;\nvarying vec2 v_texCoord;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_InverseViewProjectionMatrix;\nuniform mat4 u_ViewProjectionMatrixUncentered;\nvarying float v_intensity;\n\n\nvec2 toBezier(float t, vec2 P0, vec2 P1, vec2 P2, vec2 P3) {\n float t2 = t * t;\n float one_minus_t = 1.0 - t;\n float one_minus_t2 = one_minus_t * one_minus_t;\n return (P0 * one_minus_t2 * one_minus_t + P1 * 3.0 * t * one_minus_t2 + P2 * 3.0 * t2 * one_minus_t + P3 * t2 * t);\n}\nvec2 toBezier(float t, vec4 p){\n return toBezier(t, vec2(0.0, 0.0), vec2(p.x, p.y), vec2(p.z, p.w), vec2(1.0, 1.0));\n}\n#pragma include \"projection\"\nvoid main() {\n v_texCoord = a_Uv;\n\n vec2 pos = a_Uv * vec2(2.0) - vec2(1.0); // \u5C06\u539F\u672C 0 -> 1 \u7684 uv \u8F6C\u6362\u4E3A -1 -> 1 \u7684\u6807\u51C6\u5750\u6807\u7A7A\u95F4\uFF08NDC\uFF09\n\n vec4 p1 = vec4(pos, 0.0, 1.0); // x/y \u5E73\u9762\u4E0A\u7684\u70B9\uFF08z == 0\uFF09\u53EF\u4EE5\u8BA4\u4E3A\u662F\u4E09\u7EF4\u4E0A\u7684\u70B9\u88AB\u6295\u5F71\u5230\u5E73\u9762\u540E\u7684\u70B9\n\tvec4 p2 = vec4(pos, 1.0, 1.0); // \u5E73\u884C\u4E8Ex/y\u5E73\u9762\u3001z==1 \u7684\u5E73\u9762\u4E0A\u7684\u70B9\n\n\tvec4 inverseP1 = u_InverseViewProjectionMatrix * p1; // \u6839\u636E\u89C6\u56FE\u6295\u5F71\u77E9\u9635\u7684\u9006\u77E9\u9635\u5E73\u9762\u4E0A\u7684\u53CD\u7B97\u51FA\u4E09\u7EF4\u7A7A\u95F4\u4E2D\u7684\u70B9\uFF08p1\u5E73\u9762\u4E0A\u7684\u70B9\uFF09\n\tvec4 inverseP2 = u_InverseViewProjectionMatrix * p2;\n\n inverseP1 = inverseP1 / inverseP1.w; // \u5F52\u4E00\u5316\u64CD\u4F5C\uFF08\u5F52\u4E00\u5316\u540E\u4E3A\u4E16\u754C\u5750\u6807\uFF09\n\tinverseP2 = inverseP2 / inverseP2.w;\n\n\tfloat zPos = (0.0 - inverseP1.z) / (inverseP2.z - inverseP1.z); // ??\n\tvec4 position = inverseP1 + zPos * (inverseP2 - inverseP1);\n\n vec4 b= vec4(0.5000, 0.0, 1.0, 0.5000);\n float fh;\n\n v_intensity = texture2D(u_texture, v_texCoord).r;\n fh = toBezier(v_intensity, b).y;\n gl_Position = u_ViewProjectionMatrixUncentered * vec4(position.xy, fh * project_pixel(50.), 1.0);\n \n}\n"; // 绘制平面热力的 shader
24
- /* babel-plugin-inline-import '../shaders/heatmap_frag.glsl' */
25
- var heatmapColorFrag = "uniform sampler2D u_texture; // \u70ED\u529B\u5F3A\u5EA6\u56FE\nuniform sampler2D u_colorTexture; // \u6839\u636E\u5F3A\u5EA6\u5206\u5E03\u7684\u8272\u5E26\nuniform float u_opacity;\nvarying vec2 v_texCoord;\n\nuniform vec2 u_ViewportSize;\n\nfloat getBlurIndusty() {\n float vW = 2.0/u_ViewportSize.x;\n float vH = 2.0/u_ViewportSize.y;\n vec2 vUv = v_texCoord;\n float i11 = texture2D( u_texture, vec2( vUv.x - 1.0 * vW, vUv.y + 1.0 * vH) ).r;\n float i12 = texture2D( u_texture, vec2( vUv.x - 0.0 * vW, vUv.y + 1.0 * vH) ).r;\n float i13 = texture2D( u_texture, vec2( vUv.x + 1.0 * vW, vUv.y + 1.0 * vH) ).r;\n\n float i21 = texture2D( u_texture, vec2( vUv.x - 1.0 * vW, vUv.y) ).r;\n float i22 = texture2D( u_texture, vec2( vUv.x , vUv.y) ).r;\n float i23 = texture2D( u_texture, vec2( vUv.x + 1.0 * vW, vUv.y) ).r;\n\n float i31 = texture2D( u_texture, vec2( vUv.x - 1.0 * vW, vUv.y-1.0*vH) ).r;\n float i32 = texture2D( u_texture, vec2( vUv.x - 0.0 * vW, vUv.y-1.0*vH) ).r;\n float i33 = texture2D( u_texture, vec2( vUv.x + 1.0 * vW, vUv.y-1.0*vH) ).r;\n\n return(\n i11 + \n i12 + \n i13 + \n i21 + \n i21 + \n i22 + \n i23 + \n i31 + \n i32 + \n i33\n )/9.0;\n}\n\n\nvoid main(){\n // float intensity = texture2D(u_texture, v_texCoord).r;\n float intensity = getBlurIndusty();\n vec4 color = texture2D(u_colorTexture, vec2(intensity, 0.0));\n\n gl_FragColor =color;\n gl_FragColor.a = color.a * smoothstep(0.,0.1,intensity) * u_opacity;\n\n}\n";
26
- /* babel-plugin-inline-import '../shaders/heatmap_vert.glsl' */
27
- var heatmapColorVert = "precision highp float;\nattribute vec3 a_Position;\nattribute vec2 a_Uv;\nvarying vec2 v_texCoord;\n\nvoid main() {\n v_texCoord = a_Uv;\n\n gl_Position = vec4(a_Position.xy, 0, 1.);\n}\n";
28
- /* babel-plugin-inline-import '../shaders/heatmap_framebuffer_frag.glsl' */
29
- var heatmapFramebufferFrag = "precision highp float;\nuniform float u_intensity;\nvarying float v_weight;\nvarying vec2 v_extrude;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(){\n float d = -0.5 * 3.0 * 3.0 * dot(v_extrude, v_extrude);\n float val = v_weight * u_intensity * GAUSS_COEF * exp(d);\n gl_FragColor = vec4(val, 1., 1., 1.);\n}\n";
30
- /* babel-plugin-inline-import '../shaders/heatmap_framebuffer_vert.glsl' */
31
- var heatmapFramebufferVert = "precision highp float;\nattribute vec3 a_Position;\nattribute float a_Size;\nattribute vec2 a_Dir;\nuniform float u_intensity;\nuniform float u_radius;\nvarying vec2 v_extrude;\nvarying float v_weight;\nuniform mat4 u_ModelMatrix;\n\n\n#define GAUSS_COEF 0.3989422804014327\n\n#pragma include \"projection\"\n\nvoid main(){\n v_weight = a_Size;\n float ZERO = 1.0 / 255.0 / 16.0;\n float extrude_x = a_Dir.x * 2.0 -1.0;\n float extrude_y = a_Dir.y * 2.0 -1.0;\n vec2 extrude_dir = normalize(vec2(extrude_x,extrude_y));\n float S = sqrt(-2.0 * log(ZERO / a_Size / u_intensity / GAUSS_COEF)) / 2.5;\n v_extrude = extrude_dir * S;\n\n vec2 offset = project_pixel(v_extrude * u_radius);\n vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));\n\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy + offset, 0.0, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n }\n}\n";
22
+ /* babel-plugin-inline-import '../shaders/heatmap/heatmap_3d_frag.glsl' */
23
+ var heatmap_3d_frag = "layout(std140) uniform commonUniforms {\n mat4 u_ViewProjectionMatrixUncentered;\n mat4 u_InverseViewProjectionMatrix;\n float u_opacity;\n float u_common_uniforms_padding1;\n float u_common_uniforms_padding2;\n float u_common_uniforms_padding3;\n};\n\nuniform sampler2D u_texture;\nuniform sampler2D u_colorTexture;\n\nin vec2 v_texCoord;\nin float v_intensity;\nout vec4 outputColor;\n\nvoid main(){\n \n float intensity = texture(SAMPLER_2D(u_texture), v_texCoord).r;\n vec4 color = texture(SAMPLER_2D(u_colorTexture),vec2(intensity, 0));\n outputColor = color;\n // gl_FragColor.a = color.a * smoothstep(0.1,0.2,intensity)* u_opacity;\n outputColor.a = color.a * smoothstep(0.,0.1,intensity) * u_opacity;\n}\n";
24
+ /* babel-plugin-inline-import '../shaders/heatmap/heatmap_3d_vert.glsl' */
25
+ var heatmap_3d_vert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 14) in vec2 a_Uv;\n\nlayout(std140) uniform commonUniforms {\n mat4 u_ViewProjectionMatrixUncentered;\n mat4 u_InverseViewProjectionMatrix;\n float u_opacity;\n float u_common_uniforms_padding1;\n float u_common_uniforms_padding2;\n float u_common_uniforms_padding3;\n};\n\nuniform sampler2D u_texture;\nuniform sampler2D u_colorTexture;\n\nout vec2 v_texCoord;\nout float v_intensity;\n\nvec2 toBezier(float t, vec2 P0, vec2 P1, vec2 P2, vec2 P3) {\n float t2 = t * t;\n float one_minus_t = 1.0 - t;\n float one_minus_t2 = one_minus_t * one_minus_t;\n return (P0 * one_minus_t2 * one_minus_t + P1 * 3.0 * t * one_minus_t2 + P2 * 3.0 * t2 * one_minus_t + P3 * t2 * t);\n}\nvec2 toBezier(float t, vec4 p){\n return toBezier(t, vec2(0.0, 0.0), vec2(p.x, p.y), vec2(p.z, p.w), vec2(1.0, 1.0));\n}\n\n#pragma include \"projection\"\n#pragma include \"project\"\n\nvoid main() {\n v_texCoord = a_Uv;\n\n vec2 pos = a_Uv * vec2(2.0) - vec2(1.0); // \u5C06\u539F\u672C 0 -> 1 \u7684 uv \u8F6C\u6362\u4E3A -1 -> 1 \u7684\u6807\u51C6\u5750\u6807\u7A7A\u95F4\uFF08NDC\uFF09\n\n vec4 p1 = vec4(pos, 0.0, 1.0); // x/y \u5E73\u9762\u4E0A\u7684\u70B9\uFF08z == 0\uFF09\u53EF\u4EE5\u8BA4\u4E3A\u662F\u4E09\u7EF4\u4E0A\u7684\u70B9\u88AB\u6295\u5F71\u5230\u5E73\u9762\u540E\u7684\u70B9\n\tvec4 p2 = vec4(pos, 1.0, 1.0); // \u5E73\u884C\u4E8Ex/y\u5E73\u9762\u3001z==1 \u7684\u5E73\u9762\u4E0A\u7684\u70B9\n\n\tvec4 inverseP1 = u_InverseViewProjectionMatrix * p1; // \u6839\u636E\u89C6\u56FE\u6295\u5F71\u77E9\u9635\u7684\u9006\u77E9\u9635\u5E73\u9762\u4E0A\u7684\u53CD\u7B97\u51FA\u4E09\u7EF4\u7A7A\u95F4\u4E2D\u7684\u70B9\uFF08p1\u5E73\u9762\u4E0A\u7684\u70B9\uFF09\n\tvec4 inverseP2 = u_InverseViewProjectionMatrix * p2;\n\n inverseP1 = inverseP1 / inverseP1.w; // \u5F52\u4E00\u5316\u64CD\u4F5C\uFF08\u5F52\u4E00\u5316\u540E\u4E3A\u4E16\u754C\u5750\u6807\uFF09\n\tinverseP2 = inverseP2 / inverseP2.w;\n\n\tfloat zPos = (0.0 - inverseP1.z) / (inverseP2.z - inverseP1.z); // ??\n\tvec4 position = inverseP1 + zPos * (inverseP2 - inverseP1);\n\n vec4 b= vec4(0.5000, 0.0, 1.0, 0.5000);\n float fh;\n\n v_intensity = texture(SAMPLER_2D(u_texture), v_texCoord).r;\n fh = toBezier(v_intensity, b).y;\n gl_Position = u_ViewProjectionMatrixUncentered * vec4(position.xy, fh * project_pixel(50.), 1.0);\n \n}\n"; // 绘制平面热力的 shader
26
+ /* babel-plugin-inline-import '../shaders/heatmap/heatmap_frag.glsl' */
27
+ var heatmap_frag = "uniform sampler2D u_texture; // \u70ED\u529B\u5F3A\u5EA6\u56FE\nuniform sampler2D u_colorTexture; // \u6839\u636E\u5F3A\u5EA6\u5206\u5E03\u7684\u8272\u5E26\n\nlayout(std140) uniform commonUniforms {\n float u_opacity;\n float u_common_uniforms_padding1;\n float u_common_uniforms_padding2;\n float u_common_uniforms_padding3;\n};\nin vec2 v_texCoord;\nout vec4 outputColor;\n\n#pragma include \"scene_uniforms\"\n\nfloat getBlurIndusty() {\n float vW = 2.0/ u_ViewportSize.x;\n float vH = 2.0/ u_ViewportSize.y;\n vec2 vUv = v_texCoord;\n float i11 = texture(SAMPLER_2D(u_texture), vec2( vUv.x - 1.0 * vW, vUv.y + 1.0 * vH) ).r;\n float i12 = texture(SAMPLER_2D(u_texture), vec2( vUv.x - 0.0 * vW, vUv.y + 1.0 * vH) ).r;\n float i13 = texture(SAMPLER_2D(u_texture), vec2( vUv.x + 1.0 * vW, vUv.y + 1.0 * vH) ).r;\n\n float i21 = texture(SAMPLER_2D(u_texture), vec2( vUv.x - 1.0 * vW, vUv.y) ).r;\n float i22 = texture(SAMPLER_2D(u_texture), vec2( vUv.x , vUv.y) ).r;\n float i23 = texture(SAMPLER_2D(u_texture), vec2( vUv.x + 1.0 * vW, vUv.y) ).r;\n\n float i31 = texture(SAMPLER_2D(u_texture), vec2( vUv.x - 1.0 * vW, vUv.y-1.0*vH) ).r;\n float i32 = texture(SAMPLER_2D(u_texture), vec2( vUv.x - 0.0 * vW, vUv.y-1.0*vH) ).r;\n float i33 = texture(SAMPLER_2D(u_texture), vec2( vUv.x + 1.0 * vW, vUv.y-1.0*vH) ).r;\n\n return(\n i11 + \n i12 + \n i13 + \n i21 + \n i21 + \n i22 + \n i23 + \n i31 + \n i32 + \n i33\n )/9.0;\n}\n\n\nvoid main(){\n // float intensity = texture(u_texture, v_texCoord).r;\n float intensity = getBlurIndusty();\n vec4 color = texture(SAMPLER_2D(u_colorTexture), vec2(intensity, 0.0));\n outputColor = color;\n outputColor.a = color.a * smoothstep(0.,0.1,intensity) * u_opacity;\n}\n";
28
+ /* babel-plugin-inline-import '../shaders/heatmap/heatmap_vert.glsl' */
29
+ var heatmap_vert = "\nlayout(location = 0) in vec3 a_Position;\nlayout(location = 14) in vec2 a_Uv;\n\nlayout(std140) uniform commonUniforms {\n float u_opacity;\n float u_common_uniforms_padding1;\n float u_common_uniforms_padding2;\n float u_common_uniforms_padding3;\n};\n\n#pragma include \"scene_uniforms\"\n\nout vec2 v_texCoord;\nvoid main() {\n v_texCoord = a_Uv;\n\n gl_Position = vec4(a_Position.xy, 0, 1.);\n}\n";
30
+ import { ShaderLocation } from "../../core/CommonStyleAttribute";
31
+ /* babel-plugin-inline-import '../shaders/heatmap/heatmap_framebuffer_frag.glsl' */
32
+ var heatmap_framebuffer_frag = "layout(std140) uniform commonUniforms {\n float u_radius;\n float u_intensity;\n float u_common_uniforms_padding1;\n float u_common_uniforms_padding2;\n};\n\nin float v_weight;\nin vec2 v_extrude;\nout vec4 outputColor;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(){\n float d = -0.5 * 3.0 * 3.0 * dot(v_extrude, v_extrude);\n float val = v_weight * u_intensity * GAUSS_COEF * exp(d);\n outputColor = vec4(val, 1., 1., 1.);\n}\n";
33
+ /* babel-plugin-inline-import '../shaders/heatmap/heatmap_framebuffer_vert.glsl' */
34
+ var heatmap_framebuffer_vert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 9) in float a_Size;\nlayout(location = 10) in vec2 a_Dir;\n\n\nlayout(std140) uniform commonUniforms {\n float u_radius;\n float u_intensity;\n float u_common_uniforms_padding1;\n float u_common_uniforms_padding2;\n};\n\nout vec2 v_extrude;\nout float v_weight;\n\n\n#define GAUSS_COEF 0.3989422804014327\n\n#pragma include \"projection\"\n\nvoid main(){\n v_weight = a_Size;\n float ZERO = 1.0 / 255.0 / 16.0;\n float extrude_x = a_Dir.x * 2.0 -1.0;\n float extrude_y = a_Dir.y * 2.0 -1.0;\n vec2 extrude_dir = normalize(vec2(extrude_x,extrude_y));\n float S = sqrt(-2.0 * log(ZERO / a_Size / u_intensity / GAUSS_COEF)) / 2.5;\n v_extrude = extrude_dir * S;\n\n vec2 offset = project_pixel(v_extrude * u_radius);\n vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));\n\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy + offset, 0.0, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n }\n}\n";
32
35
  import { heatMap3DTriangulation } from "../triangulation";
33
36
  var isEqual = lodashUtil.isEqual;
34
37
  var HeatMapModel = (_dec = injectable(), _dec(_class = /*#__PURE__*/function (_BaseModel) {
35
38
  _inherits(HeatMapModel, _BaseModel);
36
39
  var _super = _createSuper(HeatMapModel);
37
40
  function HeatMapModel() {
41
+ var _this;
38
42
  _classCallCheck(this, HeatMapModel);
39
- return _super.apply(this, arguments);
43
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
44
+ args[_key] = arguments[_key];
45
+ }
46
+ _this = _super.call.apply(_super, [this].concat(args));
47
+ _defineProperty(_assertThisInitialized(_this), "colorModelUniformBuffer", []);
48
+ _defineProperty(_assertThisInitialized(_this), "heat3DModelUniformBuffer", []);
49
+ return _this;
40
50
  }
41
51
  _createClass(HeatMapModel, [{
42
52
  key: "render",
43
53
  value: function render(options) {
44
- var _this = this;
54
+ var _this2 = this;
45
55
  var _this$rendererService = this.rendererService,
46
56
  clear = _this$rendererService.clear,
47
57
  useFramebuffer = _this$rendererService.useFramebuffer;
@@ -52,14 +62,16 @@ var HeatMapModel = (_dec = injectable(), _dec(_class = /*#__PURE__*/function (_B
52
62
  color: [0, 0, 0, 0],
53
63
  depth: 1,
54
64
  stencil: 0,
55
- framebuffer: _this.heatmapFramerBuffer
65
+ framebuffer: _this2.heatmapFramerBuffer
56
66
  });
57
- _this.drawIntensityMode();
67
+ _this2.drawIntensityMode(); // 密度图
58
68
  });
69
+
59
70
  if (!isEqual(this.preRampColors, rampColors)) {
60
71
  this.updateColorTexture();
61
72
  }
62
- this.shapeType === 'heatmap' ? this.drawColorMode(options) : this.draw3DHeatMap(options);
73
+ this.shapeType === 'heatmap' ? this.drawHeatMap(options) // 2D
74
+ : this.draw3DHeatMap(options); // 3D
63
75
  }
64
76
  }, {
65
77
  key: "getUninforms",
@@ -85,23 +97,25 @@ var HeatMapModel = (_dec = injectable(), _dec(_class = /*#__PURE__*/function (_B
85
97
  case 6:
86
98
  this.intensityModel = _context.sent;
87
99
  // 渲染到屏幕
88
- this.colorModel = shapeType === 'heatmap' ? this.buildHeatmapColor() // 2D
100
+ this.colorModel = shapeType === 'heatmap' ? this.buildHeatmap() // 2D
89
101
  : this.build3dHeatMap(); // 3D
90
102
  _getViewportSize = getViewportSize(), width = _getViewportSize.width, height = _getViewportSize.height; // 初始化密度图纹理
103
+ this.heatmapTexture = createTexture2D({
104
+ width: Math.floor(width / 4),
105
+ height: Math.floor(height / 4),
106
+ wrapS: gl.CLAMP_TO_EDGE,
107
+ wrapT: gl.CLAMP_TO_EDGE,
108
+ min: gl.LINEAR,
109
+ mag: gl.LINEAR,
110
+ usage: TextureUsage.RENDER_TARGET
111
+ });
91
112
  this.heatmapFramerBuffer = createFramebuffer({
92
- color: createTexture2D({
93
- width: Math.floor(width / 4),
94
- height: Math.floor(height / 4),
95
- wrapS: gl.CLAMP_TO_EDGE,
96
- wrapT: gl.CLAMP_TO_EDGE,
97
- min: gl.LINEAR,
98
- mag: gl.LINEAR
99
- }),
113
+ color: this.heatmapTexture,
100
114
  depth: false
101
115
  });
102
116
  this.updateColorTexture();
103
117
  return _context.abrupt("return", [this.intensityModel, this.colorModel]);
104
- case 12:
118
+ case 13:
105
119
  case "end":
106
120
  return _context.stop();
107
121
  }
@@ -139,6 +153,7 @@ var HeatMapModel = (_dec = injectable(), _dec(_class = /*#__PURE__*/function (_B
139
153
  type: AttributeType.Attribute,
140
154
  descriptor: {
141
155
  name: 'a_Dir',
156
+ shaderLocation: 10,
142
157
  buffer: {
143
158
  usage: gl.DYNAMIC_DRAW,
144
159
  data: [],
@@ -155,6 +170,7 @@ var HeatMapModel = (_dec = injectable(), _dec(_class = /*#__PURE__*/function (_B
155
170
  type: AttributeType.Attribute,
156
171
  descriptor: {
157
172
  name: 'a_Size',
173
+ shaderLocation: ShaderLocation.SIZE,
158
174
  buffer: {
159
175
  // give the WebGL driver a hint that this buffer may change
160
176
  usage: gl.DYNAMIC_DRAW,
@@ -178,12 +194,18 @@ var HeatMapModel = (_dec = injectable(), _dec(_class = /*#__PURE__*/function (_B
178
194
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
179
195
  while (1) switch (_context3.prev = _context3.next) {
180
196
  case 0:
197
+ this.uniformBuffers = [this.rendererService.createBuffer({
198
+ // opacity
199
+ data: new Float32Array(4).fill(0),
200
+ // 长度需要大于等于 4
201
+ isUBO: true
202
+ })];
181
203
  this.layer.triangulation = HeatmapTriangulation;
182
- _context3.next = 3;
204
+ _context3.next = 4;
183
205
  return this.layer.buildLayerModel({
184
206
  moduleName: 'heatmapIntensity',
185
- vertexShader: heatmapFramebufferVert,
186
- fragmentShader: heatmapFramebufferFrag,
207
+ vertexShader: heatmap_framebuffer_vert,
208
+ fragmentShader: heatmap_framebuffer_frag,
187
209
  triangulation: HeatmapTriangulation,
188
210
  depth: {
189
211
  enable: false
@@ -193,10 +215,10 @@ var HeatMapModel = (_dec = injectable(), _dec(_class = /*#__PURE__*/function (_B
193
215
  face: getCullFace(this.mapService.version)
194
216
  }
195
217
  });
196
- case 3:
218
+ case 4:
197
219
  model = _context3.sent;
198
220
  return _context3.abrupt("return", model);
199
- case 5:
221
+ case 6:
200
222
  case "end":
201
223
  return _context3.stop();
202
224
  }
@@ -208,12 +230,18 @@ var HeatMapModel = (_dec = injectable(), _dec(_class = /*#__PURE__*/function (_B
208
230
  return buildHeatMapIntensity;
209
231
  }()
210
232
  }, {
211
- key: "buildHeatmapColor",
212
- value: function buildHeatmapColor() {
233
+ key: "buildHeatmap",
234
+ value: function buildHeatmap() {
213
235
  this.shaderModuleService.registerModule('heatmapColor', {
214
- vs: heatmapColorVert,
215
- fs: heatmapColorFrag
236
+ vs: heatmap_vert,
237
+ fs: heatmap_frag
216
238
  });
239
+ this.colorModelUniformBuffer = [this.rendererService.createBuffer({
240
+ // opacity
241
+ data: new Float32Array(4).fill(0),
242
+ // 长度需要大于等于 4
243
+ isUBO: true
244
+ })];
217
245
  var _this$shaderModuleSer = this.shaderModuleService.getModule('heatmapColor'),
218
246
  vs = _this$shaderModuleSer.vs,
219
247
  fs = _this$shaderModuleSer.fs,
@@ -226,8 +254,10 @@ var HeatMapModel = (_dec = injectable(), _dec(_class = /*#__PURE__*/function (_B
226
254
  return createModel({
227
255
  vs: vs,
228
256
  fs: fs,
257
+ uniformBuffers: [].concat(_toConsumableArray(this.colorModelUniformBuffer), _toConsumableArray(this.rendererService.uniformBuffers)),
229
258
  attributes: {
230
259
  a_Position: createAttribute({
260
+ shaderLocation: ShaderLocation.POSITION,
231
261
  buffer: createBuffer({
232
262
  data: [-1, 1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0],
233
263
  type: gl.FLOAT
@@ -235,6 +265,7 @@ var HeatMapModel = (_dec = injectable(), _dec(_class = /*#__PURE__*/function (_B
235
265
  size: 3
236
266
  }),
237
267
  a_Uv: createAttribute({
268
+ shaderLocation: ShaderLocation.UV,
238
269
  buffer: createBuffer({
239
270
  data: [0, 1, 1, 1, 0, 0, 1, 0],
240
271
  type: gl.FLOAT
@@ -253,25 +284,30 @@ var HeatMapModel = (_dec = injectable(), _dec(_class = /*#__PURE__*/function (_B
253
284
  })
254
285
  });
255
286
  }
287
+ // 绘制密度图
256
288
  }, {
257
289
  key: "drawIntensityMode",
258
290
  value: function drawIntensityMode() {
259
291
  var _this$intensityModel;
260
292
  var _ref2 = this.layer.getLayerConfig(),
261
- opacity = _ref2.opacity,
262
293
  _ref2$intensity = _ref2.intensity,
263
294
  intensity = _ref2$intensity === void 0 ? 10 : _ref2$intensity,
264
295
  _ref2$radius = _ref2.radius,
265
296
  radius = _ref2$radius === void 0 ? 5 : _ref2$radius;
297
+ var commonOptions = {
298
+ u_radius: radius,
299
+ u_intensity: intensity
300
+ };
301
+ this.uniformBuffers[0].subData({
302
+ offset: 0,
303
+ data: [radius, intensity]
304
+ });
266
305
  this.layerService.beforeRenderData(this.layer);
267
306
  this.layer.hooks.beforeRender.call();
307
+
268
308
  // 绘制密度图
269
309
  (_this$intensityModel = this.intensityModel) === null || _this$intensityModel === void 0 || _this$intensityModel.draw({
270
- uniforms: {
271
- u_opacity: opacity || 1.0,
272
- u_radius: radius,
273
- u_intensity: intensity
274
- },
310
+ uniforms: commonOptions,
275
311
  blend: {
276
312
  enable: true,
277
313
  func: {
@@ -295,17 +331,25 @@ var HeatMapModel = (_dec = injectable(), _dec(_class = /*#__PURE__*/function (_B
295
331
  this.layer.hooks.afterRender.call();
296
332
  }
297
333
  }, {
298
- key: "drawColorMode",
299
- value: function drawColorMode(options) {
334
+ key: "drawHeatMap",
335
+ value: function drawHeatMap(options) {
300
336
  var _this$colorModel;
301
337
  var _ref3 = this.layer.getLayerConfig(),
302
- opacity = _ref3.opacity;
338
+ _ref3$opacity = _ref3.opacity,
339
+ opacity = _ref3$opacity === void 0 ? 1.0 : _ref3$opacity;
340
+ var commonOptions = {
341
+ u_opacity: opacity,
342
+ u_colorTexture: this.colorTexture,
343
+ u_texture: this.heatmapFramerBuffer
344
+ };
345
+ var textures = [this.heatmapTexture, this.colorTexture];
346
+ this.colorModelUniformBuffer[0].subData({
347
+ offset: 0,
348
+ data: [opacity]
349
+ });
303
350
  (_this$colorModel = this.colorModel) === null || _this$colorModel === void 0 || _this$colorModel.draw({
304
- uniforms: {
305
- u_opacity: opacity || 1.0,
306
- u_colorTexture: this.colorTexture,
307
- u_texture: this.heatmapFramerBuffer
308
- },
351
+ uniforms: commonOptions,
352
+ textures: textures,
309
353
  blend: this.getBlend(),
310
354
  stencil: this.getStencil(options)
311
355
  });
@@ -315,25 +359,25 @@ var HeatMapModel = (_dec = injectable(), _dec(_class = /*#__PURE__*/function (_B
315
359
  value: function draw3DHeatMap(options) {
316
360
  var _this$colorModel2;
317
361
  var _ref4 = this.layer.getLayerConfig(),
318
- opacity = _ref4.opacity;
319
-
320
- // const invert = mat4.invert(
321
- // mat4.create(),
322
- // mat4.fromValues(
323
- // // @ts-ignore
324
- // ...this.cameraService.getViewProjectionMatrixUncentered(),
325
- // ),
326
- // ) as mat4;
362
+ _ref4$opacity = _ref4.opacity,
363
+ opacity = _ref4$opacity === void 0 ? 1.0 : _ref4$opacity;
327
364
  var invert = mat4.create();
328
365
  mat4.invert(invert, this.cameraService.getViewProjectionMatrixUncentered());
366
+ var commonOptions = {
367
+ u_opacity: opacity,
368
+ u_colorTexture: this.colorTexture,
369
+ u_texture: this.heatmapFramerBuffer,
370
+ u_ViewProjectionMatrixUncentered: this.cameraService.getViewProjectionMatrixUncentered(),
371
+ u_InverseViewProjectionMatrix: _toConsumableArray(invert)
372
+ };
373
+ this.heat3DModelUniformBuffer[0].subData({
374
+ offset: 0,
375
+ data: [].concat(_toConsumableArray(commonOptions.u_ViewProjectionMatrixUncentered), _toConsumableArray(commonOptions.u_InverseViewProjectionMatrix), [opacity])
376
+ });
377
+ var textures = [this.heatmapTexture, this.colorTexture];
329
378
  (_this$colorModel2 = this.colorModel) === null || _this$colorModel2 === void 0 || _this$colorModel2.draw({
330
- uniforms: {
331
- u_opacity: opacity || 1.0,
332
- u_colorTexture: this.colorTexture,
333
- u_texture: this.heatmapFramerBuffer,
334
- u_ViewProjectionMatrixUncentered: this.cameraService.getViewProjectionMatrixUncentered(),
335
- u_InverseViewProjectionMatrix: _toConsumableArray(invert)
336
- },
379
+ uniforms: commonOptions,
380
+ textures: textures,
337
381
  blend: {
338
382
  enable: true,
339
383
  func: {
@@ -355,9 +399,15 @@ var HeatMapModel = (_dec = injectable(), _dec(_class = /*#__PURE__*/function (_B
355
399
  height = _getViewportSize2.height;
356
400
  var triangulation = heatMap3DTriangulation(width / 4.0, height / 4.0);
357
401
  this.shaderModuleService.registerModule('heatmap3dColor', {
358
- vs: heatmap3DVert,
359
- fs: heatmap3DFrag
402
+ vs: heatmap_3d_vert,
403
+ fs: heatmap_3d_frag
360
404
  });
405
+ this.heat3DModelUniformBuffer = [this.rendererService.createBuffer({
406
+ // opacity
407
+ data: new Float32Array(16 * 2 + 4).fill(0),
408
+ // 长度需要大于等于 4
409
+ isUBO: true
410
+ })];
361
411
  var _this$shaderModuleSer2 = this.shaderModuleService.getModule('heatmap3dColor'),
362
412
  vs = _this$shaderModuleSer2.vs,
363
413
  fs = _this$shaderModuleSer2.fs,
@@ -372,6 +422,7 @@ var HeatMapModel = (_dec = injectable(), _dec(_class = /*#__PURE__*/function (_B
372
422
  fs: fs,
373
423
  attributes: {
374
424
  a_Position: createAttribute({
425
+ shaderLocation: ShaderLocation.POSITION,
375
426
  buffer: createBuffer({
376
427
  data: triangulation.vertices,
377
428
  type: gl.FLOAT
@@ -379,6 +430,7 @@ var HeatMapModel = (_dec = injectable(), _dec(_class = /*#__PURE__*/function (_B
379
430
  size: 3
380
431
  }),
381
432
  a_Uv: createAttribute({
433
+ shaderLocation: ShaderLocation.UV,
382
434
  buffer: createBuffer({
383
435
  data: triangulation.uvs,
384
436
  type: gl.FLOAT
@@ -387,6 +439,7 @@ var HeatMapModel = (_dec = injectable(), _dec(_class = /*#__PURE__*/function (_B
387
439
  })
388
440
  },
389
441
  primitive: gl.TRIANGLES,
442
+ uniformBuffers: [].concat(_toConsumableArray(this.heat3DModelUniformBuffer), _toConsumableArray(this.rendererService.uniformBuffers)),
390
443
  uniforms: _objectSpread({}, uniforms),
391
444
  depth: {
392
445
  enable: true
@@ -407,11 +460,6 @@ var HeatMapModel = (_dec = injectable(), _dec(_class = /*#__PURE__*/function (_B
407
460
  })
408
461
  });
409
462
  }
410
- }, {
411
- key: "updateStyle",
412
- value: function updateStyle() {
413
- this.updateColorTexture();
414
- }
415
463
  }, {
416
464
  key: "updateColorTexture",
417
465
  value: function updateColorTexture() {
@@ -1,7 +1,14 @@
1
- import { IModel, IModelUniform } from '@antv/l7-core';
1
+ import type { IModel, IModelUniform } from '@antv/l7-core';
2
2
  import BaseModel from '../../core/BaseModel';
3
3
  export default class HexagonModel extends BaseModel {
4
4
  getUninforms(): IModelUniform;
5
+ protected getCommonUniformsInfo(): {
6
+ uniformsArray: number[];
7
+ uniformsLength: number;
8
+ uniformsOption: {
9
+ [key: string]: any;
10
+ };
11
+ };
5
12
  initModels(): Promise<IModel[]>;
6
13
  buildModels(): Promise<IModel[]>;
7
14
  protected registerBuiltinAttributes(): void;
@@ -1,4 +1,5 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
3
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
4
  import _createClass from "@babel/runtime/helpers/esm/createClass";
4
5
  import _inherits from "@babel/runtime/helpers/esm/inherits";
@@ -10,10 +11,10 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
10
11
  import { AttributeType, gl } from '@antv/l7-core';
11
12
  import BaseModel from "../../core/BaseModel";
12
13
  import { HeatmapGridTriangulation } from "../../core/triangulation";
13
- /* babel-plugin-inline-import '../shaders/hexagon_frag.glsl' */
14
- var heatmapGridFrag = "precision highp float;\nvarying vec4 v_color;\nuniform float u_opacity: 1;\n\n#pragma include \"picking\"\n\nvoid main() {\n gl_FragColor = v_color;\n gl_FragColor.a *= u_opacity;\n\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
15
- /* babel-plugin-inline-import '../shaders/hexagon_vert.glsl' */
16
- var heatmapGridVert = "precision highp float;\n// \u591A\u8FB9\u5F62\u9876\u70B9\u5750\u6807\nattribute vec3 a_Position;\n// \u591A\u8FB9\u5F62\u7ECF\u7EAC\u5EA6\u5750\u6807\nattribute vec3 a_Pos;\nattribute float a_Size;\nattribute vec4 a_Color;\nuniform vec2 u_radius;\nuniform float u_coverage: 0.9;\nuniform float u_angle: 0;\nuniform mat4 u_ModelMatrix;\n\nvarying vec4 v_color;\n\nuniform vec2 u_sceneCenterMercator;\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"picking\"\n\nvoid main() {\n v_color = a_Color;\n \n mat2 rotationMatrix = mat2(cos(u_angle), sin(u_angle), -sin(u_angle), cos(u_angle));\n vec2 offset =(vec2(a_Position.xy * u_radius * rotationMatrix * u_coverage));\n vec2 lnglat = unProjectFlat(a_Pos.xy + offset);\n \n // vec4 project_pos = project_position(vec4(lnglat, 0, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0., 1.0));\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n // gl_Position = u_Mvp * (vec4(project_pos.xy, 0., 1.0));\n // gl_Position = u_Mvp * (vec4(a_Pos.xy + offset, 0., 1.0));\n vec2 customLnglat = customProject(lnglat) - u_sceneCenterMercator;\n vec4 project_pos = project_position(vec4(customLnglat, 0, 1.0));\n gl_Position = u_Mvp * vec4(project_pos.xy, 0.0, 1.0);\n } else {\n vec4 project_pos = project_position(vec4(lnglat, 0, 1.0));\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0., 1.0));\n }\n setPickingColor(a_PickingColor);\n}\n";
14
+ /* babel-plugin-inline-import '../shaders/hexagon/hexagon_frag.glsl' */
15
+ var hexagon_frag = "in vec4 v_color;\n\n#pragma include \"picking\"\nout vec4 outputColor;\nvoid main() {\n outputColor = v_color;\n outputColor = filterColor(outputColor);\n}\n";
16
+ /* babel-plugin-inline-import '../shaders/hexagon/hexagon_vert.glsl' */
17
+ var hexagon_vert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 10) in vec3 a_Pos;\n\nlayout(std140) uniform commonUniforms {\n vec2 u_radius;\n float u_opacity;\n float u_coverage;\n float u_angle;\n};\n\nout vec4 v_color;\n\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"picking\"\n\nvoid main() {\n v_color = a_Color;\n v_color.a *= u_opacity;\n \n mat2 rotationMatrix = mat2(cos(u_angle), sin(u_angle), -sin(u_angle), cos(u_angle));\n vec2 offset =(vec2(a_Position.xy * u_radius * rotationMatrix * u_coverage));\n vec2 lnglat = unProjectFlat(a_Pos.xy + offset);\n \n // vec4 project_pos = project_position(vec4(lnglat, 0, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0., 1.0));\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n // gl_Position = u_Mvp * (vec4(project_pos.xy, 0., 1.0));\n // gl_Position = u_Mvp * (vec4(a_Pos.xy + offset, 0., 1.0));\n vec2 customLnglat = customProject(lnglat) - u_sceneCenterMercator;\n vec4 project_pos = project_position(vec4(customLnglat, 0, 1.0));\n gl_Position = u_Mvp * vec4(project_pos.xy, 0.0, 1.0);\n } else {\n vec4 project_pos = project_position(vec4(lnglat, 0, 1.0));\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0., 1.0));\n }\n setPickingColor(a_PickingColor);\n}\n";
17
18
  var HexagonModel = /*#__PURE__*/function (_BaseModel) {
18
19
  _inherits(HexagonModel, _BaseModel);
19
20
  var _super = _createSuper(HexagonModel);
@@ -24,16 +25,26 @@ var HexagonModel = /*#__PURE__*/function (_BaseModel) {
24
25
  _createClass(HexagonModel, [{
25
26
  key: "getUninforms",
26
27
  value: function getUninforms() {
28
+ var commoninfo = this.getCommonUniformsInfo();
29
+ var attributeInfo = this.getUniformsBufferInfo(this.getStyleAttribute());
30
+ this.updateStyleUnifoms();
31
+ return _objectSpread(_objectSpread({}, commoninfo.uniformsOption), attributeInfo.uniformsOption);
32
+ }
33
+ }, {
34
+ key: "getCommonUniformsInfo",
35
+ value: function getCommonUniformsInfo() {
27
36
  var _ref = this.layer.getLayerConfig(),
28
37
  opacity = _ref.opacity,
29
38
  coverage = _ref.coverage,
30
39
  angle = _ref.angle;
31
- return {
40
+ var commonOptions = {
41
+ u_radius: [this.layer.getSource().data.xOffset, this.layer.getSource().data.yOffset],
32
42
  u_opacity: opacity || 1.0,
33
43
  u_coverage: coverage || 0.9,
34
- u_angle: angle || 0,
35
- u_radius: [this.layer.getSource().data.xOffset, this.layer.getSource().data.yOffset]
44
+ u_angle: angle || 0
36
45
  };
46
+ var commonBufferInfo = this.getUniformsBufferInfo(commonOptions);
47
+ return commonBufferInfo;
37
48
  }
38
49
  }, {
39
50
  key: "initModels",
@@ -62,21 +73,22 @@ var HexagonModel = /*#__PURE__*/function (_BaseModel) {
62
73
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
63
74
  while (1) switch (_context2.prev = _context2.next) {
64
75
  case 0:
65
- _context2.next = 2;
76
+ this.initUniformsBuffer();
77
+ _context2.next = 3;
66
78
  return this.layer.buildLayerModel({
67
79
  moduleName: 'heatmapHexagon',
68
- vertexShader: heatmapGridVert,
69
- fragmentShader: heatmapGridFrag,
80
+ vertexShader: hexagon_vert,
81
+ fragmentShader: hexagon_frag,
70
82
  triangulation: HeatmapGridTriangulation,
71
83
  depth: {
72
84
  enable: false
73
85
  },
74
86
  primitive: gl.TRIANGLES
75
87
  });
76
- case 2:
88
+ case 3:
77
89
  model = _context2.sent;
78
90
  return _context2.abrupt("return", [model]);
79
- case 4:
91
+ case 5:
80
92
  case "end":
81
93
  return _context2.stop();
82
94
  }
@@ -96,6 +108,7 @@ var HexagonModel = /*#__PURE__*/function (_BaseModel) {
96
108
  type: AttributeType.Attribute,
97
109
  descriptor: {
98
110
  name: 'a_Pos',
111
+ shaderLocation: 10,
99
112
  buffer: {
100
113
  usage: gl.DYNAMIC_DRAW,
101
114
  data: [],
@@ -0,0 +1,8 @@
1
+ in vec4 v_color;
2
+
3
+ #pragma include "picking"
4
+ out vec4 outputColor;
5
+ void main() {
6
+ outputColor = v_color;
7
+ outputColor = filterColor(outputColor);
8
+ }
@@ -1,18 +1,17 @@
1
- precision highp float;
2
- // 多边形顶点坐标
3
- attribute vec3 a_Position;
4
- // 多边形经纬度坐标
5
- attribute vec3 a_Pos;
6
- attribute float a_Size;
7
- attribute vec4 a_Color;
8
- uniform vec2 u_radius;
9
- uniform float u_coverage: 0.9;
10
- uniform float u_angle: 0;
11
- uniform mat4 u_ModelMatrix;
12
-
13
- varying vec4 v_color;
14
-
15
- uniform vec2 u_sceneCenterMercator;
1
+ layout(location = 0) in vec3 a_Position;
2
+ layout(location = 1) in vec4 a_Color;
3
+ layout(location = 10) in vec3 a_Pos;
4
+
5
+ layout(std140) uniform commonUniforms {
6
+ vec2 u_radius;
7
+ float u_opacity;
8
+ float u_coverage;
9
+ float u_angle;
10
+ };
11
+
12
+
13
+ out vec4 v_color;
14
+
16
15
 
17
16
  #pragma include "projection"
18
17
  #pragma include "project"
@@ -20,6 +19,7 @@ uniform vec2 u_sceneCenterMercator;
20
19
 
21
20
  void main() {
22
21
  v_color = a_Color;
22
+ v_color.a *= u_opacity;
23
23
 
24
24
  mat2 rotationMatrix = mat2(cos(u_angle), sin(u_angle), -sin(u_angle), cos(u_angle));
25
25
  vec2 offset = a_Position.xy * u_radius * rotationMatrix * u_coverage ;
@@ -0,0 +1,8 @@
1
+ in vec4 v_color;
2
+
3
+ #pragma include "picking"
4
+ out vec4 outputColor;
5
+ void main() {
6
+ outputColor = v_color;
7
+ outputColor = filterColor(outputColor);
8
+ }
@@ -1,20 +1,17 @@
1
- precision highp float;
2
- // 多边形顶点坐标
3
- attribute vec3 a_Position;
4
- // 多边形经纬度坐标
5
- attribute vec3 a_Pos;
1
+ layout(location = 0) in vec3 a_Position;
2
+ layout(location = 1) in vec4 a_Color;
3
+ layout(location = 9) in float a_Size;
4
+ layout(location = 10) in vec3 a_Pos;
5
+ layout(location = 13) in vec3 a_Normal;
6
6
 
7
- attribute vec3 a_Normal;
8
- attribute float a_Size;
9
- attribute vec4 a_Color;
10
- uniform vec2 u_radius;
11
- uniform float u_coverage: 0.9;
12
- uniform float u_angle: 0;
13
- uniform mat4 u_ModelMatrix;
7
+ layout(std140) uniform commonUniforms {
8
+ vec2 u_radius;
9
+ float u_opacity;
10
+ float u_coverage;
11
+ float u_angle;
12
+ };
14
13
 
15
- varying vec4 v_color;
16
-
17
- uniform vec2 u_sceneCenterMercator;
14
+ out vec4 v_color;
18
15
 
19
16
  #pragma include "projection"
20
17
  #pragma include "project"
@@ -34,7 +31,7 @@ void main() {
34
31
  vec4 project_pos = project_position(vec4(customLnglat, a_Position.z * a_Size, 1.0));
35
32
 
36
33
  float lightWeight = calc_lighting(project_pos);
37
- v_color =vec4(a_Color.rgb*lightWeight, a_Color.w);
34
+ v_color =vec4(a_Color.rgb*lightWeight, a_Color.w * u_opacity);
38
35
 
39
36
  gl_Position = u_Mvp * vec4(customLnglat , a_Position.z * a_Size, 1.0);
40
37
  } else {
@@ -0,0 +1,24 @@
1
+ layout(std140) uniform commonUniforms {
2
+ mat4 u_ViewProjectionMatrixUncentered;
3
+ mat4 u_InverseViewProjectionMatrix;
4
+ float u_opacity;
5
+ float u_common_uniforms_padding1;
6
+ float u_common_uniforms_padding2;
7
+ float u_common_uniforms_padding3;
8
+ };
9
+
10
+ uniform sampler2D u_texture;
11
+ uniform sampler2D u_colorTexture;
12
+
13
+ in vec2 v_texCoord;
14
+ in float v_intensity;
15
+ out vec4 outputColor;
16
+
17
+ void main(){
18
+
19
+ float intensity = texture(SAMPLER_2D(u_texture), v_texCoord).r;
20
+ vec4 color = texture(SAMPLER_2D(u_colorTexture),vec2(intensity, 0));
21
+ outputColor = color;
22
+ // gl_FragColor.a = color.a * smoothstep(0.1,0.2,intensity)* u_opacity;
23
+ outputColor.a = color.a * smoothstep(0.,0.1,intensity) * u_opacity;
24
+ }