@antv/l7-layers 2.9.27-alpha.2 → 2.9.27-alpha.3

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 (300) hide show
  1. package/es/Geometry/index.js +6 -2
  2. package/es/Geometry/models/billboard.js +1 -2
  3. package/es/Geometry/models/plane.js +2 -4
  4. package/es/Geometry/models/sprite.js +2 -4
  5. package/es/canvas/index.d.ts +4 -0
  6. package/es/canvas/index.js +38 -2
  7. package/es/citybuliding/building.js +6 -2
  8. package/es/citybuliding/models/build.js +2 -3
  9. package/es/core/BaseLayer.d.ts +15 -6
  10. package/es/core/BaseLayer.js +51 -69
  11. package/es/core/BaseModel.d.ts +1 -1
  12. package/es/core/BaseModel.js +7 -3
  13. package/es/core/interface.d.ts +18 -0
  14. package/es/core/triangulation.d.ts +6 -0
  15. package/es/core/triangulation.js +64 -2
  16. package/es/earth/index.js +3 -1
  17. package/es/earth/models/base.js +2 -4
  18. package/es/earth/shaders/atmosphere_frag.glsl +1 -1
  19. package/es/earth/shaders/bloomsphere_frag.glsl +1 -1
  20. package/es/heatmap/index.js +6 -2
  21. package/es/heatmap/models/heatmap.js +5 -3
  22. package/es/image/index.js +6 -2
  23. package/es/image/models/dataImage.js +4 -7
  24. package/es/image/models/image.js +4 -7
  25. package/es/line/index.d.ts +1 -0
  26. package/es/line/index.js +8 -2
  27. package/es/line/models/arc.js +6 -5
  28. package/es/line/models/half.js +3 -4
  29. package/es/line/models/line.js +9 -8
  30. package/es/line/models/simpleLine.js +2 -1
  31. package/es/line/models/simpleTileLine.d.ts +9 -0
  32. package/es/line/models/simpleTileLine.js +100 -0
  33. package/es/line/models/tile.d.ts +1 -4
  34. package/es/line/models/tile.js +49 -222
  35. package/es/line/models/wall.js +10 -46
  36. package/es/line/shaders/dash/arc_dash_vert.glsl +2 -0
  37. package/es/line/shaders/dash/line_dash_frag.glsl +1 -1
  38. package/es/line/shaders/line_arc2d_vert.glsl +1 -1
  39. package/es/line/shaders/line_arc_3d_frag.glsl +1 -1
  40. package/es/line/shaders/line_arc_3d_vert.glsl +3 -3
  41. package/es/line/shaders/line_arc_frag.glsl +1 -1
  42. package/es/line/shaders/line_arc_great_circle_frag.glsl +1 -1
  43. package/es/line/shaders/line_arc_great_circle_vert.glsl +1 -1
  44. package/es/line/shaders/line_arc_vert.glsl +5 -3
  45. package/es/line/shaders/line_bezier_vert.glsl +1 -1
  46. package/es/line/shaders/line_frag.glsl +1 -2
  47. package/es/line/shaders/line_vert.glsl +1 -1
  48. package/es/line/shaders/linear/arc3d_linear_frag.glsl +1 -1
  49. package/es/line/shaders/linear/arc3d_linear_vert.glsl +3 -3
  50. package/es/line/shaders/linear/arc_linear_frag.glsl +1 -1
  51. package/es/line/shaders/tile/line_tile_map_vert.glsl +25 -0
  52. package/es/line/shaders/tile/line_tile_vert.glsl +19 -177
  53. package/es/line/shaders/tile/simpleline_map_vert.glsl +15 -0
  54. package/es/line/shaders/tile/simpleline_vert.glsl +21 -0
  55. package/es/line/shaders/{wall_frag.glsl → wall/wall_frag.glsl} +17 -21
  56. package/es/line/shaders/wall/wall_vert.glsl +77 -0
  57. package/es/mask/index.d.ts +1 -0
  58. package/es/mask/index.js +80 -5
  59. package/es/mask/models/fill.d.ts +2 -1
  60. package/es/mask/models/fill.js +13 -10
  61. package/es/mask/shaders/mask_vert.glsl +0 -6
  62. package/es/plugins/DataMappingPlugin.d.ts +4 -3
  63. package/es/plugins/DataMappingPlugin.js +129 -58
  64. package/es/plugins/DataSourcePlugin.js +3 -2
  65. package/es/plugins/FeatureScalePlugin.d.ts +0 -2
  66. package/es/plugins/FeatureScalePlugin.js +8 -51
  67. package/es/plugins/LayerAnimateStylePlugin.d.ts +0 -2
  68. package/es/plugins/LayerAnimateStylePlugin.js +7 -27
  69. package/es/plugins/LayerModelPlugin.js +2 -6
  70. package/es/plugins/LightingPlugin.js +1 -7
  71. package/es/plugins/MultiPassRendererPlugin.d.ts +0 -1
  72. package/es/plugins/MultiPassRendererPlugin.js +4 -16
  73. package/es/plugins/PixelPickingPlugin.d.ts +1 -1
  74. package/es/plugins/PixelPickingPlugin.js +8 -28
  75. package/es/plugins/RegisterStyleAttributePlugin.d.ts +4 -0
  76. package/es/plugins/RegisterStyleAttributePlugin.js +56 -5
  77. package/es/plugins/UpdateStyleAttributePlugin.js +2 -9
  78. package/es/point/index.js +6 -2
  79. package/es/point/models/fill.js +2 -2
  80. package/es/point/models/fillmage.js +1 -1
  81. package/es/point/models/image.js +1 -1
  82. package/es/point/models/normal.d.ts +0 -1
  83. package/es/point/models/normal.js +9 -60
  84. package/es/point/models/radar.js +4 -69
  85. package/es/point/models/simplePoint.d.ts +0 -1
  86. package/es/point/models/simplePoint.js +2 -11
  87. package/es/point/models/text.js +6 -7
  88. package/es/point/models/tile.d.ts +0 -7
  89. package/es/point/models/tile.js +22 -155
  90. package/es/point/models/tileText.d.ts +0 -4
  91. package/es/point/models/tileText.js +98 -185
  92. package/es/point/shaders/animate/wave_frag.glsl +3 -3
  93. package/es/point/shaders/earth/fill_vert.glsl +0 -1
  94. package/es/point/shaders/fill_vert.glsl +0 -1
  95. package/es/point/shaders/normal_frag.glsl +1 -10
  96. package/es/point/shaders/normal_vert.glsl +5 -60
  97. package/es/point/shaders/radar/radar_frag.glsl +4 -15
  98. package/es/point/shaders/radar/radar_vert.glsl +4 -54
  99. package/es/point/shaders/tile/fill_tile_frag.glsl +10 -17
  100. package/es/point/shaders/tile/fill_tile_vert.glsl +20 -123
  101. package/es/point/shaders/tile/text_frag.glsl +33 -0
  102. package/es/point/shaders/tile/text_map_frag.glsl +31 -0
  103. package/es/point/shaders/tile/text_map_vert.glsl +38 -0
  104. package/es/point/shaders/tile/text_vert.glsl +48 -0
  105. package/es/polygon/index.js +6 -2
  106. package/es/polygon/models/extrude.js +1 -3
  107. package/es/polygon/models/fill.js +3 -4
  108. package/es/polygon/models/ocean.d.ts +0 -2
  109. package/es/polygon/models/ocean.js +13 -47
  110. package/es/polygon/models/tile.d.ts +1 -4
  111. package/es/polygon/models/tile.js +25 -57
  112. package/es/polygon/models/water.d.ts +0 -2
  113. package/es/polygon/models/water.js +13 -47
  114. package/es/polygon/shaders/polygon_frag.glsl +2 -2
  115. package/es/polygon/shaders/polygon_vert.glsl +2 -2
  116. package/es/polygon/shaders/tile/polygon_tile_map_vert.glsl +16 -0
  117. package/es/polygon/shaders/tile/polygon_tile_vert.glsl +20 -60
  118. package/es/polygon/shaders/water/polygon_ocean_frag.glsl +1 -2
  119. package/es/polygon/shaders/water/polygon_ocean_vert.glsl +0 -31
  120. package/es/polygon/shaders/water/polygon_water_frag.glsl +1 -3
  121. package/es/polygon/shaders/water/polygon_water_vert.glsl +0 -29
  122. package/es/raster/buffers/triangulation.js +1 -4
  123. package/es/raster/index.js +6 -2
  124. package/es/raster/models/raster.js +3 -2
  125. package/es/shader/minify_frag.glsl +7 -0
  126. package/es/shader/minify_picking_frag.glsl +10 -0
  127. package/es/tile/manager/baseMapTileLayerManager.d.ts +29 -0
  128. package/es/tile/manager/baseMapTileLayerManager.js +207 -0
  129. package/es/tile/manager/tileLayerManager.d.ts +2 -2
  130. package/es/tile/manager/tileLayerManager.js +2 -2
  131. package/es/tile/manager/tilePickerManager.d.ts +2 -3
  132. package/es/tile/manager/tilePickerManager.js +1 -2
  133. package/es/tile/models/tileModel.d.ts +1 -0
  134. package/es/tile/models/tileModel.js +18 -2
  135. package/es/tile/tileFactory/base.d.ts +1 -1
  136. package/es/tile/tileFactory/base.js +58 -33
  137. package/es/tile/tileFactory/line.js +3 -0
  138. package/es/tile/tileFactory/point.js +3 -0
  139. package/es/tile/tileFactory/polygon.js +3 -0
  140. package/es/tile/tileFactory/raster.js +3 -0
  141. package/es/tile/tileFactory/rasterData.js +3 -0
  142. package/es/tile/tileFactory/rasterDataLayer.js +6 -2
  143. package/es/tile/tileFactory/test.js +26 -5
  144. package/es/tile/tileFactory/vectorLayer.d.ts +4 -1
  145. package/es/tile/tileFactory/vectorLayer.js +110 -7
  146. package/es/tile/tileLayer/baseMapTileLayer.d.ts +29 -0
  147. package/es/tile/tileLayer/baseMapTileLayer.js +188 -0
  148. package/es/tile/tileLayer/baseTileLayer.d.ts +4 -4
  149. package/es/tile/tileLayer/baseTileLayer.js +46 -75
  150. package/es/tile/tileTest.d.ts +1 -0
  151. package/es/tile/tileTest.js +3 -2
  152. package/es/tile/tmsMapTileLayer.d.ts +9 -0
  153. package/es/tile/tmsMapTileLayer.js +119 -0
  154. package/es/tile/tmsTileLayer.d.ts +2 -0
  155. package/es/tile/tmsTileLayer.js +24 -2
  156. package/es/tile/utils.d.ts +4 -0
  157. package/es/tile/utils.js +30 -0
  158. package/es/utils/dataMappingStyle.js +3 -0
  159. package/es/utils/layerData.js +2 -2
  160. package/es/utils/updateShape.js +2 -2
  161. package/es/wind/index.js +6 -2
  162. package/es/wind/models/wind.js +8 -8
  163. package/es/wind/shaders/wind_vert.glsl +1 -1
  164. package/lib/Geometry/index.js +6 -2
  165. package/lib/Geometry/models/billboard.js +1 -2
  166. package/lib/Geometry/models/plane.js +2 -4
  167. package/lib/Geometry/models/sprite.js +2 -4
  168. package/lib/canvas/index.js +37 -2
  169. package/lib/citybuliding/building.js +6 -2
  170. package/lib/citybuliding/models/build.js +2 -3
  171. package/lib/core/BaseLayer.js +51 -69
  172. package/lib/core/BaseModel.js +7 -3
  173. package/lib/core/triangulation.js +66 -2
  174. package/lib/earth/index.js +3 -1
  175. package/lib/earth/models/base.js +2 -4
  176. package/lib/earth/shaders/atmosphere_frag.glsl +1 -1
  177. package/lib/earth/shaders/bloomsphere_frag.glsl +1 -1
  178. package/lib/heatmap/index.js +6 -2
  179. package/lib/heatmap/models/heatmap.js +5 -3
  180. package/lib/image/index.js +6 -2
  181. package/lib/image/models/dataImage.js +4 -7
  182. package/lib/image/models/image.js +4 -7
  183. package/lib/line/index.js +7 -2
  184. package/lib/line/models/arc.js +6 -5
  185. package/lib/line/models/half.js +3 -4
  186. package/lib/line/models/line.js +9 -8
  187. package/lib/line/models/simpleLine.js +2 -1
  188. package/lib/line/models/simpleTileLine.js +115 -0
  189. package/lib/line/models/tile.js +49 -223
  190. package/lib/line/models/wall.js +10 -46
  191. package/lib/line/shaders/dash/arc_dash_vert.glsl +2 -0
  192. package/lib/line/shaders/dash/line_dash_frag.glsl +1 -1
  193. package/lib/line/shaders/line_arc2d_vert.glsl +1 -1
  194. package/lib/line/shaders/line_arc_3d_frag.glsl +1 -1
  195. package/lib/line/shaders/line_arc_3d_vert.glsl +3 -3
  196. package/lib/line/shaders/line_arc_frag.glsl +1 -1
  197. package/lib/line/shaders/line_arc_great_circle_frag.glsl +1 -1
  198. package/lib/line/shaders/line_arc_great_circle_vert.glsl +1 -1
  199. package/lib/line/shaders/line_arc_vert.glsl +5 -3
  200. package/lib/line/shaders/line_bezier_vert.glsl +1 -1
  201. package/lib/line/shaders/line_frag.glsl +1 -2
  202. package/lib/line/shaders/line_vert.glsl +1 -1
  203. package/lib/line/shaders/linear/arc3d_linear_frag.glsl +1 -1
  204. package/lib/line/shaders/linear/arc3d_linear_vert.glsl +3 -3
  205. package/lib/line/shaders/linear/arc_linear_frag.glsl +1 -1
  206. package/lib/line/shaders/tile/line_tile_map_vert.glsl +25 -0
  207. package/lib/line/shaders/tile/line_tile_vert.glsl +19 -177
  208. package/lib/line/shaders/tile/simpleline_map_vert.glsl +15 -0
  209. package/lib/line/shaders/tile/simpleline_vert.glsl +21 -0
  210. package/lib/line/shaders/{wall_frag.glsl → wall/wall_frag.glsl} +17 -21
  211. package/lib/line/shaders/wall/wall_vert.glsl +77 -0
  212. package/lib/mask/index.js +82 -5
  213. package/lib/mask/models/fill.js +14 -10
  214. package/lib/mask/shaders/mask_vert.glsl +0 -6
  215. package/lib/plugins/DataMappingPlugin.js +127 -57
  216. package/lib/plugins/DataSourcePlugin.js +3 -2
  217. package/lib/plugins/FeatureScalePlugin.js +6 -50
  218. package/lib/plugins/LayerAnimateStylePlugin.js +6 -29
  219. package/lib/plugins/LayerModelPlugin.js +2 -6
  220. package/lib/plugins/LightingPlugin.js +1 -7
  221. package/lib/plugins/MultiPassRendererPlugin.js +3 -19
  222. package/lib/plugins/PixelPickingPlugin.js +8 -28
  223. package/lib/plugins/RegisterStyleAttributePlugin.js +56 -5
  224. package/lib/plugins/UpdateStyleAttributePlugin.js +2 -9
  225. package/lib/point/index.js +6 -2
  226. package/lib/point/models/fill.js +2 -2
  227. package/lib/point/models/fillmage.js +1 -1
  228. package/lib/point/models/image.js +1 -1
  229. package/lib/point/models/normal.js +8 -59
  230. package/lib/point/models/radar.js +4 -69
  231. package/lib/point/models/simplePoint.js +1 -10
  232. package/lib/point/models/text.js +6 -7
  233. package/lib/point/models/tile.js +21 -156
  234. package/lib/point/models/tileText.js +97 -184
  235. package/lib/point/shaders/animate/wave_frag.glsl +3 -3
  236. package/lib/point/shaders/earth/fill_vert.glsl +0 -1
  237. package/lib/point/shaders/fill_vert.glsl +0 -1
  238. package/lib/point/shaders/normal_frag.glsl +1 -10
  239. package/lib/point/shaders/normal_vert.glsl +5 -60
  240. package/lib/point/shaders/radar/radar_frag.glsl +4 -15
  241. package/lib/point/shaders/radar/radar_vert.glsl +4 -54
  242. package/lib/point/shaders/tile/fill_tile_frag.glsl +10 -17
  243. package/lib/point/shaders/tile/fill_tile_vert.glsl +20 -123
  244. package/lib/point/shaders/tile/text_frag.glsl +33 -0
  245. package/lib/point/shaders/tile/text_map_frag.glsl +31 -0
  246. package/lib/point/shaders/tile/text_map_vert.glsl +38 -0
  247. package/lib/point/shaders/tile/text_vert.glsl +48 -0
  248. package/lib/polygon/index.js +6 -2
  249. package/lib/polygon/models/extrude.js +1 -3
  250. package/lib/polygon/models/fill.js +3 -4
  251. package/lib/polygon/models/ocean.js +14 -47
  252. package/lib/polygon/models/tile.js +24 -57
  253. package/lib/polygon/models/water.js +14 -47
  254. package/lib/polygon/shaders/polygon_frag.glsl +2 -2
  255. package/lib/polygon/shaders/polygon_vert.glsl +2 -2
  256. package/lib/polygon/shaders/tile/polygon_tile_map_vert.glsl +16 -0
  257. package/lib/polygon/shaders/tile/polygon_tile_vert.glsl +20 -60
  258. package/lib/polygon/shaders/water/polygon_ocean_frag.glsl +1 -2
  259. package/lib/polygon/shaders/water/polygon_ocean_vert.glsl +0 -31
  260. package/lib/polygon/shaders/water/polygon_water_frag.glsl +1 -3
  261. package/lib/polygon/shaders/water/polygon_water_vert.glsl +0 -29
  262. package/lib/raster/buffers/triangulation.js +1 -4
  263. package/lib/raster/index.js +6 -2
  264. package/lib/raster/models/raster.js +3 -2
  265. package/lib/shader/minify_frag.glsl +7 -0
  266. package/lib/shader/minify_picking_frag.glsl +10 -0
  267. package/lib/tile/manager/baseMapTileLayerManager.js +222 -0
  268. package/lib/tile/manager/tileLayerManager.js +2 -2
  269. package/lib/tile/manager/tilePickerManager.js +1 -2
  270. package/lib/tile/models/tileModel.js +19 -2
  271. package/lib/tile/tileFactory/base.js +60 -33
  272. package/lib/tile/tileFactory/line.js +3 -0
  273. package/lib/tile/tileFactory/point.js +3 -0
  274. package/lib/tile/tileFactory/polygon.js +3 -0
  275. package/lib/tile/tileFactory/raster.js +3 -0
  276. package/lib/tile/tileFactory/rasterData.js +3 -0
  277. package/lib/tile/tileFactory/rasterDataLayer.js +6 -2
  278. package/lib/tile/tileFactory/test.js +26 -5
  279. package/lib/tile/tileFactory/vectorLayer.js +112 -8
  280. package/lib/tile/tileLayer/baseMapTileLayer.js +195 -0
  281. package/lib/tile/tileLayer/baseTileLayer.js +46 -75
  282. package/lib/tile/tileTest.js +3 -2
  283. package/lib/tile/tmsMapTileLayer.js +136 -0
  284. package/lib/tile/tmsTileLayer.js +25 -2
  285. package/lib/tile/utils.js +38 -0
  286. package/lib/utils/dataMappingStyle.js +3 -0
  287. package/lib/utils/layerData.js +2 -2
  288. package/lib/utils/updateShape.js +2 -2
  289. package/lib/wind/index.js +6 -2
  290. package/lib/wind/models/wind.js +7 -7
  291. package/lib/wind/shaders/wind_vert.glsl +1 -1
  292. package/package.json +8 -7
  293. package/es/line/shaders/tile/line_tile_frag.glsl +0 -79
  294. package/es/line/shaders/wall_vert.glsl +0 -111
  295. package/es/mask/shaders/mask_frag.glsl +0 -7
  296. package/es/polygon/shaders/tile/polygon_tile_frag.glsl +0 -12
  297. package/lib/line/shaders/tile/line_tile_frag.glsl +0 -79
  298. package/lib/line/shaders/wall_vert.glsl +0 -111
  299. package/lib/mask/shaders/mask_frag.glsl +0 -7
  300. package/lib/polygon/shaders/tile/polygon_tile_frag.glsl +0 -12
