@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
@@ -6,43 +6,32 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
6
6
  import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
7
7
  import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
8
8
  import _regeneratorRuntime from "@babel/runtime/regenerator";
9
-
10
9
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
11
-
12
10
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
13
-
14
11
  import { AttributeType, gl } from '@antv/l7-core';
15
12
  import { Version } from '@antv/l7-maps';
16
13
  import { isNumber } from 'lodash';
17
14
  import BaseModel from "../../core/BaseModel";
18
15
  import { polygonTriangulation } from "../../core/triangulation";
19
-
20
16
  /* babel-plugin-inline-import '../shaders/water/polygon_water_frag.glsl' */
21
17
  var water_frag = "uniform sampler2D u_texture;\nuniform float u_time: 0.0;\nuniform float u_speed: 1.0;\nuniform float u_opacity: 1.0;\n\nvarying vec4 v_Color;\nvarying vec2 v_uv;\n\nfloat rand(vec2 n) { return 0.5 + 0.5 * fract(sin(dot(n.xy, vec2(12.9898, 78.233)))* 43758.5453); }\n\nfloat water(vec3 p) {\n float t = u_time * u_speed;\n p.z += t * 2.; p.x += t * 2.;\n vec3 c1 = texture2D(u_texture, p.xz / 30.).xyz;\n p.z += t * 3.; p.x += t * 0.52;\n vec3 c2 = texture2D(u_texture, p.xz / 30.).xyz;\n p.z += t * 4.; p.x += t * 0.8;\n vec3 c3 = texture2D(u_texture, p.xz / 30.).xyz;\n c1 += c2 - c3;\n float z = (c1.x + c1.y + c1.z) / 3.;\n return p.y + z / 4.;\n}\n\nfloat map(vec3 p) {\n float d = 100.0;\n d = water(p);\n return d;\n}\n\nfloat intersect(vec3 ro, vec3 rd) {\n float d = 0.0;\n for (int i = 0; i <= 100; i++) {\n float h = map(ro + rd * d);\n if (h < 0.1) return d;\n d += h;\n }\n return 0.0;\n}\n\nvec3 norm(vec3 p) {\n float eps = .1;\n return normalize(vec3(\n map(p + vec3(eps, 0, 0)) - map(p + vec3(-eps, 0, 0)),\n map(p + vec3(0, eps, 0)) - map(p + vec3(0, -eps, 0)),\n map(p + vec3(0, 0, eps)) - map(p + vec3(0, 0, -eps))\n ));\n} \n\nfloat calSpc() {\n vec3 l1 = normalize(vec3(1, 1, 1));\n vec3 ro = vec3(-3, 20, -8);\n vec3 rc = vec3(0, 0, 0);\n vec3 ww = normalize(rc - ro);\n vec3 uu = normalize(cross(vec3(0,1,0), ww));\n vec3 vv = normalize(cross(rc - ro, uu));\n vec3 rd = normalize(uu * v_uv.x + vv * v_uv.y + ww);\n float d = intersect(ro, rd);\n vec3 p = ro + rd * d;\n vec3 n = norm(p);\n float spc = pow(max(0.0, dot(reflect(l1, n), rd)), 30.0);\n return spc;\n}\n\nvoid main() {\n float opacity = u_opacity;\n gl_FragColor = v_Color;\n gl_FragColor.a *= opacity;\n\n float spc = calSpc();\n gl_FragColor += spc * 0.4;\n}\n";
22
-
23
18
  /* babel-plugin-inline-import '../shaders/water/polygon_water_vert.glsl' */
24
19
  var water_vert = "attribute vec4 a_Color;\nattribute vec2 a_uv;\nattribute vec3 a_Position;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nvarying vec4 v_Color;\nvarying vec2 v_uv;\nuniform float u_opacity: 1.0;\n\n\n#pragma include \"projection\"\n\nvoid main() {\n v_uv = a_uv;\n\n v_Color = a_Color;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n }\n}\n\n";
