@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,5 +1,4 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
2
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
4
3
  import _createClass from "@babel/runtime/helpers/esm/createClass";
5
4
  import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
@@ -13,11 +12,12 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
13
12
  import { AttributeType, gl } from '@antv/l7-core';
14
13
  import { rgb2arr } from '@antv/l7-utils';
15
14
  import BaseModel from "../../core/BaseModel";
15
+ import { ShaderLocation } from "../../core/CommonStyleAttribute";
16
16
  import { LineTriangulation } from "../../core/triangulation";
17
17
  /* babel-plugin-inline-import '../shaders/wall/wall_frag.glsl' */
18
- var line_frag = "#define Animate 0.0\n#define LineTexture 1.0\n\n// line texture\nuniform float u_line_texture;\nuniform sampler2D u_texture;\nuniform vec2 u_textSize;\nuniform float u_linearColor: 0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\nuniform float u_textureBlend;\nuniform float u_iconStepCount;\nuniform float u_time;\nuniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ]; // \u63A7\u5236\u8FD0\u52A8\n\nvarying vec2 v_iconMapUV;\nvarying float v_blur;\nvarying float v_radio;\nvarying vec4 v_color;\nvarying vec4 v_dataset;\n\n#pragma include \"picking\"\n\nvoid main() {\n float animateSpeed = 0.0; // \u8FD0\u52A8\u901F\u5EA6\n float d_distance_ratio = v_dataset.r; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n float v = v_dataset.a;\n\n if(u_linearColor == 1.0) { // \u4F7F\u7528\u6E10\u53D8\u989C\u8272\n gl_FragColor = mix(u_sourceColor, u_targetColor, v);\n } else { // \u4F7F\u7528 color \u65B9\u6CD5\u4F20\u5165\u7684\u989C\u8272\n gl_FragColor = v_color;\n }\n\n gl_FragColor.a *= v_color.a; // \u5168\u5C40\u900F\u660E\u5EA6\n if(u_animate.x == Animate) {\n animateSpeed = u_time / u_animate.y;\n float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_animate.z)* (1.0/ u_animate.z) + animateSpeed);\n alpha = (alpha + u_animate.w -1.0) / u_animate.w;\n alpha = smoothstep(0., 1., alpha);\n gl_FragColor.a *= alpha;\n }\n\n if(u_line_texture == LineTexture) { // while load texture\n float aDistance = v_dataset.g; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n float d_texPixelLen = v_dataset.b; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n float u = fract(mod(aDistance, d_texPixelLen)/d_texPixelLen - animateSpeed);\n float v = v_dataset.a; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n // \u8BA1\u7B97\u7EB9\u7406\u95F4\u9694 start\n float flag = 0.0;\n if(u > 1.0/u_iconStepCount) {\n flag = 1.0;\n }\n u = fract(u*u_iconStepCount);\n // \u8BA1\u7B97\u7EB9\u7406\u95F4\u9694 end\n\n vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;\n vec4 pattern = texture2D(u_texture, uv);\n\n // Tip: \u5224\u65AD\u7EB9\u7406\u95F4\u9694\n if(flag > 0.0) {\n pattern = vec4(0.0);\n }\n\n if(u_textureBlend == 0.0) { // normal\n pattern.a = 0.0;\n gl_FragColor = filterColor(gl_FragColor + pattern);\n } else { // replace\n pattern.a *= v_color.a;\n if(gl_FragColor.a <= 0.0) {\n pattern.a = 0.0;\n }\n gl_FragColor = filterColor(pattern);\n }\n }\n \n\n // blur - AA\n if(v < v_blur) {\n gl_FragColor.a = mix(0.0, gl_FragColor.a, v/v_blur);\n } else if(v > 1.0 - v_blur) {\n gl_FragColor.a = mix(gl_FragColor.a, 0.0, (v - (1.0 - v_blur))/v_blur);\n }\n\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
18
+ var line_frag = "#define Animate 0.0\n#define LineTexture 1.0\n\n// line texture\n\nuniform sampler2D u_texture;\nlayout(std140) uniform commonUniorm {\n vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n vec4 u_sourceColor;\n vec4 u_targetColor;\n vec2 u_textSize;\n float u_icon_step: 100;\n float u_heightfixed;\n float u_linearColor: 0;\n float u_line_texture;\n float u_textureBlend;\n float u_iconStepCount;\n float u_time;\n};\nin vec2 v_iconMapUV;\nin float v_blur;\nin float v_radio;\nin vec4 v_color;\nin vec4 v_dataset;\n\nout vec4 outputColor;\n#pragma include \"picking\"\n\nvoid main() {\n float animateSpeed = 0.0; // \u8FD0\u52A8\u901F\u5EA6\n float d_distance_ratio = v_dataset.r; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n float v = v_dataset.a;\n\n if(u_linearColor == 1.0) { // \u4F7F\u7528\u6E10\u53D8\u989C\u8272\n outputColor = mix(u_sourceColor, u_targetColor, v);\n } else { // \u4F7F\u7528 color \u65B9\u6CD5\u4F20\u5165\u7684\u989C\u8272\n outputColor = v_color;\n }\n\n outputColor.a *= v_color.a; // \u5168\u5C40\u900F\u660E\u5EA6\n if(u_animate.x == Animate) {\n animateSpeed = u_time / u_animate.y;\n float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_animate.z)* (1.0/ u_animate.z) + animateSpeed);\n alpha = (alpha + u_animate.w -1.0) / u_animate.w;\n alpha = smoothstep(0., 1., alpha);\n outputColor.a *= alpha;\n }\n\n if(u_line_texture == LineTexture) { // while load texture\n float aDistance = v_dataset.g; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n float d_texPixelLen = v_dataset.b; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n float u = fract(mod(aDistance, d_texPixelLen)/d_texPixelLen - animateSpeed);\n float v = v_dataset.a; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n // \u8BA1\u7B97\u7EB9\u7406\u95F4\u9694 start\n float flag = 0.0;\n if(u > 1.0/u_iconStepCount) {\n flag = 1.0;\n }\n u = fract(u*u_iconStepCount);\n // \u8BA1\u7B97\u7EB9\u7406\u95F4\u9694 end\n\n vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;\n vec4 pattern = texture(SAMPLER_2D(u_texture), uv);\n\n // Tip: \u5224\u65AD\u7EB9\u7406\u95F4\u9694\n if(flag > 0.0) {\n pattern = vec4(0.0);\n }\n\n if(u_textureBlend == 0.0) { // normal\n pattern.a = 0.0;\n outputColor = filterColor(outputColor + pattern);\n } else { // replace\n pattern.a *= v_color.a;\n if(outputColor.a <= 0.0) {\n pattern.a = 0.0;\n }\n outputColor = filterColor(pattern);\n }\n }\n \n\n // blur - AA\n if(v < v_blur) {\n outputColor.a = mix(0.0, outputColor.a, v/v_blur);\n } else if(v > 1.0 - v_blur) {\n outputColor.a = mix(outputColor.a, 0.0, (v - (1.0 - v_blur))/v_blur);\n }\n\n outputColor = filterColor(outputColor);\n}\n";
19
19
  /* babel-plugin-inline-import '../shaders/wall/wall_vert.glsl' */