@@ -35,11 +35,11 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
35
35
 
36
36
  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; } }
37
37
 
38
- /* babel-plugin-inline-import '../shaders/wall_frag.glsl' */
39
- var line_frag = "#define Animate 0.0\n#define LineTexture 1.0\n\nuniform float u_opacity : 1.0;\nuniform float u_textureBlend;\nuniform float u_iconStepCount;\n\nvarying vec4 v_color;\n\n// line texture\nuniform float u_line_texture;\nuniform sampler2D u_texture;\nuniform vec2 u_textSize;\n\nvarying vec2 v_iconMapUV;\nvarying float v_blur;\n\nuniform float u_linearColor: 0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\n\n#pragma include \"picking\"\n\nuniform float u_time;\nuniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ]; // \u63A7\u5236\u8FD0\u52A8\n\nvarying mat4 styleMappingMat;\n// [animate, duration, interval, trailLength],\nvoid main() {\n float opacity = styleMappingMat[0][0];\n float animateSpeed = 0.0; // \u8FD0\u52A8\u901F\u5EA6\n float d_distance_ratio = styleMappingMat[3].r; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n float v = styleMappingMat[3].a;\n\n if(u_linearColor == 1.0) { // \u4F7F\u7528\u6E10\u53D8\u989C\u8272\n gl_FragColor = mix(u_sourceColor, u_targetColor, v);\n } else { // \u4F7F\u7528 color \u65B9\u6CD5\u4F20\u5165\u7684\u989C\u8272\n gl_FragColor = v_color;\n }\n\n gl_FragColor.a *= opacity; // \u5168\u5C40\u900F\u660E\u5EA6\n if(u_aimate.x == Animate) {\n animateSpeed = u_time / u_aimate.y;\n float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_aimate.z)* (1.0/ u_aimate.z) + animateSpeed);\n alpha = (alpha + u_aimate.w -1.0) / u_aimate.w;\n alpha = smoothstep(0., 1., alpha);\n gl_FragColor.a *= alpha;\n }\n\n if(u_line_texture == LineTexture) { // while load texture\n float aDistance = styleMappingMat[3].g; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n float d_texPixelLen = styleMappingMat[3].b; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n float u = fract(mod(aDistance, d_texPixelLen)/d_texPixelLen - animateSpeed);\n float v = styleMappingMat[3].a; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n // \u8BA1\u7B97\u7EB9\u7406\u95F4\u9694 start\n float flag = 0.0;\n if(u > 1.0/u_iconStepCount) {\n flag = 1.0;\n }\n u = fract(u*u_iconStepCount);\n // \u8BA1\u7B97\u7EB9\u7406\u95F4\u9694 end\n\n vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;\n vec4 pattern = texture2D(u_texture, uv);\n\n // Tip: \u5224\u65AD\u7EB9\u7406\u95F4\u9694\n if(flag > 0.0) {\n pattern = vec4(0.0);\n }\n\n if(u_textureBlend == 0.0) { // normal\n pattern.a = 0.0;\n gl_FragColor = filterColor(gl_FragColor + pattern);\n } else { // replace\n pattern.a *= opacity;\n if(gl_FragColor.a <= 0.0) {\n pattern.a = 0.0;\n }\n gl_FragColor = filterColor(pattern);\n }\n }\n \n\n // blur - AA\n if(v < v_blur) {\n gl_FragColor.a = mix(0.0, gl_FragColor.a, v/v_blur);\n } else if(v > 1.0 - v_blur) {\n gl_FragColor.a = mix(gl_FragColor.a, 0.0, (v - (1.0 - v_blur))/v_blur);\n }\n\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
38
+ /* babel-plugin-inline-import '../shaders/wall/wall_frag.glsl' */
39
+ var line_frag = "#define Animate 0.0\n#define LineTexture 1.0\n\n// line texture\nuniform float u_line_texture;\nuniform sampler2D u_texture;\nuniform vec2 u_textSize;\nuniform float u_linearColor: 0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\nuniform float u_opacity : 1.0;\nuniform float u_textureBlend;\nuniform float u_iconStepCount;\nuniform float u_time;\nuniform vec4 u_aimate: [ 1., 2., 1.0, 0.2 ]; // \u63A7\u5236\u8FD0\u52A8\n\nvarying vec2 v_iconMapUV;\nvarying float v_blur;\nvarying float v_radio;\nvarying vec4 v_color;\nvarying vec4 v_dataset;\n\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = u_opacity;\n float animateSpeed = 0.0; // \u8FD0\u52A8\u901F\u5EA6\n float d_distance_ratio = v_dataset.r; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n float v = v_dataset.a;\n\n if(u_linearColor == 1.0) { // \u4F7F\u7528\u6E10\u53D8\u989C\u8272\n gl_FragColor = mix(u_sourceColor, u_targetColor, v);\n } else { // \u4F7F\u7528 color \u65B9\u6CD5\u4F20\u5165\u7684\u989C\u8272\n gl_FragColor = v_color;\n }\n\n gl_FragColor.a *= opacity; // \u5168\u5C40\u900F\u660E\u5EA6\n if(u_aimate.x == Animate) {\n animateSpeed = u_time / u_aimate.y;\n float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_aimate.z)* (1.0/ u_aimate.z) + animateSpeed);\n alpha = (alpha + u_aimate.w -1.0) / u_aimate.w;\n alpha = smoothstep(0., 1., alpha);\n gl_FragColor.a *= alpha;\n }\n\n if(u_line_texture == LineTexture) { // while load texture\n float aDistance = v_dataset.g; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n float d_texPixelLen = v_dataset.b; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n float u = fract(mod(aDistance, d_texPixelLen)/d_texPixelLen - animateSpeed);\n float v = v_dataset.a; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n // \u8BA1\u7B97\u7EB9\u7406\u95F4\u9694 start\n float flag = 0.0;\n if(u > 1.0/u_iconStepCount) {\n flag = 1.0;\n }\n u = fract(u*u_iconStepCount);\n // \u8BA1\u7B97\u7EB9\u7406\u95F4\u9694 end\n\n vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;\n vec4 pattern = texture2D(u_texture, uv);\n\n // Tip: \u5224\u65AD\u7EB9\u7406\u95F4\u9694\n if(flag > 0.0) {\n pattern = vec4(0.0);\n }\n\n if(u_textureBlend == 0.0) { // normal\n pattern.a = 0.0;\n gl_FragColor = filterColor(gl_FragColor + pattern);\n } else { // replace\n pattern.a *= opacity;\n if(gl_FragColor.a <= 0.0) {\n pattern.a = 0.0;\n }\n gl_FragColor = filterColor(pattern);\n }\n }\n \n\n // blur - AA\n if(v < v_blur) {\n gl_FragColor.a = mix(0.0, gl_FragColor.a, v/v_blur);\n } else if(v > 1.0 - v_blur) {\n gl_FragColor.a = mix(gl_FragColor.a, 0.0, (v - (1.0 - v_blur))/v_blur);\n }\n\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
40
40
 
