@antv/l7-layers 2.16.1 → 2.16.2

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 (386) hide show
  1. package/es/Geometry/index.js +9 -31
  2. package/es/Geometry/models/billboard.js +51 -89
  3. package/es/Geometry/models/plane.js +81 -143
  4. package/es/Geometry/models/sprite.js +60 -118
  5. package/es/canvas/index.js +10 -33
  6. package/es/canvas/models/canvas.js +41 -97
  7. package/es/citybuliding/building.js +8 -27
  8. package/es/citybuliding/models/build.js +57 -82
  9. package/es/core/BaseLayer.d.ts +3 -0
  10. package/es/core/BaseLayer.js +360 -528
  11. package/es/core/BaseModel.d.ts +9 -71
  12. package/es/core/BaseModel.js +118 -429
  13. package/es/core/CommonStyleAttribute.d.ts +2 -0
  14. package/es/core/CommonStyleAttribute.js +66 -0
  15. package/es/core/LayerPickService.js +21 -32
  16. package/es/core/TextureService.js +0 -13
  17. package/es/core/interface.d.ts +13 -3
  18. package/es/core/interface.js +17 -24
  19. package/es/core/shape/Path.js +13 -20
  20. package/es/core/shape/extrude.js +27 -36
  21. package/es/core/triangulation.d.ts +12 -0
  22. package/es/core/triangulation.js +124 -114
  23. package/es/earth/index.js +9 -33
  24. package/es/earth/models/atmosphere.js +30 -54
  25. package/es/earth/models/base.js +47 -85
  26. package/es/earth/models/bloomsphere.js +30 -54
  27. package/es/earth/utils.js +9 -13
  28. package/es/heatmap/index.js +10 -40
  29. package/es/heatmap/models/grid.js +29 -53
  30. package/es/heatmap/models/grid3d.js +29 -53
  31. package/es/heatmap/models/heatmap.d.ts +1 -0
  32. package/es/heatmap/models/heatmap.js +99 -150
  33. package/es/heatmap/models/hexagon.js +29 -53
  34. package/es/heatmap/shaders/grid_vert.glsl +2 -2
  35. package/es/heatmap/shaders/hexagon_3d_vert.glsl +2 -2
  36. package/es/heatmap/shaders/hexagon_vert.glsl +2 -2
  37. package/es/heatmap/triangulation.js +0 -4
  38. package/es/image/index.js +9 -28
  39. package/es/image/models/image.js +66 -100
  40. package/es/index.js +9 -17
  41. package/es/line/index.d.ts +1 -0
  42. package/es/line/index.js +12 -36
  43. package/es/line/models/arc.js +72 -160
  44. package/es/line/models/arc_3d.js +67 -148
  45. package/es/line/models/earthArc_3d.js +66 -148
  46. package/es/line/models/{half.d.ts → flow.d.ts} +1 -11
  47. package/es/line/models/flow.js +167 -0
  48. package/es/line/models/great_circle.js +57 -135
  49. package/es/line/models/index.d.ts +1 -1
  50. package/es/line/models/index.js +3 -3
  51. package/es/line/models/line.js +98 -186
  52. package/es/line/models/linearline.js +46 -115
  53. package/es/line/models/simpleLine.d.ts +0 -1
  54. package/es/line/models/simpleLine.js +42 -114
  55. package/es/line/models/wall.js +52 -92
  56. package/es/line/shaders/dash/arc_dash_frag.glsl +3 -6
  57. package/es/line/shaders/dash/arc_dash_vert.glsl +6 -46
  58. package/es/line/shaders/dash/line_dash_frag.glsl +4 -7
  59. package/es/line/shaders/dash/line_dash_vert.glsl +3 -33
  60. package/es/line/shaders/flow/flow_line_frag.glsl +13 -0
  61. package/es/line/shaders/flow/flow_line_vert.glsl +83 -0
  62. package/es/line/shaders/line_arc_3d_frag.glsl +6 -6
  63. package/es/line/shaders/line_arc_3d_vert.glsl +4 -34
  64. package/es/line/shaders/line_arc_frag.glsl +7 -11
  65. package/es/line/shaders/line_arc_great_circle_frag.glsl +5 -6
  66. package/es/line/shaders/line_arc_great_circle_vert.glsl +4 -32
  67. package/es/line/shaders/line_arc_vert.glsl +9 -45
  68. package/es/line/shaders/line_frag.glsl +15 -17
  69. package/es/line/shaders/line_vert.glsl +3 -34
  70. package/es/line/shaders/linear/arc3d_linear_frag.glsl +5 -19
  71. package/es/line/shaders/linear/arc3d_linear_vert.glsl +9 -48
  72. package/es/line/shaders/linear/arc_linear_frag.glsl +2 -30
  73. package/es/line/shaders/linear/arc_linear_vert.glsl +9 -45
  74. package/es/line/shaders/linear/line_linear_frag.glsl +5 -6
  75. package/es/line/shaders/linearLine/line_linear_frag.glsl +2 -14
  76. package/es/line/shaders/linearLine/line_linear_vert.glsl +14 -32
  77. package/es/line/shaders/simple/simpleline_frag.glsl +1 -5
  78. package/es/line/shaders/simple/simpleline_linear_frag.glsl +2 -6
  79. package/es/line/shaders/simple/simpleline_vert.glsl +7 -33
  80. package/es/mask/index.js +9 -28
  81. package/es/mask/models/fill.js +29 -54
  82. package/es/plugins/DataMappingPlugin.js +90 -141
  83. package/es/plugins/DataSourcePlugin.js +45 -68
  84. package/es/plugins/FeatureScalePlugin.js +67 -122
  85. package/es/plugins/LayerAnimateStylePlugin.js +0 -5
  86. package/es/plugins/LayerMaskPlugin.js +3 -11
  87. package/es/plugins/LayerModelPlugin.js +79 -104
  88. package/es/plugins/LayerStylePlugin.js +3 -9
  89. package/es/plugins/LightingPlugin.js +12 -18
  90. package/es/plugins/MultiPassRendererPlugin.js +11 -16
  91. package/es/plugins/PixelPickingPlugin.js +12 -21
  92. package/es/plugins/RegisterStyleAttributePlugin.js +5 -12
  93. package/es/plugins/ShaderUniformPlugin.js +15 -29
  94. package/es/plugins/UpdateModelPlugin.js +0 -5
  95. package/es/plugins/UpdateStyleAttributePlugin.js +5 -11
  96. package/es/point/index.d.ts +1 -0
  97. package/es/point/index.js +27 -77
  98. package/es/point/models/earthExtrude.d.ts +0 -3
  99. package/es/point/models/earthExtrude.js +60 -139
  100. package/es/point/models/earthFill.d.ts +0 -1
  101. package/es/point/models/earthFill.js +59 -140
  102. package/es/point/models/extrude.d.ts +0 -3
  103. package/es/point/models/extrude.js +60 -140
  104. package/es/point/models/fill.d.ts +0 -1
  105. package/es/point/models/fill.js +67 -158
  106. package/es/point/models/fillmage.js +66 -147
  107. package/es/point/models/image.js +52 -126
  108. package/es/point/models/index.js +2 -2
  109. package/es/point/models/normal.js +32 -56
  110. package/es/point/models/radar.d.ts +0 -1
  111. package/es/point/models/radar.js +42 -75
  112. package/es/point/models/simplePoint.d.ts +0 -1
  113. package/es/point/models/simplePoint.js +46 -115
  114. package/es/point/models/text.js +211 -344
  115. package/es/point/shaders/animate/wave_frag.glsl +1 -11
  116. package/es/point/shaders/earth/extrude_frag.glsl +5 -17
  117. package/es/point/shaders/earth/extrude_vert.glsl +14 -29
  118. package/es/point/shaders/earth/fill_frag.glsl +5 -14
  119. package/es/point/shaders/earth/fill_vert.glsl +1 -75
  120. package/es/point/shaders/extrude/extrude_frag.glsl +3 -29
  121. package/es/point/shaders/extrude/extrude_vert.glsl +27 -35
  122. package/es/point/shaders/fill_frag.glsl +9 -20
  123. package/es/point/shaders/fill_vert.glsl +16 -101
  124. package/es/point/shaders/image/fillImage_frag.glsl +2 -5
  125. package/es/point/shaders/image/fillImage_vert.glsl +4 -47
  126. package/es/point/shaders/image_frag.glsl +1 -5
  127. package/es/point/shaders/image_vert.glsl +1 -44
  128. package/es/point/shaders/normal_frag.glsl +0 -2
  129. package/es/point/shaders/normal_vert.glsl +2 -1
  130. package/es/point/shaders/radar/radar_vert.glsl +2 -2
  131. package/es/point/shaders/simplePoint_frag.glsl +0 -7
  132. package/es/point/shaders/simplePoint_vert.glsl +3 -45
  133. package/es/point/shaders/text_frag.glsl +6 -19
  134. package/es/point/shaders/text_vert.glsl +5 -66
  135. package/es/point/shape/extrude.js +4 -13
  136. package/es/polygon/index.d.ts +1 -0
  137. package/es/polygon/index.js +12 -40
  138. package/es/polygon/models/extrude.d.ts +0 -3
  139. package/es/polygon/models/extrude.js +122 -162
  140. package/es/polygon/models/fill.d.ts +0 -4
  141. package/es/polygon/models/fill.js +57 -130
  142. package/es/polygon/models/index.js +3 -2
  143. package/es/polygon/models/ocean.js +42 -76
  144. package/es/polygon/models/water.js +37 -71
  145. package/es/polygon/shaders/extrude/polygon_extrude_frag.glsl +2 -23
  146. package/es/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +7 -5
  147. package/es/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +7 -32
  148. package/es/polygon/shaders/extrude/polygon_extrude_vert.glsl +33 -38
  149. package/es/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +12 -9
  150. package/es/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +16 -44
  151. package/es/polygon/shaders/polygon_frag.glsl +0 -5
  152. package/es/polygon/shaders/polygon_linear_frag.glsl +0 -8
  153. package/es/polygon/shaders/polygon_linear_vert.glsl +0 -32
  154. package/es/polygon/shaders/polygon_vert.glsl +1 -27
  155. package/es/raster/buffers/triangulation.js +2 -4
  156. package/es/raster/index.js +9 -32
  157. package/es/raster/models/raster.js +80 -116
  158. package/es/raster/models/rasterRgb.js +84 -127
  159. package/es/raster/models/rasterTerrainRgb.js +56 -84
  160. package/es/tile/interaction/getRasterData.js +14 -20
  161. package/es/tile/interaction/utils.js +7 -9
  162. package/es/tile/manager/base.js +63 -96
  163. package/es/tile/service/TileLayerService.js +33 -55
  164. package/es/tile/service/TilePickService.js +26 -40
  165. package/es/tile/service/TileSourceService.js +3 -7
  166. package/es/tile/tileFactory/DebugTile.js +29 -46
  167. package/es/tile/tileFactory/ImageTile.js +20 -38
  168. package/es/tile/tileFactory/MaskTile.js +22 -43
  169. package/es/tile/tileFactory/RasterRGBTile.js +22 -42
  170. package/es/tile/tileFactory/RasterTerrainRGBTile.js +20 -38
  171. package/es/tile/tileFactory/RasterTile.js +30 -53
  172. package/es/tile/tileFactory/Tile.js +63 -97
  173. package/es/tile/tileFactory/VectorTile.js +41 -68
  174. package/es/tile/tileFactory/index.js +0 -11
  175. package/es/tile/tileFactory/layers/TileDebugLayer.js +6 -27
  176. package/es/tile/tileFactory/util.js +0 -3
  177. package/es/tile/tileLayer/BaseLayer.js +105 -146
  178. package/es/tile/utils.js +1 -1
  179. package/es/utils/blend.js +0 -2
  180. package/es/utils/collision-index.js +9 -16
  181. package/es/utils/extrude_polyline.js +101 -149
  182. package/es/utils/grid-index.js +2 -27
  183. package/es/utils/identityScale.js +0 -8
  184. package/es/utils/layerData.js +32 -46
  185. package/es/utils/multiPassRender.js +11 -13
  186. package/es/utils/polylineNormal.js +31 -37
  187. package/es/utils/simpleLine.js +2 -16
  188. package/es/utils/stencil.js +2 -3
  189. package/es/utils/symbol-layout.js +27 -53
  190. package/es/wind/index.js +9 -29
  191. package/es/wind/models/utils.js +26 -51
  192. package/es/wind/models/wind.js +101 -147
  193. package/es/wind/models/windRender.js +53 -66
  194. package/lib/Geometry/index.js +9 -38
  195. package/lib/Geometry/models/billboard.js +51 -97
  196. package/lib/Geometry/models/index.js +0 -5
  197. package/lib/Geometry/models/plane.js +79 -151
  198. package/lib/Geometry/models/sprite.js +60 -127
  199. package/lib/canvas/index.js +10 -40
  200. package/lib/canvas/models/canvas.js +41 -101
  201. package/lib/canvas/models/index.js +0 -3
  202. package/lib/citybuliding/building.js +8 -35
  203. package/lib/citybuliding/models/build.js +57 -92
  204. package/lib/core/BaseLayer.js +358 -520
  205. package/lib/core/BaseModel.js +117 -441
  206. package/lib/core/CommonStyleAttribute.js +72 -0
  207. package/lib/core/LayerPickService.js +21 -37
  208. package/lib/core/TextureService.js +0 -16
  209. package/lib/core/interface.js +21 -31
  210. package/lib/core/schema.js +0 -1
  211. package/lib/core/shape/Path.js +14 -31
  212. package/lib/core/shape/extrude.js +27 -59
  213. package/lib/core/triangulation.js +125 -153
  214. package/lib/earth/index.js +9 -43
  215. package/lib/earth/models/atmosphere.js +30 -63
  216. package/lib/earth/models/base.js +47 -90
  217. package/lib/earth/models/bloomsphere.js +30 -63
  218. package/lib/earth/utils.js +7 -31
  219. package/lib/heatmap/index.js +10 -48
  220. package/lib/heatmap/models/grid.js +29 -61
  221. package/lib/heatmap/models/grid3d.js +29 -61
  222. package/lib/heatmap/models/heatmap.js +99 -166
  223. package/lib/heatmap/models/hexagon.js +29 -61
  224. package/lib/heatmap/models/index.js +0 -6
  225. package/lib/heatmap/shaders/grid_vert.glsl +2 -2
  226. package/lib/heatmap/shaders/hexagon_3d_vert.glsl +2 -2
  227. package/lib/heatmap/shaders/hexagon_vert.glsl +2 -2
  228. package/lib/heatmap/triangulation.js +0 -5
  229. package/lib/image/index.js +9 -36
  230. package/lib/image/models/image.js +66 -109
  231. package/lib/image/models/index.js +0 -3
  232. package/lib/index.js +7 -61
  233. package/lib/line/index.js +12 -42
  234. package/lib/line/models/arc.js +70 -170
  235. package/lib/line/models/arc_3d.js +65 -159
  236. package/lib/line/models/earthArc_3d.js +64 -159
  237. package/lib/line/models/flow.js +174 -0
  238. package/lib/line/models/great_circle.js +57 -146
  239. package/lib/line/models/index.js +3 -14
  240. package/lib/line/models/line.js +96 -194
  241. package/lib/line/models/linearline.js +46 -127
  242. package/lib/line/models/simpleLine.js +42 -124
  243. package/lib/line/models/wall.js +52 -103
  244. package/lib/line/shaders/dash/arc_dash_frag.glsl +3 -6
  245. package/lib/line/shaders/dash/arc_dash_vert.glsl +6 -46
  246. package/lib/line/shaders/dash/line_dash_frag.glsl +4 -7
  247. package/lib/line/shaders/dash/line_dash_vert.glsl +3 -33
  248. package/lib/line/shaders/flow/flow_line_frag.glsl +13 -0
  249. package/lib/line/shaders/flow/flow_line_vert.glsl +83 -0
  250. package/lib/line/shaders/line_arc_3d_frag.glsl +6 -6
  251. package/lib/line/shaders/line_arc_3d_vert.glsl +4 -34
  252. package/lib/line/shaders/line_arc_frag.glsl +7 -11
  253. package/lib/line/shaders/line_arc_great_circle_frag.glsl +5 -6
  254. package/lib/line/shaders/line_arc_great_circle_vert.glsl +4 -32
  255. package/lib/line/shaders/line_arc_vert.glsl +9 -45
  256. package/lib/line/shaders/line_frag.glsl +15 -17
  257. package/lib/line/shaders/line_vert.glsl +3 -34
  258. package/lib/line/shaders/linear/arc3d_linear_frag.glsl +5 -19
  259. package/lib/line/shaders/linear/arc3d_linear_vert.glsl +9 -48
  260. package/lib/line/shaders/linear/arc_linear_frag.glsl +2 -30
  261. package/lib/line/shaders/linear/arc_linear_vert.glsl +9 -45
  262. package/lib/line/shaders/linear/line_linear_frag.glsl +5 -6
  263. package/lib/line/shaders/linearLine/line_linear_frag.glsl +2 -14
  264. package/lib/line/shaders/linearLine/line_linear_vert.glsl +14 -32
  265. package/lib/line/shaders/simple/simpleline_frag.glsl +1 -5
  266. package/lib/line/shaders/simple/simpleline_linear_frag.glsl +2 -6
  267. package/lib/line/shaders/simple/simpleline_vert.glsl +7 -33
  268. package/lib/mask/index.js +9 -36
  269. package/lib/mask/models/fill.js +29 -63
  270. package/lib/mask/models/index.js +0 -3
  271. package/lib/plugins/DataMappingPlugin.js +90 -152
  272. package/lib/plugins/DataSourcePlugin.js +45 -76
  273. package/lib/plugins/FeatureScalePlugin.js +67 -138
  274. package/lib/plugins/LayerAnimateStylePlugin.js +0 -10
  275. package/lib/plugins/LayerMaskPlugin.js +4 -17
  276. package/lib/plugins/LayerModelPlugin.js +80 -113
  277. package/lib/plugins/LayerStylePlugin.js +4 -14
  278. package/lib/plugins/LightingPlugin.js +12 -25
  279. package/lib/plugins/MultiPassRendererPlugin.js +11 -22
  280. package/lib/plugins/PixelPickingPlugin.js +12 -27
  281. package/lib/plugins/RegisterStyleAttributePlugin.js +5 -19
  282. package/lib/plugins/ShaderUniformPlugin.js +15 -36
  283. package/lib/plugins/UpdateModelPlugin.js +1 -10
  284. package/lib/plugins/UpdateStyleAttributePlugin.js +5 -16
  285. package/lib/point/index.js +27 -83
  286. package/lib/point/models/earthExtrude.js +60 -150
  287. package/lib/point/models/earthFill.js +59 -170
  288. package/lib/point/models/extrude.js +60 -150
  289. package/lib/point/models/fill.js +65 -167
  290. package/lib/point/models/fillmage.js +64 -155
  291. package/lib/point/models/image.js +52 -136
  292. package/lib/point/models/index.js +1 -12
  293. package/lib/point/models/normal.js +32 -66
  294. package/lib/point/models/radar.js +42 -85
  295. package/lib/point/models/simplePoint.js +46 -125
  296. package/lib/point/models/text.js +209 -350
  297. package/lib/point/shaders/animate/wave_frag.glsl +1 -11
  298. package/lib/point/shaders/earth/extrude_frag.glsl +5 -17
  299. package/lib/point/shaders/earth/extrude_vert.glsl +14 -29
  300. package/lib/point/shaders/earth/fill_frag.glsl +5 -14
  301. package/lib/point/shaders/earth/fill_vert.glsl +1 -75
  302. package/lib/point/shaders/extrude/extrude_frag.glsl +3 -29
  303. package/lib/point/shaders/extrude/extrude_vert.glsl +27 -35
  304. package/lib/point/shaders/fill_frag.glsl +9 -20
  305. package/lib/point/shaders/fill_vert.glsl +16 -101
  306. package/lib/point/shaders/image/fillImage_frag.glsl +2 -5
  307. package/lib/point/shaders/image/fillImage_vert.glsl +4 -47
  308. package/lib/point/shaders/image_frag.glsl +1 -5
  309. package/lib/point/shaders/image_vert.glsl +1 -44
  310. package/lib/point/shaders/normal_frag.glsl +0 -2
  311. package/lib/point/shaders/normal_vert.glsl +2 -1
  312. package/lib/point/shaders/radar/radar_vert.glsl +2 -2
  313. package/lib/point/shaders/simplePoint_frag.glsl +0 -7
  314. package/lib/point/shaders/simplePoint_vert.glsl +3 -45
  315. package/lib/point/shaders/text_frag.glsl +6 -19
  316. package/lib/point/shaders/text_vert.glsl +5 -66
  317. package/lib/point/shape/extrude.js +4 -20
  318. package/lib/polygon/index.js +12 -48
  319. package/lib/polygon/models/extrude.js +122 -173
  320. package/lib/polygon/models/fill.js +57 -140
  321. package/lib/polygon/models/index.js +2 -14
  322. package/lib/polygon/models/ocean.js +42 -88
  323. package/lib/polygon/models/water.js +37 -82
  324. package/lib/polygon/shaders/extrude/polygon_extrude_frag.glsl +2 -23
  325. package/lib/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +7 -5
  326. package/lib/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +7 -32
  327. package/lib/polygon/shaders/extrude/polygon_extrude_vert.glsl +33 -38
  328. package/lib/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +12 -9
  329. package/lib/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +16 -44
  330. package/lib/polygon/shaders/polygon_frag.glsl +0 -5
  331. package/lib/polygon/shaders/polygon_linear_frag.glsl +0 -8
  332. package/lib/polygon/shaders/polygon_linear_vert.glsl +0 -32
  333. package/lib/polygon/shaders/polygon_vert.glsl +1 -27
  334. package/lib/raster/buffers/triangulation.js +3 -7
  335. package/lib/raster/index.js +9 -40
  336. package/lib/raster/models/index.js +0 -5
  337. package/lib/raster/models/raster.js +80 -125
  338. package/lib/raster/models/rasterRgb.js +84 -139
  339. package/lib/raster/models/rasterTerrainRgb.js +56 -93
  340. package/lib/tile/interaction/getRasterData.js +14 -25
  341. package/lib/tile/interaction/utils.js +7 -19
  342. package/lib/tile/manager/base.js +63 -104
  343. package/lib/tile/service/TileLayerService.js +33 -60
  344. package/lib/tile/service/TilePickService.js +26 -48
  345. package/lib/tile/service/TileSourceService.js +2 -16
  346. package/lib/tile/style/utils.js +0 -3
  347. package/lib/tile/tileFactory/DebugTile.js +29 -54
  348. package/lib/tile/tileFactory/ImageTile.js +20 -46
  349. package/lib/tile/tileFactory/MaskTile.js +22 -51
  350. package/lib/tile/tileFactory/RasterRGBTile.js +22 -50
  351. package/lib/tile/tileFactory/RasterTerrainRGBTile.js +20 -46
  352. package/lib/tile/tileFactory/RasterTile.js +30 -63
  353. package/lib/tile/tileFactory/Tile.js +63 -102
  354. package/lib/tile/tileFactory/VectorTile.js +41 -76
  355. package/lib/tile/tileFactory/index.js +0 -25
  356. package/lib/tile/tileFactory/layers/TileDebugLayer.js +6 -32
  357. package/lib/tile/tileFactory/util.js +0 -9
  358. package/lib/tile/tileLayer/BaseLayer.js +105 -153
  359. package/lib/tile/utils.js +1 -5
  360. package/lib/utils/blend.js +0 -5
  361. package/lib/utils/collision-index.js +9 -25
  362. package/lib/utils/extrude_polyline.js +101 -181
  363. package/lib/utils/grid-index.js +2 -28
  364. package/lib/utils/identityScale.js +0 -9
  365. package/lib/utils/layerData.js +32 -51
  366. package/lib/utils/multiPassRender.js +11 -16
  367. package/lib/utils/polylineNormal.js +31 -66
  368. package/lib/utils/simpleLine.js +2 -21
  369. package/lib/utils/stencil.js +0 -4
  370. package/lib/utils/symbol-layout.js +27 -55
  371. package/lib/wind/index.js +9 -37
  372. package/lib/wind/models/index.js +0 -3
  373. package/lib/wind/models/utils.js +26 -62
  374. package/lib/wind/models/wind.js +101 -157
  375. package/lib/wind/models/windRender.js +53 -71
  376. package/lib/wind/models/windShader.js +0 -1
  377. package/package.json +7 -7
  378. package/es/line/models/half.js +0 -298
  379. package/es/line/shaders/half/line_half_frag.glsl +0 -53
  380. package/es/line/shaders/half/line_half_vert.glsl +0 -169
  381. package/es/utils/dataMappingStyle.d.ts +0 -31
  382. package/es/utils/dataMappingStyle.js +0 -147
  383. package/lib/line/models/half.js +0 -315
  384. package/lib/line/shaders/half/line_half_frag.glsl +0 -53
  385. package/lib/line/shaders/half/line_half_vert.glsl +0 -169
  386. package/lib/utils/dataMappingStyle.js +0 -151
