@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
@@ -12,9 +12,10 @@ import BaseModel from "../../core/BaseModel";
12
12
  import { SizeUnitType } from "../../core/interface";
13
13
  import { PointFillTriangulation } from "../../core/triangulation";
14
14
  /* babel-plugin-inline-import '../shaders/radar/radar_frag.glsl' */
15
- var pointFillFrag = "\nuniform float u_additive;\nuniform float u_opacity: 1.0;\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\nvarying vec2 v_exteude;\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\n\nvoid main() {\n\n lowp float antialiasblur = v_data.z;\n float r = v_radius / (v_radius);\n\n float outer_df = sdCircle(v_data.xy, 1.0);\n float inner_df = sdCircle(v_data.xy, r);\n\n float opacity_t = smoothstep(0.0, antialiasblur, outer_df);\n\n gl_FragColor = vec4(v_color.rgb, v_color.a * u_opacity);\n\n if(u_additive > 0.0) {\n gl_FragColor *= opacity_t;\n } else {\n gl_FragColor.a *= opacity_t;\n }\n\n if(gl_FragColor.a > 0.0) {\n gl_FragColor = filterColor(gl_FragColor);\n }\n\n vec2 extrude = v_exteude;\n vec2 dir = normalize(extrude);\n vec2 baseDir = vec2(1.0, 0.0);\n float pi = 3.14159265359;\n float flag = sign(dir.y);\n float rades = dot(dir, baseDir);\n float radar_v = (flag - 1.0) * -0.5 * acos(rades)/pi;\n // simple AA\n if(radar_v > 0.99) {\n radar_v = 1.0 - (radar_v - 0.99)/0.01;\n }\n\n gl_FragColor.a *= radar_v;\n}\n";
15
+ var pointFillFrag = "\nlayout(std140) uniform commonUniorm{\n float u_additive;\n float u_size_unit;\n float u_speed: 1.0;\n float u_time;\n};\nin vec4 v_data;\nin vec4 v_color;\nin float v_radius;\nin vec2 v_extrude;\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\n\nout vec4 outputColor;\n\nvoid main() {\n\n lowp float antialiasblur = v_data.z;\n float r = v_radius / (v_radius);\n\n float outer_df = sdCircle(v_data.xy, 1.0);\n float inner_df = sdCircle(v_data.xy, r);\n\n float opacity_t = smoothstep(0.0, antialiasblur, outer_df);\n\n outputColor = vec4(v_color.rgb, v_color.a);\n\n if(u_additive > 0.0) {\n outputColor *= opacity_t;\n } else {\n outputColor.a *= opacity_t;\n }\n\n if(outputColor.a > 0.0) {\n outputColor = filterColor(outputColor);\n }\n\n vec2 extrude = v_extrude;\n vec2 dir = normalize(extrude);\n vec2 baseDir = vec2(1.0, 0.0);\n float pi = 3.14159265359;\n float flag = sign(dir.y);\n float rades = dot(dir, baseDir);\n float radar_v = (flag - 1.0) * -0.5 * acos(rades)/pi;\n // simple AA\n if(radar_v > 0.99) {\n radar_v = 1.0 - (radar_v - 0.99)/0.01;\n }\n\n outputColor.a *= radar_v;\n}\n";
16
16
  /* babel-plugin-inline-import '../shaders/radar/radar_vert.glsl' */