41
- /* babel-plugin-inline-import '../shaders/wall_vert.glsl' */
42
- var line_vert = "#define Animate 0.0\n\nattribute float a_Miter;\nattribute vec4 a_Color;\nattribute vec2 a_Size;\nattribute vec3 a_Normal;\nattribute vec3 a_Position;\nattribute vec2 a_iconMapUV;\n\nattribute float a_Total_Distance;\nattribute float a_Distance;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];\nuniform float u_icon_step: 100;\nuniform float u_heightfixed;\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvarying vec4 v_color;\nvarying float v_blur;\n\n// texV \u7EBF\u56FE\u5C42 - \u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\uFF08\u7EBF\u7684\u5BBD\u5EA6\u65B9\u5411\uFF09\nvarying vec2 v_iconMapUV;\n\nuniform float u_linearColor: 0;\n\nuniform float u_opacity: 1.0;\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"light\"\n#pragma include \"styleMappingCalOpacity\"\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0 // distance_ratio/distance/pixelLen/texV\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n float d_distance_ratio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n float d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n\n v_iconMapUV = a_iconMapUV;\n if(u_heightfixed < 1.0) { // \u9AD8\u5EA6\u968F zoom \u8C03\u6574\n d_texPixelLen = project_pixel(u_icon_step);\n } else {\n d_texPixelLen = u_icon_step;\n }\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {\n d_texPixelLen *= 10.0;\n }\n\n if(u_aimate.x == Animate || u_linearColor == 1.0) {\n d_distance_ratio = a_Distance / a_Total_Distance;\n }\n\n float miter = (a_Miter + 1.0)/2.0;\n // \u8BBE\u7F6E\u6570\u636E\u96C6\u7684\u53C2\u6570\n styleMappingMat[3][0] = d_distance_ratio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n styleMappingMat[3][1] = a_Distance; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n styleMappingMat[3][2] = d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n styleMappingMat[3][3] = miter; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C 0 - 1\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n float originSize = a_Size.x; // \u56FA\u5B9A\u9AD8\u5EA6\n if(u_heightfixed < 1.0) { // \u9AD8\u5EA6\u968F zoom \u8C03\u6574\n originSize = project_float_pixel(a_Size.x);\n }\n\n float wallHeight = originSize * miter;\n float lightWeight = calc_lighting(vec4(project_pos.xy, wallHeight, 1.0));\n\n v_blur = min(project_float_pixel(2.0) / originSize, 0.05);\n\n v_color = vec4(a_Color.rgb * lightWeight, a_Color.w);\n // v_color = a_Color;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy, wallHeight, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, wallHeight, 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}\n";
41
+ /* babel-plugin-inline-import '../shaders/wall/wall_vert.glsl' */
42
+ var line_vert = "#define Animate 0.0\n\nattribute float a_Miter;\nattribute vec4 a_Color;\nattribute vec2 a_Size;\nattribute vec3 a_Normal;\nattribute vec3 a_Position;\nattribute vec2 a_iconMapUV;\nattribute float a_Total_Distance;\nattribute float a_Distance;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform vec4 u_aimate: [ 1., 2., 1.0, 0.2 ];\nuniform float u_icon_step: 100;\nuniform float u_heightfixed;\nuniform float u_linearColor: 0;\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\n// texV \u7EBF\u56FE\u5C42 - \u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\uFF08\u7EBF\u7684\u5BBD\u5EA6\u65B9\u5411\uFF09\nvarying vec2 v_iconMapUV;\nvarying vec4 v_color;\nvarying float v_blur;\nvarying float v_radio;\nvarying vec4 v_dataset;\n\nvoid main() {\n\n\n float d_distance_ratio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n float d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n\n v_iconMapUV = a_iconMapUV;\n if(u_heightfixed < 1.0) { // \u9AD8\u5EA6\u968F zoom \u8C03\u6574\n d_texPixelLen = project_pixel(u_icon_step);\n } else {\n d_texPixelLen = u_icon_step;\n }\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {\n d_texPixelLen *= 10.0;\n }\n\n if(u_aimate.x == Animate || u_linearColor == 1.0) {\n d_distance_ratio = a_Distance / a_Total_Distance;\n }\n\n float miter = (a_Miter + 1.0)/2.0;\n // \u8BBE\u7F6E\u6570\u636E\u96C6\u7684\u53C2\u6570\n v_dataset[0] = d_distance_ratio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n v_dataset[1] = a_Distance; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n v_dataset[2] = d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n v_dataset[3] = miter; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C 0 - 1\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n float originSize = a_Size.x; // \u56FA\u5B9A\u9AD8\u5EA6\n if(u_heightfixed < 1.0) { // \u9AD8\u5EA6\u968F zoom \u8C03\u6574\n originSize = project_float_pixel(a_Size.x);\n }\n\n float wallHeight = originSize * miter;\n float lightWeight = calc_lighting(vec4(project_pos.xy, wallHeight, 1.0));\n\n v_blur = min(project_float_pixel(2.0) / originSize, 0.05);\n v_color = vec4(a_Color.rgb * lightWeight, a_Color.w);\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy, wallHeight, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, wallHeight, 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}\n";
43
43
 