@@ -1,7 +1,6 @@
1
1
 
2
2
  uniform float u_additive;
3
3
 
4
- varying mat4 styleMappingMat; // 传递从片元中传递的映射数据
5
4
 
6
5
  varying vec4 v_data;
7
6
  varying vec4 v_color;
@@ -14,15 +13,6 @@ uniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
14
13
 
15
14
  void main() {
16
15
 
17
- vec4 textrueStroke = vec4(
18
- styleMappingMat[1][0],
19
- styleMappingMat[1][1],
20
- styleMappingMat[1][2],
21
- styleMappingMat[1][3]
22
- );
23
-
24
- float opacity = styleMappingMat[0][0];
25
-
26
16
  lowp float antialiasblur = v_data.z;
27
17
  float r = v_radius / (v_radius);
28
18
 
@@ -45,7 +35,7 @@ void main() {
45
35
  float N_RINGS = 3.0;
46
36
  float FREQ = 1.0;
47
37
 
48
- gl_FragColor = vec4(v_color.rgb, v_color.a * opacity);
38
+ gl_FragColor = v_color;
49
39
 
50
40
  float d = length(v_data.xy);
51
41
  if(d > 0.5) {
@@ -5,7 +5,6 @@ uniform float u_pickLight: 0.0;
5
5
 
6
6
  #pragma include "picking"
7
7
 
8
- varying mat4 styleMappingMat; // 传递从片元中传递的映射数据
9
8
 
10
9
  uniform float u_linearColor: 0;
11
10
  uniform vec4 u_sourceColor;
@@ -13,31 +12,20 @@ uniform vec4 u_targetColor;
13
12
 
14
13
  uniform float u_opacitylinear: 0.0;
15
14
  uniform float u_opacitylinear_dir: 1.0;
16
-
15
+ varying float v_lightWeight;
16
+ varying float v_barLinearZ;
17
17
  void main() {
18
- float opacity = styleMappingMat[0][0];
19
- float lightWeight = styleMappingMat[1][3];
20
- float barLinearZ = styleMappingMat[2][3];
21
-
22
- // 设置圆柱的底色
23
- if(u_linearColor == 1.0) { // 使用渐变颜色
24
- gl_FragColor = mix(u_sourceColor, u_targetColor, barLinearZ);
25
- gl_FragColor.rgb *= lightWeight;
26
- } else { // 使用 color 方法传入的颜色
27
- gl_FragColor = v_color;
28
- }
29
18
 
30
- // 应用透明度
31
- gl_FragColor.a *= opacity;
19
+ gl_FragColor = v_color;
32
20
 
33
21
  // 开启透明度渐变
34
22
  if(u_opacitylinear > 0.0) {
35
- gl_FragColor.a *= u_opacitylinear_dir > 0.0 ? (1.0 - barLinearZ): barLinearZ;
23
+ gl_FragColor.a *= u_opacitylinear_dir > 0.0 ? (1.0 - v_barLinearZ): v_barLinearZ;
36
24
  }
37
25
 
38
26
  // picking
39
27
  if(u_pickLight > 0.0) {
40
- gl_FragColor = filterColorAlpha(gl_FragColor, lightWeight);
28
+ gl_FragColor = filterColorAlpha(gl_FragColor, v_lightWeight);
41
29
  } else {
42
30
  gl_FragColor = filterColor(gl_FragColor);
43
31
  }
@@ -20,11 +20,10 @@ varying vec4 v_color;
20
20
 
21
21
  uniform float u_opacity : 1;
22
22
  uniform float u_lightEnable: 1;
23
+ varying float v_lightWeight;
24
+ varying float v_barLinearZ;
25
+ // 用于将在顶点着色器中计算好的样式值传递给片元
23
26
 
24
- varying mat4 styleMappingMat; // 用于将在顶点着色器中计算好的样式值传递给片元
25
-
26
- #pragma include "styleMapping"
27
- #pragma include "styleMappingCalOpacity"
28
27
 
29
28
  #pragma include "projection"
30
29
  #pragma include "light"
@@ -48,35 +47,15 @@ float getXRadian(float y, float r) {
48
47
 
49
48
  void main() {
50
49
 
51
- // cal style mapping - 数据纹理映射部分的计算
52
- styleMappingMat = mat4(
53
- 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty
54
- 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA - lightWeight
55
- 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1] - linearZ(垂直方向 0 - 1 的值)
56
- 0.0, 0.0, 0.0, 0.0
57
- );
58
-
59
- float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行
60
- float columnCount = u_cellTypeLayout[0][1]; // 当看到数据纹理有几列
61
- float columnWidth = 1.0/columnCount; // 列宽
62
- float rowHeight = 1.0/rowCount; // 行高
63
- float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets
64
- float id = a_vertexId; // 第n个顶点
65
- float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // 起始点在第几行
66
- float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // 起始点在第几列
67
50
 
68
- // cell 固定顺序 opacity -> strokeOpacity -> strokeWidth -> stroke ...
69
- // 按顺序从 cell 中取值、若没有则自动往下取值
70
51
  float textureOffset = 0.0; // 在 cell 中取值的偏移量
71
52
 
72
- vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);
73
- styleMappingMat[0][0] = opacityAndOffset.r;
74
53
  textureOffset = opacityAndOffset.g;
75
54
  // cal style mapping - 数据纹理映射部分的计算
76
55
  vec3 size = a_Size * a_Position;
77
56
 
78
57
  // a_Position.z 是在构建网格的时候传入的标准值 0 - 1,在插值器插值可以获取 0~1 线性渐变的值
79
- styleMappingMat[2][3] = a_Position.z;
58
+ v_barLinearZ = a_Position.z;
80
59
 
81
60
  vec3 offset = size; // 控制圆柱体的大小 - 从标准单位圆柱体进行偏移
82
61
  if(u_heightfixed < 1.0) { // 圆柱体不固定高度
@@ -106,11 +85,17 @@ void main() {
106
85
  if(u_lightEnable > 0.0) { // 取消三元表达式,增强健壮性
107
86
  lightWeight = calc_lighting(pos);
108
87
  }
109
- styleMappingMat[1][3] = lightWeight;
110
-
111
- v_color =vec4(a_Color.rgb * lightWeight, a_Color.w);
88
+ v_lightWeight = lightWeight;
89
+ // 设置圆柱的底色
90
+ if(u_linearColor == 1.0) { // 使用渐变颜色
91
+ v_color = mix(u_sourceColor, u_targetColor, barLinearZ);
92
+ v_color.rgb *= lightWeight;
93
+ } else { // 使用 color 方法传入的颜色
94
+ v_color = a_Color;
95
+ }
96
+ v_color.a *= u_opacity;
112
97
 
113
-
98
+
114
99
  // 在地球模式下,将原本垂直于 xy 平面的圆柱调整姿态到适应圆的角度
115
100
  //旋转矩阵mx,创建绕x轴旋转矩阵
116
101
  float r = sqrt(a_Pos.z*a_Pos.z + a_Pos.x*a_Pos.x);
@@ -1,6 +1,7 @@
1
1
  uniform float u_additive;
2
-
3
- varying mat4 styleMappingMat; // 传递从片元中传递的映射数据
2
+ uniform float u_opacity : 1;
3
+ uniform float u_stroke_opacity : 1;
4
+ uniform float u_stroke_width : 2;
4
5
 
5
6
  varying vec4 v_data;
6
7
  varying vec4 v_color;
@@ -13,16 +14,6 @@ varying float v_radius;
13
14
  void main() {
14
15
  int shape = int(floor(v_data.w + 0.5));
15
16
 
16
- vec4 textrueStroke = vec4(
17
- styleMappingMat[1][0],
18
- styleMappingMat[1][1],
19
- styleMappingMat[1][2],
20
- styleMappingMat[1][3]
21
- );
22
-
23
- float opacity = styleMappingMat[0][0];
24
- float stroke_opacity = styleMappingMat[0][1];
25
- float strokeWidth = styleMappingMat[0][2];
26
17
  vec4 strokeColor = textrueStroke == vec4(0) ? v_color : textrueStroke;
27
18
 
28
19
  lowp float antialiasblur = v_data.z;
@@ -71,9 +62,9 @@ void main() {
71
62
  );
72
63
 
73
64
  if(strokeWidth < 0.01) {
74
- gl_FragColor = vec4(v_color.rgb, v_color.a * opacity);
65
+ gl_FragColor = vec4(v_color.rgb, v_color.a * u_opacity);
75
66
  } else {
76
- gl_FragColor = mix(vec4(v_color.rgb, v_color.a * opacity), strokeColor * stroke_opacity, color_t);
67
+ gl_FragColor = mix(vec4(v_color.rgb, v_color.a * u_opacity), u_stroke_color * u_stroke_opacity, color_t);
77
68
  }
78
69
 
79
70
  if(u_additive > 0.0) {
@@ -3,9 +3,6 @@ attribute vec3 a_Position;
3
3
  attribute vec3 a_Extrude;
4
4
  attribute float a_Size;
5
5
  attribute float a_Shape;
6
-
7
- varying mat4 styleMappingMat; // 用于将在顶点着色器中计算好的样式值传递给片元
8
-
9
6
  uniform mat4 u_ModelMatrix;
10
7
  uniform mat4 u_Mvp;
11
8
 
@@ -21,11 +18,6 @@ uniform vec2 u_offsets;
21
18
 
22
19
  uniform float u_blur : 0.0;
23
20
 
24
- #pragma include "styleMapping"
25
- #pragma include "styleMappingCalOpacity"
26
- #pragma include "styleMappingCalStrokeOpacity"
27
- #pragma include "styleMappingCalStrokeWidth"
28
-
29
21
  #pragma include "projection"
30
22
  #pragma include "picking"
31
23
 
@@ -39,72 +31,6 @@ void main() {
39
31
  float newSize = setPickingSize(a_Size);
40
32
  // float newSize = setPickingSize(a_Size) * 0.00001038445708445579;
41
33
 
42
- // cal style mapping - 数据纹理映射部分的计算
43
- styleMappingMat = mat4(
44
- 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty
45
- 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA
46
- 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]
47
- 0.0, 0.0, 0.0, 0.0
48
- );
49
-
50
- float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行
51
- float columnCount = u_cellTypeLayout[0][1]; // 当看到数据纹理有几列
52
- float columnWidth = 1.0/columnCount; // 列宽
53
- float rowHeight = 1.0/rowCount; // 行高
54
- float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets
55
- float id = a_vertexId; // 第n个顶点
56
- float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // 起始点在第几行
57
- float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // 起始点在第几列
58
-
59
- // cell 固定顺序 opacity -> strokeOpacity -> strokeWidth -> stroke ...
60
- // 按顺序从 cell 中取值、若没有则自动往下取值
61
- float textureOffset = 0.0; // 在 cell 中取值的偏移量
62
-
63
- vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);
64
- styleMappingMat[0][0] = opacityAndOffset.r;
65
- textureOffset = opacityAndOffset.g;
66
-
67
- vec2 strokeOpacityAndOffset = calStrokeOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);
68
- styleMappingMat[0][1] = strokeOpacityAndOffset.r;
69
- textureOffset = strokeOpacityAndOffset.g;
70
-
71
- vec2 strokeWidthAndOffset = calStrokeWidthAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);
72
- styleMappingMat[0][2] = strokeWidthAndOffset.r;
73
- textureOffset = strokeWidthAndOffset.g;
74
-
75
- vec4 textrueStroke = vec4(-1.0, -1.0, -1.0, -1.0);
76
- if(hasStroke()) {
77
- vec2 valueRPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);
78
- styleMappingMat[1][0] = pos2value(valueRPos, columnWidth, rowHeight); // R
79
- textureOffset += 1.0;
80
-
81
- vec2 valueGPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);
82
- styleMappingMat[1][1] = pos2value(valueGPos, columnWidth, rowHeight); // G
83
- textureOffset += 1.0;
84
-
85
- vec2 valueBPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);
86
- styleMappingMat[1][2] = pos2value(valueBPos, columnWidth, rowHeight); // B
87
- textureOffset += 1.0;
88
-
89
- vec2 valueAPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);
90
- styleMappingMat[1][3] = pos2value(valueAPos, columnWidth, rowHeight); // A
91
- textureOffset += 1.0;
92
- } else {
93
- if(u_stroke_color == vec4(0.0)) {
94
- styleMappingMat[1][0] = v_color.r;
95
- styleMappingMat[1][1] = v_color.g;
96
- styleMappingMat[1][2] = v_color.b;
97
- styleMappingMat[1][3] = v_color.a;
98
- } else {
99
- styleMappingMat[1][0] = u_stroke_color.r;
100
- styleMappingMat[1][1] = u_stroke_color.g;
101
- styleMappingMat[1][2] = u_stroke_color.b;
102
- styleMappingMat[1][3] = u_stroke_color.a;
103
- }
104
- }
105
-
106
- // cal style mapping
107
-
108
34
  // unpack color(vec2)
109
35
  v_color = a_Color;
110
36
 
@@ -119,7 +45,7 @@ void main() {
119
45
  v_data = vec4(extrude.x/abs(extrude.x), extrude.y/abs(extrude.y), antialiasblur,shape_type);
120
46
 
121
47
 
122
- gl_Position = u_ViewProjectionMatrix * vec4(a_Position + extrude * newSize * 0.1, 1.0);
48
+ gl_Position = u_ViewProjectionMatrix * vec4(a_Position + extrude * newSize * 0.1 + u_offsets, 1.0);
123
49
 
124
50
  setPickingColor(a_PickingColor);
125
51
  }
@@ -1,43 +1,17 @@
1
1
  varying vec4 v_color;
2
- uniform float u_opacity: 1.0;
3
-
2
+ varying float v_lightWeight;
4
3
  uniform float u_pickLight: 0.0;
5
4
 
6
5
  #pragma include "picking"
7
6
 
8
- varying mat4 styleMappingMat; // 传递从片元中传递的映射数据
9
-
10
- uniform float u_linearColor: 0;
11
- uniform vec4 u_sourceColor;
12
- uniform vec4 u_targetColor;
13
-
14
- uniform float u_opacitylinear: 0.0;
15
- uniform float u_opacitylinear_dir: 1.0;
16
7
 
17
8
  void main() {
18
- float opacity = styleMappingMat[0][0];
19
- float lightWeight = styleMappingMat[1][3];
20
- float barLinearZ = styleMappingMat[2][3];
21
-
22
- // 设置圆柱的底色
23
- if(u_linearColor == 1.0) { // 使用渐变颜色
24
- gl_FragColor = mix(u_sourceColor, u_targetColor, barLinearZ);
25
- gl_FragColor.rgb *= lightWeight;
26
- } else { // 使用 color 方法传入的颜色
27
- gl_FragColor = v_color;
28
- }
29
-
30
- // 应用透明度
31
- gl_FragColor.a *= opacity;
32
9
 
10
+ gl_FragColor = v_color;
33
11
  // 开启透明度渐变
34
- if(u_opacitylinear > 0.0) {
35
- gl_FragColor.a *= u_opacitylinear_dir > 0.0 ? (1.0 - barLinearZ): barLinearZ;
36
- }
37
-
38
12
  // picking
39
13
  if(u_pickLight > 0.0) {
40
- gl_FragColor = filterColorAlpha(gl_FragColor, lightWeight);
14
+ gl_FragColor = filterColorAlpha(gl_FragColor, v_lightWeight);
41
15
  } else {
42
16
  gl_FragColor = filterColor(gl_FragColor);
43
17
  }
@@ -16,14 +16,17 @@ uniform float u_r;
16
16
  uniform mat4 u_ModelMatrix;
17
17
  uniform mat4 u_Mvp;
18
18
  varying vec4 v_color;
19
+ varying float v_lightWeight;
20
+ varying float v_barLinearZ;
19
21
 
20
22
  uniform float u_opacity : 1;
21
23
  uniform float u_lightEnable: 1;
24
+ uniform float u_opacitylinear: 0.0;
25
+ uniform vec4 u_sourceColor;
26
+ uniform vec4 u_targetColor;
27
+ uniform float u_opacitylinear_dir: 1.0;
28
+ uniform float u_linearColor: 0.0;
22
29
 
23
- varying mat4 styleMappingMat; // 用于将在顶点着色器中计算好的样式值传递给片元
24
-
25
- #pragma include "styleMapping"
26
- #pragma include "styleMappingCalOpacity"
27
30
 
28
31
  #pragma include "projection"
29
32
  #pragma include "light"
@@ -47,37 +50,11 @@ float getXRadian(float y, float r) {
47
50
 
48
51
  void main() {
49
52
 
50
- // cal style mapping - 数据纹理映射部分的计算
51
- styleMappingMat = mat4(
52
- 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty
53
- 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA - lightWeight
54
- 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1] - linearZ(垂直方向 0 - 1 的值)
55
- 0.0, 0.0, 0.0, 0.0
56
- );
57
-
58
- float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行
59
- float columnCount = u_cellTypeLayout[0][1]; // 当看到数据纹理有几列
60
- float columnWidth = 1.0/columnCount; // 列宽
61
- float rowHeight = 1.0/rowCount; // 行高
62
- float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets
63
- float id = a_vertexId; // 第n个顶点
64
- float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // 起始点在第几行
65
- float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // 起始点在第几列
66
-
67
- // cell 固定顺序 opacity -> strokeOpacity -> strokeWidth -> stroke ...
68
- // 按顺序从 cell 中取值、若没有则自动往下取值
69
- float textureOffset = 0.0; // 在 cell 中取值的偏移量
70
-
71
- vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);
72
- styleMappingMat[0][0] = opacityAndOffset.r;
73
- textureOffset = opacityAndOffset.g;
74
- // cal style mapping - 数据纹理映射部分的计算
75
- vec3 size = a_Size * a_Position;
76
53
 
77
- // a_Position.z 是在构建网格的时候传入的标准值 0 - 1,在插值器插值可以获取 0~1 线性渐变的值
78
- styleMappingMat[2][3] = a_Position.z;
54
+ vec3 size = a_Size * a_Position;
79
55
 
80
56
  vec3 offset = size; // 控制圆柱体的大小 - 从标准单位圆柱体进行偏移
57
+
81
58
  if(u_heightfixed < 1.0) { // 圆柱体不固定高度
82
59
 
83
60
  if (u_CoordinateSystem == COORDINATE_SYSTEM_P20 || u_CoordinateSystem == COORDINATE_SYSTEM_P20_OFFSET) {
@@ -100,14 +77,29 @@ void main() {
100
77
  // u_r 控制圆柱的生长
101
78
  vec4 pos = vec4(project_pos.xy + offset.xy, offset.z * u_r, 1.0);
102
79
 
103
- // 圆柱光照效果
80
+ // // 圆柱光照效果
104
81
  float lightWeight = 1.0;
82
+
105
83
  if(u_lightEnable > 0.0) { // 取消三元表达式,增强健壮性
106
84
  lightWeight = calc_lighting(pos);
107
85
  }
108
- styleMappingMat[1][3] = lightWeight;
109
86
 
110
- v_color =vec4(a_Color.rgb * lightWeight, a_Color.w);
87
+ v_lightWeight = lightWeight;
88
+
89
+ v_color = a_Color;
90
+
91
+ // 设置圆柱的底色
92
+ if(u_linearColor == 1.0) { // 使用渐变颜色
93
+ v_color = mix(u_sourceColor, u_targetColor, a_Position.z);
94
+ v_color.a = v_color.a * u_opacity;
95
+ } else {
96
+ v_color = vec4(a_Color.rgb * lightWeight, a_Color.w * u_opacity);
97
+ }
98
+
99
+ if(u_opacitylinear > 0.0) {
100
+ v_color.a *= u_opacitylinear_dir > 0.0 ? (1.0 - a_Position.z): a_Position.z;
101
+ }
102
+
111
103
 
112
104
  // gl_Position = project_common_position_to_clipspace(pos);
113
105
 
@@ -1,10 +1,12 @@
1
1
  uniform float u_additive;
2
-
3
- varying mat4 styleMappingMat; // 传递从片元中传递的映射数据
2
+ uniform float u_stroke_opacity : 1;
3
+ uniform float u_stroke_width : 2;
4
4
 
5
5
  varying vec4 v_data;
6
6
  varying vec4 v_color;
7
7
  varying float v_radius;
8
+ varying vec4 v_stroke;
9
+
8
10
 
9
11
  #pragma include "sdf_2d"
10
12
  #pragma include "picking"
@@ -12,21 +14,8 @@ varying float v_radius;
12
14
 
13
15
  void main() {
14
16
  int shape = int(floor(v_data.w + 0.5));
15
-
16
- vec4 textrueStroke = vec4(
17
- styleMappingMat[1][0],
18
- styleMappingMat[1][1],
19
- styleMappingMat[1][2],
20
- styleMappingMat[1][3]
21
- );
22
-
23
- float opacity = styleMappingMat[0][0];
24
- float stroke_opacity = styleMappingMat[0][1];
25
- float strokeWidth = styleMappingMat[0][2];
26
- vec4 strokeColor = textrueStroke == vec4(0) ? v_color : textrueStroke;
27
-
28
17
  lowp float antialiasblur = v_data.z;
29
- float r = v_radius / (v_radius + strokeWidth);
18
+ float r = v_radius / (v_radius + u_stroke_width);
30
19
 
31
20
  float outer_df;
32
21
  float inner_df;
@@ -62,16 +51,16 @@ void main() {
62
51
 
63
52
  float opacity_t = smoothstep(0.0, antialiasblur, outer_df);
64
53
 
65
- float color_t = strokeWidth < 0.01 ? 0.0 : smoothstep(
54
+ float color_t = u_stroke_width < 0.01 ? 0.0 : smoothstep(
66
55
  antialiasblur,
67
56
  0.0,
68
57
  inner_df
69
58
  );
70
59
 
71
- if(strokeWidth < 0.01) {
72
- gl_FragColor = vec4(v_color.rgb, v_color.a * opacity);
60
+ if(u_stroke_width < 0.01) {
61
+ gl_FragColor = v_color;
73
62
  } else {
74
- gl_FragColor = mix(vec4(v_color.rgb, v_color.a * opacity), strokeColor * stroke_opacity, color_t);
63
+ gl_FragColor = mix(v_color, v_stroke * u_stroke_opacity, color_t);
75
64
  }
76
65
 
77
66
  if(u_additive > 0.0) {
@@ -4,36 +4,27 @@ attribute vec3 a_Extrude;
4
4
  attribute float a_Size;
5
5
  attribute float a_Shape;
6
6
 
7
- varying mat4 styleMappingMat; // 用于将在顶点着色器中计算好的样式值传递给片元
8
-
9
7
  uniform mat4 u_ModelMatrix;
10
8
  uniform mat4 u_Mvp;
11
- uniform int u_Size_Unit;
9
+ uniform int u_size_unit;
12
10
 
13
11
  varying vec4 v_data;
14
12
  varying vec4 v_color;
15
13
  varying float v_radius;
14
+ varying vec4 v_stroke;
16
15
 
17
- uniform float u_opacity : 1;
18
- uniform float u_stroke_opacity : 1;
19
- uniform float u_stroke_width : 2;
20
- uniform vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];
21
- uniform vec2 u_offsets;
22
-
23
- uniform float u_blur : 0.0;
24
- uniform float u_raisingHeight: 0.0;
25
- uniform float u_heightfixed: 0.0;
16
+ // uniform float u_opacity : 1;
17
+ uniform float u_stroke_width: 2;
18
+ uniform vec3 u_blur_height_fixed: [0, 0, 0];
26
19
 
27
- #pragma include "styleMapping"
28
- #pragma include "styleMappingCalOpacity"
29
- #pragma include "styleMappingCalStrokeOpacity"
30
- #pragma include "styleMappingCalStrokeWidth"
31
20
 
32
21
  #pragma include "projection"
33
22
  #pragma include "picking"
34
23
 
35
24
 
36
25
  void main() {
26
+ // 透明度计算
27
+ v_stroke = stroke;
37
28
  vec3 extrude = a_Extrude;
38
29
  float shape_type = a_Shape;
39
30
  /*
@@ -43,88 +34,12 @@ void main() {
43
34
  float newSize = setPickingSize(a_Size);
44
35
  // float newSize = setPickingSize(a_Size) * 0.00001038445708445579;
45
36
 
46
- // cal style mapping - 数据纹理映射部分的计算
47
- styleMappingMat = mat4(
48
- 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty
49
- 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA
50
- 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]
51
- 0.0, 0.0, 0.0, 0.0
52
- );
53
-
54
- float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行
55
- float columnCount = u_cellTypeLayout[0][1]; // 当看到数据纹理有几列
56
- float columnWidth = 1.0/columnCount; // 列宽
57
- float rowHeight = 1.0/rowCount; // 行高
58
- float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets
59
- float id = a_vertexId; // 第n个顶点
60
- float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // 起始点在第几行
61
- float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // 起始点在第几列
62
-
63
- // cell 固定顺序 opacity -> strokeOpacity -> strokeWidth -> stroke ...
64
- // 按顺序从 cell 中取值、若没有则自动往下取值
65
- float textureOffset = 0.0; // 在 cell 中取值的偏移量
66
-
67
- vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);
68
- styleMappingMat[0][0] = opacityAndOffset.r;
69
- textureOffset = opacityAndOffset.g;
70
-
71
- vec2 strokeOpacityAndOffset = calStrokeOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);
72
- styleMappingMat[0][1] = strokeOpacityAndOffset.r;
73
- textureOffset = strokeOpacityAndOffset.g;
74
-
75
- vec2 strokeWidthAndOffset = calStrokeWidthAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);
76
- styleMappingMat[0][2] = strokeWidthAndOffset.r;
77
- textureOffset = strokeWidthAndOffset.g;
78
-
79
- vec4 textrueStroke = vec4(-1.0, -1.0, -1.0, -1.0);
80
- if(hasStroke()) {
81
- vec2 valueRPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);
82
- styleMappingMat[1][0] = pos2value(valueRPos, columnWidth, rowHeight); // R
83
- textureOffset += 1.0;
84
-
85
- vec2 valueGPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);
86
- styleMappingMat[1][1] = pos2value(valueGPos, columnWidth, rowHeight); // G
87
- textureOffset += 1.0;
88
-
89
- vec2 valueBPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);
90
- styleMappingMat[1][2] = pos2value(valueBPos, columnWidth, rowHeight); // B
91
- textureOffset += 1.0;
92
-
93
- vec2 valueAPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);
94
- styleMappingMat[1][3] = pos2value(valueAPos, columnWidth, rowHeight); // A
95
- textureOffset += 1.0;
96
- } else {
97
- if(u_stroke_color == vec4(0.0)) {
98
- styleMappingMat[1][0] = v_color.r;
99
- styleMappingMat[1][1] = v_color.g;
100
- styleMappingMat[1][2] = v_color.b;
101
- styleMappingMat[1][3] = v_color.a;
102
- } else {
103
- styleMappingMat[1][0] = u_stroke_color.r;
104
- styleMappingMat[1][1] = u_stroke_color.g;
105
- styleMappingMat[1][2] = u_stroke_color.b;
106
- styleMappingMat[1][3] = u_stroke_color.a;
107
- }
108
- }
109
37
 
110
- vec2 textrueOffsets = vec2(0.0, 0.0);
111
- if(hasOffsets()) {
112
- vec2 valueXPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);
113
- textrueOffsets.r = pos2value(valueXPos, columnWidth, rowHeight); // x
114
- textureOffset += 1.0;
115
-
116
- vec2 valueYPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);
117
- textrueOffsets.g = pos2value(valueYPos, columnWidth, rowHeight); // x
118
- textureOffset += 1.0;
119
- } else {
120
- textrueOffsets = u_offsets;
121
- }
122
-
123
- // cal style mapping
124
38
 
125
39
  // unpack color(vec2)
126
- v_color = a_Color;
127
- if(u_Size_Unit == 1) {
40
+ v_color = vec4(a_Color.xyz, a_Color.w * opacity);
41
+
42
+ if(u_size_unit == 1) {
128
43
  newSize = newSize * u_PixelsPerMeter.z;
129
44
  }
130
45
 
@@ -132,9 +47,9 @@ if(u_Size_Unit == 1) {
132
47
 
133
48
  // anti-alias
134
49
  // float antialiased_blur = -max(u_blur, antialiasblur);
135
- float antialiasblur = -max(2.0 / u_DevicePixelRatio / newSize, u_blur);
50
+ float antialiasblur = -max(2.0 / u_DevicePixelRatio / newSize, u_blur_height_fixed.x);
136
51
 
137
- vec2 offset = (extrude.xy * (newSize + u_stroke_width) + textrueOffsets);
52
+ vec2 offset = (extrude.xy * (newSize + u_stroke_width) + u_offsets);
138
53
  vec3 aPosition = a_Position;
139
54
 
140
55
  offset = project_pixel(offset);
@@ -147,14 +62,14 @@ if(u_Size_Unit == 1) {
147
62
  vec4 project_pos = project_position(vec4(aPosition.xy, 0.0, 1.0));
148
63
  // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));
149
64
 
150
- float raisingHeight = u_raisingHeight;
65
+ float raisingHeight = u_blur_height_fixed.y;
151
66
 
152
- if(u_heightfixed < 1.0) { // false
153
- raisingHeight = project_pixel(u_raisingHeight);
67
+ if(u_blur_height_fixed.z < 1.0) { // false
68
+ raisingHeight = project_pixel(u_blur_height_fixed.y);
154
69
  } else {
155
70
  if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
156
71
  float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);
157
- raisingHeight = u_raisingHeight * mapboxZoomScale;
72
+ raisingHeight = u_blur_height_fixed.y * mapboxZoomScale;
158
73
  }
159
74
  }
160
75
 
@@ -1,7 +1,6 @@
1
1
  uniform sampler2D u_texture;
2
2
  uniform vec2 u_textSize;
3
-
4
- varying mat4 styleMappingMat; // 传递从片元中传递的映射数据
3
+ uniform float u_opacity : 1;
5
4
 
6
5
  #pragma include "sdf_2d"
7
6
  #pragma include "picking"
@@ -10,11 +9,9 @@ varying vec2 v_Iconuv;
10
9
 
11
10
  void main() {
12
11
 
13
- float opacity = styleMappingMat[0][0];
14
-
15
12
  vec2 pos = v_Iconuv / u_textSize + v_uv / u_textSize * 64.;
16
13
  gl_FragColor = texture2D(u_texture, pos);
17
- gl_FragColor.a *= opacity;
14
+ gl_FragColor.a *= u_opacity;
18
15
 
19
16
  gl_FragColor = filterColor(gl_FragColor);
20
17
  }