20
- var line_vert = "#define Animate 0.0\n\nattribute float a_Miter;\nattribute vec4 a_Color;\nattribute vec2 a_Size;\nattribute vec3 a_Normal;\nattribute vec3 a_Position;\nattribute vec2 a_iconMapUV;\nattribute float a_Total_Distance;\nattribute float a_Distance;\n\nuniform mat4 u_ModelMatrix;\n\nuniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\nuniform float u_icon_step: 100;\nuniform float u_heightfixed;\nuniform float u_linearColor: 0;\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\n// texV \u7EBF\u56FE\u5C42 - \u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\uFF08\u7EBF\u7684\u5BBD\u5EA6\u65B9\u5411\uFF09\nvarying vec2 v_iconMapUV;\nvarying vec4 v_color;\nvarying float v_blur;\nvarying float v_radio;\nvarying vec4 v_dataset;\n\nvoid main() {\n\n\n float d_distance_ratio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n float d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n\n v_iconMapUV = a_iconMapUV;\n if(u_heightfixed < 1.0) { // \u9AD8\u5EA6\u968F zoom \u8C03\u6574\n d_texPixelLen = project_pixel(u_icon_step);\n } else {\n d_texPixelLen = u_icon_step;\n }\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {\n d_texPixelLen *= 10.0;\n }\n\n if(u_animate.x == Animate || u_linearColor == 1.0) {\n d_distance_ratio = a_Distance / a_Total_Distance;\n }\n\n float miter = (a_Miter + 1.0)/2.0;\n // \u8BBE\u7F6E\u6570\u636E\u96C6\u7684\u53C2\u6570\n v_dataset[0] = d_distance_ratio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n v_dataset[1] = a_Distance; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n v_dataset[2] = d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n v_dataset[3] = miter; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C 0 - 1\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n float originSize = a_Size.x; // \u56FA\u5B9A\u9AD8\u5EA6\n if(u_heightfixed < 1.0) { \n originSize = project_float_meter(a_Size.x); // \u9AD8\u5EA6\u968F zoom \u8C03\u6574\n }\n\n\n float wallHeight = originSize * miter;\n float lightWeight = calc_lighting(vec4(project_pos.xy, wallHeight, 1.0));\n\n v_blur = min(project_float_pixel(2.0) / originSize, 0.05);\n v_color = vec4(a_Color.rgb * lightWeight, a_Color.w * opacity);\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy, wallHeight, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, wallHeight, 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}\n";
20
+ var line_vert = "#define Animate 0.0\nlayout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 9) in vec2 a_Size;\nlayout(location = 10) in float a_Miter;\nlayout(location = 11) in float a_Total_Distance;\nlayout(location = 12) in vec4 a_Instance;\nlayout(location = 13) in vec3 a_Normal;\nlayout(location = 14) in vec2 a_iconMapUV;\nlayout(location = 15) in float a_Distance;\n\n\nlayout(std140) uniform commonUniorm {\n vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n vec4 u_sourceColor;\n vec4 u_targetColor;\n vec2 u_textSize;\n float u_icon_step: 100;\n float u_heightfixed;\n float u_linearColor: 0;\n float u_line_texture;\n float u_textureBlend;\n float u_iconStepCount;\n float u_time;\n};\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\n// texV \u7EBF\u56FE\u5C42 - \u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\uFF08\u7EBF\u7684\u5BBD\u5EA6\u65B9\u5411\uFF09\nout vec2 v_iconMapUV;\nout vec4 v_color;\nout float v_blur;\nout float v_radio;\nout vec4 v_dataset;\n\nvoid main() {\n\n\n float d_distance_ratio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n float d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n\n v_iconMapUV = a_iconMapUV;\n if(u_heightfixed < 1.0) { // \u9AD8\u5EA6\u968F zoom \u8C03\u6574\n d_texPixelLen = project_pixel(u_icon_step);\n } else {\n d_texPixelLen = u_icon_step;\n }\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {\n d_texPixelLen *= 10.0;\n }\n\n if(u_animate.x == Animate || u_linearColor == 1.0) {\n d_distance_ratio = a_Distance / a_Total_Distance;\n }\n\n float miter = (a_Miter + 1.0)/2.0;\n // \u8BBE\u7F6E\u6570\u636E\u96C6\u7684\u53C2\u6570\n v_dataset[0] = d_distance_ratio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n v_dataset[1] = a_Distance; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n v_dataset[2] = d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n v_dataset[3] = miter; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C 0 - 1\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n float originSize = a_Size.x; // \u56FA\u5B9A\u9AD8\u5EA6\n if(u_heightfixed < 1.0) { \n originSize = project_float_meter(a_Size.x); // \u9AD8\u5EA6\u968F zoom \u8C03\u6574\n }\n\n\n float wallHeight = originSize * miter;\n float lightWeight = calc_lighting(vec4(project_pos.xy, wallHeight, 1.0));\n\n v_blur = min(project_float_pixel(2.0) / originSize, 0.05);\n v_color = vec4(a_Color.rgb * lightWeight, a_Color.w * opacity);\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy, wallHeight, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, wallHeight, 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}\n";
21
21
  var LineWallModel = /*#__PURE__*/function (_BaseModel) {
22
22
  _inherits(LineWallModel, _BaseModel);
23
23
  var _super = _createSuper(LineWallModel);
@@ -45,12 +45,13 @@ var LineWallModel = /*#__PURE__*/function (_BaseModel) {
45
45
  width: 1024,
46
46
  height: _this.iconService.canvasHeight || 128
47
47
  });
