@antv/l7-layers 2.21.10 → 2.21.11-beta.0

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 (287) hide show
  1. package/es/citybuliding/models/build.d.ts +16 -0
  2. package/es/citybuliding/models/build.js +18 -20
  3. package/es/citybuliding/shaders/build_frag.glsl +6 -6
  4. package/es/citybuliding/shaders/build_vert.glsl +8 -14
  5. package/es/core/BaseLayer.d.ts +0 -1
  6. package/es/core/BaseLayer.js +9 -19
  7. package/es/core/BaseModel.d.ts +15 -2
  8. package/es/core/BaseModel.js +98 -64
  9. package/es/core/CommonStyleAttribute.d.ts +14 -18
  10. package/es/core/CommonStyleAttribute.js +23 -67
  11. package/es/core/shape/extrude.js +6 -3
  12. package/es/core/triangulation.js +22 -50
  13. package/es/core/utils.d.ts +4 -0
  14. package/es/core/utils.js +33 -0
  15. package/es/earth/models/atmosphere.d.ts +15 -0
  16. package/es/earth/models/atmosphere.js +30 -24
  17. package/es/earth/models/base.d.ts +15 -0
  18. package/es/earth/models/base.js +30 -24
  19. package/es/earth/models/bloomsphere.d.ts +15 -0
  20. package/es/earth/models/bloomsphere.js +30 -24
  21. package/es/earth/shaders/atmosphere/atmosphere_vert.glsl +7 -5
  22. package/es/earth/shaders/base/base_vert.glsl +3 -3
  23. package/es/earth/shaders/bloomshpere/bloomsphere_vert.glsl +5 -4
  24. package/es/geometry/models/billboard.d.ts +15 -0
  25. package/es/geometry/models/billboard.js +14 -8
  26. package/es/geometry/models/plane.d.ts +14 -0
  27. package/es/geometry/models/plane.js +10 -10
  28. package/es/geometry/models/sprite.js +3 -9
  29. package/es/geometry/shaders/billboard_vert.glsl +28 -25
  30. package/es/geometry/shaders/plane_vert.glsl +6 -6
  31. package/es/geometry/shaders/sprite_vert.glsl +7 -9
  32. package/es/heatmap/models/grid.d.ts +14 -0
  33. package/es/heatmap/models/grid.js +10 -3
  34. package/es/heatmap/models/grid3d.d.ts +16 -0
  35. package/es/heatmap/models/grid3d.js +14 -6
  36. package/es/heatmap/models/heatmap.d.ts +20 -1
  37. package/es/heatmap/models/heatmap.js +96 -83
  38. package/es/heatmap/models/hexagon.d.ts +14 -0
  39. package/es/heatmap/models/hexagon.js +9 -3
  40. package/es/heatmap/shaders/grid/grid_vert.glsl +30 -42
  41. package/es/heatmap/shaders/grid3d/grid_3d_vert.glsl +14 -26
  42. package/es/heatmap/shaders/heatmap/heatmap_3d_vert.glsl +19 -16
  43. package/es/heatmap/shaders/heatmap/heatmap_framebuffer_vert.glsl +16 -22
  44. package/es/heatmap/shaders/heatmap/heatmap_vert.glsl +3 -4
  45. package/es/heatmap/shaders/hexagon/hexagon_vert.glsl +13 -23
  46. package/es/image/models/image.d.ts +14 -0
  47. package/es/image/models/image.js +11 -7
  48. package/es/image/shaders/image_vert.glsl +7 -6
  49. package/es/line/models/arc.d.ts +18 -0
  50. package/es/line/models/arc.js +57 -8
  51. package/es/line/models/arc_3d.d.ts +18 -0
  52. package/es/line/models/arc_3d.js +55 -7
  53. package/es/line/models/flow.d.ts +17 -0
  54. package/es/line/models/flow.js +35 -7
  55. package/es/line/models/great_circle.d.ts +17 -0
  56. package/es/line/models/great_circle.js +34 -6
  57. package/es/line/models/line.d.ts +17 -0
  58. package/es/line/models/line.js +17 -8
  59. package/es/line/models/simple_line.d.ts +14 -0
  60. package/es/line/models/simple_line.js +12 -47
  61. package/es/line/models/wall.d.ts +17 -0
  62. package/es/line/models/wall.js +22 -48
  63. package/es/line/shaders/arc/line_arc_vert.glsl +44 -52
  64. package/es/line/shaders/arc3d/line_arc_3d_vert.glsl +15 -20
  65. package/es/line/shaders/flow/flow_line_vert.glsl +30 -48
  66. package/es/line/shaders/greatCircle/line_arc_great_circle_vert.glsl +53 -74
  67. package/es/line/shaders/line/line_vert.glsl +31 -48
  68. package/es/line/shaders/simple/simpleline_vert.glsl +18 -23
  69. package/es/line/shaders/wall/wall_vert.glsl +36 -45
  70. package/es/mask/models/fill.js +2 -1
  71. package/es/mask/shaders/mask_vert.glsl +2 -7
  72. package/es/plugins/DataMappingPlugin.d.ts +0 -1
  73. package/es/plugins/DataMappingPlugin.js +1 -24
  74. package/es/plugins/PixelPickingPlugin.js +2 -2
  75. package/es/plugins/RegisterStyleAttributePlugin.d.ts +0 -1
  76. package/es/plugins/RegisterStyleAttributePlugin.js +3 -25
  77. package/es/plugins/ShaderUniformPlugin.d.ts +0 -5
  78. package/es/plugins/ShaderUniformPlugin.js +4 -35
  79. package/es/point/models/billboard_point.d.ts +14 -0
  80. package/es/point/models/billboard_point.js +11 -3
  81. package/es/point/models/earthExtrude.d.ts +16 -0
  82. package/es/point/models/earthExtrude.js +15 -8
  83. package/es/point/models/earthFill.d.ts +16 -0
  84. package/es/point/models/earthFill.js +13 -5
  85. package/es/point/models/extrude.d.ts +16 -0
  86. package/es/point/models/extrude.js +19 -12
  87. package/es/point/models/fill.d.ts +16 -0
  88. package/es/point/models/fill.js +16 -5
  89. package/es/point/models/fillImage.d.ts +16 -0
  90. package/es/point/models/fillImage.js +16 -16
  91. package/es/point/models/image.d.ts +15 -0
  92. package/es/point/models/image.js +14 -4
  93. package/es/point/models/normal.d.ts +14 -0
  94. package/es/point/models/normal.js +11 -3
  95. package/es/point/models/radar.d.ts +15 -0
  96. package/es/point/models/radar.js +13 -4
  97. package/es/point/models/text.d.ts +16 -0
  98. package/es/point/models/text.js +18 -11
  99. package/es/point/shaders/billboard/billboard_point_vert.glsl +10 -13
  100. package/es/point/shaders/earthExtrude/earthExtrude_vert.glsl +15 -25
  101. package/es/point/shaders/earthFill/earthFill_vert.glsl +6 -6
  102. package/es/point/shaders/extrude/extrude_vert.glsl +35 -39
  103. package/es/point/shaders/fill/fill_vert.glsl +12 -14
  104. package/es/point/shaders/fillImage/fillImage_vert.glsl +16 -28
  105. package/es/point/shaders/image/image_vert.glsl +15 -12
  106. package/es/point/shaders/normal/normal_vert.glsl +7 -10
  107. package/es/point/shaders/radar/radar_vert.glsl +11 -11
  108. package/es/point/shaders/text/text_vert.glsl +10 -9
  109. package/es/polygon/models/extrude.d.ts +16 -0
  110. package/es/polygon/models/extrude.js +26 -26
  111. package/es/polygon/models/extrusion.d.ts +16 -0
  112. package/es/polygon/models/extrusion.js +34 -4
  113. package/es/polygon/models/fill.d.ts +14 -0
  114. package/es/polygon/models/fill.js +12 -4
  115. package/es/polygon/models/ocean.d.ts +14 -0
  116. package/es/polygon/models/ocean.js +11 -6
  117. package/es/polygon/models/water.d.ts +14 -0
  118. package/es/polygon/models/water.js +11 -6
  119. package/es/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +17 -15
  120. package/es/polygon/shaders/extrude/polygon_extrude_vert.glsl +22 -20
  121. package/es/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +17 -17
  122. package/es/polygon/shaders/extrusion/polygon_extrusion_vert.glsl +8 -8
  123. package/es/polygon/shaders/fill/fill_linear_vert.glsl +7 -6
  124. package/es/polygon/shaders/fill/fill_vert.glsl +10 -12
  125. package/es/polygon/shaders/ocean/ocean_vert.glsl +3 -4
  126. package/es/polygon/shaders/water/polygon_water_vert.glsl +5 -5
  127. package/es/raster/index.d.ts +1 -1
  128. package/es/raster/index.js +1 -1
  129. package/es/raster/models/raster.d.ts +14 -0
  130. package/es/raster/models/raster.js +13 -3
  131. package/es/raster/models/rasterRgb.d.ts +14 -0
  132. package/es/raster/models/rasterRgb.js +12 -3
  133. package/es/raster/models/rasterTerrainRgb.d.ts +14 -0
  134. package/es/raster/models/rasterTerrainRgb.js +11 -3
  135. package/es/raster/shaders/raster/raster_2d_vert.glsl +6 -6
  136. package/es/raster/shaders/rgb/raster_rgb_vert.glsl +11 -11
  137. package/es/raster/shaders/terrain/terrain_rgb_vert.glsl +11 -11
  138. package/es/tile/core/BaseLayer.js +0 -16
  139. package/es/utils/extrude_polyline.d.ts +0 -15
  140. package/es/utils/extrude_polyline.js +0 -217
  141. package/es/wind/models/wind.d.ts +14 -0
  142. package/es/wind/models/wind.js +9 -1
  143. package/es/wind/shaders/wind_vert.glsl +6 -5
  144. package/lib/citybuliding/models/build.d.ts +16 -0
  145. package/lib/citybuliding/models/build.js +18 -20
  146. package/lib/citybuliding/shaders/build_frag.glsl +6 -6
  147. package/lib/citybuliding/shaders/build_vert.glsl +8 -14
  148. package/lib/core/BaseLayer.d.ts +0 -1
  149. package/lib/core/BaseLayer.js +9 -19
  150. package/lib/core/BaseModel.d.ts +15 -2
  151. package/lib/core/BaseModel.js +96 -62
  152. package/lib/core/CommonStyleAttribute.d.ts +14 -18
  153. package/lib/core/CommonStyleAttribute.js +23 -68
  154. package/lib/core/shape/extrude.js +6 -3
  155. package/lib/core/triangulation.js +22 -50
  156. package/lib/core/utils.d.ts +4 -0
  157. package/lib/core/utils.js +35 -0
  158. package/lib/earth/models/atmosphere.d.ts +15 -0
  159. package/lib/earth/models/atmosphere.js +30 -24
  160. package/lib/earth/models/base.d.ts +15 -0
  161. package/lib/earth/models/base.js +30 -24
  162. package/lib/earth/models/bloomsphere.d.ts +15 -0
  163. package/lib/earth/models/bloomsphere.js +30 -24
  164. package/lib/earth/shaders/atmosphere/atmosphere_vert.glsl +7 -5
  165. package/lib/earth/shaders/base/base_vert.glsl +3 -3
  166. package/lib/earth/shaders/bloomshpere/bloomsphere_vert.glsl +5 -4
  167. package/lib/geometry/models/billboard.d.ts +15 -0
  168. package/lib/geometry/models/billboard.js +14 -8
  169. package/lib/geometry/models/plane.d.ts +14 -0
  170. package/lib/geometry/models/plane.js +10 -10
  171. package/lib/geometry/models/sprite.js +3 -9
  172. package/lib/geometry/shaders/billboard_vert.glsl +28 -25
  173. package/lib/geometry/shaders/plane_vert.glsl +6 -6
  174. package/lib/geometry/shaders/sprite_vert.glsl +7 -9
  175. package/lib/heatmap/models/grid.d.ts +14 -0
  176. package/lib/heatmap/models/grid.js +10 -3
  177. package/lib/heatmap/models/grid3d.d.ts +16 -0
  178. package/lib/heatmap/models/grid3d.js +14 -6
  179. package/lib/heatmap/models/heatmap.d.ts +20 -1
  180. package/lib/heatmap/models/heatmap.js +95 -82
  181. package/lib/heatmap/models/hexagon.d.ts +14 -0
  182. package/lib/heatmap/models/hexagon.js +9 -3
  183. package/lib/heatmap/shaders/grid/grid_vert.glsl +30 -42
  184. package/lib/heatmap/shaders/grid3d/grid_3d_vert.glsl +14 -26
  185. package/lib/heatmap/shaders/heatmap/heatmap_3d_vert.glsl +19 -16
  186. package/lib/heatmap/shaders/heatmap/heatmap_framebuffer_vert.glsl +16 -22
  187. package/lib/heatmap/shaders/heatmap/heatmap_vert.glsl +3 -4
  188. package/lib/heatmap/shaders/hexagon/hexagon_vert.glsl +13 -23
  189. package/lib/image/models/image.d.ts +14 -0
  190. package/lib/image/models/image.js +11 -7
  191. package/lib/image/shaders/image_vert.glsl +7 -6
  192. package/lib/line/models/arc.d.ts +18 -0
  193. package/lib/line/models/arc.js +56 -7
  194. package/lib/line/models/arc_3d.d.ts +18 -0
  195. package/lib/line/models/arc_3d.js +55 -7
  196. package/lib/line/models/flow.d.ts +17 -0
  197. package/lib/line/models/flow.js +35 -7
  198. package/lib/line/models/great_circle.d.ts +17 -0
  199. package/lib/line/models/great_circle.js +33 -5
  200. package/lib/line/models/line.d.ts +17 -0
  201. package/lib/line/models/line.js +17 -8
  202. package/lib/line/models/simple_line.d.ts +14 -0
  203. package/lib/line/models/simple_line.js +12 -47
  204. package/lib/line/models/wall.d.ts +17 -0
  205. package/lib/line/models/wall.js +22 -48
  206. package/lib/line/shaders/arc/line_arc_vert.glsl +44 -52
  207. package/lib/line/shaders/arc3d/line_arc_3d_vert.glsl +15 -20
  208. package/lib/line/shaders/flow/flow_line_vert.glsl +30 -48
  209. package/lib/line/shaders/greatCircle/line_arc_great_circle_vert.glsl +53 -74
  210. package/lib/line/shaders/line/line_vert.glsl +31 -48
  211. package/lib/line/shaders/simple/simpleline_vert.glsl +18 -23
  212. package/lib/line/shaders/wall/wall_vert.glsl +36 -45
  213. package/lib/mask/models/fill.js +2 -1
  214. package/lib/mask/shaders/mask_vert.glsl +2 -7
  215. package/lib/plugins/DataMappingPlugin.d.ts +0 -1
  216. package/lib/plugins/DataMappingPlugin.js +0 -23
  217. package/lib/plugins/PixelPickingPlugin.js +1 -1
  218. package/lib/plugins/RegisterStyleAttributePlugin.d.ts +0 -1
  219. package/lib/plugins/RegisterStyleAttributePlugin.js +2 -24
  220. package/lib/plugins/ShaderUniformPlugin.d.ts +0 -5
  221. package/lib/plugins/ShaderUniformPlugin.js +4 -35
  222. package/lib/point/models/billboard_point.d.ts +14 -0
  223. package/lib/point/models/billboard_point.js +11 -3
  224. package/lib/point/models/earthExtrude.d.ts +16 -0
  225. package/lib/point/models/earthExtrude.js +14 -7
  226. package/lib/point/models/earthFill.d.ts +16 -0
  227. package/lib/point/models/earthFill.js +13 -5
  228. package/lib/point/models/extrude.d.ts +16 -0
  229. package/lib/point/models/extrude.js +18 -11
  230. package/lib/point/models/fill.d.ts +16 -0
  231. package/lib/point/models/fill.js +16 -5
  232. package/lib/point/models/fillImage.d.ts +16 -0
  233. package/lib/point/models/fillImage.js +16 -16
  234. package/lib/point/models/image.d.ts +15 -0
  235. package/lib/point/models/image.js +14 -4
  236. package/lib/point/models/normal.d.ts +14 -0
  237. package/lib/point/models/normal.js +11 -3
  238. package/lib/point/models/radar.d.ts +15 -0
  239. package/lib/point/models/radar.js +13 -4
  240. package/lib/point/models/text.d.ts +16 -0
  241. package/lib/point/models/text.js +18 -11
  242. package/lib/point/shaders/billboard/billboard_point_vert.glsl +10 -13
  243. package/lib/point/shaders/earthExtrude/earthExtrude_vert.glsl +15 -25
  244. package/lib/point/shaders/earthFill/earthFill_vert.glsl +6 -6
  245. package/lib/point/shaders/extrude/extrude_vert.glsl +35 -39
  246. package/lib/point/shaders/fill/fill_vert.glsl +12 -14
  247. package/lib/point/shaders/fillImage/fillImage_vert.glsl +16 -28
  248. package/lib/point/shaders/image/image_vert.glsl +15 -12
  249. package/lib/point/shaders/normal/normal_vert.glsl +7 -10
  250. package/lib/point/shaders/radar/radar_vert.glsl +11 -11
  251. package/lib/point/shaders/text/text_vert.glsl +10 -9
  252. package/lib/polygon/models/extrude.d.ts +16 -0
  253. package/lib/polygon/models/extrude.js +25 -25
  254. package/lib/polygon/models/extrusion.d.ts +16 -0
  255. package/lib/polygon/models/extrusion.js +34 -4
  256. package/lib/polygon/models/fill.d.ts +14 -0
  257. package/lib/polygon/models/fill.js +12 -4
  258. package/lib/polygon/models/ocean.d.ts +14 -0
  259. package/lib/polygon/models/ocean.js +11 -6
  260. package/lib/polygon/models/water.d.ts +14 -0
  261. package/lib/polygon/models/water.js +11 -6
  262. package/lib/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +17 -15
  263. package/lib/polygon/shaders/extrude/polygon_extrude_vert.glsl +22 -20
  264. package/lib/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +17 -17
  265. package/lib/polygon/shaders/extrusion/polygon_extrusion_vert.glsl +8 -8
  266. package/lib/polygon/shaders/fill/fill_linear_vert.glsl +7 -6
  267. package/lib/polygon/shaders/fill/fill_vert.glsl +10 -12
  268. package/lib/polygon/shaders/ocean/ocean_vert.glsl +3 -4
  269. package/lib/polygon/shaders/water/polygon_water_vert.glsl +5 -5
  270. package/lib/raster/index.d.ts +1 -1
  271. package/lib/raster/index.js +2 -2
  272. package/lib/raster/models/raster.d.ts +14 -0
  273. package/lib/raster/models/raster.js +13 -3
  274. package/lib/raster/models/rasterRgb.d.ts +14 -0
  275. package/lib/raster/models/rasterRgb.js +12 -3
  276. package/lib/raster/models/rasterTerrainRgb.d.ts +14 -0
  277. package/lib/raster/models/rasterTerrainRgb.js +11 -3
  278. package/lib/raster/shaders/raster/raster_2d_vert.glsl +6 -6
  279. package/lib/raster/shaders/rgb/raster_rgb_vert.glsl +11 -11
  280. package/lib/raster/shaders/terrain/terrain_rgb_vert.glsl +11 -11
  281. package/lib/tile/core/BaseLayer.js +0 -16
  282. package/lib/utils/extrude_polyline.d.ts +0 -15
  283. package/lib/utils/extrude_polyline.js +0 -217
  284. package/lib/wind/models/wind.d.ts +14 -0
  285. package/lib/wind/models/wind.js +9 -1
  286. package/lib/wind/shaders/wind_vert.glsl +6 -5
  287. package/package.json +6 -6