44
44
  var LineWallModel = /*#__PURE__*/function (_BaseModel) {
45
45
  (0, _inherits2.default)(LineWallModel, _BaseModel);
@@ -116,43 +116,8 @@ var LineWallModel = /*#__PURE__*/function (_BaseModel) {
116
116
  useLinearColor = 1;
117
117
  }
118
118
 
119
- if (this.dataTextureTest && this.dataTextureNeedUpdate({
120
- opacity: opacity
121
- })) {
122
- this.judgeStyleAttributes({
123
- opacity: opacity
124
- });
125
- var encodeData = this.layer.getEncodedData();
126
-
127
- var _this$calDataFrame = this.calDataFrame(this.cellLength, encodeData, this.cellProperties),
128
- data = _this$calDataFrame.data,
129
- width = _this$calDataFrame.width,
130
- height = _this$calDataFrame.height;
131
-
132
- this.rowCount = height; // 当前数据纹理有多少行
133
-
134
- this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
135
- flipY: true,
136
- data: data,
137
- format: _l7Core.gl.LUMINANCE,
138
- type: _l7Core.gl.FLOAT,
139
- width: width,
140
- height: height
141
- }) : this.createTexture2D({
142
- flipY: true,
143
- data: [1],
144
- format: _l7Core.gl.LUMINANCE,
145
- type: _l7Core.gl.FLOAT,
146
- width: 1,
147
- height: 1
148
- });
149
- }
150
-
151
119
  return {
152
120
  u_heightfixed: Number(heightfixed),
153
- u_dataTexture: this.dataTexture,
154
- // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]
155
- u_cellTypeLayout: this.getCellTypeLayout(),
156
121
  u_opacity: (0, _lodash.isNumber)(opacity) ? opacity : 1.0,
157
122
  u_textureBlend: textureBlend === 'normal' ? 0.0 : 1.0,
158
123
  // 纹理支持参数
@@ -190,10 +155,9 @@ var LineWallModel = /*#__PURE__*/function (_BaseModel) {
190
155
  }, {
191
156
  key: "clearModels",
192
157
  value: function clearModels() {
193
- var _this$texture, _this$dataTexture;
158
+ var _this$texture;
194
159
 
195
160
  (_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
196
- (_this$dataTexture = this.dataTexture) === null || _this$dataTexture === void 0 ? void 0 : _this$dataTexture.destroy();
197
161
  this.iconService.off('imageUpdate', this.updateTexture);
198
162
  }
199
163
  }, {
@@ -232,7 +196,7 @@ var LineWallModel = /*#__PURE__*/function (_BaseModel) {
232
196
  type: _l7Core.gl.FLOAT
233
197
  },
234
198
  size: 1,
235
- update: function update(feature, featureIdx, vertex, attributeIdx) {
199
+ update: function update(feature, featureIdx, vertex) {
236
200
  return [vertex[3]];
237
201
  }
238
202
  }
@@ -249,7 +213,7 @@ var LineWallModel = /*#__PURE__*/function (_BaseModel) {
249
213
  type: _l7Core.gl.FLOAT
250
214
  },
251
215
  size: 1,
252
- update: function update(feature, featureIdx, vertex, attributeIdx) {
216
+ update: function update(feature, featureIdx, vertex) {
253
217
  return [vertex[5]];
254
218
  }
255
219
  }
@@ -266,7 +230,7 @@ var LineWallModel = /*#__PURE__*/function (_BaseModel) {
266
230
  type: _l7Core.gl.FLOAT
267
231
  },
268
232
  size: 2,
269
- update: function update(feature, featureIdx, vertex, attributeIdx) {
233
+ update: function update(feature) {
270
234
  var _feature$size = feature.size,
271
235
  size = _feature$size === void 0 ? 1 : _feature$size;
272
236
  return Array.isArray(size) ? [size[0], size[1]] : [size, 0];
@@ -304,7 +268,7 @@ var LineWallModel = /*#__PURE__*/function (_BaseModel) {
304
268
  type: _l7Core.gl.FLOAT
305
269
  },
306
270
  size: 1,
307
- update: function update(feature, featureIdx, vertex, attributeIdx) {
271
+ update: function update(feature, featureIdx, vertex) {
308
272
  return [vertex[4]];
309
273
  }
310
274
  }
@@ -321,7 +285,7 @@ var LineWallModel = /*#__PURE__*/function (_BaseModel) {
321
285
  type: _l7Core.gl.FLOAT
322
286
  },
323
287
  size: 2,
324
- update: function update(feature, featureIdx, vertex, attributeIdx) {
288
+ update: function update(feature) {
325
289
  var iconMap = _this2.iconService.getIconMap();
326
290
 
327
291
  var texture = feature.texture;
@@ -48,6 +48,8 @@ vec2 midPoint(vec2 source, vec2 target, float arcThetaOffset) {
48
48
  // return mid;
49
49
  }
50
50
  float getSegmentRatio(float index) {
51
+ // dash: index / (segmentNumber - 1.);
52
+ // normal: smoothstep(0.0, 1.0, index / (segmentNumber - 1.));
51
53
  return index / (segmentNumber - 1.);
52
54
  }
53
55
  vec2 interpolate (vec2 source, vec2 target, float t, float arcThetaOffset) {
@@ -9,7 +9,7 @@ varying vec4 v_dash_array;
9
9
  #pragma include "picking"
10
10
 
11
11
  uniform float u_time;
12
- uniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ]; // 控制运动
12
+ uniform vec4 u_aimate: [ 1., 2., 1.0, 0.2 ]; // 控制运动
13
13
 
14
14
  varying mat4 styleMappingMat;
15
15
  // [animate, duration, interval, trailLength],
@@ -7,7 +7,7 @@ attribute vec4 a_Instance;
7
7
  attribute float a_Size;
8
8
  uniform mat4 u_ModelMatrix;
9
9
  uniform float segmentNumber;
10
- uniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];
10
+ uniform vec4 u_aimate: [ 1., 2., 1.0, 0.2 ];
11
11
  varying vec4 v_color;
12
12
  varying vec2 v_normal;
13
13
 
@@ -20,7 +20,7 @@ uniform float segmentNumber;
20
20
  varying vec2 v_iconMapUV;
21
21
 
22
22
  uniform float u_time;
23
- uniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];
23
+ uniform vec4 u_aimate: [ 1., 2., 1.0, 0.2 ];
24
24
 
25
25
  varying mat4 styleMappingMat;
26
26
 
@@ -13,7 +13,7 @@ uniform float u_global_height: 10;
13
13
  uniform mat4 u_ModelMatrix;
14
14
  uniform mat4 u_Mvp;
15
15
  uniform float segmentNumber;
16
- uniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];
16
+ uniform vec4 u_aimate: [ 1., 2., 1.0, 0.2 ];
17
17
  varying vec4 v_color;
18
18
  // varying vec2 v_normal;
19
19
  uniform float u_line_type: 0.0;
@@ -85,11 +85,11 @@ float torad(float deg) {
85
85
 
86
86
  vec3 lglt2xyz(vec2 lnglat) {
87
87
  float pi = 3.1415926;
88
- // TODO: + Math.PI/2 是为了对齐坐标
88
+ // + Math.PI/2 是为了对齐坐标
89
89
  float lng = torad(lnglat.x) + pi / 2.0;
90
90
  float lat = torad(lnglat.y);
91
91
 
92
- // TODO: 手动增加一些偏移,减轻面的冲突
92
+ // 手动增加一些偏移,减轻面的冲突
93
93
  float radius = u_globel_radius;
94
94
 
95
95
  float z = radius * cos(lat) * cos(lng);
@@ -11,7 +11,7 @@ varying vec4 v_dash_array;
11
11
  varying vec4 v_color;
12
12
 
13
13
  uniform float u_time;
14
- uniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];
14
+ uniform vec4 u_aimate: [ 1., 2., 1.0, 0.2 ];
15
15
 
16
16
  uniform float u_line_texture;
17
17
  uniform sampler2D u_texture;
@@ -13,7 +13,7 @@ varying float v_distance_ratio;
13
13
  varying vec4 v_color;
14
14
 
15
15
  uniform float u_time;
16
- uniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];
16
+ uniform vec4 u_aimate: [ 1., 2., 1.0, 0.2 ];
17
17
 
18
18
  uniform float u_line_texture: 0.0;
19
19
  uniform sampler2D u_texture;
@@ -10,7 +10,7 @@ attribute float a_Size;
10
10
  uniform mat4 u_ModelMatrix;
11
11
  uniform mat4 u_Mvp;
12
12
  uniform float segmentNumber;
13
- uniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];
13
+ uniform vec4 u_aimate: [ 1., 2., 1.0, 0.2 ];
14
14
  varying vec4 v_color;
15
15
  // varying vec2 v_normal;
16
16
 
@@ -8,7 +8,7 @@ attribute float a_Size;
8
8
  uniform mat4 u_ModelMatrix;
9
9
  uniform mat4 u_Mvp;
10
10
  uniform float segmentNumber;
11
- uniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];
11
+ uniform vec4 u_aimate: [ 1., 2., 1.0, 0.2 ];
12
12
  varying vec4 v_color;
13
13
 
14
14
  uniform float u_lineDir: 1.0;
@@ -52,8 +52,10 @@ vec2 midPoint(vec2 source, vec2 target, float arcThetaOffset) {
52
52
  // return mid;
53
53
  }
54
54
  float getSegmentRatio(float index) {
55
- // return smoothstep(0.0, 1.0, index / (segmentNumber - 1.));
56
- return index / (segmentNumber - 1.);
55
+ // dash: index / (segmentNumber - 1.);
56
+ // normal: smoothstep(0.0, 1.0, index / (segmentNumber - 1.));
57
+ return smoothstep(0.0, 1.0, index / (segmentNumber - 1.));
58
+ // return index / (segmentNumber - 1.);
57
59
  }
58
60
  vec2 interpolate (vec2 source, vec2 target, float t, float arcThetaOffset) {
59
61
  // if the angularDist is PI, linear interpolation is applied. otherwise, use spherical interpolation
@@ -7,7 +7,7 @@ attribute vec4 a_Instance;
7
7
  attribute float a_Size;
8
8
  uniform mat4 u_ModelMatrix;
9
9
  uniform float segmentNumber;
10
- uniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];
10
+ uniform vec4 u_aimate: [ 1., 2., 1.0, 0.2 ];
11
11
  varying vec4 v_color;
12
12
  varying vec2 v_normal;
13
13
 
@@ -19,7 +19,7 @@ varying vec2 v_iconMapUV;
19
19
  #pragma include "picking"
20
20
 
21
21
  uniform float u_time;
22
- uniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ]; // 控制运动
22
+ uniform vec4 u_aimate: [ 1, 2., 1.0, 0.2 ]; // 控制运动
23
23
 
24
24
  varying mat4 styleMappingMat;
25
25
  // [animate, duration, interval, trailLength],
@@ -95,6 +95,5 @@ void main() {
95
95
  gl_FragColor.a *= mix(u_blur.g, u_blur.b, (blurV - 0.5)/0.5);
96
96
  }
97
97
 
98
-
99
98
  gl_FragColor = filterColor(gl_FragColor);
100
99
  }