17
- var pointFillVert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Extrude;\nattribute float a_Size;\nuniform float u_speed: 1.0;\nuniform float u_time;\n\nuniform mat4 u_ModelMatrix;\n\nuniform int u_size_unit;\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\nvarying vec2 v_exteude;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n vec3 extrude = a_Extrude;\n float newSize = setPickingSize(a_Size);\n\n float time = u_time * u_speed;\n mat2 rotateMatrix = mat2( \n cos(time), sin(time), \n -sin(time), cos(time)\n );\n v_exteude = rotateMatrix * a_Extrude.xy;\n\n // unpack color(vec2)\n v_color = a_Color;\n\n // anti-alias\n float blur = 0.0;\n float antialiasblur = -max(2.0 / u_DevicePixelRatio / a_Size, blur);\n\n if(u_size_unit == 1) {\n newSize = newSize * u_PixelsPerMeter.z;\n }\n // radius(16-bit)\n v_radius = newSize;\n\n vec2 offset = (extrude.xy * (newSize));\n vec3 aPosition = a_Position;\n \n // \u4E0D\u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n offset = project_pixel(offset);\n \n v_data = vec4(extrude.x, extrude.y, antialiasblur, -1.0);\n\n vec4 project_pos = project_position(vec4(aPosition.xy, 0.0, 1.0));\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
17
+ var pointFillVert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 11) in vec4 a_ExtrudeAndSize;\n\nlayout(std140) uniform commonUniorm {\n float u_additive;\n float u_size_unit;\n float u_speed: 1.0;\n float u_time;\n};\n\nout vec4 v_data;\nout vec4 v_color;\nout float v_radius;\nout vec2 v_extrude;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n vec3 extrude = a_ExtrudeAndSize.xyz;\n float newSize = setPickingSize(a_ExtrudeAndSize.w);\n\n float time = u_time * u_speed;\n mat2 rotateMatrix = mat2( \n cos(time), sin(time), \n -sin(time), cos(time)\n );\n v_extrude = rotateMatrix * a_ExtrudeAndSize.xy;\n\n v_color = a_Color;\n v_color.a *= opacity;\n\n float blur = 0.0;\n float antialiasblur = -max(2.0 / u_DevicePixelRatio / a_ExtrudeAndSize.w, blur);\n\n if(u_size_unit == 1.) {\n newSize = newSize * u_PixelsPerMeter.z;\n }\n v_radius = newSize;\n\n vec2 offset = (extrude.xy * (newSize));\n vec3 aPosition = a_Position;\n \n offset = project_pixel(offset);\n \n v_data = vec4(extrude.x, extrude.y, antialiasblur, -1.0);\n\n vec4 project_pos = project_position(vec4(aPosition.xy, 0.0, 1.0));\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
18
+ import { ShaderLocation } from "../../core/CommonStyleAttribute";
18
19
  var RadarModel = /*#__PURE__*/function (_BaseModel) {
19
20
  _inherits(RadarModel, _BaseModel);
20
21
  var _super = _createSuper(RadarModel);
@@ -23,35 +24,27 @@ var RadarModel = /*#__PURE__*/function (_BaseModel) {
23
24
  return _super.apply(this, arguments);
24
25
  }
25
26
  _createClass(RadarModel, [{
26
- key: "getUninforms",
27
- value: function getUninforms() {
27
+ key: "getCommonUniformsInfo",
28
+ value: function getCommonUniformsInfo() {
28
29
  var _ref = this.layer.getLayerConfig(),
29
- _ref$opacity = _ref.opacity,
30
- opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
31
30
  blend = _ref.blend,
32
31
  _ref$speed = _ref.speed,
33
32
  speed = _ref$speed === void 0 ? 1 : _ref$speed,
34
33
  _ref$unit = _ref.unit,
35
34
  unit = _ref$unit === void 0 ? 'pixel' : _ref$unit;
36
- return {
35
+ var commonOptions = {
36
+ u_additive: blend === 'additive' ? 1.0 : 0.0,
37
37
  u_size_unit: SizeUnitType[unit],
38
38
  u_speed: speed,
39
- u_additive: blend === 'additive' ? 1.0 : 0.0,
40
- u_opacity: opacity
41
- };
39
+ u_time: this.layer.getLayerAnimateTime()
40
+ }; //1+1+1+1
41
+ var commonBufferInfo = this.getUniformsBufferInfo(commonOptions);
42
+ return commonBufferInfo;
42
43
  }
43
44
  }, {
44
45
  key: "getAnimateUniforms",
45
46
  value: function getAnimateUniforms() {
46
- var _ref2 = this.layer.getLayerConfig(),
47
- _ref2$animateOption = _ref2.animateOption,
48
- animateOption = _ref2$animateOption === void 0 ? {
49
- enable: false
50
- } : _ref2$animateOption;
51
- return {
52
- u_animate: this.animateOption2Array(animateOption),
53
- u_time: this.layer.getLayerAnimateTime()
54
- };
47
+ return {};
55
48
  }
56
49
  }, {
57
50
  key: "getAttribute",
@@ -85,20 +78,22 @@ var RadarModel = /*#__PURE__*/function (_BaseModel) {
85
78
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
86
79
  while (1) switch (_context2.prev = _context2.next) {
87
80
  case 0:
88
- _context2.next = 2;
81
+ this.initUniformsBuffer();
82
+ _context2.next = 3;
89
83
  return this.layer.buildLayerModel({
90
84
  moduleName: 'pointRadar',
91
85
  vertexShader: pointFillVert,
92
86
  fragmentShader: pointFillFrag,
93
87
  triangulation: PointFillTriangulation,
88
+ inject: this.getInject(),
94
89
  depth: {
95
90
  enable: false
96
91
  }
97
92
  });
98
- case 2:
93
+ case 3:
99
94
  model = _context2.sent;
100
95
  return _context2.abrupt("return", [model]);
101
- case 4:
96
+ case 5:
102
97
  case "end":
103
98
  return _context2.stop();
104
99
  }
@@ -118,42 +113,25 @@ var RadarModel = /*#__PURE__*/function (_BaseModel) {
118
113
  key: "registerBuiltinAttributes",
119
114
  value: function registerBuiltinAttributes() {
120
115
  this.styleAttributeService.registerStyleAttribute({
121
- name: 'extrude',
116
+ name: 'extrudeAndSize',
122
117
  type: AttributeType.Attribute,
123
118
  descriptor: {
124
- name: 'a_Extrude',
119
+ name: 'a_ExtrudeAndSize',
120
+ shaderLocation: ShaderLocation.EXTRUDE,
125
121
  buffer: {
126
122
  // give the WebGL driver a hint that this buffer may change
127
123
  usage: gl.DYNAMIC_DRAW,
128
124
  data: [],
129
125
  type: gl.FLOAT
130
126
  },
131
- size: 3,
127
+ size: 4,
132
128
  update: function update(feature, featureIdx, vertex, attributeIdx) {
133
129
  var extrude = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0];
134
130
  var extrudeIndex = attributeIdx % 4 * 3;
135
- return [extrude[extrudeIndex], extrude[extrudeIndex + 1], extrude[extrudeIndex + 2]];
136
- }
137
- }
138
- });
139
-
140
- // point layer size;
141
- this.styleAttributeService.registerStyleAttribute({
142
- name: 'size',
143
- type: AttributeType.Attribute,
144
- descriptor: {
145
- name: 'a_Size',
146
- buffer: {
147
- // give the WebGL driver a hint that this buffer may change
148
- usage: gl.DYNAMIC_DRAW,
149
- data: [],
150
- type: gl.FLOAT
151
- },
152
- size: 1,
153
- update: function update(feature) {
154
131
  var _feature$size = feature.size,
155
132
  size = _feature$size === void 0 ? 5 : _feature$size;
156
- return Array.isArray(size) ? [size[0]] : [size];
133
+ var a_Size = Array.isArray(size) ? size[0] : size;
134
+ return [extrude[extrudeIndex], extrude[extrudeIndex + 1], extrude[extrudeIndex + 2], a_Size];
157
135
  }
158
136
  }
159
137
  });
@@ -1,6 +1,6 @@
1
- import { IEncodeFeature, IModel, IModelUniform } from '@antv/l7-core';
1
+ import type { IEncodeFeature, IModel, IModelUniform } from '@antv/l7-core';
2
2
  import BaseModel from '../../core/BaseModel';
3
- import { IGlyphQuad } from '../../utils/symbol-layout';
3
+ import type { IGlyphQuad } from '../../utils/symbol-layout';
4
4
  export declare function TextTrianglation(feature: IEncodeFeature): {
5
5
  vertices: number[];
6
6
  indices: number[];
@@ -23,6 +23,13 @@ export default class TextModel extends BaseModel {
23
23
  private textCount;
24
24
  private preTextStyle;
25
25
  getUninforms(): IModelUniform;
26
+ protected getCommonUniformsInfo(): {
27
+ uniformsArray: number[];
28
+ uniformsLength: number;
29
+ uniformsOption: {
30
+ [key: string]: any;
31
+ };
32
+ };
26
33
  initModels(): Promise<IModel[]>;
27
34
  buildModels(): Promise<IModel[]>;
28
35
  needUpdate(): Promise<boolean>;
@@ -19,10 +19,11 @@ import { boundsContains, calculateCentroid, lodashUtil, padBounds, rgb2arr } fro
19
19
  import BaseModel from "../../core/BaseModel";
20
20
  import CollisionIndex from "../../utils/collision-index";
21
21
  import { getGlyphQuads, shapeText } from "../../utils/symbol-layout";
22
- /* babel-plugin-inline-import '../shaders/text_frag.glsl' */
23
- var textFrag = "#define SDF_PX 8.0\n#define EDGE_GAMMA 0.105\n#define FONT_SIZE 48.0\nuniform sampler2D u_sdf_map;\nuniform float u_gamma_scale : 0.5;\nuniform float u_stroke_width : 2.0;\nuniform float u_halo_blur : 0.5;\nuniform float u_DevicePixelRatio;\n\nvarying vec4 v_color;\nvarying vec4 v_stroke_color;\nvarying vec2 v_uv;\nvarying float v_gamma_scale;\nvarying float v_fontScale;\n\n\n#pragma include \"picking\"\nvoid main() {\n // get style data mapping\n\n // get sdf from atlas\n float dist = texture2D(u_sdf_map, v_uv).a;\n\n lowp float buff = (6.0 - u_stroke_width / v_fontScale) / SDF_PX;\n highp float gamma = (u_halo_blur * 1.19 / SDF_PX + EDGE_GAMMA) / (v_fontScale * u_gamma_scale) / 1.0;\n\n highp float gamma_scaled = gamma * v_gamma_scale;\n\n highp float alpha = smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist);\n\n gl_FragColor = mix(v_color, v_stroke_color, smoothstep(0., 0.5, 1.- dist));\n\n gl_FragColor.a *= alpha;\n // \u4F5C\u4E3A mask \u6A21\u677F\u65F6\u9700\u8981\u4E22\u5F03\u900F\u660E\u7684\u50CF\u7D20\n if (gl_FragColor.a < 0.01) {\n discard;\n }\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
24
- /* babel-plugin-inline-import '../shaders/text_vert.glsl' */
25
- var textVert = "#define SDF_PX 8.0\n#define EDGE_GAMMA 0.105\n#define FONT_SIZE 24.0\nattribute vec3 a_Position;\nattribute vec2 a_tex;\nattribute vec2 a_textOffsets;\nattribute vec4 a_Color;\nattribute float a_Size;\n\nuniform vec2 u_sdf_map_size;\nuniform mat4 u_ModelMatrix;\n\nuniform float u_raisingHeight: 0.0;\n\nvarying vec2 v_uv;\nvarying float v_gamma_scale;\nvarying vec4 v_color;\nvarying vec4 v_stroke_color;\nvarying float v_fontScale;\nuniform float u_stroke_width : 2;\nuniform vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];\n\n\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n#pragma include \"rotation_2d\"\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n \n v_uv = a_tex / u_sdf_map_size;\n\n\n\n v_color = vec4(a_Color.xyz, a_Color.w * opacity);\n v_stroke_color = vec4(u_stroke_color.xyz, u_stroke_color.w * opacity);\n\n // \u6587\u672C\u7F29\u653E\u6BD4\u4F8B\n float fontScale = a_Size / FONT_SIZE;\n v_fontScale = fontScale;\n\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n // vec4 projected_position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n\n vec2 offset = rotate_matrix(a_textOffsets,rotation);\n \n // gl_Position = vec4(projected_position.xy / projected_position.w + rotation_matrix * a_textOffsets * fontScale / u_ViewportSize * 2.0 * u_DevicePixelRatio, 0.0, 1.0);\n\n float raiseHeight = u_raisingHeight;\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n raiseHeight = u_raisingHeight * mapboxZoomScale;\n }\n\n vec4 projected_position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz + vec3(0.0, 0.0, raiseHeight), 1.0));\n\n gl_Position = vec4(\n projected_position.xy / projected_position.w + offset * fontScale / u_ViewportSize * 2.0 * u_DevicePixelRatio, 0.0, 1.0);\n v_gamma_scale = gl_Position.w;\n setPickingColor(a_PickingColor);\n\n}\n";
22
+ /* babel-plugin-inline-import '../shaders/text/text_frag.glsl' */
23
+ var textFrag = "#define SDF_PX 8.0\n#define EDGE_GAMMA 0.105\n#define FONT_SIZE 48.0\n\nuniform sampler2D u_sdf_map;\nlayout(std140) uniform commonUniforms {\n vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];\n vec2 u_sdf_map_size;\n float u_raisingHeight: 0.0;\n float u_stroke_width : 2;\n float u_gamma_scale : 0.5;\n float u_halo_blur : 0.5;\n};\n\nin vec4 v_color;\nin vec4 v_stroke_color;\nin vec2 v_uv;\nin float v_gamma_scale;\nin float v_fontScale;\nout vec4 outputColor;\n\n#pragma include \"picking\"\nvoid main() {\n // get style data mapping\n\n // get sdf from atlas\n float dist = texture(SAMPLER_2D(u_sdf_map), v_uv).a;\n\n lowp float buff = (6.0 - u_stroke_width / v_fontScale) / SDF_PX;\n highp float gamma = (u_halo_blur * 1.19 / SDF_PX + EDGE_GAMMA) / (v_fontScale * u_gamma_scale) / 1.0;\n\n highp float gamma_scaled = gamma * v_gamma_scale;\n\n highp float alpha = smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist);\n\n outputColor = mix(v_color, v_stroke_color, smoothstep(0., 0.5, 1.- dist));\n\n outputColor.a *= alpha;\n // \u4F5C\u4E3A mask \u6A21\u677F\u65F6\u9700\u8981\u4E22\u5F03\u900F\u660E\u7684\u50CF\u7D20\n if (outputColor.a < 0.01) {\n discard;\n }\n outputColor = filterColor(outputColor);\n}\n";
24
+ /* babel-plugin-inline-import '../shaders/text/text_vert.glsl' */
25
+ var textVert = "#define SDF_PX 8.0\n#define EDGE_GAMMA 0.105\n#define FONT_SIZE 24.0\n\nlayout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 9) in float a_Size;\nlayout(location = 14) in vec4 a_textUvAndOffsets;\n\nlayout(std140) uniform commonUniforms {\n vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];\n vec2 u_sdf_map_size;\n float u_raisingHeight: 0.0;\n float u_stroke_width : 2;\n float u_gamma_scale : 0.5;\n float u_halo_blur : 0.5;\n};\n\nout vec2 v_uv;\nout float v_gamma_scale;\nout vec4 v_color;\nout vec4 v_stroke_color;\nout float v_fontScale;\n\n\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n#pragma include \"rotation_2d\"\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n \n v_uv = a_textUvAndOffsets.xy / u_sdf_map_size;\n\n\n\n v_color = vec4(a_Color.xyz, a_Color.w * opacity);\n v_stroke_color = vec4(u_stroke_color.xyz, u_stroke_color.w * opacity);\n\n // \u6587\u672C\u7F29\u653E\u6BD4\u4F8B\n float fontScale = a_Size / FONT_SIZE;\n v_fontScale = fontScale;\n\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n // vec4 projected_position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n\n vec2 offset = rotate_matrix(a_textUvAndOffsets.zw,rotation);\n \n // gl_Position = vec4(projected_position.xy / projected_position.w + rotation_matrix * a_textOffsets * fontScale / u_ViewportSize * 2.0 * u_DevicePixelRatio, 0.0, 1.0);\n\n float raiseHeight = u_raisingHeight;\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n raiseHeight = u_raisingHeight * mapboxZoomScale;\n }\n\n vec4 projected_position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz + vec3(0.0, 0.0, raiseHeight), 1.0));\n\n gl_Position = vec4(\n projected_position.xy / projected_position.w + offset * fontScale / u_ViewportSize * 2.0 * u_DevicePixelRatio, 0.0, 1.0);\n v_gamma_scale = gl_Position.w;\n setPickingColor(a_PickingColor);\n\n}\n";
26
+ import { ShaderLocation } from "../../core/CommonStyleAttribute";
26
27
  var isEqual = lodashUtil.isEqual;
27
28
  export function TextTrianglation(feature) {
28
29
  // @ts-ignore
@@ -85,6 +86,16 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
85
86
  _createClass(TextModel, [{
86
87
  key: "getUninforms",
87
88
  value: function getUninforms() {
89
+ var commoninfo = this.getCommonUniformsInfo();
90
+ var attributeInfo = this.getUniformsBufferInfo(this.getStyleAttribute());
91
+ this.updateStyleUnifoms();
92
+ return _objectSpread(_objectSpread(_objectSpread({}, commoninfo.uniformsOption), attributeInfo.uniformsOption), {
93
+ u_sdf_map: this.textures[0]
94
+ });
95
+ }
96
+ }, {
97
+ key: "getCommonUniformsInfo",
98
+ value: function getCommonUniformsInfo() {
88
99
  var _ref2 = this.layer.getLayerConfig(),
89
100
  _ref2$stroke = _ref2.stroke,
90
101
  stroke = _ref2$stroke === void 0 ? '#fff' : _ref2$stroke,
@@ -103,15 +114,16 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
103
114
  this.textCount = Object.keys(mapping).length;
104
115
  }
105
116
  this.preTextStyle = this.getTextStyle();
106
- return _objectSpread({
117
+ var commonOptions = {
118
+ u_stroke_color: rgb2arr(stroke),
119
+ u_sdf_map_size: [(canvas === null || canvas === void 0 ? void 0 : canvas.width) || 1, (canvas === null || canvas === void 0 ? void 0 : canvas.height) || 1],
107
120
  u_raisingHeight: Number(raisingHeight),
108
121
  u_stroke_width: strokeWidth,
109
- u_stroke_color: rgb2arr(stroke),
110
- u_sdf_map: this.texture,
111
- u_halo_blur: halo,
112
122
  u_gamma_scale: gamma,
113
- u_sdf_map_size: [(canvas === null || canvas === void 0 ? void 0 : canvas.width) || 1, (canvas === null || canvas === void 0 ? void 0 : canvas.height) || 1]
114
- }, this.getStyleAttribute());
123
+ u_halo_blur: halo
124
+ };
125
+ var commonBufferInfo = this.getUniformsBufferInfo(commonOptions);
126
+ return commonBufferInfo;
115
127
  }
116
128
  }, {
117
129
  key: "initModels",
@@ -125,8 +137,9 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
125
137
  this.extent = this.textExtent();
126
138
  this.rawEncodeData = this.layer.getEncodedData();
127
139
  this.preTextStyle = this.getTextStyle();
140
+ this.initUniformsBuffer();
128
141
  return _context2.abrupt("return", this.buildModels());
129
- case 5:
142
+ case 6:
130
143
  case "end":
131
144
  return _context2.stop();
132
145
  }
@@ -242,30 +255,31 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
242
255
  key: "registerBuiltinAttributes",
243
256
  value: function registerBuiltinAttributes() {
244
257
  this.styleAttributeService.registerStyleAttribute({
245
- name: 'textOffsets',
258
+ name: 'textUvAndOffsets',
246
259
  type: AttributeType.Attribute,
247
260
  descriptor: {
248
- name: 'a_textOffsets',
261
+ name: 'a_textUvAndOffsets',
249
262
  // 文字偏移量
263
+ shaderLocation: ShaderLocation.UV,
250
264
  buffer: {
251
265
  // give the WebGL driver a hint that this buffer may change
252
266
  usage: gl.STATIC_DRAW,
253
267
  data: [],
254
268
  type: gl.FLOAT
255
269
  },
256
- size: 2,
270
+ size: 4,
257
271
  update: function update(feature, featureIdx, vertex) {
258
- return [vertex[5], vertex[6]];
272
+ return [vertex[3], vertex[4], vertex[5], vertex[6]];
259
273
  }
260
274
  }
261
275
  });
262
-
263
276
  // point layer size;
264
277
  this.styleAttributeService.registerStyleAttribute({
265
278
  name: 'size',
266
279
  type: AttributeType.Attribute,
267
280
  descriptor: {
268
281
  name: 'a_Size',
282
+ shaderLocation: ShaderLocation.SIZE,
269
283
  buffer: {
270
284
  // give the WebGL driver a hint that this buffer may change
271
285
  usage: gl.DYNAMIC_DRAW,
@@ -280,22 +294,6 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
280
294
  }
281
295
  }
282
296
  });
283
- this.styleAttributeService.registerStyleAttribute({
284
- name: 'textUv',
285
- type: AttributeType.Attribute,
286
- descriptor: {
287
- name: 'a_tex',
288
- buffer: {
289
- usage: gl.DYNAMIC_DRAW,
290
- data: [],
291
- type: gl.FLOAT
292
- },
293
- size: 2,
294
- update: function update(feature, featureIdx, vertex) {
295
- return [vertex[3], vertex[4]];
296
- }
297
- }
298
- });
299
297
  }
300
298
  }, {
301
299
  key: "bindEvent",
@@ -569,6 +567,7 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
569
567
  width: canvas.width,
570
568
  height: canvas.height
571
569
  });
570
+ this.textures = [this.texture];
572
571
  }
573
572
  }, {
574
573
  key: "reBuildModel",
@@ -1,12 +1,16 @@
1
1
 
2
- uniform float u_additive;
3
- uniform float u_stroke_opacity : 1;
2
+ layout(std140) uniform commonUniorm {
3
+ vec4 u_stroke_color;
4
+ float u_additive;
5
+ float u_stroke_opacity;
6
+ float u_stroke_width;
7
+ };
4
8
 
5
- uniform vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];
9
+ in vec4 v_color;
10
+ in float v_blur;
11
+ in float v_innerRadius;
6
12
 
7
- varying vec4 v_color;
8
- varying float v_blur;
9
- varying float v_innerRadius;
13
+ out vec4 outputColor;
10
14
 
11
15
  #pragma include "picking"
12
16
  void main() {
@@ -23,24 +27,24 @@ void main() {
23
27
  float blurWidth = (1.0 - v_blur)/2.0;
24
28
  vec4 stroke = vec4(u_stroke_color.rgb, u_stroke_opacity);
25
29
  if(fragmengTocenter > v_innerRadius + blurWidth) {
26
- gl_FragColor = stroke;
30
+ outputColor = stroke;
27
31
  } else if(fragmengTocenter > v_innerRadius - blurWidth){
28
32
  float mixR = (fragmengTocenter - (v_innerRadius - blurWidth)) / (blurWidth * 2.0);
29
- gl_FragColor = mix(v_color, stroke, mixR);
33
+ outputColor = mix(v_color, stroke, mixR);
30
34
  } else {
31
- gl_FragColor = v_color;
35
+ outputColor = v_color;
32
36
  }
33
37
  } else {
34
38
  // 当不存在 stroke 或 stroke <= 0.01
35
- gl_FragColor = v_color;
39
+ outputColor = v_color;
36
40
  }
37
41
 
38
- gl_FragColor = filterColor(gl_FragColor);
42
+ outputColor = filterColor(outputColor);
39
43
 
40
44
  if(u_additive > 0.0) {
41
- gl_FragColor *= circleClipOpacity;
45
+ outputColor *= circleClipOpacity;
42
46
  } else {
43
- gl_FragColor.a *= circleClipOpacity;
47
+ outputColor.a *= circleClipOpacity;
44
48
  }
45
49
 
46
50
  }
@@ -1,25 +1,24 @@
1
1
 
2
- attribute vec3 a_Position;
3
- uniform mat4 u_ModelMatrix;
4
-
5
- attribute float a_Size;
6
- attribute vec4 a_Color;
7
- varying vec4 v_color;
8
-
9
- uniform float u_opacity : 1;
10
- uniform vec2 u_offsets;
11
- uniform float u_stroke_width;
12
-
13
- varying float v_blur;
14
- varying float v_innerRadius;
2
+ layout(location = 0) in vec3 a_Position;
3
+ layout(location = 1) in vec4 a_Color;
4
+ layout(location = 9) in float a_Size;
15
5
 
6
+ layout(std140) uniform commonUniorm {
7
+ vec4 u_stroke_color;
8
+ float u_additive;
9
+ float u_stroke_opacity;
10
+ float u_stroke_width;
11
+ };
16
12
 
13
+ out vec4 v_color;
14
+ out float v_blur;
15
+ out float v_innerRadius;
17
16
 
18
17
  #pragma include "projection"
19
18
  #pragma include "picking"
20
19
  #pragma include "project"
21
20
  void main() {
22
- v_color = vec4(a_Color.xyz, a_Color.w * u_opacity);
21
+ v_color = vec4(a_Color.xyz, a_Color.w * opacity);
23
22
  v_blur = 1.0 - max(2.0/a_Size, 0.05);
24
23
  v_innerRadius = max((a_Size - u_stroke_width) / a_Size, 0.0);
25
24
 
@@ -0,0 +1,36 @@
1
+ precision highp float;
2
+ in vec4 v_color;
3
+
4
+ #pragma include "picking"
5
+
6
+ layout(std140) uniform commonUniform {
7
+ vec4 u_sourceColor;
8
+ vec4 u_targetColor;
9
+ float u_linearColor: 0;
10
+ float u_heightfixed: 0.0; // 默认不固定
11
+ float u_globel;
12
+ float u_r;
13
+ float u_pickLight: 0.0;
14
+ float u_opacitylinear: 0.0;
15
+ float u_opacitylinear_dir: 1.0;
16
+ float u_lightEnable: 1.0;
17
+ };
18
+ in float v_lightWeight;
19
+ in float v_barLinearZ;
20
+ out vec4 outputColor;
21
+ void main() {
22
+
23
+ outputColor = v_color;
24
+
25
+ // 开启透明度渐变
26
+ if(u_opacitylinear > 0.0) {
27
+ outputColor.a *= u_opacitylinear_dir > 0.0 ? (1.0 - v_barLinearZ): v_barLinearZ;
28
+ }
29
+
30
+ // picking
31
+ if(u_pickLight > 0.0) {
32
+ outputColor = filterColorAlpha(outputColor, v_lightWeight);
33
+ } else {
34
+ outputColor = filterColor(outputColor);
35
+ }
36
+ }
@@ -5,23 +5,30 @@ precision highp float;
5
5
  #define diffuseRatio 0.3
6
6
  #define specularRatio 0.2
7
7
 
8
- attribute vec3 a_Position;
9
- attribute vec3 a_Pos;
10
- attribute vec4 a_Color;
11
- attribute vec3 a_Size;
12
- attribute vec3 a_Normal;
13
-
14
- uniform float u_heightfixed: 0.0; // 默认不固定
15
- uniform float u_globel;
16
- uniform float u_r;
17
- uniform mat4 u_ModelMatrix;
18
-
19
- varying vec4 v_color;
20
-
21
- uniform float u_opacity : 1;
22
- uniform float u_lightEnable: 1;
23
- varying float v_lightWeight;
24
- varying float v_barLinearZ;
8
+
9
+ layout(location = 0) in vec3 a_Position;
10
+ layout(location = 1) in vec4 a_Color;
11
+ layout(location = 9) in vec3 a_Size;
12
+ layout(location = 11) in vec3 a_Pos;
13
+ layout(location = 13) in vec3 a_Normal;
14
+
15
+
16
+ layout(std140) uniform commonUniform {
17
+ vec4 u_sourceColor;
18
+ vec4 u_targetColor;
19
+ float u_linearColor: 0;
20
+ float u_heightfixed: 0.0; // 默认不固定
21
+ float u_globel;
22
+ float u_r;
23
+ float u_pickLight: 0.0;
24
+ float u_opacitylinear: 0.0;
25
+ float u_opacitylinear_dir: 1.0;
26
+ float u_lightEnable: 1.0;
27
+ };
28
+
29
+ out vec4 v_color;
30
+ out float v_lightWeight;
31
+ out float v_barLinearZ;
25
32
  // 用于将在顶点着色器中计算好的样式值传递给片元
26
33
 
27
34
 
@@ -47,10 +54,6 @@ float getXRadian(float y, float r) {
47
54
 
48
55
  void main() {
49
56
 
50
-
51
- float textureOffset = 0.0; // 在 cell 中取值的偏移量
52
-
53
- textureOffset = opacityAndOffset.g;
54
57
  // cal style mapping - 数据纹理映射部分的计算
55
58
  vec3 size = a_Size * a_Position;
56
59
 
@@ -88,7 +91,7 @@ void main() {
88
91
  v_lightWeight = lightWeight;
89
92
  // 设置圆柱的底色
90
93
  if(u_linearColor == 1.0) { // 使用渐变颜色
91
- v_color = mix(u_sourceColor, u_targetColor, barLinearZ);
94
+ v_color = mix(u_sourceColor, u_targetColor, v_barLinearZ);
92
95
  v_color.rgb *= lightWeight;
93
96
  } else { // 使用 color 方法传入的颜色
94
97
  v_color = a_Color;
@@ -1,23 +1,25 @@
1
- uniform float u_additive;
2
- uniform float u_opacity : 1;
3
- uniform float u_stroke_opacity : 1;
4
- uniform float u_stroke_width : 2;
5
-
6
- varying vec4 v_data;
7
- varying vec4 v_color;
8
- varying float v_radius;
1
+ in vec4 v_data;
2
+ in vec4 v_color;
3
+ in float v_radius;
9
4
 
5
+ layout(std140) uniform commonUniform {
6
+ float u_additive;
7
+ float u_stroke_opacity : 1;
8
+ float u_stroke_width : 2;
9
+ float u_blur : 0.0;
10
+ };
10
11
  #pragma include "sdf_2d"
11
12
  #pragma include "picking"
12
13
 
14
+ out vec4 outputColor;
13
15
 
14
16
  void main() {
15
17
  int shape = int(floor(v_data.w + 0.5));
16
18
 
17
- vec4 strokeColor = textrueStroke == vec4(0) ? v_color : textrueStroke;
19
+ vec4 strokeColor = u_stroke == vec4(0.0) ? v_color : u_stroke;
18
20
 
19
21
  lowp float antialiasblur = v_data.z;
20
- float r = v_radius / (v_radius + strokeWidth);
22
+ float r = v_radius / (v_radius + u_stroke_width);
21
23
 
22
24
  float outer_df;
23
25
  float inner_df;
@@ -55,23 +57,23 @@ void main() {
55
57
 
56
58
  float opacity_t = smoothstep(0.0, antialiasblur, outer_df);
57
59
 
58
- float color_t = strokeWidth < 0.01 ? 0.0 : smoothstep(
60
+ float color_t = u_stroke_width < 0.01 ? 0.0 : smoothstep(
59
61
  antialiasblur,
60
62
  0.0,
61
63
  inner_df
62
64
  );
63
65
 
64
- if(strokeWidth < 0.01) {
65
- gl_FragColor = vec4(v_color.rgb, v_color.a * u_opacity);
66
+ if(u_stroke_width < 0.01) {
67
+ outputColor = vec4(v_color.rgb, v_color.a * u_opacity);
66
68
  } else {
67
- gl_FragColor = mix(vec4(v_color.rgb, v_color.a * u_opacity), u_stroke_color * u_stroke_opacity, color_t);
69
+ outputColor = mix(vec4(v_color.rgb, v_color.a * u_opacity), strokeColor * u_stroke_opacity, color_t);
68
70
  }
69
71
 
70
72
  if(u_additive > 0.0) {
71
- gl_FragColor *= opacity_t;
72
- gl_FragColor = filterColorAlpha(gl_FragColor, gl_FragColor.a);
73
+ outputColor *= opacity_t;
74
+ outputColor = filterColorAlpha(outputColor, outputColor.a);
73
75
  } else {
74
- gl_FragColor.a *= opacity_t;
75
- gl_FragColor = filterColor(gl_FragColor);
76
+ outputColor.a *= opacity_t;
77
+ outputColor = filterColor(outputColor);
76
78
  }
77
79
  }
@@ -1,22 +1,18 @@
1
- attribute vec4 a_Color;
2
- attribute vec3 a_Position;
3
- attribute vec3 a_Extrude;
4
- attribute float a_Size;
5
- attribute float a_Shape;
6
- uniform mat4 u_ModelMatrix;
7
-
8
-
9
- varying vec4 v_data;
10
- varying vec4 v_color;
11
- varying float v_radius;
12
-
13
- uniform float u_opacity : 1;
14
- uniform float u_stroke_opacity : 1;
15
- uniform float u_stroke_width : 2;
16
- uniform vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];
17
- uniform vec2 u_offsets;
18
-
19
- uniform float u_blur : 0.0;
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 float a_Shape;
5
+ layout(location = 11) in vec3 a_Extrude;
6
+
7
+ layout(std140) uniform commonUniform {
8
+ float u_additive;
9
+ float u_stroke_opacity : 1;
10
+ float u_stroke_width : 2;
11
+ float u_blur : 0.0;
12
+ };
13
+ out vec4 v_data;
14
+ out vec4 v_color;
15
+ out float v_radius;
20
16
 
21
17
  #pragma include "projection"
22
18
  #pragma include "picking"
@@ -44,8 +40,7 @@ void main() {
44
40
  // TODP: /abs(extrude.x) 是为了兼容地球模式
45
41
  v_data = vec4(extrude.x/abs(extrude.x), extrude.y/abs(extrude.y), antialiasblur,shape_type);
46
42
 
47
-
48
- gl_Position = u_ViewProjectionMatrix * vec4(a_Position + extrude * newSize * 0.1 + u_offsets, 1.0);
43
+ gl_Position = u_ViewProjectionMatrix * vec4(a_Position + extrude * newSize * 0.1 + vec3(u_offsets,0.0), 1.0);
49
44
 
50
45
  setPickingColor(a_PickingColor);
51
- }
46
+ }
@@ -1,7 +1,4 @@
1
1
  #define pi 3.1415926535
2
- #define ambientRatio 0.5
3
- #define diffuseRatio 0.3
4
- #define specularRatio 0.2
5
2
 
6
3
  layout(location = 0) in vec3 a_Position;
7
4
  layout(location = 1) in vec4 a_Color;