@@ -1,8 +1,9 @@
1
- layout(location = 0) in vec3 a_Position;
2
- layout(location = 1) in vec4 a_Color;
3
- layout(location = 9) in vec2 a_Size;
4
- layout(location = 12) in vec4 a_Instance;
5
- layout(location = 13) in vec3 a_Normal;
1
+ layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
2
+ layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
3
+ layout(location = ATTRIBUTE_LOCATION_SIZE) in vec2 a_Size;
4
+ layout(location = ATTRIBUTE_LOCATION_INSTANCE) in vec4 a_Instance;
5
+ layout(location = ATTRIBUTE_LOCATION_INSTANCE_64LOW) in vec4 a_Instance64Low;
6
+ layout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal;
6
7
 
7
8
  layout(std140) uniform commonUniorm {
8
9
  float u_gap_width: 1.0;
@@ -17,78 +18,59 @@ layout(std140) uniform commonUniorm {
17
18
  out vec4 v_color;
18
19
 
19
20
  vec2 project_pixel_offset(vec2 offsets) {
21
+ vec2 data = project_pixel(offsets);
20
22
 
21
- vec2 data = project_pixel(offsets);
22
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {
23
- // P20_2 坐标系下,为了和 Web 墨卡托坐标系统一,zoom 默认减3
24
- return data;
25
- }
26
-
27
- return vec2(data.x, -data.y);;
23
+ return vec2(data.x, -data.y);
28
24
  }
29
25
 
30
26
  vec2 line_dir(vec2 target, vec2 source) {
31
-
32
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {
33
- // P20_2 坐标系下,为了和 Web 墨卡托坐标系统一,zoom 默认减3
34
- return normalize(target - source);
35
- }
36
27
  return normalize(ProjectFlat(target) - ProjectFlat(source));
37
28
  }
38
29
 
39
- float flag_gap() {
40
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {
41
- // P20_2 坐标系下,为了和 Web 墨卡托坐标系统一,zoom 默认减3
42
- return 1.;
43
- }
44
- return -1.;
45
-
46
- }
47
-
48
30
 
49
31
  void main() {
32
+ // 透明度计算
33
+ vec2 source_world = a_Instance.rg; // 起点
34
+ vec2 target_world = a_Instance.ba; // 终点
35
+ vec2 flowlineDir = line_dir(target_world, source_world);
36
+ vec2 perpendicularDir = vec2(-flowlineDir.y, flowlineDir.x);
50
37
 
51
- // 透明度计算
52
- vec2 source = a_Instance.rg; // 起始点
53
- vec2 target = a_Instance.ba; // 终点
54
- vec2 flowlineDir = line_dir(target,source);
55
- vec2 perpendicularDir = vec2(-flowlineDir.y, flowlineDir.x); // mapbox || 高德
56
-
57
- vec2 position = mix(source, target, a_Position.x);
58
-
59
- float lengthCommon = length(project_position(vec4(target,0,1)) - project_position(vec4(source,0,1))); //
38
+ vec2 position = mix(source_world, target_world, a_Position.x);
39
+ vec2 position64Low = mix(a_Instance64Low.rg, a_Instance64Low.ba, a_Position.x);
40
+
41
+ float lengthCommon = length(
42
+ project_position(vec4(target_world, 0, 1)) - project_position(vec4(source_world, 0, 1))
43
+ );
60
44
  vec2 offsetDistances = a_Size.x * project_pixel_offset(vec2(a_Position.y, a_Position.z)); // Mapbox || 高德
61
- vec2 limitedOffsetDistances = clamp(
62
- offsetDistances,
63
- project_pixel(-lengthCommon*.2), project_pixel(lengthCommon*.2)
45
+ vec2 limitedOffsetDistances = clamp(
46
+ offsetDistances,
47
+ project_pixel(-lengthCommon * 0.2),
48
+ project_pixel(lengthCommon * 0.2)
64
49
  );
65
50
 
66
-
67
51
  float startOffsetCommon = project_pixel(offsets[0]);
68
52
  float endOffsetCommon = project_pixel(offsets[1]);
69
53
  float endpointOffset = mix(
70
- clamp(startOffsetCommon, 0.0, lengthCommon*.2),
71
- -clamp(endOffsetCommon, 0.0, lengthCommon*.2),
54
+ clamp(startOffsetCommon, 0.0, lengthCommon * 0.2),
55
+ -clamp(endOffsetCommon, 0.0, lengthCommon * 0.2),
72
56
  a_Position.x
73
57
  );
74
58
 
75
- vec2 normalsCommon = u_stroke_width * project_pixel_offset(vec2(a_Normal.x, a_Normal.y)); // mapbox || 高德
59
+ vec2 normalsCommon = u_stroke_width * project_pixel_offset(vec2(a_Normal.x, a_Normal.y));
76
60
 
77
- float gapCommon = flag_gap() * project_pixel(u_gap_width);
61
+ float gapCommon = -1. * project_pixel(u_gap_width);
78
62
  vec3 offsetCommon = vec3(
79
63
  flowlineDir * (limitedOffsetDistances[1] + normalsCommon.y + endpointOffset * 1.05) -
80
- perpendicularDir * (limitedOffsetDistances[0] + gapCommon + normalsCommon.x),
64
+ perpendicularDir * (limitedOffsetDistances[0] + gapCommon + normalsCommon.x),
81
65
  0.0
82
66
  );
83
67
 
84
- vec4 project_pos = project_position(vec4(position.xy, 0, 1.0));
68
+ vec4 project_pos = project_position(vec4(position.xy, 0, 1.0), position64Low);
85
69
 
86
70
  vec4 fillColor = vec4(a_Color.rgb, a_Color.a * opacity);
87
71
  v_color = mix(fillColor, vec4(u_stroke.xyz, u_stroke.w * fillColor.w * u_stroke_opacity), a_Normal.z);
88
72
 
89
- gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy + offsetCommon.xy, 0., 1.0));
90
-
91
-
73
+ gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offsetCommon.xy, 0., 1.0));
92
74
 