@@ -15,7 +15,7 @@ attribute vec2 a_DistanceAndIndex;
15
15
 
16
16
  uniform mat4 u_ModelMatrix;
17
17
  uniform mat4 u_Mvp;
18
- uniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];
18
+ uniform vec4 u_aimate: [ 1., 2., 1.0, 0.2 ];
19
19
  uniform float u_icon_step: 100;
20
20
 
21
21
  uniform float u_heightfixed: 0.0;
@@ -8,7 +8,7 @@ uniform float segmentNumber;
8
8
 
9
9
 
10
10
  uniform float u_time;
11
- uniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];
11
+ uniform vec4 u_aimate: [ 1., 2., 1.0, 0.2 ];
12
12
 
13
13
  uniform float u_linearColor: 0;
14
14
  uniform vec4 u_sourceColor;
@@ -13,7 +13,7 @@ uniform float u_global_height: 10;
13
13
  uniform mat4 u_ModelMatrix;
14
14
  uniform mat4 u_Mvp;
15
15
  uniform float segmentNumber;
16
- uniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];
16
+ uniform vec4 u_aimate: [ 1., 2., 1.0, 0.2 ];
17
17
  varying vec4 v_color;
18
18
  // varying vec2 v_normal;
19
19
  uniform float u_line_type: 0.0;
