@antv/l7-layers 2.21.9 → 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 +9 -9
@@ -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
  }
@@ -6,7 +6,7 @@ import { polygonTriangulation } from "../../core/triangulation";
6
6
  /* babel-plugin-inline-import '../../shader/minify_frag.glsl' */
7
7
  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";
8
8
  /* babel-plugin-inline-import '../shaders/mask_vert.glsl' */
9
- 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";
9
+ 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";
10
10
  export default class MaskModel extends BaseModel {
11
11
  getUninforms() {
12
12
  const commoninfo = this.getCommonUniformsInfo();
@@ -40,6 +40,7 @@ export default class MaskModel extends BaseModel {
40
40
  moduleName: 'mask',
41
41
  vertexShader: mask_vert,
42
42
  fragmentShader: mask_frag,
43
+ defines: _this2.getDefines(),
43
44
  triangulation: polygonTriangulation,
44
45
  depth: {
45
46
  enable: false
@@ -1,4 +1,4 @@
1
- layout(location = 0) in vec3 a_Position;
1
+ layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
2
2
 
3
3
  layout(std140) uniform commonUniorm {
4
4
  vec4 u_color;
@@ -9,11 +9,6 @@ layout(std140) uniform commonUniorm {
9
9
 
10
10
  void main() {
11
11
  vec4 project_pos = project_position(vec4(a_Position, 1.0));
12
-
13
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
14
- gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));
15
- } else {
16
- gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
17
- }
12
+ gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
18
13
  }
19
14
 
@@ -5,7 +5,6 @@ export default class DataMappingPlugin implements ILayerPlugin {
5
5
  apply(layer: ILayer, { styleAttributeService, mapService, fontService }: L7Container): void;
6
6
  private generateMaping;
7
7
  private mapping;
8
- private adjustData2Amap2Coordinates;
9
8
  private adjustData2SimpleCoordinates;
10
9
  private unProjectCoordinates;
11
10
  private applyAttributeMapping;
@@ -2,10 +2,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
3
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
4
4
  import { IDebugLog, ILayerStage } from '@antv/l7-core';
5
- import { lodashUtil, normalize, rgb2arr } from '@antv/l7-utils';
6
- const {
7
- cloneDeep
8
- } = lodashUtil;
5
+ import { normalize, rgb2arr } from '@antv/l7-utils';
9
6
  export default class DataMappingPlugin {
10
7
  constructor() {
11
8
  _defineProperty(this, "mapService", void 0);
@@ -136,31 +133,11 @@ export default class DataMappingPlugin {
136
133
  attributes.forEach(attribute => {
137
134
  attribute.needRemapping = false;
138
135
  });
139
- // 调整数据兼容 Amap2.0
140
- this.adjustData2Amap2Coordinates(mappedData, layer);
141
136
 
142
137
  // 调整数据兼容 SimpleCoordinates
143
138
  this.adjustData2SimpleCoordinates(mappedData);
144
139
  return mappedData;
145
140
  }
146
- adjustData2Amap2Coordinates(mappedData, layer) {
147
- // 根据地图的类型判断是否需要对点位数据进行处理, 若是高德2.0则需要对坐标进行相对偏移
148
- if (mappedData.length > 0 && this.mapService.version === 'GAODE2.x') {
149
- const layerCenter = layer.coordCenter || layer.getSource().center;
150
- // 单个的点数据
151
- // @ts-ignore
152
- mappedData
153
- // TODO: 避免经纬度被重复计算导致坐标位置偏移
154
- .filter(d => !d.originCoordinates).map(d => {
155
- d.version = 'GAODE2.x';
156
- // @ts-ignore
157
- d.originCoordinates = cloneDeep(d.coordinates); // 为了兼容高德1.x 需要保存一份原始的经纬度坐标数据(许多上层逻辑依赖经纬度数据)
158
- // @ts-ignore
159
- // d.coordinates = this.mapService.lngLatToCoord(d.coordinates);
160
- d.coordinates = this.mapService.coordToAMap2RelativeCoordinates(d.coordinates, layerCenter);
161
- });
162
- }
163
- }
164
141
  adjustData2SimpleCoordinates(mappedData) {
165
142
  if (mappedData.length > 0 && this.mapService.version === 'SIMPLE') {
166
143
  mappedData.map(d => {
@@ -1,7 +1,7 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
2
  import { AttributeType, gl } from '@antv/l7-core';
3
3
  import { decodePickingColor, encodePickingColor, lodashUtil, rgb2arr } from '@antv/l7-utils';
4
- import { ShaderLocation } from "../core/CommonStyleAttribute";
4
+ import { COMMON_ATTRIBUTE_LOCATION } from "../core/CommonStyleAttribute";
5
5
  const {
6
6
  isNumber
7
7
  } = lodashUtil;
@@ -59,7 +59,7 @@ export default class PixelPickingPlugin {
59
59
  type: AttributeType.Attribute,
60
60
  descriptor: {
61
61
  name: 'a_PickingColor',
62
- shaderLocation: ShaderLocation.PICKING_COLOR,
62
+ shaderLocation: COMMON_ATTRIBUTE_LOCATION.PICKING_COLOR,
63
63
  buffer: {
64
64
  data: [],
65
65
  type: gl.FLOAT
@@ -7,5 +7,4 @@ export default class RegisterStyleAttributePlugin implements ILayerPlugin {
7
7
  private registerBuiltinAttributes;
8
8
  private registerPositionAttribute;
9
9
  private registerColorAttribute;
10
- private registerVertexIdAttribute;
11
10
  }