93
75
  setPickingColor(a_PickingColor);
94
76
  }
@@ -1,13 +1,14 @@
1
- #define LineTypeSolid 0.0
2
- #define LineTypeDash 1.0
3
- #define Animate 0.0
4
- #define LineTexture 1.0
5
-
6
- layout(location = 0) in vec3 a_Position;
7
- layout(location = 1) in vec4 a_Color;
8
- layout(location = 9) in float a_Size;
9
- layout(location = 12) in vec4 a_Instance;
10
- layout(location = 14) in vec2 a_iconMapUV;
1
+ #define LineTypeSolid (0.0)
2
+ #define LineTypeDash (1.0)
3
+ #define Animate (0.0)
4
+ #define LineTexture (1.0)
5
+
6
+ layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
7
+ layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
8
+ layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;
9
+ layout(location = ATTRIBUTE_LOCATION_INSTANCE) in vec4 a_Instance;
10
+ layout(location = ATTRIBUTE_LOCATION_INSTANCE_64LOW) in vec4 a_Instance64Low;
11
+ layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_iconMapUV;
11
12
 
12
13
  layout(std140) uniform commonUniorm {
13
14
  vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
@@ -34,12 +35,12 @@ out float v_distance_ratio;
34
35
  #pragma include "project"
35
36
  #pragma include "picking"
36
37
 
37
- float maps (float value, float start1, float stop1, float start2, float stop2) {
38
+ float maps(float value, float start1, float stop1, float start2, float stop2) {
38
39
  return start2 + (stop2 - start2) * ((value - start1) / (stop1 - start1));
39
40
  }
40
41
 
41
42
  float getSegmentRatio(float index) {
42
- return index / (segmentNumber - 1.);
43
+ return index / (segmentNumber - 1.0);
43
44
  }
44
45
 
45
46
  float paraboloid(vec2 source, vec2 target, float ratio) {
@@ -53,33 +54,29 @@ float paraboloid(vec2 source, vec2 target, float ratio) {
53
54
  vec3 getPos(vec2 source, vec2 target, float segmentRatio) {
54
55
  float vertex_height = paraboloid(source, target, segmentRatio);
55
56
 
56
- return vec3(
57
- mix(source, target, segmentRatio),
58
- sqrt(max(0.0, vertex_height))
59
- );
57
+ return vec3(mix(source, target, segmentRatio), sqrt(max(0.0, vertex_height)));
60
58
  }
61
59
  vec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) {
62
60
  // normalized direction of the line
63
61
  vec2 dir_screenspace = normalize(line_clipspace);
64
62
  // rotate by 90 degrees
65
- dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);
66
- vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size)/ 2.0;
63
+ dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);
64
+ vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size) / 2.0;
67
65
  return offset;