@@ -85,11 +85,11 @@ float torad(float deg) {
85
85
 
86
86
  vec3 lglt2xyz(vec2 lnglat) {
87
87
  float pi = 3.1415926;
88
- // TODO: + Math.PI/2 是为了对齐坐标
88
+ // + Math.PI/2 是为了对齐坐标
89
89
  float lng = torad(lnglat.x) + pi / 2.0;
90
90
  float lat = torad(lnglat.y);
91
91
 
92
- // TODO: 手动增加一些偏移,减轻面的冲突
92
+ // 手动增加一些偏移,减轻面的冲突
93
93
  float radius = u_globel_radius;
94
94
 
95
95
  float z = radius * cos(lat) * cos(lng);
@@ -10,7 +10,7 @@ varying vec4 v_dash_array;
10
10
  varying vec4 v_color;
11
11
 
12
12
  uniform float u_time;
13
- uniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];
13
+ uniform vec4 u_aimate: [ 1., 2., 1.0, 0.2 ];
14
14
 
15
15
  uniform float u_line_texture;
16
16
  uniform sampler2D u_texture;
@@ -0,0 +1,25 @@
1
+ attribute float a_Miter;
2
+ attribute vec4 a_Color;
3
+ attribute vec3 a_Normal;
4
+ attribute vec3 a_Position;
5
+
6
+ uniform mat4 u_ModelMatrix;
7
+ uniform mat4 u_Mvp;
8
+ uniform float u_size;
9
+
10
+ #pragma include "projection"
11
+
12
+ void main() {
13
+
14
+ vec3 size = a_Miter * u_size * reverse_offset_normal(a_Normal);
15
+
16
+ vec2 offset = project_pixel(size.xy);
17
+
18
+ vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));
19
+
20
+ if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
21
+ gl_Position = u_Mvp * (vec4(project_pos.xy + offset, 0.0, 1.0));
22
+ } else {
23
+ gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));
24
+ }
25
+ }
@@ -1,210 +1,52 @@
1
-
2
1
  attribute float a_Miter;