25
-
26
20
  var WaterModel = /*#__PURE__*/function (_BaseModel) {
27
21
  _inherits(WaterModel, _BaseModel);
28
-
29
22
  var _super = _createSuper(WaterModel);
30
-
31
23
  function WaterModel() {
32
24
  _classCallCheck(this, WaterModel);
33
-
34
25
  return _super.apply(this, arguments);
35
26
  }
36
-
37
27
  _createClass(WaterModel, [{
38
28
  key: "getUninforms",
39
29
  value: function getUninforms() {
40
30
  var _ref = this.layer.getLayerConfig(),
41
- _ref$opacity = _ref.opacity,
42
- opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
43
- _ref$speed = _ref.speed,
44
- speed = _ref$speed === void 0 ? 0.5 : _ref$speed;
45
-
31
+ _ref$opacity = _ref.opacity,
32
+ opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
33
+ _ref$speed = _ref.speed,
34
+ speed = _ref$speed === void 0 ? 0.5 : _ref$speed;
46
35
  return {
47
36
  u_texture: this.texture,
48
37
  u_speed: speed,
@@ -61,24 +50,19 @@ var WaterModel = /*#__PURE__*/function (_BaseModel) {
61
50
  value: function () {
62
51
  var _initModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
63
52
  return _regeneratorRuntime.wrap(function _callee$(_context) {
64
- while (1) {
65
- switch (_context.prev = _context.next) {
66
- case 0:
67
- this.loadTexture();
68
- return _context.abrupt("return", this.buildModels());
69
-
70
- case 2:
71
- case "end":
72
- return _context.stop();
73
- }
53
+ while (1) switch (_context.prev = _context.next) {
54
+ case 0:
55
+ this.loadTexture();
56
+ return _context.abrupt("return", this.buildModels());
57
+ case 2:
58
+ case "end":
59
+ return _context.stop();
74
60
  }
75
61
  }, _callee, this);
76
62
  }));
77
-
78
63
  function initModels() {
79
64
  return _initModels.apply(this, arguments);
80
65
  }
81
-
82
66
  return initModels;
83
67
  }()
84
68
  }, {
@@ -87,57 +71,48 @@ var WaterModel = /*#__PURE__*/function (_BaseModel) {
87
71
  var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
88
72
  var model;
89
73
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
90
- while (1) {
91
- switch (_context2.prev = _context2.next) {
92
- case 0:
93
- _context2.next = 2;
94
- return this.layer.buildLayerModel({
95
- moduleName: 'polygonWater',
96
- vertexShader: water_vert,
97
- fragmentShader: water_frag,
98
- triangulation: polygonTriangulation,
99
- primitive: gl.TRIANGLES,
100
- depth: {
101
- enable: false
102
- }
103
- });
104
-
105
- case 2:
106
- model = _context2.sent;
107
- return _context2.abrupt("return", [model]);
108
-
109
- case 4:
110
- case "end":
111
- return _context2.stop();
112
- }
74
+ while (1) switch (_context2.prev = _context2.next) {
75
+ case 0:
76
+ _context2.next = 2;
77
+ return this.layer.buildLayerModel({
78
+ moduleName: 'polygonWater',
79
+ vertexShader: water_vert,
80
+ fragmentShader: water_frag,
81
+ triangulation: polygonTriangulation,
82
+ primitive: gl.TRIANGLES,
83
+ depth: {
84
+ enable: false
85
+ }
86
+ });
87
+ case 2:
88
+ model = _context2.sent;
89
+ return _context2.abrupt("return", [model]);
90
+ case 4:
91
+ case "end":
92
+ return _context2.stop();
113
93
  }
114
94
  }, _callee2, this);
115
95
  }));
116
-
117
96
  function buildModels() {
118
97
  return _buildModels.apply(this, arguments);
119
98
  }
120
-
121
99
  return buildModels;
122
100
  }()
123
101
  }, {
124
102
  key: "clearModels",
125
103
  value: function clearModels() {
126
104
  var _this$texture;
127
-
128
105
  (_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
129
106
  }
130
107
  }, {
131
108
  key: "registerBuiltinAttributes",
132
109
  value: function registerBuiltinAttributes() {
133
110
  var bbox = this.layer.getSource().extent;
134
-
135
111
  var _bbox = _slicedToArray(bbox, 4),
136
- minLng = _bbox[0],
137
- minLat = _bbox[1],
138
- maxLng = _bbox[2],
139
- maxLat = _bbox[3];
140
-
112
+ minLng = _bbox[0],
113
+ minLat = _bbox[1],
114
+ maxLng = _bbox[2],
115
+ maxLat = _bbox[3];
141
116
  var lngLen = maxLng - minLng;
142
117
  var latLen = maxLat - minLat;
143
118
  this.styleAttributeService.registerStyleAttribute({
@@ -154,11 +129,9 @@ var WaterModel = /*#__PURE__*/function (_BaseModel) {
154
129
  size: 2,
155
130
  update: function update(feature, featureIdx, vertex, attributeIdx) {
156
131
  var v = feature.version === Version['GAODE2.x'] ? feature.originCoordinates[0][attributeIdx] : vertex;
157
-
158
132
  var _v = _slicedToArray(v, 2),
159
- lng = _v[0],
160
- lat = _v[1];
161
-
133
+ lng = _v[0],
134
+ lat = _v[1];
162
135
  return [(lng - minLng) / lngLen, (lat - minLat) / latLen];
163
136
  }
164
137
  }
@@ -168,10 +141,8 @@ var WaterModel = /*#__PURE__*/function (_BaseModel) {
168
141
  key: "loadTexture",
169
142
  value: function loadTexture() {
170
143
  var _this = this;
171
-
172
144
  var _ref2 = this.layer.getLayerConfig(),
173
- waterTexture = _ref2.waterTexture;
174
-
145
+ waterTexture = _ref2.waterTexture;
175
146
  var createTexture2D = this.rendererService.createTexture2D;
176
147
  this.texture = createTexture2D({
177
148
  height: 0,
@@ -179,7 +150,6 @@ var WaterModel = /*#__PURE__*/function (_BaseModel) {
179
150
  });
180
151
  var image = new Image();
181
152
  image.crossOrigin = '';
182
-
183
153
  if (waterTexture) {
184
154
  // custom texture
185
155
  console.warn('L7 recommend:https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*EojwT4VzSiYAAAAAAAAAAAAAARQnAQ');
@@ -188,7 +158,6 @@ var WaterModel = /*#__PURE__*/function (_BaseModel) {
188
158
  // default texture
189
159
  image.src = 'https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*EojwT4VzSiYAAAAAAAAAAAAAARQnAQ';
190
160
  }
191
-
192
161
  image.onload = function () {
193
162
  _this.texture = createTexture2D({
194
163
  data: image,
@@ -199,13 +168,10 @@ var WaterModel = /*#__PURE__*/function (_BaseModel) {
199
168
  min: gl.LINEAR,
200
169
  mag: gl.LINEAR
201
170
  });
202
-
203
171
  _this.layerService.reRender();
204
172
  };
205
173
  }
206
174
  }]);
207
-
208
175
  return WaterModel;
209
176
  }(BaseModel);
210
-
211
177
  export { WaterModel as default };
@@ -1,4 +1,3 @@
1
- uniform float u_opacity: 1.0;
2
1
  uniform vec4 u_sourceColor;
3
2
  uniform vec4 u_targetColor;
4
3
  uniform float u_linearColor: 0;
@@ -7,39 +6,19 @@ uniform float u_topsurface: 1.0;
7
6
  uniform float u_sidesurface: 1.0;
8
7
 
9
8
  varying vec4 v_Color;
10
- varying mat4 styleMappingMat; // 传递从片元中传递的映射数据
9
+
11
10
  #pragma include "picking"
12
11
 
13
12
  void main() {
14
- float opacity = styleMappingMat[0][0];
15
- float isSide = styleMappingMat[0][3];
16
- float sidey = styleMappingMat[3][0];
17
- float lightWeight = styleMappingMat[3][1];
18
-
19
- // Tip: 部分机型 GPU 计算精度兼容
20
- if(isSide < 0.999) {
21
- // side face
22
- if(u_sidesurface < 1.0) {
23
- discard;
24
- }
25
13
 
26
- if(u_linearColor == 1.0) {
27
- vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey);
28
- linearColor.rgb *= lightWeight;
29
- gl_FragColor = linearColor;
30
- } else {
31
- gl_FragColor = v_Color;
32
- }
33
14
 
34
- } else {
35
15
  // top face
36
16
  if(u_topsurface < 1.0) {
37
17
  discard;
38
18
  }
39
19
 
40
20
  gl_FragColor = v_Color;
41
- }
21
+
42
22
 
43
- gl_FragColor.a *= opacity;
44
23
  gl_FragColor = filterColor(gl_FragColor);
45
24
  }
@@ -7,14 +7,16 @@ uniform float u_topsurface: 1.0;
7
7
  uniform float u_sidesurface: 1.0;
8
8
 
9
9
  varying vec4 v_Color;
10
- varying mat4 styleMappingMat; // 传递从片元中传递的映射数据
10
+ varying vec3 v_uvs;
11
+ varying vec2 v_texture_data;
12
+
11
13
  #pragma include "picking"
12
14
 
13
15
  void main() {
14
- float opacity = styleMappingMat[0][0];
15
- float isSide = styleMappingMat[0][3];
16
- float sidey = styleMappingMat[3][0];
17
- float lightWeight = styleMappingMat[3][1];
16
+ float opacity = u_opacity;
17
+ float isSide = v_texture_data.x;
18
+ float sidey = v_uvs[2];
19
+ float lightWeight = v_texture_data.y;
18
20
 
19
21
  // Tip: 部分机型 GPU 计算精度兼容
20
22
  if(isSide < 0.999) {
@@ -12,46 +12,22 @@ attribute vec3 a_uvs;
12
12
  uniform mat4 u_ModelMatrix;
13
13
  uniform mat4 u_Mvp;
14
14
 
15
- varying vec4 v_Color;
16
15
  uniform float u_heightfixed: 0.0; // 默认不固定
17
16
  uniform float u_raisingHeight: 0.0;
18
- uniform float u_opacity: 1.0;
19
- varying mat4 styleMappingMat; // 用于将在顶点着色器中计算好的样式值传递给片元
20
17
 
21
- #pragma include "styleMapping"
22
- #pragma include "styleMappingCalOpacity"
18
+ varying vec2 v_texture_data;
19
+ varying vec3 v_uvs;
20
+ varying vec4 v_Color;
21
+
23
22
 
24
23
  #pragma include "projection"
25
24
  #pragma include "light"
26
25
  #pragma include "picking"
27
26
 
28
27
  void main() {
29
- // cal style mapping - 数据纹理映射部分的计算
30
- styleMappingMat = mat4(
31
- 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - isSide
32
- 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA
33
- 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]
34
- 0.0, 0.0, 0.0, 0.0 // sidey
35
- );
36
- styleMappingMat[0][3] = a_Position.z;
37
- styleMappingMat[3][0] = a_uvs[2];
38
28
 
39
- float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行
40
- float columnCount = u_cellTypeLayout[0][1]; // 当看到数据纹理有几列
41
- float columnWidth = 1.0/columnCount; // 列宽
42
- float rowHeight = 1.0/rowCount; // 行高
43
- float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets
44
- float id = a_vertexId; // 第n个顶点
45
- float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // 起始点在第几行
46
- float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // 起始点在第几列
47
-
48
- // cell 固定顺序 opacity -> strokeOpacity -> strokeWidth -> stroke ...
49
- // 按顺序从 cell 中取值、若没有则自动往下取值
50
- float textureOffset = 0.0; // 在 cell 中取值的偏移量
51
29
 
52
- vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);
53
- styleMappingMat[0][0] = opacityAndOffset.r;
54
- textureOffset = opacityAndOffset.g;
30
+ v_uvs = a_uvs;
55
31
  // cal style mapping - 数据纹理映射部分的计算
56
32
  vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);
57
33
  vec4 project_pos = project_position(pos);
@@ -76,10 +52,9 @@ void main() {
76
52
  }
77
53
 
78
54
  float lightWeight = calc_lighting(pos);
79
- // v_Color = a_Color;
80
- v_Color = vec4(a_Color.rgb * lightWeight, a_Color.w);
55
+ v_texture_data = vec2(a_Position.z,lightWeight);
81
56
 
82
- styleMappingMat[3][1] = lightWeight;
57
+ v_Color = vec4(a_Color.rgb * lightWeight, a_Color.w);
83
58
 
84
59
  setPickingColor(a_PickingColor);
85
60
  }
@@ -11,50 +11,31 @@ attribute float a_Size;
11
11
  attribute vec3 a_uvs;
12
12
  uniform mat4 u_ModelMatrix;
13
13
  uniform mat4 u_Mvp;
14
+ uniform vec4 u_sourceColor;
15
+ uniform vec4 u_targetColor;
16
+ uniform float u_linearColor: 0;
17
+
18
+ uniform float u_topsurface: 1.0;
19
+ uniform float u_sidesurface: 1.0;
14
20
 
15
21
  varying vec4 v_Color;
16
22
  uniform float u_heightfixed: 0.0; // 默认不固定
17
23
  uniform float u_raisingHeight: 0.0;
18
- uniform float u_opacity: 1.0;
19
- varying mat4 styleMappingMat; // 用于将在顶点着色器中计算好的样式值传递给片元
20
-
21
- #pragma include "styleMapping"
22
- #pragma include "styleMappingCalOpacity"
23
24
 
24
25
  #pragma include "projection"
25
26
  #pragma include "light"
26
27
  #pragma include "picking"
27
28
 
28
29
  void main() {
29
- // cal style mapping - 数据纹理映射部分的计算
30
- styleMappingMat = mat4(
31
- 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - isSide
32
- 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA
33
- 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]
34
- 0.0, 0.0, 0.0, 0.0 // sidey
35
- );
36
- styleMappingMat[0][3] = a_Position.z;
37
- styleMappingMat[3][0] = a_uvs[2];
38
-
39
- float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行
40
- float columnCount = u_cellTypeLayout[0][1]; // 当看到数据纹理有几列
41
- float columnWidth = 1.0/columnCount; // 列宽
42
- float rowHeight = 1.0/rowCount; // 行高
43
- float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets
44
- float id = a_vertexId; // 第n个顶点
45
- float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // 起始点在第几行
46
- float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // 起始点在第几列
47
-
48
- // cell 固定顺序 opacity -> strokeOpacity -> strokeWidth -> stroke ...
49
- // 按顺序从 cell 中取值、若没有则自动往下取值
50
- float textureOffset = 0.0; // 在 cell 中取值的偏移量
51
-
52
- vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);
53
- styleMappingMat[0][0] = opacityAndOffset.r;
54
- textureOffset = opacityAndOffset.g;
55
- // cal style mapping - 数据纹理映射部分的计算
30
+
31
+ float isSide = a_Position.z;
32
+ float topU = a_uvs[0];
33
+ float topV = 1.0 - a_uvs[1];
34
+ float sidey = a_uvs[2];
56
35
 
57
36
  vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);
37
+ float lightWeight = calc_lighting(pos);
38
+
58
39
  vec4 project_pos = project_position(pos);
59
40
 
60
41
  if(u_heightfixed > 0.0) { // 判断几何体是否固定高度
@@ -68,10 +49,7 @@ void main() {
68
49
  }
69
50
  }
70
51
 
71
- // project_pos.z += 500000.0; // amap1
72
52
 
73
- // project_pos.z += (500000.0 * 4.0)/pow(2.0, 21.0 - u_Zoom); // mapbox
74
- // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
75
53
 
76
54
  if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
77
55
  // gl_Position = u_Mvp * (vec4(project_pos.xyz * vec3(1.0, 1.0, -1.0), 1.0));
@@ -80,11 +58,28 @@ void main() {
80
58
  gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
81
59
  }
82
60
 
83
- float lightWeight = calc_lighting(pos);
61
+ // Tip: 部分机型 GPU 计算精度兼容
62
+ if(isSide < 0.999) {
63
+ // side face
64
+ // if(u_sidesurface < 1.0) {
65
+ // discard;
66
+ // }
67
+
68
+ if(u_linearColor == 1.0) {
69
+ vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey);
70
+ linearColor.rgb *= lightWeight;
71
+ v_Color = linearColor;
72
+ } else {
73
+ v_Color = a_Color;
74
+ }
75
+
76
+ } else {
77
+ v_Color = a_Color;
78
+ }
79
+
84
80
  // v_Color = a_Color;