68
66
  }
69
67
  vec2 getNormal(vec2 line_clipspace, float offset_direction) {
70
68
  // normalized direction of the line
71
69
  vec2 dir_screenspace = normalize(line_clipspace);
72
70
  // rotate by 90 degrees
73
- dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);
74
- return reverse_offset_normal(vec3(dir_screenspace,1.0)).xy * sign(offset_direction);
71
+ dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);
72
+ return dir_screenspace.xy * sign(offset_direction);
75
73
  }
76
- float getAngularDist (vec2 source, vec2 target) {
74
+ float getAngularDist(vec2 source, vec2 target) {
77
75
  vec2 delta = source - target;
78
76
  vec2 sin_half_delta = sin(delta / 2.0);
79
77
  float a =
80
78
  sin_half_delta.y * sin_half_delta.y +
81
- cos(source.y) * cos(target.y) *
82
- sin_half_delta.x * sin_half_delta.x;
79
+ cos(source.y) * cos(target.y) * sin_half_delta.x * sin_half_delta.x;
83
80
  return 2.0 * atan(sqrt(a), sqrt(1.0 - a));
84
81
  }
85
82
 
@@ -90,37 +87,29 @@ vec2 midPoint(vec2 source, vec2 target) {
90
87
  float thetaOffset = 0.314;
91
88
  float r2 = r / 2.0 / cos(thetaOffset);
92
89
  float theta2 = theta + thetaOffset;
93
- vec2 mid = vec2(r2*cos(theta2) + source.x, r2*sin(theta2) + source.y);
90
+ vec2 mid = vec2(r2 * cos(theta2) + source.x, r2 * sin(theta2) + source.y);
94
91
  return mid;
95
92
  }
96
93
  float bezier3(vec3 arr, float t) {
97
- float ut = 1. - t;
94
+ float ut = 1.0 - t;
98
95
  return (arr.x * ut + arr.y * t) * ut + (arr.y * ut + arr.z * t) * t;
99
96
  }
100
97
 
101
- vec2 interpolate (vec2 source, vec2 target, float angularDist, float t) {
102
- // if the angularDist is PI, linear interpolation is applied. otherwise, use spherical interpolation
103
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
104
- vec2 mid = midPoint(source, target);
105
- vec3 x = vec3(source.x, mid.x, target.x);
106
- vec3 y = vec3(source.y, mid.y, target.y);
107
- return vec2(bezier3(x ,t), bezier3(y,t));
108
- }
109
- else {
110
- if(abs(angularDist - PI) < 0.001) {
111
- return (1.0 - t) * source + t * target;
112
- }
113
- float a = sin((1.0 - t) * angularDist) / sin(angularDist);
114
- float b = sin(t * angularDist) / sin(angularDist);
115
- vec2 sin_source = sin(source);
116
- vec2 cos_source = cos(source);
117
- vec2 sin_target = sin(target);
118
- vec2 cos_target = cos(target);
119
- float x = a * cos_source.y * cos_source.x + b * cos_target.y * cos_target.x;
120
- float y = a * cos_source.y * sin_source.x + b * cos_target.y * sin_target.x;
121
- float z = a * sin_source.y + b * sin_target.y;
122
- return vec2(atan(y, x), atan(z, sqrt(x * x + y * y)));
98
+ vec2 interpolate(vec2 source, vec2 target, float angularDist, float t) {
99
+ if (abs(angularDist - PI) < 0.001) {
100
+ return (1.0 - t) * source + t * target;
123
101
  }
102
+ float a = sin((1.0 - t) * angularDist) / sin(angularDist);
103
+ float b = sin(t * angularDist) / sin(angularDist);
104
+ vec2 sin_source = sin(source);
105
+ vec2 cos_source = cos(source);
106
+ vec2 sin_target = sin(target);
107
+ vec2 cos_target = cos(target);
108
+ float x = a * cos_source.y * cos_source.x + b * cos_target.y * cos_target.x;
109
+ float y = a * cos_source.y * sin_source.x + b * cos_target.y * sin_target.x;
110
+ float z = a * sin_source.y + b * sin_target.y;
111
+ return vec2(atan(y, x), atan(z, sqrt(x * x + y * y)));
112
+
124
113
  }
125
114
 
126
115
  void main() {
@@ -133,54 +122,44 @@ void main() {
133
122
  float segmentRatio = getSegmentRatio(segmentIndex);
134
123
  float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));
135
124
 
136
- if(u_line_type == LineTypeDash) {
125
+ if (u_line_type == LineTypeDash) {
137
126
  v_distance_ratio = segmentIndex / segmentNumber;
138
- vec2 s = source;
139
- vec2 t = target;
140
-
141
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
142
- s = unProjCustomCoord(source);
143
- t = unProjCustomCoord(target);
144
- }
145
- float total_Distance = pixelDistance(s, t) / 2.0 * PI;
146
- total_Distance = total_Distance*16.0; // total_Distance*16.0 调整默认的效果
127
+ float total_Distance = pixelDistance(source, target) / 2.0 * PI;
128
+ total_Distance = total_Distance * 16.0; // total_Distance*16.0 调整默认的效果
147
129
  v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / total_Distance;
148
130
  }
149
131
 
150
- if(u_animate.x == Animate) {
151
- v_distance_ratio = segmentIndex / segmentNumber;
132
+ if (u_animate.x == Animate) {
133
+ v_distance_ratio = segmentIndex / segmentNumber;
152
134
  }
153
135
 
154
136
  float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);
155
137
  v_distance_ratio = segmentIndex / segmentNumber;
156
- vec4 curr = project_position(vec4(degrees(interpolate(source, target, angularDist, segmentRatio)), 0.0, 1.0));
157
- vec4 next = project_position(vec4(degrees(interpolate(source, target, angularDist, nextSegmentRatio)), 0.0, 1.0));
138
+
139
+ vec4 curr = project_position(vec4(degrees(interpolate(source, target, angularDist, segmentRatio)), 0.0, 1.0), a_Instance64Low.xy);
140
+ vec4 next = project_position(vec4(degrees(interpolate(source, target, angularDist, nextSegmentRatio)), 0.0, 1.0), a_Instance64Low.zw);
141
+
158
142
  // v_normal = getNormal((next.xy - curr.xy) * indexDir, a_Position.y);
159
143
  vec2 offset = project_pixel(getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y));
160
144
  // vec4 project_pos = project_position(vec4(curr.xy, 0, 1.0));
161
145
  // gl_Position = project_common_position_to_clipspace(vec4(curr.xy + offset, curr.z, 1.0));
162
146
 
163
147
  v_line_data.g = a_Position.x; // 该顶点在弧线上的分段排序
164
- if(LineTexture == u_line_texture) { // 开启贴图模式
165
- // float mapZoomScale = u_CoordinateSystem !== COORDINATE_SYSTEM_P20_2?10000000.0:1.0;
148
+ if (LineTexture == u_line_texture) {
166
149
  float d_arcDistrance = length(source - target);
167
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20) { // amap
168
- d_arcDistrance = d_arcDistrance * 1000000.0;
169
- }
170
- if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) { // mapbox
171
- d_arcDistrance = project_pixel_allmap(d_arcDistrance);
172
- }
173
- float d_pixelLen = project_pixel(u_icon_step)/8.0;
174
- v_line_data.b = floor(d_arcDistrance/d_pixelLen); // 贴图在弧线上重复的数量
150
+ d_arcDistrance = project_pixel(d_arcDistrance);
151
+
152
+ float d_pixelLen = project_pixel(u_icon_step) / 8.0;
153
+ v_line_data.b = floor(d_arcDistrance / d_pixelLen); // 贴图在弧线上重复的数量
175
154
 
176
155
  float lineOffsetWidth = length(offset + offset * sign(a_Position.y)); // 线横向偏移的距离
177
- float linePixelSize = project_pixel(a_Size); // 定点位置偏移,按地图等级缩放后的距离
178
- v_line_data.a = lineOffsetWidth/linePixelSize; // 线图层贴图部分的 v 坐标值
156
+ float linePixelSize = project_pixel(a_Size); // 定点位置偏移,按地图等级缩放后的距离
157
+ v_line_data.a = lineOffsetWidth / linePixelSize; // 线图层贴图部分的 v 坐标值
179
158
 
180
159
  v_iconMapUV = a_iconMapUV;
181
160
  }