3
2
  attribute vec4 a_Color;
4
3
  attribute vec2 a_Size;
5
4
  attribute vec3 a_Normal;
6
5
  attribute vec3 a_Position;
7
6
 
8
- attribute vec2 a_iconMapUV;
9
-
10
- // dash line
11
- attribute float a_Total_Distance;
12
- attribute vec2 a_DistanceAndIndex;
13
-
14
- uniform vec2 u_tileOrigin;
15
- uniform float u_coord;
7
+ // uniform vec2 u_tileOrigin;
8
+ // uniform float u_coord;
16
9
 
17
10
  uniform mat4 u_ModelMatrix;
18
11
  uniform mat4 u_Mvp;
19
- uniform float u_icon_step: 100;
20
12
 
21
- uniform float u_heightfixed: 0.0;
22
- uniform float u_vertexScale: 1.0;
23
13
 
24
14
  #pragma include "projection"
25
15
  #pragma include "picking"
26
16
 
27
17
  varying vec4 v_color;
28
18
 
29
- // texV 线图层 - 贴图部分的 v 坐标(线的宽度方向)
30
- varying vec2 v_iconMapUV;
31
-
32
-
33
- uniform float u_linearColor: 0;
34
- uniform float u_arrow: 0.0;
35
- uniform float u_arrowHeight: 3.0;
36
- uniform float u_arrowWidth: 2.0;
37
- uniform float u_tailWidth: 1.0;
38
-
39
- uniform float u_opacity: 1.0;
40
- varying mat4 styleMappingMat; // 用于将在顶点着色器中计算好的样式值传递给片元
41
-
42
- #pragma include "styleMapping"
43
- #pragma include "styleMappingCalOpacity"
44
-
45
- vec2 calculateArrow(vec2 offset) {
46
- /*
47
- * 在支持箭头的时候,第二、第三组顶点是额外插入用于构建顶点的
48
- */
49
- float arrowFlag = -1.0;
50
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {
51
- // 高德 2.0 的旋转角度不同
52
- arrowFlag = 1.0;
53
- }
54
- float pi = arrowFlag * 3.1415926/2.;
55
- if(a_Miter < 0.) {
56
- // 根据线的两侧偏移不同、旋转的方向相反
57
- pi = -pi;
58
- }
59
- highp float angle_sin = sin(pi);
60
- highp float angle_cos = cos(pi);
61
- // 计算垂直与线方向的旋转矩阵
62
- mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos);
63
- float arrowWidth = u_arrowWidth;
64
- float arrowHeight = u_arrowHeight;
65
-
66
- vec2 arrowOffset = vec2(0.0);
67
- /*
68
- * a_DistanceAndIndex.y 用于标记当前顶点属于哪一组(两个顶点一组,构成线的其实是矩形,最简需要四个顶点、两组顶点构成)
69
- */
70
- if(a_DistanceAndIndex.y == 0.0) {
71
- // 箭头尖部
72
- offset = vec2(0.0);
73
- } else if(a_DistanceAndIndex.y == 1.0) {
74
- // 箭头两侧
75
- arrowOffset = rotation_matrix*(offset * arrowHeight);
76
- offset += arrowOffset; // 沿线偏移
77
- offset = offset * arrowWidth; // 垂直线向外偏移(是构建箭头两侧的顶点)
78
- } else if(a_DistanceAndIndex.y == 2.0 || a_DistanceAndIndex.y == 3.0 || a_DistanceAndIndex.y == 4.0) {
79
- // 偏移其余的点位(将长度让位给箭头)
80
- arrowOffset = rotation_matrix*(offset * arrowHeight) * arrowWidth;
81
- offset += arrowOffset;// 沿线偏移
82
- }
83
-
84
- return offset;
85
- }
86
-
87
19
  void main() {
88
- // cal style mapping - 数据纹理映射部分的计算
89
- styleMappingMat = mat4(
90
- 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty
91
- 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA
92
- 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]
93
- 0.0, 0.0, 0.0, 0.0 // distance_ratio/distance/pixelLen/texV
94
- );
95
-
96
- float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行
97
- float columnCount = u_cellTypeLayout[0][1]; // 当看到数据纹理有几列
98
- float columnWidth = 1.0/columnCount; // 列宽
99
- float rowHeight = 1.0/rowCount; // 行高
100
- float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets
101
- float id = a_vertexId; // 第n个顶点
102
- float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // 起始点在第几行
103
- float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // 起始点在第几列
104
-
105
- // cell 固定顺序 opacity -> strokeOpacity -> strokeWidth -> stroke ...
106
- // 按顺序从 cell 中取值、若没有则自动往下取值
107
- float textureOffset = 0.0; // 在 cell 中取值的偏移量
108
-
109
- vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);
110
- styleMappingMat[0][0] = opacityAndOffset.r;
111
- textureOffset = opacityAndOffset.g;
112
- // cal style mapping - 数据纹理映射部分的计算
113
-
114
- float d_texPixelLen; // 贴图的像素长度,根据地图层级缩放
115
-
116
- v_iconMapUV = a_iconMapUV;
117
- d_texPixelLen = project_float_pixel(u_icon_step);
118
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {
119
- d_texPixelLen *= 10.0;
120
- }
121
-
122
20
  v_color = a_Color;