85
- v_Color = vec4(a_Color.rgb * lightWeight, a_Color.w);
81
+ v_Color = vec4(a_Color.rgb * lightWeight, a_Color.w * opacity);
86
82
 
87
- styleMappingMat[3][1] = lightWeight;
88
83
 
89
84
  setPickingColor(a_PickingColor);
90
85
  }
@@ -8,19 +8,21 @@ uniform float u_topsurface: 1.0;
8
8
  uniform float u_sidesurface: 1.0;
9
9
 
10
10
  varying vec4 v_Color;
11
- varying mat4 styleMappingMat; // 传递从片元中传递的映射数据
11
+ varying vec3 v_uvs;
12
+ varying vec2 v_texture_data;
13
+
14
+
12
15
  #pragma include "picking"
13
16
 
14
17
  void main() {
15
- float opacity = styleMappingMat[0][0];
16
- float isSide = styleMappingMat[0][3];
17
- float lightWeight = styleMappingMat[3][1];
18
- float topU = styleMappingMat[2][2];
19
- float topV = styleMappingMat[2][3];
20
-
21
- float sidey = styleMappingMat[3][0];
18
+ float opacity = u_opacity;
19
+ float isSide = v_texture_data.x;
20
+ float lightWeight = v_texture_data.y;
21
+ float topU = v_uvs[0];
22
+ float topV = 1.0 - v_uvs[1];
23
+ float sidey = v_uvs[2];
22
24
  // Tip: 部分机型 GPU 计算精度兼容
23
- if(isSide < 0.999) {
25
+ if(isSide < 0.999) {// 是否是边缘
24
26
  // side face
25
27
  if(u_sidesurface < 1.0) {
26
28
  discard;
@@ -41,6 +43,7 @@ void main() {
41
43
  }
42
44
 
43
45
  gl_FragColor = texture2D(u_texture, vec2(topU, topV));
46
+ // gl_FragColor = vec4(1.0, 0., 0., 1.0);
44
47
  }
45
48
 
46
49
 
@@ -11,57 +11,33 @@ attribute float a_Size;
11
11
  attribute vec3 a_uvs;
12
12
  uniform mat4 u_ModelMatrix;
13
13
  uniform mat4 u_Mvp;
14
+ uniform sampler2D u_texture;
14
15
 
16
+
17
+ uniform vec4 u_sourceColor;
18
+ uniform vec4 u_targetColor;
19
+ uniform float u_topsurface: 1.0;
20
+ uniform float u_sidesurface: 1.0;
15
21
  varying vec4 v_Color;
16
22
  uniform float u_heightfixed: 0.0; // 默认不固定
17
23
  uniform float u_raisingHeight: 0.0;
18
- uniform float u_opacity: 1.0;
19
- varying mat4 styleMappingMat; // 用于将在顶点着色器中计算好的样式值传递给片元
24
+ uniform float u_linearColor: 0.0;
20
25
 
21
- #pragma include "styleMapping"
22
- #pragma include "styleMappingCalOpacity"
26
+ varying vec2 v_texture_data;
27
+ varying vec3 v_uvs;
23
28
 
24
29
  #pragma include "projection"
25
30
  #pragma include "light"
26
31
  #pragma include "picking"
27
32
 
28
33
  void main() {
29
- v_Color = a_Color;
30
-
31
- // cal style mapping - 数据纹理映射部分的计算
32
- styleMappingMat = mat4(
33
- 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - a_Position.z(judge side by a_Position.z)
34
- 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA
35
- 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1] - u - v
36
- 0.0, 0.0, 0.0, 0.0 // sidey
37
- );
38
-
39
- styleMappingMat[0][3] = a_Position.z;
40
- styleMappingMat[2][2] = a_uvs[0];
41
- styleMappingMat[2][3] = 1.0 - a_uvs[1];
42
- styleMappingMat[3][0] = a_uvs[2];
43
-
44
-
45
- float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行
46
- float columnCount = u_cellTypeLayout[0][1]; // 当看到数据纹理有几列
47
- float columnWidth = 1.0/columnCount; // 列宽
48
- float rowHeight = 1.0/rowCount; // 行高
49
- float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets
50
- float id = a_vertexId; // 第n个顶点
51
- float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // 起始点在第几行
52
- float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // 起始点在第几列
53
-
54
- // cell 固定顺序 opacity -> strokeOpacity -> strokeWidth -> stroke ...
55
- // 按顺序从 cell 中取值、若没有则自动往下取值
56
- float textureOffset = 0.0; // 在 cell 中取值的偏移量
57
-
58
- vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);
59
- styleMappingMat[0][0] = opacityAndOffset.r;
60
- textureOffset = opacityAndOffset.g;
61
- // cal style mapping - 数据纹理映射部分的计算
62
-
34
+
63
35
  vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);
36
+ float lightWeight = calc_lighting(pos);
64
37
  vec4 project_pos = project_position(pos);
38
+ v_uvs = a_uvs;
39
+
40
+ v_texture_data = vec2(a_Position.z, lightWeight);
65
41
 
66
42
  if(u_heightfixed > 0.0) { // 判断几何体是否固定高度
67
43
  project_pos.z = a_Position.z * a_Size;
@@ -74,10 +50,6 @@ void main() {
74
50
  }
75
51
  }
76
52
 
77
- // project_pos.z += 500000.0; // amap1
78
-
79
- // project_pos.z += (500000.0 * 4.0)/pow(2.0, 21.0 - u_Zoom); // mapbox
80
- // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
81
53
 
82
54
  if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
83
55
  // gl_Position = u_Mvp * (vec4(project_pos.xyz * vec3(1.0, 1.0, -1.0), 1.0));
@@ -86,8 +58,8 @@ void main() {
86
58
  gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
87
59
  }
88
60
 
89
- float lightWeight = calc_lighting(pos);
90
- styleMappingMat[3][1] = lightWeight;
61
+
62
+
91
63
 
92
64
  setPickingColor(a_PickingColor);
93
65
  }