182
161
 
183
- gl_Position = project_common_position_to_clipspace_v2(vec4(curr.xy + offset, 0, 1.0));
162
+ gl_Position = project_common_position_to_clipspace(vec4(curr.xy + offset, 0, 1.0));
184
163
  setPickingColor(a_PickingColor);
185
164
  }
186
165
 
@@ -1,12 +1,12 @@
1
+ #define Animate (0.0)
1
2
 
2
- #define Animate 0.0
3
-
4
- layout(location = 0) in vec3 a_Position;
5
- layout(location = 1) in vec4 a_Color;
6
- layout(location = 9) in vec2 a_Size;
7
- layout(location = 10) in vec3 a_DistanceAndIndexAndMiter;
8
- layout(location = 13) in vec4 a_Normal_Total_Distance;
9
- layout(location = 14) in vec2 a_iconMapUV;
3
+ layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
4
+ layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;
5
+ layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
6
+ layout(location = ATTRIBUTE_LOCATION_SIZE) in vec2 a_Size;
7
+ layout(location = ATTRIBUTE_LOCATION_DISTANCE_INDEX) in vec3 a_DistanceAndIndexAndMiter;
8
+ layout(location = ATTRIBUTE_LOCATION_NORMAL) in vec4 a_Normal_Total_Distance;
9
+ layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_iconMapUV;
10
10
 