123
21
 
124
22
  vec3 size = a_Miter * setPickingSize(a_Size.x) * reverse_offset_normal(a_Normal);
125
23
 
126
24
  vec2 offset = project_pixel(size.xy);
127
25
 
128
- float lineDistance = a_DistanceAndIndex.x;
129
- float currentLinePointRatio = lineDistance / a_Total_Distance;
130
-
131
- if(u_arrow > 0.0) {
132
- // 计算箭头
133
- offset = calculateArrow(offset);
134
-
135
- if(a_DistanceAndIndex.y > 4.0) {
136
- offset *= mix(1.0, u_tailWidth, currentLinePointRatio);
137
- }
138
- }
139
-
140
- float lineOffsetWidth = length(offset + offset * sign(a_Miter)); // 线横向偏移的距离(向两侧偏移的和)
141
- float linePixelSize = project_pixel(a_Size.x) * 2.0; // 定点位置偏移,按地图等级缩放后的距离 单侧 * 2
142
- float texV = lineOffsetWidth/linePixelSize; // 线图层贴图部分的 v 坐标值
143
-
144
- // 设置数据集的参数
145
- styleMappingMat[3][0] = currentLinePointRatio; // 当前点位距离占线总长的比例
146
- styleMappingMat[3][1] = lineDistance; // 当前顶点的距离
147
- styleMappingMat[3][2] = d_texPixelLen; // 贴图的像素长度,根据地图层级缩放
148
- styleMappingMat[3][3] = texV; // 线图层贴图部分的 v 坐标值
149
-
150
26
  vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));
151
27
 
152
- // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, a_Size.y, 1.0));
153
-
154
- float h = float(a_Position.z) * u_vertexScale; // 线顶点的高度 - 兼容不存在第三个数值的情况 vertex height
155
- float lineHeight = a_Size.y; // size 第二个参数代表的高度 [linewidth, lineheight]
156
-
157
- if(u_coord > 0.0) {
158
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
159
- lineHeight *= 0.2; // 保持和 amap/mapbox 一致的效果
160
- h *= 0.2;
161
- if(u_heightfixed < 1.0) {
162
- lineHeight = project_pixel(a_Size.y);
163
- }
164
- gl_Position = u_Mvp * (vec4(project_pos.xy + offset, lineHeight + h, 1.0));
165
- } else {
166
- // mapbox - amap
167
-
168
- // 兼容 mapbox 在线高度上的效果表现基本一致
169
- if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
170
- // mapbox
171
- // 保持高度相对不变
172
- float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);
173
- h *= mapboxZoomScale;
174
- if(u_heightfixed > 0.0) {
175
- lineHeight *= mapboxZoomScale;
176
- }
177
-
28
+ // if(u_coord > 0.0) { // 使用经纬度坐标
29
+ if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
30
+ gl_Position = u_Mvp * (vec4(project_pos.xy + offset, 0.0, 1.0));
178
31
  } else {
179
- // amap
180
- // lineHeight 顶点偏移高度
181
- if(u_heightfixed < 1.0) {
182
- lineHeight *= pow(2.0, 20.0 - u_Zoom);
183
- }
32
+ gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));
184
33
  }
34
+ // } else { // 使用偏移坐标
35
+ // vec2 pointPos = a_Position.xy;
36
+ // vec4 tileWorld = vec4(project_mvt_offset_position(vec4(u_tileOrigin, 0.0, 1.0)).xyz, 1.0); // 瓦片起始点的世界坐标
185
37
 
186
- gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, lineHeight + h, 1.0));
187
- }
188
- } else {
189
- vec2 pointPos = a_Position.xy;
190
- vec4 tileWorld = vec4(project_mvt_offset_position(vec4(u_tileOrigin, 0.0, 1.0)).xyz, 1.0); // 瓦片起始点的世界坐标
191
-
192
- vec2 pointOffset = pointPos * pow(2.0, u_Zoom); // 瓦片内的点的偏移坐标
193
-
194
- tileWorld.xy += pointOffset;
195
-
196
- tileWorld.xy += offset;
197
-
198
- if (u_CoordinateSystem == COORDINATE_SYSTEM_METER_OFFSET || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
199
- // Needs to be divided with project_uCommonUnitsPerMeter
200
- tileWorld.w *= u_PixelsPerMeter.z;
201
- }
38
+ // vec2 pointOffset = pointPos * pow(2.0, u_Zoom); // 瓦片内的点的偏移坐标
39
+
40
+ // tileWorld.xy += pointOffset;
202
41
 
203
- gl_Position = u_ViewProjectionMatrix * tileWorld + u_ViewportCenterProjection;
204
- }
42
+ // tileWorld.xy += offset;
205
43
 
44
+ // if (u_CoordinateSystem == COORDINATE_SYSTEM_METER_OFFSET || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
45
+ // // Needs to be divided with project_uCommonUnitsPerMeter
46
+ // tileWorld.w *= u_PixelsPerMeter.z;
47
+ // }
48
+ // gl_Position = u_ViewProjectionMatrix * tileWorld + u_ViewportCenterProjection;
49
+ // }
206
50
 
207
51
  setPickingColor(a_PickingColor);
208
-
209
-
210
52
  }
@@ -0,0 +1,15 @@
1
+ attribute vec3 a_Position;
2
+ uniform mat4 u_ModelMatrix;
3
+ uniform mat4 u_Mvp;
4
+
5
+ #pragma include "projection"
6
+
7
+ void main() {
8
+ vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));
9
+
10
+ if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
11
+ gl_Position = u_Mvp * (vec4(project_pos.xy, 0.0, 1.0));
12
+ } else {
13
+ gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0.0, 1.0));
14
+ }
15
+ }
@@ -0,0 +1,21 @@
1
+ attribute vec4 a_Color;
2
+ attribute vec3 a_Position;
3
+
4
+ uniform mat4 u_ModelMatrix;
5
+ uniform mat4 u_Mvp;
6
+
7
+ #pragma include "projection"
8
+
9
+ varying vec4 v_color;
10
+
11
+ void main() {
12
+ v_color = a_Color;
13
+
14
+ vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));
15
+
16
+ if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
17
+ gl_Position = u_Mvp * (vec4(project_pos.xy, 0.0, 1.0));
18
+ } else {
19
+ gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0.0, 1.0));
20
+ }
21
+ }