@@ -1,12 +1,7 @@
1
- uniform float u_opacity: 1.0;
2
1
  varying vec4 v_color;
3
- varying mat4 styleMappingMat; // 传递从片元中传递的映射数据
4
-
5
2
  #pragma include "picking"
6
3
 
7
4
  void main() {
8
- float opacity = styleMappingMat[0][0];
9
5
  gl_FragColor = v_color;
10
- gl_FragColor.a *= opacity;
11
6
  gl_FragColor = filterColor(gl_FragColor);
12
7
  }
@@ -1,7 +1,3 @@
1
- uniform float u_opacity: 1.0;
2
- varying vec4 v_Color;
3
- varying mat4 styleMappingMat; // 传递从片元中传递的映射数据
4
-
5
1
  #pragma include "picking"
6
2
  uniform float u_opacitylinear: 0.0;
7
3
  uniform float u_dir: 1.0;
@@ -10,13 +6,9 @@ varying vec2 v_pos;
10
6
 
11
7
 
12
8
  void main() {
13
- float opacity = styleMappingMat[0][0];
14
- gl_FragColor = v_Color;
15
9
 
16
10
  if(u_opacitylinear > 0.0) {
17
11
  gl_FragColor.a *= u_dir == 1.0 ? 1.0 - length(v_pos - v_linear.xy)/v_linear.z : length(v_pos - v_linear.xy)/v_linear.z;
18
12
  }
19
-
20
- gl_FragColor.a *= opacity;
21
13
  gl_FragColor = filterColor(gl_FragColor);
22
14
  }