11
11
  layout(std140) uniform commonUniorm {
12
12
  vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
@@ -27,7 +27,6 @@ layout(std140) uniform commonUniorm {
27
27
  float u_time;
28
28
  };
29
29
 
30
-
31
30
  out vec4 v_color;
32
31
  out vec4 v_stroke;
33
32
  //dash
@@ -50,69 +49,53 @@ void main() {
50
49
  v_d_distance_ratio = a_DistanceAndIndex.x / a_Total_Distance;
51
50
 
52
51
  // cal style mapping - 数据纹理映射部分的计算
53
- float d_texPixelLen; // 贴图的像素长度,根据地图层级缩放
52
+ float d_texPixelLen; // 贴图的像素长度,根据地图层级缩放
54
53
  v_iconMapUV = a_iconMapUV;
55
54
  d_texPixelLen = project_float_pixel(u_icon_step);
56
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {
57
- d_texPixelLen *= 10.0;
58
- }
59
55
 
60
56
  v_color = a_Color;
61
57
  v_color.a *= opacity;
62
58
  v_stroke = stroke;
63
59
 
64
- vec3 size = a_Miter * setPickingSize(a_Size.x) * reverse_offset_normal(a_Normal);
65
-
60
+ vec3 size = a_Miter * setPickingSize(a_Size.x) * a_Normal;
61
+
66
62
  vec2 offset = project_pixel(size.xy);
67
63
 
68
64
  float lineDistance = a_DistanceAndIndex.x;
69
65
  float currentLinePointRatio = lineDistance / a_Total_Distance;
70
-
71
66
 
72
67
  float lineOffsetWidth = length(offset + offset * sign(a_Miter)); // 线横向偏移的距离(向两侧偏移的和)
73
- float linePixelSize = project_pixel(a_Size.x) * 2.0; // 定点位置偏移,按地图等级缩放后的距离 单侧 * 2
74
- float texV = lineOffsetWidth/linePixelSize; // 线图层贴图部分的 v 坐标值
75
-
68
+ float linePixelSize = project_pixel(a_Size.x) * 2.0; // 定点位置偏移,按地图等级缩放后的距离 单侧 * 2
69
+ float texV = lineOffsetWidth / linePixelSize; // 线图层贴图部分的 v 坐标值
70
+
76
71
  v_texture_data = vec4(currentLinePointRatio, lineDistance, d_texPixelLen, texV);
77
72
  // 设置数据集的参数
78
73
 
79
- vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));
74
+ vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0), a_Position64Low);
80
75
 