48
+ _this.textures = [_this.texture];
48
49
  });
49
50
  return _this;
50
51
  }
51
52
  _createClass(LineWallModel, [{
52
- key: "getUninforms",
53
- value: function getUninforms() {
53
+ key: "getCommonUniformsInfo",
54
+ value: function getCommonUniformsInfo() {
54
55
  var _ref = this.layer.getLayerConfig(),
55
56
  sourceColor = _ref.sourceColor,
56
57
  targetColor = _ref.targetColor,
@@ -64,6 +65,8 @@ var LineWallModel = /*#__PURE__*/function (_BaseModel) {
64
65
  iconStep = _ref$iconStep === void 0 ? 100 : _ref$iconStep,
65
66
  _ref$iconStepCount = _ref.iconStepCount,
66
67
  iconStepCount = _ref$iconStepCount === void 0 ? 1 : _ref$iconStepCount;
68
+ var _ref2 = this.layer.getLayerConfig(),
69
+ animateOption = _ref2.animateOption;
67
70
  if (this.rendererService.getDirty()) {
68
71
  this.texture.bind();
69
72
  }
@@ -77,33 +80,31 @@ var LineWallModel = /*#__PURE__*/function (_BaseModel) {
77
80
  targetColorArr = rgb2arr(targetColor);
78
81
  useLinearColor = 1;
79
82
  }
80
- return _objectSpread({
83
+ var commonOptions = {
84
+ u_animate: this.animateOption2Array(animateOption),
85
+ u_sourceColor: sourceColorArr,
86
+ u_targetColor: targetColorArr,
87
+ u_textSize: [1024, this.iconService.canvasHeight || 128],
88
+ u_icon_step: iconStep,
81
89
  u_heightfixed: Number(heightfixed),
82
- u_textureBlend: textureBlend === 'normal' ? 0.0 : 1.0,
83
- // 纹理支持参数
84
- u_texture: this.texture,
85
- // 贴图
90
+ // 渐变色支持参数
91
+ u_linearColor: useLinearColor,
86
92
  u_line_texture: lineTexture ? 1.0 : 0.0,
87
93
  // 传入线的标识
94
+ u_textureBlend: textureBlend === 'normal' ? 0.0 : 1.0,
88
95
  u_iconStepCount: iconStepCount,
89
- u_icon_step: iconStep,
90
- u_textSize: [1024, this.iconService.canvasHeight || 128],
91
- // 渐变色支持参数
92
- u_linearColor: useLinearColor,
93
- u_sourceColor: sourceColorArr,
94
- u_targetColor: targetColorArr
95
- }, this.getStyleAttribute());
96
- }
97
- }, {
98
- key: "getAnimateUniforms",
99
- value: function getAnimateUniforms() {
100
- var _ref2 = this.layer.getLayerConfig(),
101
- animateOption = _ref2.animateOption;
102
- return {
103
- u_animate: this.animateOption2Array(animateOption),
104
- u_time: this.layer.getLayerAnimateTime()
96
+ u_time: this.layer.getLayerAnimateTime() || 0
105
97
  };
98
+ var commonBufferInfo = this.getUniformsBufferInfo(commonOptions);
99
+ return commonBufferInfo;
106
100
  }
101
+ // public getAnimateUniforms(): IModelUniform {
102
+ // const { animateOption } = this.layer.getLayerConfig() as ILayerConfig;
103
+ // return {
104
+ // u_animate: this.animateOption2Array(animateOption as IAnimateOption),
105
+ // u_time: this.layer.getLayerAnimateTime(),
106
+ // };
107
+ // }
107
108
  }, {
108
109
  key: "initModels",
109
110
  value: function () {
@@ -111,10 +112,11 @@ var LineWallModel = /*#__PURE__*/function (_BaseModel) {
111
112
  return _regeneratorRuntime.wrap(function _callee$(_context) {
112
113
  while (1) switch (_context.prev = _context.next) {
113
114
  case 0:
115
+ this.initUniformsBuffer();
114
116
  this.updateTexture();
115
117
  this.iconService.on('imageUpdate', this.updateTexture);
116
118
  return _context.abrupt("return", this.buildModels());
117
- case 3:
119
+ case 4:
118
120
  case "end":
119
121
  return _context.stop();
120
122
  }
@@ -175,6 +177,7 @@ var LineWallModel = /*#__PURE__*/function (_BaseModel) {
175
177
  type: AttributeType.Attribute,
176
178
  descriptor: {
177
179
  name: 'a_Distance',
180
+ shaderLocation: 15,
178
181
  buffer: {
179
182
  // give the WebGL driver a hint that this buffer may change
180
183
  usage: gl.STATIC_DRAW,
@@ -192,6 +195,7 @@ var LineWallModel = /*#__PURE__*/function (_BaseModel) {
192
195
  type: AttributeType.Attribute,
193
196
  descriptor: {
194
197
  name: 'a_Total_Distance',
198
+ shaderLocation: 11,
195
199
  buffer: {
196
200
  // give the WebGL driver a hint that this buffer may change
197
201
  usage: gl.STATIC_DRAW,
@@ -209,6 +213,7 @@ var LineWallModel = /*#__PURE__*/function (_BaseModel) {
209
213
  type: AttributeType.Attribute,
210
214
  descriptor: {
211
215
  name: 'a_Size',
216
+ shaderLocation: ShaderLocation.SIZE,
212
217
  buffer: {
213
218
  // give the WebGL driver a hint that this buffer may change
214
219
  usage: gl.DYNAMIC_DRAW,
@@ -230,6 +235,7 @@ var LineWallModel = /*#__PURE__*/function (_BaseModel) {
230
235
  type: AttributeType.Attribute,
231
236
  descriptor: {
232
237
  name: 'a_Normal',
238
+ shaderLocation: ShaderLocation.NORMAL,
233
239
  buffer: {
234
240
  // give the WebGL driver a hint that this buffer may change
235
241
  usage: gl.STATIC_DRAW,
@@ -248,6 +254,7 @@ var LineWallModel = /*#__PURE__*/function (_BaseModel) {
248
254
  type: AttributeType.Attribute,
249
255
  descriptor: {
250
256
  name: 'a_Miter',
257
+ shaderLocation: 10,
251
258
  buffer: {
252
259
  // give the WebGL driver a hint that this buffer may change
253
260
  usage: gl.STATIC_DRAW,
@@ -265,6 +272,7 @@ var LineWallModel = /*#__PURE__*/function (_BaseModel) {
265
272
  type: AttributeType.Attribute,
266
273
  descriptor: {
267
274
  name: 'a_iconMapUV',
275
+ shaderLocation: 14,
268
276
  buffer: {
269
277
  // give the WebGL driver a hint that this buffer may change
270
278
  usage: gl.DYNAMIC_DRAW,
@@ -1,39 +1,49 @@
1
1
 
2
2
  #define Animate 0.0
3
3
  #define LineTexture 1.0
4
- uniform float u_textureBlend;
5
- uniform float u_blur : 0.9;
6
- uniform float u_line_type: 0.0;
7
- // varying vec2 v_normal;
8
- varying vec4 v_dash_array;
9
- varying vec4 v_color;
10
-
11
- uniform float u_time;
12
- uniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
13
-
14
- uniform float u_line_texture;
15
4
  uniform sampler2D u_texture;
16
- uniform vec2 u_textSize;
17
-
18
- uniform float segmentNumber;
19
- varying vec2 v_iconMapUV;
20
- varying vec4 v_lineData;
21
-
5
+ layout(std140) uniform commonUniorm {
6
+ vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
7
+ vec4 u_dash_array;
8
+ vec4 u_sourceColor;
9
+ vec4 u_targetColor;
10
+ vec2 u_textSize;
11
+ float segmentNumber;
12
+ float u_lineDir: 1.0;
13
+ float u_icon_step: 100;
14
+ float u_line_texture: 0.0;
15
+ float u_textureBlend;
16
+ float u_blur : 0.9;
17
+ float u_line_type: 0.0;
18
+ float u_time;
19
+ float u_linearColor: 0.0;
20
+ };
21
+ in vec2 v_iconMapUV;
22
+ in vec4 v_lineData;
23
+ in vec4 v_color;
24
+ //dash
25
+ in vec4 v_dash_array;
26
+ in float v_distance_ratio;
22
27
 
28
+ out vec4 outputColor;
23
29
  #pragma include "picking"
24
30
 
25
31
  void main() {
32
+ if(u_dash_array!=vec4(0.0)){
33
+ float dashLength = mod(v_distance_ratio, v_dash_array.x + v_dash_array.y + v_dash_array.z + v_dash_array.w);
34
+ if(!(dashLength < v_dash_array.x || (dashLength > (v_dash_array.x + v_dash_array.y) && dashLength < v_dash_array.x + v_dash_array.y + v_dash_array.z))) {
35
+ discard;
36
+ };
37
+ }
26
38
  float animateSpeed = 0.0; // 运动速度
27
- gl_FragColor = v_color;
28
-
29
-
39
+ outputColor = v_color;
30
40
  if(u_animate.x == Animate && u_line_texture != LineTexture) {
31
41
  animateSpeed = u_time / u_animate.y;
32
42
  float alpha =1.0 - fract( mod(1.0- v_lineData.b, u_animate.z)* (1.0/ u_animate.z) + u_time / u_animate.y);
33
43
  alpha = (alpha + u_animate.w -1.0) / u_animate.w;
34
44
  // alpha = smoothstep(0., 1., alpha);
35
45
  alpha = clamp(alpha, 0.0, 1.0);
36
- gl_FragColor.a *= alpha;
46
+ outputColor.a *= alpha;
37
47
  }
38
48
 
39
49
  // 当存在贴图时在底色上贴上贴图
@@ -53,7 +63,7 @@ void main() {
53
63
  float v = v_lineData.a; // 横向 v
54
64
  vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;
55
65
 
56
- vec4 pattern = texture2D(u_texture, uv);
66
+ vec4 pattern = texture(SAMPLER_2D(u_texture), uv);
57
67
 
58
68
  if(u_animate.x == Animate) {
59
69
  float currentPlane = floor(redioCount - time);
@@ -66,16 +76,16 @@ void main() {
66
76
 
67
77
  if(u_textureBlend == 0.0) { // normal
68
78
  pattern.a = 0.0;
69
- gl_FragColor = filterColor(gl_FragColor + pattern);
79
+ outputColor = filterColor(outputColor + pattern);
70
80
  } else { // replace
71
81
  pattern.a *= v_color.a;
72
- if(gl_FragColor.a <= 0.0) {
82
+ if(outputColor.a <= 0.0) {
73
83
  pattern.a = 0.0;
74
84
  }
75
- gl_FragColor = filterColor(pattern);
85
+ outputColor = filterColor(pattern);
76
86
  }
77
87
 
78
88
  } else {
79
- gl_FragColor = filterColor(gl_FragColor);
89
+ outputColor = filterColor(outputColor);
80
90
  }
81
91
  }
@@ -1,24 +1,33 @@
1
1
  #define Animate 0.0
2
2
  #define LineTexture 1.0
3
-
4
- attribute vec4 a_Color;
5
- attribute vec3 a_Position;
6
- attribute vec4 a_Instance;
7
- attribute float a_Size;
8
- uniform mat4 u_ModelMatrix;
9
-
10
- uniform float segmentNumber;
11
- uniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
12
- varying vec4 v_color;
13
-
14
- uniform float u_lineDir: 1.0;
15
-
16
- uniform float u_icon_step: 100;
17
- uniform float u_line_texture: 0.0;
18
- attribute vec2 a_iconMapUV;
19
- varying vec2 v_iconMapUV;
20
- varying vec4 v_lineData;
21
- varying vec2 v_distance_ratio;
3
+ layout(location = 0) in vec3 a_Position;
4
+ layout(location = 1) in vec4 a_Color;
5
+ layout(location = 9) in float a_Size;
6
+ layout(location = 12) in vec4 a_Instance;
7
+ layout(location = 14) in vec2 a_iconMapUV;
8
+
9
+ layout(std140) uniform commonUniorm {
10
+ vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
11
+ vec4 u_dash_array;
12
+ vec4 u_sourceColor;
13
+ vec4 u_targetColor;
14
+ vec2 u_textSize;
15
+ float segmentNumber;
16
+ float u_lineDir: 1.0;
17
+ float u_icon_step: 100;
18
+ float u_line_texture: 0.0;
19
+ float u_textureBlend;
20
+ float u_blur : 0.9;
21
+ float u_line_type: 0.0;
22
+ float u_time;
23
+ float u_linearColor: 0.0;
24
+ };
25
+ out vec4 v_color;
26
+ out vec2 v_iconMapUV;
27
+ out vec4 v_lineData;
28
+ //dash
29
+ out vec4 v_dash_array;
30
+ out float v_distance_ratio;
22
31
 
23
32
 
24
33
  #pragma include "projection"
@@ -76,14 +85,35 @@ vec2 getNormal(vec2 line_clipspace, float offset_direction) {
76
85
  }
77
86
 
78
87
  void main() {
79
- v_color = a_Color;
88
+ //vs中计算渐变色
89
+ if(u_linearColor==1.0){
90
+ float d_segmentIndex = a_Position.x + 1.0; // 当前顶点在弧线中所处的分段位置
91
+ v_color = mix(u_sourceColor, u_targetColor, d_segmentIndex/segmentNumber);
92
+ }
93
+ else{
94
+ v_color = a_Color;
95
+ }
80
96
  v_color.a = v_color.a * opacity;
81
97
 
82
98
  vec2 source = a_Instance.rg; // 起始点
83
99
  vec2 target = a_Instance.ba; // 终点
100
+
101
+
102
+
84
103
  float segmentIndex = a_Position.x;
85
104
  float segmentRatio = getSegmentRatio(segmentIndex);
86
105
 
106
+ //计算dashArray和distanceRatio 输出到片元
107
+ vec2 s = source;
108
+ vec2 t = target;
109
+ if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
110
+ s = unProjCustomCoord(source);
111
+ t = unProjCustomCoord(target);
112
+ }
113
+ float total_Distance = pixelDistance(s, t) / 2.0 * PI;
114
+ v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / total_Distance;
115
+ v_distance_ratio = segmentIndex / segmentNumber;
116
+
87
117
  float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));
88
118
  float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);
89
119
  float d_distance_ratio;
@@ -95,7 +125,7 @@ void main() {
95
125
  }
96
126
  }
97
127
 
98
- v_lineData.b = d_distance_ratio;
128
+ v_lineData.b = d_distance_ratio;
99
129
 
100
130
  vec4 curr = project_position(vec4(interpolate(source, target, segmentRatio, thetaOffset), 0.0, 1.0));
101
131
  vec4 next = project_position(vec4(interpolate(source, target, nextSegmentRatio, thetaOffset), 0.0, 1.0));
@@ -105,7 +135,7 @@ void main() {
105
135
 
106
136
 
107
137
  float d_segmentIndex = a_Position.x + 1.0; // 当前顶点在弧线中所处的分段位置
108
- v_lineData.r = d_segmentIndex;
138
+ v_lineData.r = d_segmentIndex;
109
139
 
110
140
  if(LineTexture == u_line_texture) { // 开启贴图模式
111
141
 
@@ -3,33 +3,41 @@
3
3
  #define Animate 0.0
4
4
  #define LineTexture 1.0
5
5
 
6
- uniform float u_textureBlend;
7
- uniform float u_blur : 0.9;
8
- uniform float u_line_type: 0.0;
9
- // varying vec2 v_normal;
10
- varying vec4 v_dash_array;
11
- varying vec4 v_color;
12
- varying vec4 v_line_data;
13
-
14
- uniform float u_line_texture: 0.0;
15
6
  uniform sampler2D u_texture;
16
- uniform vec2 u_textSize;
17
- varying float v_segmentIndex;
18
- uniform float segmentNumber;
19
7
 
8
+ layout(std140) uniform commonUniorm {
9
+ vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
10
+ vec4 u_dash_array: [10.0, 5., 0, 0];
11
+ vec4 u_sourceColor;
12
+ vec4 u_targetColor;
13
+ vec2 u_textSize;
14
+ float u_globel;
15
+ float u_globel_radius;
16
+ float u_global_height: 10;
17
+ float segmentNumber;
18
+ float u_line_type: 0.0;
19
+ float u_icon_step: 100;
20
+ float u_line_texture: 0.0;
21
+ float u_textureBlend;
22
+ float u_time;
23
+ float u_linearColor: 0.0;
24
+ };
20
25
 
21
- varying vec2 v_iconMapUV;
22
-
23
- uniform float u_time;
24
- uniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
26
+ // varying vec2 v_normal;
27
+ in vec4 v_dash_array;
28
+ in vec4 v_color;
29
+ in vec4 v_line_data;
30
+ in float v_segmentIndex;
31
+ in vec2 v_iconMapUV;
25
32
 
33
+ out vec4 outputColor;
26
34
 
27
35
  #pragma include "picking"
28
36
 
29
37
  void main() {
30
38
  float animateSpeed = 0.0; // 运动速度
31
39
  float d_distance_ratio = v_line_data.g; // 当前点位距离占线总长的比例
32
- gl_FragColor = v_color;
40
+ outputColor = v_color;
33
41
 
34
42
  if(u_line_type == LineTypeDash) {
35
43
  float flag = 0.;
@@ -37,7 +45,7 @@ void main() {
37
45
  if(dashLength < v_dash_array.x || (dashLength > (v_dash_array.x + v_dash_array.y) && dashLength < v_dash_array.x + v_dash_array.y + v_dash_array.z)) {
38
46
  flag = 1.;
39
47
  }
40
- gl_FragColor.a *=flag;
48
+ outputColor.a *=flag;
41
49
  }
42
50
 
43
51
  if(u_animate.x == Animate && u_line_texture != LineTexture) {
@@ -47,7 +55,7 @@ void main() {
47
55
  alpha = (alpha + u_animate.w -1.0) / u_animate.w;
48
56
  // alpha = smoothstep(0., 1., alpha);
49
57
  alpha = clamp(alpha, 0.0, 1.0);
50
- gl_FragColor.a *= alpha;
58
+ outputColor.a *= alpha;
51
59
 
52
60
  // u_animate
53
61
  // x enable
@@ -71,7 +79,7 @@ void main() {
71
79
 
72
80
  float v = v_line_data.a; // 线图层贴图部分的 v 坐标值
73
81
  vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;
74
- vec4 pattern = texture2D(u_texture, uv);
82
+ vec4 pattern = texture(SAMPLER_2D(u_texture), uv);
75
83
 
76
84
  if(u_animate.x == Animate) {
77
85
  float currentPlane = floor(redioCount - time);
@@ -84,18 +92,18 @@ void main() {
84
92
 
85
93
  if(u_textureBlend == 0.0) { // normal
86
94
  pattern.a = 0.0;
87
- gl_FragColor = filterColor(gl_FragColor + pattern);
95
+ outputColor = filterColor(outputColor + pattern);
88
96
  } else { // replace
89
97
  pattern.a *= v_color.a;
90
- if(gl_FragColor.a <= 0.0) {
98
+ if(outputColor.a <= 0.0) {
91
99
  pattern.a = 0.0;
92
100
  discard;
93
101
  } else {
94
- gl_FragColor = filterColor(pattern);
102
+ outputColor = filterColor(pattern);
95
103
  }
96
104
  }
97
105
 
98
106
  } else {
99
- gl_FragColor = filterColor(gl_FragColor);
107
+ outputColor = filterColor(outputColor);
100
108
  }
101
109
  }
@@ -2,31 +2,35 @@
2
2
  #define LineTypeDash 1.0
3
3
  #define Animate 0.0
4
4
  #define LineTexture 1.0
5
- attribute vec3 a_Position;
6
- attribute vec4 a_Instance;
7
- attribute vec4 a_Color;
8
- attribute float a_Size;
9
-
10
- uniform float u_globel;
11
- uniform float u_globel_radius;
12
- uniform float u_global_height: 10;
13
- uniform mat4 u_ModelMatrix;
14
-
15
- uniform float segmentNumber;
16
- uniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
17
- varying vec4 v_color;
18
-
19
- uniform float u_line_type: 0.0;
20
- uniform vec4 u_dash_array: [10.0, 5., 0, 0];
21
- varying vec4 v_dash_array;
22
-
23
- uniform float u_icon_step: 100;
24
- uniform float u_line_texture: 0.0;
25
- varying float v_segmentIndex;
26
-
27
- attribute vec2 a_iconMapUV;
28
- varying vec2 v_iconMapUV;
29
- varying vec4 v_line_data;
5
+ layout(location = 0) in vec3 a_Position;
6
+ layout(location = 1) in vec4 a_Color;
7
+ layout(location = 9) in float a_Size;
8
+ layout(location = 12) in vec4 a_Instance;
9
+ layout(location = 14) in vec2 a_iconMapUV;
10
+
11
+
12
+ layout(std140) uniform commonUniorm {
13
+ vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
14
+ vec4 u_dash_array: [10.0, 5., 0, 0];
15
+ vec4 u_sourceColor;
16
+ vec4 u_targetColor;
17
+ vec2 u_textSize;
18
+ float u_globel;
19
+ float u_globel_radius;
20
+ float u_global_height: 10;
21
+ float segmentNumber;
22
+ float u_line_type: 0.0;
23
+ float u_icon_step: 100;
24
+ float u_line_texture: 0.0;
25
+ float u_textureBlend;
26
+ float u_time;
27
+ float u_linearColor: 0.0;
28
+ };
29
+ out vec4 v_color;
30
+ out vec4 v_dash_array;
31
+ out float v_segmentIndex;
32
+ out vec2 v_iconMapUV;
33
+ out vec4 v_line_data;
30
34
 
31
35
  #pragma include "projection"
32
36
  #pragma include "project"
@@ -94,8 +98,14 @@ vec3 lglt2xyz(vec2 lnglat) {
94
98
  }
95
99
 
96
100
  void main() {
97
-
98
- v_color = a_Color;
101
+ //vs中计算渐变色
102
+ if(u_linearColor==1.0){
103
+ float d_segmentIndex = a_Position.x + 1.0; // 当前顶点在弧线中所处的分段位置
104
+ v_color = mix(u_sourceColor, u_targetColor, d_segmentIndex/segmentNumber);
105
+ }
106
+ else{
107
+ v_color = a_Color;
108
+ }
99
109
  v_color.a = v_color.a * opacity;
100
110
  vec2 source = project_position(vec4(a_Instance.rg, 0, 0)).xy;
101
111
  vec2 target = project_position(vec4(a_Instance.ba, 0, 0)).xy;
@@ -1,6 +1,7 @@
1
- #extension GL_OES_standard_derivatives : enable
1
+ // #extension GL_OES_standard_derivatives : enable
2
2
 
3
- varying vec4 v_color;
3
+ in vec4 v_color;
4
+ out vec4 outputColor;
4
5
 
5
6
 
6
7
  // line texture
@@ -8,6 +9,6 @@ varying vec4 v_color;
8
9
  #pragma include "picking"
9
10
 
10
11
  void main() {
11
- gl_FragColor = v_color;
12
- gl_FragColor = filterColor(gl_FragColor);
12
+ outputColor = v_color;
13
+ outputColor = filterColor(outputColor);
13
14
  }
@@ -1,19 +1,20 @@
1
- attribute vec4 a_Color;
2
- attribute vec2 a_Size;
3
- attribute vec4 a_Instance;
4
- attribute vec3 a_Normal;
5
- attribute vec3 a_Position;
6
-
7
- uniform mat4 u_ModelMatrix;
8
-
1
+ layout(location = 0) in vec3 a_Position;
2
+ layout(location = 1) in vec4 a_Color;
3
+ layout(location = 9) in vec2 a_Size;
4
+ layout(location = 12) in vec4 a_Instance;
5
+ layout(location = 13) in vec3 a_Normal;
6
+
7
+ layout(std140) uniform commonUniorm {
8
+ float u_gap_width: 1.0;
9
+ float u_stroke_width: 1.0;
10
+ float u_stroke_opacity: 1.0;
11
+ };
9
12
 
10
13
  #pragma include "projection"
11
14
  #pragma include "project"
12
15
  #pragma include "picking"
13
- varying vec4 v_color;
14
- uniform float u_gap_width: 1.0;
15
- uniform float u_stroke_width: 1.0;
16
- uniform float u_stroke_opacity: 1.0;
16
+
17
+ out vec4 v_color;
17
18
 
18
19
  vec2 project_pixel_offset(vec2 offsets) {
19
20
 
@@ -51,9 +52,8 @@ void main() {
51
52
  vec2 source = a_Instance.rg; // 起始点
52
53
  vec2 target = a_Instance.ba; // 终点
53
54
  vec2 flowlineDir = line_dir(target,source);
54
- vec2 perpendicularDir = vec2(flowlineDir.y, flowlineDir.x); // mapbox || 高德
55
-
56
-
55
+ vec2 perpendicularDir = vec2(-flowlineDir.y, flowlineDir.x); // mapbox || 高德
56
+
57
57
  vec2 position = mix(source, target, a_Position.x);
58
58
 
59
59
  float lengthCommon = length(project_position(vec4(target,0,1)) - project_position(vec4(source,0,1))); //
@@ -77,17 +77,16 @@ void main() {
77
77
  float gapCommon = flag_gap() * project_pixel(u_gap_width);
78
78
  vec3 offsetCommon = vec3(
79
79
  flowlineDir * (limitedOffsetDistances[1] + normalsCommon.y + endpointOffset * 1.05) -
80
- perpendicularDir * (limitedOffsetDistances[0] + gapCommon + normalsCommon.x),
80
+ perpendicularDir * (limitedOffsetDistances[0] + gapCommon + normalsCommon.x),
81
81
  0.0
82
82
  );
83
83
 
84
-
85
84
  vec4 project_pos = project_position(vec4(position.xy, 0, 1.0));
86
85
 
87
86
  vec4 fillColor = vec4(a_Color.rgb, a_Color.a * opacity);
88
87
  v_color = mix(fillColor, vec4(u_stroke.xyz, u_stroke.w * fillColor.w * u_stroke_opacity), a_Normal.z);
89
88
 
90
- gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy + offsetCommon.xy, 0., 1.0));
89
+ gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy + offsetCommon.xy, 0., 1.0));
91
90
 
92
91
 
93
92