81
76
  // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, a_Size.y, 1.0));
82
77
 
83
78
  float h = float(a_Position.z) * u_vertexScale; // 线顶点的高度 - 兼容不存在第三个数值的情况 vertex height
84
79
  float lineHeight = a_Size.y; // size 第二个参数代表的高度 [linewidth, lineheight]
85
80
 
86
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
87
- lineHeight *= 0.2; // 保持和 amap/mapbox 一致的效果
88
- h *= 0.2;
89
- if(u_heightfixed < 1.0) {
90
- lineHeight = project_pixel(a_Size.y);
91
- }
92
- gl_Position = u_Mvp * (vec4(project_pos.xy + offset, lineHeight + h + u_raisingHeight, 1.0));
93
- } else {
94
- // 兼容 mapbox 在线高度上的效果表现基本一致
95
- if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
96
- // mapbox
97
- // 保持高度相对不变
98
- float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);
99
- h *= mapboxZoomScale;
100
- h += u_raisingHeight * mapboxZoomScale;
101
- if(u_heightfixed > 0.0) {
102
- lineHeight *= mapboxZoomScale;
103
- }
104
-
105
- } else {
106
- // amap
107
- h += u_raisingHeight;
108
- // lineHeight 顶点偏移高度
109
- if(u_heightfixed < 1.0) {
110
- lineHeight *= pow(2.0, 20.0 - u_Zoom);
111
- }
81
+ // 兼容 mapbox 在线高度上的效果表现基本一致
82
+ if (
83
+ u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
84
+ u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET
85
+ ) {
86
+ // mapbox
87
+ // 保持高度相对不变
88
+ float mapboxZoomScale = 4.0 / pow(2.0, 21.0 - u_Zoom);
89
+ h *= mapboxZoomScale;
90
+ h += u_raisingHeight * mapboxZoomScale;
91
+ if (u_heightfixed > 0.0) {
92
+ lineHeight *= mapboxZoomScale;
112
93
  }
113
-
114
- gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, lineHeight + h, 1.0));
115
94
  }
116
95
 
96
+ gl_Position = project_common_position_to_clipspace(
97
+ vec4(project_pos.xy + offset, lineHeight + h, 1.0)
98
+ );
99
+
117
100
  setPickingColor(a_PickingColor);
118
101
  }
@@ -1,6 +1,7 @@
1
- layout(location = 0) in vec3 a_Position;
2
- layout(location = 1) in vec4 a_Color;
3
- layout(location = 9) in vec4 a_SizeDistanceAndTotalDistance;
1
+ layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
2
+ layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;
3
+ layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
4
+ layout(location = ATTRIBUTE_LOCATION_SIZE) in vec4 a_SizeDistanceAndTotalDistance;
4
5
 
5
6
  layout(std140) uniform commonUniorm {
6
7
  vec4 u_sourceColor;
@@ -21,30 +22,24 @@ void main() {
21
22
  //dash输出
22
23
  v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / a_SizeDistanceAndTotalDistance.a;
23
24
 
24
- v_color = a_Color;
25
+ v_color = a_Color;
25
26
  v_distanceScale = a_SizeDistanceAndTotalDistance.b / a_SizeDistanceAndTotalDistance.a;
26
27
  v_color.a = v_color.a * opacity;
27
- vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));
28
+ vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0), a_Position64Low);
28
29
 
29
30
  float h = float(a_Position.z) * u_vertexScale; // 线顶点的高度 - 兼容不存在第三个数值的情况
30
31
 
31
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
32
- gl_Position = u_Mvp * (vec4(project_pos.xy, project_pixel(a_SizeDistanceAndTotalDistance.y) + h * 0.2, 1.0));
33
- } else {
34
- float lineHeight = a_SizeDistanceAndTotalDistance.y;
35
- // 兼容 mapbox 在线高度上的效果表现基本一致
36
- if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
37
- // 保持高度相对不变
38
- h *= 2.0/pow(2.0, 20.0 - u_Zoom);
39
- }
40
-
41
- // amap1.x
42
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20 || u_CoordinateSystem == COORDINATE_SYSTEM_P20_OFFSET) {
43
- // 保持高度相对不变
44
- lineHeight *= pow(2.0, 20.0 - u_Zoom);
45
- }
46
-
47
- gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, lineHeight + h, 1.0));
48
- gl_PointSize = 10.0;
32
+ float lineHeight = a_SizeDistanceAndTotalDistance.y;
33
+ // 兼容 mapbox 在线高度上的效果表现基本一致
34
+ if (
35
+ u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
36
+ u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET
37
+ ) {
38
+ // 保持高度相对不变
39
+ h *= 2.0 / pow(2.0, 20.0 - u_Zoom);
49
40
  }
41
+
42
+ gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, lineHeight + h, 1.0));
43
+ gl_PointSize = 10.0;
44
+
50
45
  }
@@ -1,14 +1,11 @@
1
1
  #define Animate 0.0
2
- layout(location = 0) in vec3 a_Position;
3
- layout(location = 1) in vec4 a_Color;
4
- layout(location = 9) in vec2 a_Size;
5
- layout(location = 10) in float a_Miter;
6
- layout(location = 11) in float a_Total_Distance;
7
- layout(location = 12) in vec4 a_Instance;
8
- layout(location = 13) in vec3 a_Normal;
9
- layout(location = 14) in vec2 a_iconMapUV;
10
- layout(location = 15) in float a_Distance;
11
-
2
+ layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
3
+ layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;
4
+ layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
5
+ layout(location = ATTRIBUTE_LOCATION_SIZE) in vec2 a_Size;
6
+ layout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal;
7
+ layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_iconMapUV;
8
+ layout(location = ATTRIBUTE_LOCATION_DISTANCE_MITER_TOTAL) in vec3 a_Distance_Total_Miter;
12
9
 
13
10
  layout(std140) uniform commonUniorm {
14
11
  vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
@@ -23,6 +20,7 @@ layout(std140) uniform commonUniorm {
23
20
  float u_iconStepCount;
24
21
  float u_time;
25
22
  };
23
+
26
24
  #pragma include "projection"
27
25
  #pragma include "light"
28
26
  #pragma include "picking"
@@ -35,66 +33,59 @@ out float v_radio;
35
33
  out vec4 v_dataset;
36
34
 
37
35
  void main() {
38
-
36
+ float a_Distance = a_Distance_Total_Miter.x;
37
+ float a_Miter = a_Distance_Total_Miter.y;
38
+ float a_Total_Distance = a_Distance_Total_Miter.z;
39
39
 
40
40
  float d_distance_ratio; // 当前点位距离占线总长的比例
41
- float d_texPixelLen; // 贴图的像素长度,根据地图层级缩放
41
+ float d_texPixelLen; // 贴图的像素长度,根据地图层级缩放
42
42
 
43
43
  v_iconMapUV = a_iconMapUV;
44
- if(u_heightfixed < 1.0) { // 高度随 zoom 调整
44
+ if (u_heightfixed < 1.0) {
45
+ // 高度随 zoom 调整
45
46
  d_texPixelLen = project_pixel(u_icon_step);
46
47
  } else {
47
48
  d_texPixelLen = u_icon_step;
48
49
  }
49
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {
50
- d_texPixelLen *= 10.0;
51
- }
52
50
 
53
- if(u_animate.x == Animate || u_linearColor == 1.0) {
54
- d_distance_ratio = a_Distance / a_Total_Distance;
51
+ if (u_animate.x == Animate || u_linearColor == 1.0) {
52
+ d_distance_ratio = a_Distance / a_Total_Distance;
55
53
  }
56
54
 
57
- float miter = (a_Miter + 1.0)/2.0;
55
+ float miter = (a_Miter + 1.0) / 2.0;
58
56
  // 设置数据集的参数
59
57
  v_dataset[0] = d_distance_ratio; // 当前点位距离占线总长的比例
60
- v_dataset[1] = a_Distance; // 当前顶点的距离
61
- v_dataset[2] = d_texPixelLen; // 贴图的像素长度,根据地图层级缩放
62
- v_dataset[3] = miter; // 线图层贴图部分的 v 坐标值 0 - 1
58
+ v_dataset[1] = a_Distance; // 当前顶点的距离
59
+ v_dataset[2] = d_texPixelLen; // 贴图的像素长度,根据地图层级缩放
60
+ v_dataset[3] = miter; // 线图层贴图部分的 v 坐标值 0 - 1
63
61
 
64
- vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));
62
+ vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0), a_Position64Low);
65
63
 
66
- float originSize = a_Size.x; // 固定高度
67
- if(u_heightfixed < 1.0) {
68
- originSize = project_float_meter(a_Size.x); // 高度随 zoom 调整
64
+ float originSize = a_Size.x; // 固定高度
65
+ if (u_heightfixed < 1.0) {
66
+ originSize = project_float_meter(a_Size.x); // 高度随 zoom 调整
69
67
  }
70
68
 
71
-
72
69
  float wallHeight = originSize * miter;
73
70
  float lightWeight = calc_lighting(vec4(project_pos.xy, wallHeight, 1.0));
74
71
 
75
72
  v_blur = min(project_float_pixel(2.0) / originSize, 0.05);
76
73
  v_color = vec4(a_Color.rgb * lightWeight, a_Color.w * opacity);
77
74
 
78
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
79
- gl_Position = u_Mvp * (vec4(project_pos.xy, wallHeight, 1.0));
80
- } else {
81
- // 兼容 mapbox 在线高度上的效果表现基本一致
82
- if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
83
- // mapbox
84
- // 保持高度相对不变
85
- float mapboxZoomScale = 4.0 / pow(2.0, 21.0 - u_Zoom);
86
- if(u_heightfixed > 0.0) {
87
- wallHeight *= mapboxZoomScale;
88
- }
89
-
90
- } else {
91
- // lineHeight 顶点偏移高度
92
- if(u_heightfixed < 1.0) {
93
- wallHeight *= pow(2.0, 20.0 - u_Zoom);
94
- }
75
+ // 兼容 mapbox 在线高度上的效果表现基本一致
76
+ if (
77
+ u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
78
+ u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET
79
+ ) {
80
+ // mapbox
81
+ // 保持高度相对不变
82
+ float mapboxZoomScale = 4.0 / pow(2.0, 21.0 - u_Zoom);
83
+ if (u_heightfixed > 0.0) {
84
+ wallHeight *= mapboxZoomScale;
95
85
  }
96
- gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, wallHeight, 1.0));
97
86
  }
98
87
 
88
+ gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, wallHeight, 1.0));
89
+
99
90
  setPickingColor(a_PickingColor);
100
91
  }
@@ -13,7 +13,7 @@ var _triangulation = require("../../core/triangulation");
13
13
  /* babel-plugin-inline-import '../../shader/minify_frag.glsl' */
14
14
  const mask_frag = "layout(std140) uniform commonUniorm {\n vec4 u_color;\n float u_opacity;\n};\n\nout vec4 outputColor;\n\nvoid main() {\n outputColor = u_color;\n outputColor.a *= u_opacity;\n}\n";
15
15
  /* babel-plugin-inline-import '../shaders/mask_vert.glsl' */
16
- const mask_vert = "layout(location = 0) in vec3 a_Position;\n\nlayout(std140) uniform commonUniorm {\n vec4 u_color;\n float u_opacity;\n};\n\n#pragma include \"projection\"\n\nvoid main() {\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";
16
+ const mask_vert = "layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\n\nlayout(std140) uniform commonUniorm {\n vec4 u_color;\n float u_opacity;\n};\n\n#pragma include \"projection\"\n\nvoid main() {\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n}\n\n";
17
17
  class MaskModel extends _BaseModel.default {
18
18
  getUninforms() {
19
19
  const commoninfo = this.getCommonUniformsInfo();
@@ -47,6 +47,7 @@ class MaskModel extends _BaseModel.default {
47
47
  moduleName: 'mask',
48
48
  vertexShader: mask_vert,
49
49
  fragmentShader: mask_frag,
50
+ defines: _this2.getDefines(),
50
51
  triangulation: _triangulation.polygonTriangulation,
51
52
  depth: {
52
53
  enable: false