@antv/l7-layers 2.21.8 → 2.21.9-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 (279) 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.js +9 -8
  6. package/es/core/BaseModel.d.ts +15 -2
  7. package/es/core/BaseModel.js +94 -62
  8. package/es/core/CommonStyleAttribute.d.ts +14 -18
  9. package/es/core/CommonStyleAttribute.js +23 -67
  10. package/es/core/triangulation.js +13 -39
  11. package/es/earth/models/atmosphere.d.ts +15 -0
  12. package/es/earth/models/atmosphere.js +30 -24
  13. package/es/earth/models/base.d.ts +15 -0
  14. package/es/earth/models/base.js +30 -24
  15. package/es/earth/models/bloomsphere.d.ts +15 -0
  16. package/es/earth/models/bloomsphere.js +30 -24
  17. package/es/earth/shaders/atmosphere/atmosphere_vert.glsl +7 -5
  18. package/es/earth/shaders/base/base_vert.glsl +3 -3
  19. package/es/earth/shaders/bloomshpere/bloomsphere_vert.glsl +5 -4
  20. package/es/geometry/models/billboard.d.ts +15 -0
  21. package/es/geometry/models/billboard.js +14 -8
  22. package/es/geometry/models/plane.d.ts +14 -0
  23. package/es/geometry/models/plane.js +10 -10
  24. package/es/geometry/models/sprite.js +3 -9
  25. package/es/geometry/shaders/billboard_vert.glsl +28 -25
  26. package/es/geometry/shaders/plane_vert.glsl +6 -6
  27. package/es/geometry/shaders/sprite_vert.glsl +7 -9
  28. package/es/heatmap/models/grid.d.ts +14 -0
  29. package/es/heatmap/models/grid.js +10 -3
  30. package/es/heatmap/models/grid3d.d.ts +16 -0
  31. package/es/heatmap/models/grid3d.js +14 -6
  32. package/es/heatmap/models/heatmap.d.ts +20 -1
  33. package/es/heatmap/models/heatmap.js +96 -83
  34. package/es/heatmap/models/hexagon.d.ts +14 -0
  35. package/es/heatmap/models/hexagon.js +9 -3
  36. package/es/heatmap/shaders/grid/grid_vert.glsl +30 -42
  37. package/es/heatmap/shaders/grid3d/grid_3d_vert.glsl +14 -26
  38. package/es/heatmap/shaders/heatmap/heatmap_3d_vert.glsl +19 -16
  39. package/es/heatmap/shaders/heatmap/heatmap_framebuffer_vert.glsl +16 -22
  40. package/es/heatmap/shaders/heatmap/heatmap_vert.glsl +3 -4
  41. package/es/heatmap/shaders/hexagon/hexagon_vert.glsl +13 -23
  42. package/es/image/models/image.d.ts +14 -0
  43. package/es/image/models/image.js +11 -3
  44. package/es/image/shaders/image_vert.glsl +7 -6
  45. package/es/line/models/arc.d.ts +18 -0
  46. package/es/line/models/arc.js +57 -8
  47. package/es/line/models/arc_3d.d.ts +18 -0
  48. package/es/line/models/arc_3d.js +55 -7
  49. package/es/line/models/flow.d.ts +17 -0
  50. package/es/line/models/flow.js +35 -7
  51. package/es/line/models/great_circle.d.ts +17 -0
  52. package/es/line/models/great_circle.js +34 -6
  53. package/es/line/models/line.d.ts +17 -0
  54. package/es/line/models/line.js +17 -8
  55. package/es/line/models/simple_line.d.ts +14 -0
  56. package/es/line/models/simple_line.js +12 -47
  57. package/es/line/models/wall.d.ts +17 -0
  58. package/es/line/models/wall.js +22 -48
  59. package/es/line/shaders/arc/line_arc_vert.glsl +42 -48
  60. package/es/line/shaders/arc3d/line_arc_3d_vert.glsl +15 -20
  61. package/es/line/shaders/flow/flow_line_vert.glsl +30 -48
  62. package/es/line/shaders/greatCircle/line_arc_great_circle_vert.glsl +56 -72
  63. package/es/line/shaders/line/line_vert.glsl +31 -48
  64. package/es/line/shaders/simple/simpleline_vert.glsl +18 -23
  65. package/es/line/shaders/wall/wall_vert.glsl +36 -45
  66. package/es/mask/models/fill.js +2 -1
  67. package/es/mask/shaders/mask_vert.glsl +2 -7
  68. package/es/plugins/DataMappingPlugin.d.ts +0 -1
  69. package/es/plugins/DataMappingPlugin.js +1 -24
  70. package/es/plugins/PixelPickingPlugin.js +2 -2
  71. package/es/plugins/RegisterStyleAttributePlugin.d.ts +0 -1
  72. package/es/plugins/RegisterStyleAttributePlugin.js +3 -25
  73. package/es/plugins/ShaderUniformPlugin.d.ts +0 -5
  74. package/es/plugins/ShaderUniformPlugin.js +2 -34
  75. package/es/point/models/billboard_point.d.ts +14 -0
  76. package/es/point/models/billboard_point.js +11 -3
  77. package/es/point/models/earthExtrude.d.ts +16 -0
  78. package/es/point/models/earthExtrude.js +15 -8
  79. package/es/point/models/earthFill.d.ts +16 -0
  80. package/es/point/models/earthFill.js +13 -5
  81. package/es/point/models/extrude.d.ts +16 -0
  82. package/es/point/models/extrude.js +19 -12
  83. package/es/point/models/fill.d.ts +16 -0
  84. package/es/point/models/fill.js +16 -5
  85. package/es/point/models/fillImage.d.ts +16 -0
  86. package/es/point/models/fillImage.js +16 -16
  87. package/es/point/models/image.d.ts +15 -0
  88. package/es/point/models/image.js +14 -4
  89. package/es/point/models/normal.d.ts +14 -0
  90. package/es/point/models/normal.js +11 -3
  91. package/es/point/models/radar.d.ts +15 -0
  92. package/es/point/models/radar.js +13 -4
  93. package/es/point/models/text.d.ts +16 -0
  94. package/es/point/models/text.js +18 -11
  95. package/es/point/shaders/billboard/billboard_point_vert.glsl +10 -13
  96. package/es/point/shaders/earthExtrude/earthExtrude_vert.glsl +15 -25
  97. package/es/point/shaders/earthFill/earthFill_vert.glsl +6 -6
  98. package/es/point/shaders/extrude/extrude_vert.glsl +35 -39
  99. package/es/point/shaders/fill/fill_vert.glsl +12 -14
  100. package/es/point/shaders/fillImage/fillImage_vert.glsl +16 -28
  101. package/es/point/shaders/image/image_vert.glsl +15 -12
  102. package/es/point/shaders/normal/normal_vert.glsl +7 -10
  103. package/es/point/shaders/radar/radar_vert.glsl +11 -11
  104. package/es/point/shaders/text/text_vert.glsl +10 -9
  105. package/es/polygon/models/extrude.d.ts +16 -0
  106. package/es/polygon/models/extrude.js +26 -26
  107. package/es/polygon/models/extrusion.d.ts +16 -0
  108. package/es/polygon/models/extrusion.js +34 -4
  109. package/es/polygon/models/fill.d.ts +14 -0
  110. package/es/polygon/models/fill.js +12 -4
  111. package/es/polygon/models/ocean.d.ts +14 -0
  112. package/es/polygon/models/ocean.js +11 -6
  113. package/es/polygon/models/water.d.ts +14 -0
  114. package/es/polygon/models/water.js +11 -6
  115. package/es/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +17 -15
  116. package/es/polygon/shaders/extrude/polygon_extrude_vert.glsl +22 -20
  117. package/es/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +17 -17
  118. package/es/polygon/shaders/extrusion/polygon_extrusion_vert.glsl +8 -8
  119. package/es/polygon/shaders/fill/fill_linear_vert.glsl +7 -6
  120. package/es/polygon/shaders/fill/fill_vert.glsl +10 -12
  121. package/es/polygon/shaders/ocean/ocean_vert.glsl +3 -4
  122. package/es/polygon/shaders/water/polygon_water_vert.glsl +5 -5
  123. package/es/raster/index.d.ts +1 -1
  124. package/es/raster/index.js +1 -1
  125. package/es/raster/models/raster.d.ts +14 -0
  126. package/es/raster/models/raster.js +12 -3
  127. package/es/raster/models/rasterRgb.d.ts +14 -0
  128. package/es/raster/models/rasterRgb.js +12 -3
  129. package/es/raster/models/rasterTerrainRgb.d.ts +14 -0
  130. package/es/raster/models/rasterTerrainRgb.js +11 -3
  131. package/es/raster/shaders/raster/raster_2d_vert.glsl +6 -6
  132. package/es/raster/shaders/rgb/raster_rgb_vert.glsl +11 -11
  133. package/es/raster/shaders/terrain/terrain_rgb_vert.glsl +11 -11
  134. package/es/tile/core/BaseLayer.js +0 -16
  135. package/es/utils/extrude_polyline.d.ts +0 -15
  136. package/es/utils/extrude_polyline.js +0 -217
  137. package/es/wind/models/wind.d.ts +14 -0
  138. package/es/wind/models/wind.js +9 -1
  139. package/es/wind/shaders/wind_vert.glsl +6 -5
  140. package/lib/citybuliding/models/build.d.ts +16 -0
  141. package/lib/citybuliding/models/build.js +18 -20
  142. package/lib/citybuliding/shaders/build_frag.glsl +6 -6
  143. package/lib/citybuliding/shaders/build_vert.glsl +8 -14
  144. package/lib/core/BaseLayer.js +9 -8
  145. package/lib/core/BaseModel.d.ts +15 -2
  146. package/lib/core/BaseModel.js +92 -60
  147. package/lib/core/CommonStyleAttribute.d.ts +14 -18
  148. package/lib/core/CommonStyleAttribute.js +23 -68
  149. package/lib/core/triangulation.js +13 -39
  150. package/lib/earth/models/atmosphere.d.ts +15 -0
  151. package/lib/earth/models/atmosphere.js +30 -24
  152. package/lib/earth/models/base.d.ts +15 -0
  153. package/lib/earth/models/base.js +30 -24
  154. package/lib/earth/models/bloomsphere.d.ts +15 -0
  155. package/lib/earth/models/bloomsphere.js +30 -24
  156. package/lib/earth/shaders/atmosphere/atmosphere_vert.glsl +7 -5
  157. package/lib/earth/shaders/base/base_vert.glsl +3 -3
  158. package/lib/earth/shaders/bloomshpere/bloomsphere_vert.glsl +5 -4
  159. package/lib/geometry/models/billboard.d.ts +15 -0
  160. package/lib/geometry/models/billboard.js +14 -8
  161. package/lib/geometry/models/plane.d.ts +14 -0
  162. package/lib/geometry/models/plane.js +10 -10
  163. package/lib/geometry/models/sprite.js +3 -9
  164. package/lib/geometry/shaders/billboard_vert.glsl +28 -25
  165. package/lib/geometry/shaders/plane_vert.glsl +6 -6
  166. package/lib/geometry/shaders/sprite_vert.glsl +7 -9
  167. package/lib/heatmap/models/grid.d.ts +14 -0
  168. package/lib/heatmap/models/grid.js +10 -3
  169. package/lib/heatmap/models/grid3d.d.ts +16 -0
  170. package/lib/heatmap/models/grid3d.js +14 -6
  171. package/lib/heatmap/models/heatmap.d.ts +20 -1
  172. package/lib/heatmap/models/heatmap.js +95 -82
  173. package/lib/heatmap/models/hexagon.d.ts +14 -0
  174. package/lib/heatmap/models/hexagon.js +9 -3
  175. package/lib/heatmap/shaders/grid/grid_vert.glsl +30 -42
  176. package/lib/heatmap/shaders/grid3d/grid_3d_vert.glsl +14 -26
  177. package/lib/heatmap/shaders/heatmap/heatmap_3d_vert.glsl +19 -16
  178. package/lib/heatmap/shaders/heatmap/heatmap_framebuffer_vert.glsl +16 -22
  179. package/lib/heatmap/shaders/heatmap/heatmap_vert.glsl +3 -4
  180. package/lib/heatmap/shaders/hexagon/hexagon_vert.glsl +13 -23
  181. package/lib/image/models/image.d.ts +14 -0
  182. package/lib/image/models/image.js +11 -3
  183. package/lib/image/shaders/image_vert.glsl +7 -6
  184. package/lib/line/models/arc.d.ts +18 -0
  185. package/lib/line/models/arc.js +56 -7
  186. package/lib/line/models/arc_3d.d.ts +18 -0
  187. package/lib/line/models/arc_3d.js +55 -7
  188. package/lib/line/models/flow.d.ts +17 -0
  189. package/lib/line/models/flow.js +35 -7
  190. package/lib/line/models/great_circle.d.ts +17 -0
  191. package/lib/line/models/great_circle.js +33 -5
  192. package/lib/line/models/line.d.ts +17 -0
  193. package/lib/line/models/line.js +17 -8
  194. package/lib/line/models/simple_line.d.ts +14 -0
  195. package/lib/line/models/simple_line.js +12 -47
  196. package/lib/line/models/wall.d.ts +17 -0
  197. package/lib/line/models/wall.js +22 -48
  198. package/lib/line/shaders/arc/line_arc_vert.glsl +42 -48
  199. package/lib/line/shaders/arc3d/line_arc_3d_vert.glsl +15 -20
  200. package/lib/line/shaders/flow/flow_line_vert.glsl +30 -48
  201. package/lib/line/shaders/greatCircle/line_arc_great_circle_vert.glsl +56 -72
  202. package/lib/line/shaders/line/line_vert.glsl +31 -48
  203. package/lib/line/shaders/simple/simpleline_vert.glsl +18 -23
  204. package/lib/line/shaders/wall/wall_vert.glsl +36 -45
  205. package/lib/mask/models/fill.js +2 -1
  206. package/lib/mask/shaders/mask_vert.glsl +2 -7
  207. package/lib/plugins/DataMappingPlugin.d.ts +0 -1
  208. package/lib/plugins/DataMappingPlugin.js +0 -23
  209. package/lib/plugins/PixelPickingPlugin.js +1 -1
  210. package/lib/plugins/RegisterStyleAttributePlugin.d.ts +0 -1
  211. package/lib/plugins/RegisterStyleAttributePlugin.js +2 -24
  212. package/lib/plugins/ShaderUniformPlugin.d.ts +0 -5
  213. package/lib/plugins/ShaderUniformPlugin.js +2 -34
  214. package/lib/point/models/billboard_point.d.ts +14 -0
  215. package/lib/point/models/billboard_point.js +11 -3
  216. package/lib/point/models/earthExtrude.d.ts +16 -0
  217. package/lib/point/models/earthExtrude.js +14 -7
  218. package/lib/point/models/earthFill.d.ts +16 -0
  219. package/lib/point/models/earthFill.js +13 -5
  220. package/lib/point/models/extrude.d.ts +16 -0
  221. package/lib/point/models/extrude.js +18 -11
  222. package/lib/point/models/fill.d.ts +16 -0
  223. package/lib/point/models/fill.js +16 -5
  224. package/lib/point/models/fillImage.d.ts +16 -0
  225. package/lib/point/models/fillImage.js +16 -16
  226. package/lib/point/models/image.d.ts +15 -0
  227. package/lib/point/models/image.js +14 -4
  228. package/lib/point/models/normal.d.ts +14 -0
  229. package/lib/point/models/normal.js +11 -3
  230. package/lib/point/models/radar.d.ts +15 -0
  231. package/lib/point/models/radar.js +13 -4
  232. package/lib/point/models/text.d.ts +16 -0
  233. package/lib/point/models/text.js +18 -11
  234. package/lib/point/shaders/billboard/billboard_point_vert.glsl +10 -13
  235. package/lib/point/shaders/earthExtrude/earthExtrude_vert.glsl +15 -25
  236. package/lib/point/shaders/earthFill/earthFill_vert.glsl +6 -6
  237. package/lib/point/shaders/extrude/extrude_vert.glsl +35 -39
  238. package/lib/point/shaders/fill/fill_vert.glsl +12 -14
  239. package/lib/point/shaders/fillImage/fillImage_vert.glsl +16 -28
  240. package/lib/point/shaders/image/image_vert.glsl +15 -12
  241. package/lib/point/shaders/normal/normal_vert.glsl +7 -10
  242. package/lib/point/shaders/radar/radar_vert.glsl +11 -11
  243. package/lib/point/shaders/text/text_vert.glsl +10 -9
  244. package/lib/polygon/models/extrude.d.ts +16 -0
  245. package/lib/polygon/models/extrude.js +25 -25
  246. package/lib/polygon/models/extrusion.d.ts +16 -0
  247. package/lib/polygon/models/extrusion.js +34 -4
  248. package/lib/polygon/models/fill.d.ts +14 -0
  249. package/lib/polygon/models/fill.js +12 -4
  250. package/lib/polygon/models/ocean.d.ts +14 -0
  251. package/lib/polygon/models/ocean.js +11 -6
  252. package/lib/polygon/models/water.d.ts +14 -0
  253. package/lib/polygon/models/water.js +11 -6
  254. package/lib/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +17 -15
  255. package/lib/polygon/shaders/extrude/polygon_extrude_vert.glsl +22 -20
  256. package/lib/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +17 -17
  257. package/lib/polygon/shaders/extrusion/polygon_extrusion_vert.glsl +8 -8
  258. package/lib/polygon/shaders/fill/fill_linear_vert.glsl +7 -6
  259. package/lib/polygon/shaders/fill/fill_vert.glsl +10 -12
  260. package/lib/polygon/shaders/ocean/ocean_vert.glsl +3 -4
  261. package/lib/polygon/shaders/water/polygon_water_vert.glsl +5 -5
  262. package/lib/raster/index.d.ts +1 -1
  263. package/lib/raster/index.js +2 -2
  264. package/lib/raster/models/raster.d.ts +14 -0
  265. package/lib/raster/models/raster.js +12 -3
  266. package/lib/raster/models/rasterRgb.d.ts +14 -0
  267. package/lib/raster/models/rasterRgb.js +12 -3
  268. package/lib/raster/models/rasterTerrainRgb.d.ts +14 -0
  269. package/lib/raster/models/rasterTerrainRgb.js +11 -3
  270. package/lib/raster/shaders/raster/raster_2d_vert.glsl +6 -6
  271. package/lib/raster/shaders/rgb/raster_rgb_vert.glsl +11 -11
  272. package/lib/raster/shaders/terrain/terrain_rgb_vert.glsl +11 -11
  273. package/lib/tile/core/BaseLayer.js +0 -16
  274. package/lib/utils/extrude_polyline.d.ts +0 -15
  275. package/lib/utils/extrude_polyline.js +0 -217
  276. package/lib/wind/models/wind.d.ts +14 -0
  277. package/lib/wind/models/wind.js +9 -1
  278. package/lib/wind/shaders/wind_vert.glsl +6 -5
  279. package/package.json +6 -6
@@ -1,13 +1,14 @@
1
- layout(location = 0) in vec3 a_Position;
2
- layout(location = 1) in vec4 a_Color;
3
- layout(location = 9) in float a_Size;
4
- layout(location = 11) in vec3 a_Extrude;
5
- layout(location = 14) in vec2 a_Uv;
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 float a_Size;
5
+ layout(location = ATTRIBUTE_LOCATION_EXTRUDE) in vec3 a_Extrude;
6
+ layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;
6
7
 
7
8
  layout(std140) uniform commonUniform {
8
9
  vec2 u_textSize;
9
- float u_heightfixed: 0.0;
10
- float u_raisingHeight: 0.0;
10
+ float u_heightfixed;
11
+ float u_raisingHeight;
11
12
  float u_size_unit;
12
13
  };
13
14
 
@@ -15,43 +16,30 @@ out vec2 v_uv;
15
16
  out vec2 v_Iconuv;
16
17
  out float v_opacity;
17
18
 
18
-
19
19
  #pragma include "projection"
20
20
  #pragma include "picking"
21
21
  #pragma include "rotation_2d"
22
22
 
23
23
  void main() {
24
24
  vec3 extrude = a_Extrude;
25
- v_uv = (a_Extrude.xy + 1.0)/2.0;
25
+ v_uv = (a_Extrude.xy + 1.0) / 2.0;
26
26
  v_uv.y = 1.0 - v_uv.y;
27
27
  v_Iconuv = a_Uv;
28
28
  v_opacity = opacity;
29
29
  float newSize = a_Size;
30
- if(u_size_unit == 1.0) {
31
- newSize = newSize * u_PixelsPerMeter.z;
30
+ if (u_size_unit == 1.0) {
31
+ newSize = newSize * u_PixelsPerMeter.z;
32
32
  }
33
-
34
- // vec2 offset = (u_RotateMatrix * extrude.xy * (a_Size) + textrueOffsets);
35
- vec2 offset = (extrude.xy * (newSize) + offsets);
36
33
 
37
- offset = rotate_matrix(offset,rotation);
34
+ // vec2 offset = (u_RotateMatrix * extrude.xy * (a_Size) + textrueOffsets);
35
+ vec2 offset = extrude.xy * newSize + offsets;
38
36
 
39
- vec3 aPosition = a_Position;
37
+ offset = rotate_matrix(offset, rotation);
40
38
 
41
39
  offset = project_pixel(offset);
42
40
 
43
- vec4 project_pos = project_position(vec4(aPosition.xy, 0.0, 1.0));
44
- float raisingHeight = u_raisingHeight;
45
- if(u_heightfixed < 1.0) { // height fixed
46
- raisingHeight = project_pixel(u_raisingHeight);
47
- } else {
48
- if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
49
- float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);
50
- raisingHeight = u_raisingHeight * mapboxZoomScale;
51
- }
52
- }
53
-
54
- gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy + offset, 0.0, 1.0));
41
+ vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0), a_Position64Low);
42
+ gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));
55
43
 
56
44
  setPickingColor(a_PickingColor);
57
45
  }
@@ -1,7 +1,8 @@
1
- layout(location = 0) in vec3 a_Position;
2
- layout(location = 1) in vec4 a_Color;
3
- layout(location = 9) in float a_Size;
4
- layout(location = 14) in vec2 a_Uv;
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 float a_Size;
5
+ layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;
5
6
 
6
7
  layout(std140) uniform commonUniforms {
7
8
  vec2 u_textSize;
@@ -17,27 +18,29 @@ out float v_opacity;
17
18
  #pragma include "picking"
18
19
 
19
20
  void main() {
20
-
21
21
  // cal style mapping - 数据纹理映射部分的计算
22
22
  v_color = a_Color;
23
23
  v_opacity = opacity;
24
24
  v_uv = a_Uv;
25
- vec4 project_pos = project_position(vec4(a_Position, 1.0));
26
-
25
+ vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low);
26
+
27
27
  vec2 offset = project_pixel(offsets);
28
28
 
29
29
  float raisingHeight = u_raisingHeight;
30
- if(u_heightfixed < 1.0) { // false
30
+ if (u_heightfixed < 1.0) {
31
+ // false
31
32
  raisingHeight = project_pixel(u_raisingHeight);
32
33
  } else {
33
- if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
34
- float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);
34
+ if (
35
+ u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
36
+ u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET
37
+ ) {
38
+ float mapboxZoomScale = 4.0 / pow(2.0, 21.0 - u_Zoom);
35
39
  raisingHeight = u_raisingHeight * mapboxZoomScale;
36
40
  }
37
41
  }
38
42
 
39
-
40
- gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy + offset, raisingHeight, 1.0));
43
+ gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, raisingHeight, 1.0));
41
44
 
42
45
  gl_PointSize = a_Size * 2.0 * u_DevicePixelRatio;
43
46
  setPickingColor(a_PickingColor);
@@ -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 float a_Size;
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 float a_Size;
4
5
 
5
6
  layout(std140) uniform u_Common {
6
7
  float u_size_scale;
@@ -14,12 +15,8 @@ out vec4 v_color;
14
15
  void main() {
15
16
  v_color = vec4(a_Color.xyz, a_Color.w * opacity);
16
17
 
17
- if (u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
18
- gl_Position = u_Mvp * vec4(a_Position, 1.0);
19
- } else {
20
- vec4 project_pos = project_position(vec4(a_Position, 1.0)) + vec4(a_Size / 2., -a_Size /2., 0., 0.);
21
- gl_Position = project_common_position_to_clipspace(project_pos);
22
- }
18
+ vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low);
19
+ gl_Position = project_common_position_to_clipspace(project_pos);
23
20
 
24
- gl_PointSize = a_Size * u_size_scale * 2.0 * u_DevicePixelRatio;
21
+ gl_PointSize = a_Size * u_size_scale * 2.0 * u_DevicePixelRatio;
25
22
  }
@@ -1,7 +1,8 @@
1
- layout(location = 0) in vec3 a_Position;
2
- layout(location = 1) in vec4 a_Color;
3
- layout(location = 9) in float a_Size;
4
- layout(location = 11) in vec3 a_Extrude;
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 float a_Size;
5
+ layout(location = ATTRIBUTE_LOCATION_EXTRUDE) in vec3 a_Extrude;
5
6
 
6
7
  layout(std140) uniform commonUniorm {
7
8
  float u_additive;
@@ -22,8 +23,8 @@ void main() {
22
23
  float newSize = setPickingSize(a_Size);
23
24
 
24
25
  float time = u_time * u_speed;
25
- mat2 rotateMatrix = mat2(
26
- cos(time), sin(time),
26
+ mat2 rotateMatrix = mat2(
27
+ cos(time), sin(time),
27
28
  -sin(time), cos(time)
28
29
  );
29
30
  v_extrude = rotateMatrix * a_Extrude.xy;
@@ -40,14 +41,13 @@ void main() {
40
41
  v_radius = newSize;
41
42
 
42
43
  vec2 offset = (a_Extrude.xy * (newSize));
43
- vec3 aPosition = a_Position;
44
-
44
+
45
45
  offset = project_pixel(offset);
46
-
46
+
47
47
  v_data = vec4(a_Extrude.x, a_Extrude.y, antialiasblur, -1.0);
48
48
 
49
- vec4 project_pos = project_position(vec4(aPosition.xy, 0.0, 1.0));
50
- gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));
49
+ vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0), a_Position64Low);
50
+ gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));
51
51
 
52
52
  setPickingColor(a_PickingColor);
53
53
  }
@@ -2,11 +2,12 @@
2
2
  #define EDGE_GAMMA 0.105
3
3
  #define FONT_SIZE 24.0
4
4
 
5
- layout(location = 0) in vec3 a_Position;
6
- layout(location = 1) in vec4 a_Color;
7
- layout(location = 9) in float a_Size;
8
- layout(location = 10) in vec2 a_textOffsets;
9
- layout(location = 14) in vec2 a_tex;
5
+ layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
6
+ layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;
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_TEXT_OFFSETS) in vec2 a_textOffsets;
10
+ layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_tex;
10
11
 
11
12
  layout(std140) uniform commonUniforms {
12
13
  vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];
@@ -29,7 +30,7 @@ out float v_fontScale;
29
30
 
30
31
  void main() {
31
32
  // cal style mapping - 数据纹理映射部分的计算
32
-
33
+
33
34
  v_uv = a_tex / u_sdf_map_size;
34
35
 
35
36
 
@@ -41,11 +42,11 @@ void main() {
41
42
  float fontScale = a_Size / FONT_SIZE;
42
43
  v_fontScale = fontScale;
43
44
 
44
- vec4 project_pos = project_position(vec4(a_Position, 1.0));
45
+ vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low);
45
46
  // vec4 projected_position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
46
47
 
47
48
  vec2 offset = rotate_matrix(a_textOffsets,rotation);
48
-
49
+
49
50
  // gl_Position = vec4(projected_position.xy / projected_position.w + rotation_matrix * a_textOffsets * fontScale / u_ViewportSize * 2.0 * u_DevicePixelRatio, 0.0, 1.0);
50
51
 
51
52
  float raiseHeight = u_raisingHeight;
@@ -54,7 +55,7 @@ void main() {
54
55
  raiseHeight = u_raisingHeight * mapboxZoomScale;
55
56
  }
56
57
 
57
- vec4 projected_position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz + vec3(0.0, 0.0, raiseHeight), 1.0));
58
+ vec4 projected_position = project_common_position_to_clipspace(vec4(project_pos.xyz + vec3(0.0, 0.0, raiseHeight), 1.0));
58
59
 
59
60
  gl_Position = vec4(
60
61
  projected_position.xy / projected_position.w + offset * fontScale / u_ViewportSize * 2.0 * u_DevicePixelRatio, 0.0, 1.0);
@@ -1,6 +1,22 @@
1
1
  import type { IModel, ITexture2D } from '@antv/l7-core';
2
2
  import BaseModel from '../../core/BaseModel';
3
3
  export default class ExtrudeModel extends BaseModel {
4
+ protected get attributeLocation(): {
5
+ readonly POSITION: 0;
6
+ readonly POSITION_64LOW: 1;
7
+ readonly COLOR: 2;
8
+ readonly PICKING_COLOR: 3;
9
+ readonly STROKE: 4;
10
+ readonly OPACITY: 5;
11
+ readonly OFFSETS: 6;
12
+ readonly ROTATION: 7;
13
+ readonly MAX: 8;
14
+ } & Record<string, number> & {
15
+ MAX: 8;
16
+ SIZE: number;
17
+ NORMAL: number;
18
+ UV: number;
19
+ };
4
20
  protected texture: ITexture2D;
5
21
  getUninforms(): {
6
22
  [x: string]: any;
@@ -12,25 +12,32 @@ var _l7Core = require("@antv/l7-core");
12
12
  var _l7Utils = require("@antv/l7-utils");
13
13
  var _BaseModel = _interopRequireDefault(require("../../core/BaseModel"));
14
14
  var _triangulation = require("../../core/triangulation");
15
- var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
16
15
  var _loadImage = require("../../utils/load-image");
17
16
  /* babel-plugin-inline-import '../shaders/extrude/polygon_extrude_frag.glsl' */
18
17
  const polygonExtrudeFrag = "layout(std140) uniform commonUniforms {\n vec4 u_sourceColor;\n vec4 u_targetColor;\n float u_linearColor;\n float u_topsurface;\n float u_sidesurface;\n float u_heightfixed; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\n float u_raisingHeight;\n};\n\nin vec4 v_Color;\n#pragma include \"scene_uniforms\"\n#pragma include \"picking\"\nout vec4 outputColor;\nvoid main() {\n\n // top face\n if(u_topsurface < 1.0) {\n discard;\n }\n\n outputColor = v_Color;\n \n outputColor = filterColor(outputColor);\n}\n";
19
- /* babel-plugin-inline-import '../shaders/extrude/polygon_extrude_vert.glsl' */
20
- const polygonExtrudeVert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 9) in float a_Size;\nlayout(location = 13) in vec3 a_Normal;\nlayout(location = 14) in vec3 a_uvs;\n\nlayout(std140) uniform commonUniforms {\n vec4 u_sourceColor;\n vec4 u_targetColor;\n float u_linearColor;\n float u_topsurface;\n float u_sidesurface;\n float u_heightfixed; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\n float u_raisingHeight;\n};\n\nout vec4 v_Color;\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n \nfloat isSide = a_Position.z;\n float topU = a_uvs[0];\n float topV = 1.0 - a_uvs[1];\n float sidey = a_uvs[2];\n\n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);\n float lightWeight = calc_lighting(pos);\n\n vec4 project_pos = project_position(pos);\n\n if(u_heightfixed > 0.0) { // \u5224\u65AD\u51E0\u4F55\u4F53\u662F\u5426\u56FA\u5B9A\u9AD8\u5EA6\n project_pos.z = a_Position.z * a_Size;\n project_pos.z += u_raisingHeight;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n }\n\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));\n\n // Tip: \u90E8\u5206\u673A\u578B GPU \u8BA1\u7B97\u7CBE\u5EA6\u517C\u5BB9\n if(isSide < 0.999) {\n // side face\n // if(u_sidesurface < 1.0) {\n // discard;\n // }\n\n if(u_linearColor == 1.0) {\n vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey);\n linearColor.rgb *= lightWeight;\n v_Color = linearColor;\n } else {\n v_Color = a_Color;\n }\n\n } else {\n v_Color = a_Color;\n }\n\n v_Color = vec4(v_Color.rgb * lightWeight, v_Color.w * opacity);\n\n\n setPickingColor(a_PickingColor);\n}\n"; // extrude
21
- /* babel-plugin-inline-import '../shaders/extrude/polygon_extrudetex_frag.glsl' */
22
- const polygonExtrudeTexFrag = "uniform sampler2D u_texture;\n\nlayout(std140) uniform commonUniforms {\n vec4 u_sourceColor;\n vec4 u_targetColor;\n float u_linearColor;\n float u_topsurface;\n float u_sidesurface;\n float u_heightfixed; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\n float u_raisingHeight;\n};\n\nin vec4 v_Color;\nin vec3 v_uvs;\nin vec2 v_texture_data;\n\n#pragma include \"scene_uniforms\"\n#pragma include \"picking\"\n\nout vec4 outputColor;\n\nvoid main() {\n float opacity = u_opacity;\n float isSide = v_texture_data.x;\n float lightWeight = v_texture_data.y;\n float topU = v_uvs[0];\n float topV = 1.0 - v_uvs[1];\n float sidey = v_uvs[2];\n\n outputColor = texture(SAMPLER_2D(u_texture), vec2(topU, topV));\n // Tip: \u90E8\u5206\u673A\u578B GPU \u8BA1\u7B97\u7CBE\u5EA6\u517C\u5BB9\n if (isSide < 0.999) {// \u662F\u5426\u662F\u8FB9\u7F18\n // side face\n if (u_sidesurface < 1.0) {\n discard;\n }\n\n if (u_linearColor == 1.0) {\n vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey);\n linearColor.rgb *= lightWeight;\n outputColor = linearColor;\n } else {\n outputColor = v_Color;\n }\n } else {\n // top face\n if (u_topsurface < 1.0) {\n discard;\n }\n }\n \n outputColor.a *= opacity;\n outputColor = filterColor(outputColor);\n}\n"; // texture
23
- /* babel-plugin-inline-import '../shaders/extrude/polygon_extrudetex_vert.glsl' */
24
- const polygonExtrudeTexVert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 9) in float a_Size;\nlayout(location = 13) in vec3 a_Normal;\nlayout(location = 14) in vec3 a_uvs;\n\n\nlayout(std140) uniform commonUniforms {\n vec4 u_sourceColor;\n vec4 u_targetColor;\n float u_linearColor;\n float u_topsurface;\n float u_sidesurface;\n float u_heightfixed; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\n float u_raisingHeight;\n};\n\nout vec4 v_Color;\nout vec3 v_uvs;\nout vec2 v_texture_data;\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n \n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);\n float lightWeight = calc_lighting(pos);\n vec4 project_pos = project_position(pos);\n v_uvs = a_uvs;\n v_Color = a_Color;\n v_Color.a *= opacity;\n \n v_texture_data = vec2(a_Position.z, lightWeight);\n\n if(u_heightfixed > 0.0) { // \u5224\u65AD\u51E0\u4F55\u4F53\u662F\u5426\u56FA\u5B9A\u9AD8\u5EA6\n project_pos.z = a_Position.z * a_Size;\n project_pos.z += u_raisingHeight;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n }\n\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));\n\n\n\n setPickingColor(a_PickingColor);\n}\n"; // extrude picking
25
18
  /* babel-plugin-inline-import '../shaders/extrude/polygon_extrude_picklight_frag.glsl' */
26
19
  const polygonExtrudePickLightFrag = "\nlayout(std140) uniform commonUniforms {\n vec4 u_sourceColor;\n vec4 u_targetColor;\n float u_linearColor;\n float u_topsurface;\n float u_sidesurface;\n float u_heightfixed; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\n float u_raisingHeight;\n};\n\nin vec4 v_Color;\nin vec3 v_uvs;\nin vec2 v_texture_data;\nout vec4 outputColor;\n\n#pragma include \"scene_uniforms\"\n#pragma include \"picking\"\n\nvoid main() {\n float isSide = v_texture_data.x;\n float sidey = v_uvs[2];\n float lightWeight = v_texture_data.y;\n\n // Tip: \u90E8\u5206\u673A\u578B GPU \u8BA1\u7B97\u7CBE\u5EA6\u517C\u5BB9\n if(isSide < 0.999) {\n // side face\n if(u_sidesurface < 1.0) {\n discard;\n }\n \n if( u_linearColor == 1.0) {\n // side use linear\n vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey);\n linearColor.rgb *= lightWeight;\n outputColor = linearColor;\n } else {\n // side notuse linear\n outputColor = v_Color;\n }\n } else {\n // top face\n if(u_topsurface < 1.0) {\n discard;\n }\n outputColor = v_Color;\n }\n\n outputColor = filterColorAlpha(outputColor, lightWeight);\n}\n";
27
20
  /* babel-plugin-inline-import '../shaders/extrude/polygon_extrude_picklight_vert.glsl' */
28
- const polygonExtrudePickLightVert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 9) in float a_Size;\nlayout(location = 13) in vec3 a_Normal;\nlayout(location = 14) in vec3 a_uvs;\n\n\nlayout(std140) uniform commonUniforms {\n vec4 u_sourceColor;\n vec4 u_targetColor;\n float u_linearColor;\n float u_topsurface;\n float u_sidesurface;\n float u_heightfixed; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\n float u_raisingHeight;\n};\n\nout vec4 v_Color;\nout vec3 v_uvs;\nout vec2 v_texture_data;\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n\n\n v_uvs = a_uvs;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);\n vec4 project_pos = project_position(pos);\n\n if(u_heightfixed > 0.0) { // \u5224\u65AD\u51E0\u4F55\u4F53\u662F\u5426\u56FA\u5B9A\u9AD8\u5EA6\n project_pos.z = a_Position.z * a_Size;\n project_pos.z += u_raisingHeight;\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n }\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));\n float lightWeight = calc_lighting(pos);\n v_texture_data = vec2(a_Position.z,lightWeight);\n\n v_Color = vec4(a_Color.rgb * lightWeight, a_Color.w * opacity);\n\n setPickingColor(a_PickingColor);\n}\n";
21
+ const polygonExtrudePickLightVert = "layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\nlayout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;\nlayout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;\nlayout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;\nlayout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal;\nlayout(location = ATTRIBUTE_LOCATION_UV) in vec3 a_uvs;\n\nlayout(std140) uniform commonUniforms {\n vec4 u_sourceColor;\n vec4 u_targetColor;\n float u_linearColor;\n float u_topsurface;\n float u_sidesurface;\n float u_heightfixed; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\n float u_raisingHeight;\n};\n\nout vec4 v_Color;\nout vec3 v_uvs;\nout vec2 v_texture_data;\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n v_uvs = a_uvs;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);\n vec4 project_pos = project_position(pos, a_Position64Low);\n\n if (u_heightfixed > 0.0) {\n // \u5224\u65AD\u51E0\u4F55\u4F53\u662F\u5426\u56FA\u5B9A\u9AD8\u5EA6\n project_pos.z = a_Position.z * a_Size;\n project_pos.z += u_raisingHeight;\n if (\n u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||\n u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET\n ) {\n float mapboxZoomScale = 4.0 / pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n }\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n float lightWeight = calc_lighting(project_pos);\n v_texture_data = vec2(a_Position.z, lightWeight);\n\n v_Color = vec4(a_Color.rgb * lightWeight, a_Color.w * opacity);\n\n setPickingColor(a_PickingColor);\n}\n";
22
+ /* babel-plugin-inline-import '../shaders/extrude/polygon_extrude_vert.glsl' */
23
+ const polygonExtrudeVert = "layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\nlayout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;\nlayout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;\nlayout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;\nlayout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal;\nlayout(location = ATTRIBUTE_LOCATION_UV) in vec3 a_uvs;\n\nlayout(std140) uniform commonUniforms {\n vec4 u_sourceColor;\n vec4 u_targetColor;\n float u_linearColor;\n float u_topsurface;\n float u_sidesurface;\n float u_heightfixed; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\n float u_raisingHeight;\n};\n\nout vec4 v_Color;\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n float isSide = a_Position.z;\n float topU = a_uvs[0];\n float topV = 1.0 - a_uvs[1];\n float sidey = a_uvs[2];\n\n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);\n\n vec4 project_pos = project_position(pos, a_Position64Low);\n float lightWeight = calc_lighting(project_pos);\n\n if (u_heightfixed > 0.0) {\n // \u5224\u65AD\u51E0\u4F55\u4F53\u662F\u5426\u56FA\u5B9A\u9AD8\u5EA6\n project_pos.z = a_Position.z * a_Size;\n project_pos.z += u_raisingHeight;\n\n if (\n u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||\n u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET\n ) {\n float mapboxZoomScale = 4.0 / pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n }\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n\n // Tip: \u90E8\u5206\u673A\u578B GPU \u8BA1\u7B97\u7CBE\u5EA6\u517C\u5BB9\n if (isSide < 0.999) {\n // side face\n // if(u_sidesurface < 1.0) {\n // discard;\n // }\n\n if (u_linearColor == 1.0) {\n vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey);\n linearColor.rgb *= lightWeight;\n v_Color = linearColor;\n } else {\n v_Color = a_Color;\n }\n\n } else {\n v_Color = a_Color;\n }\n\n v_Color = vec4(v_Color.rgb * lightWeight, v_Color.w * opacity);\n\n setPickingColor(a_PickingColor);\n}\n";
24
+ /* babel-plugin-inline-import '../shaders/extrude/polygon_extrudetex_frag.glsl' */
25
+ const polygonExtrudeTexFrag = "uniform sampler2D u_texture;\n\nlayout(std140) uniform commonUniforms {\n vec4 u_sourceColor;\n vec4 u_targetColor;\n float u_linearColor;\n float u_topsurface;\n float u_sidesurface;\n float u_heightfixed; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\n float u_raisingHeight;\n};\n\nin vec4 v_Color;\nin vec3 v_uvs;\nin vec2 v_texture_data;\n\n#pragma include \"scene_uniforms\"\n#pragma include \"picking\"\n\nout vec4 outputColor;\n\nvoid main() {\n float opacity = u_opacity;\n float isSide = v_texture_data.x;\n float lightWeight = v_texture_data.y;\n float topU = v_uvs[0];\n float topV = 1.0 - v_uvs[1];\n float sidey = v_uvs[2];\n\n outputColor = texture(SAMPLER_2D(u_texture), vec2(topU, topV));\n // Tip: \u90E8\u5206\u673A\u578B GPU \u8BA1\u7B97\u7CBE\u5EA6\u517C\u5BB9\n if (isSide < 0.999) {// \u662F\u5426\u662F\u8FB9\u7F18\n // side face\n if (u_sidesurface < 1.0) {\n discard;\n }\n\n if (u_linearColor == 1.0) {\n vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey);\n linearColor.rgb *= lightWeight;\n outputColor = linearColor;\n } else {\n outputColor = v_Color;\n }\n } else {\n // top face\n if (u_topsurface < 1.0) {\n discard;\n }\n }\n \n outputColor.a *= opacity;\n outputColor = filterColor(outputColor);\n}\n";
26
+ /* babel-plugin-inline-import '../shaders/extrude/polygon_extrudetex_vert.glsl' */
27
+ const polygonExtrudeTexVert = "layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\nlayout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;\nlayout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;\nlayout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;\nlayout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal;\nlayout(location = ATTRIBUTE_LOCATION_UV) in vec3 a_uvs;\n\nlayout(std140) uniform commonUniforms {\n vec4 u_sourceColor;\n vec4 u_targetColor;\n float u_linearColor;\n float u_topsurface;\n float u_sidesurface;\n float u_heightfixed; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\n float u_raisingHeight;\n};\n\nout vec4 v_Color;\nout vec3 v_uvs;\nout vec2 v_texture_data;\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);\n vec4 project_pos = project_position(pos, a_Position64Low);\n float lightWeight = calc_lighting(project_pos);\n v_uvs = a_uvs;\n v_Color = a_Color;\n v_Color.a *= opacity;\n\n v_texture_data = vec2(a_Position.z, lightWeight);\n\n if (u_heightfixed > 0.0) {\n // \u5224\u65AD\u51E0\u4F55\u4F53\u662F\u5426\u56FA\u5B9A\u9AD8\u5EA6\n project_pos.z = a_Position.z * a_Size;\n project_pos.z += u_raisingHeight;\n\n if (\n u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||\n u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET\n ) {\n float mapboxZoomScale = 4.0 / pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n }\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
29
28
  class ExtrudeModel extends _BaseModel.default {
30
29
  constructor(...args) {
31
30
  super(...args);
32
31
  (0, _defineProperty2.default)(this, "texture", void 0);
33
32
  }
33
+ get attributeLocation() {
34
+ return Object.assign(super.attributeLocation, {
35
+ MAX: super.attributeLocation.MAX,
36
+ SIZE: 9,
37
+ NORMAL: 10,
38
+ UV: 11
39
+ });
40
+ }
34
41
  getUninforms() {
35
42
  const commoninfo = this.getCommonUniformsInfo();
36
43
  const attributeInfo = this.getUniformsBufferInfo(this.getStyleAttribute());
@@ -98,6 +105,7 @@ class ExtrudeModel extends _BaseModel.default {
98
105
  depth: {
99
106
  enable: true
100
107
  },
108
+ defines: _this2.getDefines(),
101
109
  inject: _this2.getInject(),
102
110
  triangulation: _triangulation.PolygonExtrudeTriangulation
103
111
  });
@@ -136,26 +144,18 @@ class ExtrudeModel extends _BaseModel.default {
136
144
  this.textures = [];
137
145
  }
138
146
  registerBuiltinAttributes() {
139
- const bbox = this.layer.getSource().extent;
140
- let bounds = bbox;
141
- const layerCenter = this.layer.coordCenter || this.layer.getSource().center;
142
- let lngLen = bounds[2] - bounds[0];
143
- let latLen = bounds[3] - bounds[1];
144
- if (this.mapService.version === 'GAODE2.x') {
145
- // @ts-ignore
146
- const [minX, minY] = this.mapService.coordToAMap2RelativeCoordinates([bbox[0], bbox[1]], layerCenter);
147
- // @ts-ignore
148
- const [maxX, maxY] = this.mapService.coordToAMap2RelativeCoordinates([bbox[2], bbox[3]], layerCenter);
149
- lngLen = maxX - minX;
150
- latLen = maxY - minY;
151
- bounds = [minX, minY, maxX, maxY];
152
- }
147
+ const bounds = this.layer.getSource().extent;
148
+ const lngLen = bounds[2] - bounds[0];
149
+ const latLen = bounds[3] - bounds[1];
150
+
151
+ // 注册 Position 属性 64 位地位部分,经纬度数据开启双精度,避免大于 22 层级以上出现数据偏移
152
+ this.registerPosition64LowAttribute();
153
153
  this.styleAttributeService.registerStyleAttribute({
154
154
  name: 'uvs',
155
155
  type: _l7Core.AttributeType.Attribute,
156
156
  descriptor: {
157
157
  name: 'a_uvs',
158
- shaderLocation: _CommonStyleAttribute.ShaderLocation.UV,
158
+ shaderLocation: this.attributeLocation.UV,
159
159
  buffer: {
160
160
  // give the WebGL driver a hint that this buffer may change
161
161
  usage: _l7Core.gl.STATIC_DRAW,
@@ -176,7 +176,7 @@ class ExtrudeModel extends _BaseModel.default {
176
176
  type: _l7Core.AttributeType.Attribute,
177
177
  descriptor: {
178
178
  name: 'a_Normal',
179
- shaderLocation: _CommonStyleAttribute.ShaderLocation.NORMAL,
179
+ shaderLocation: this.attributeLocation.NORMAL,
180
180
  buffer: {
181
181
  // give the WebGL driver a hint that this buffer may change
182
182
  usage: _l7Core.gl.STATIC_DRAW,
@@ -194,7 +194,7 @@ class ExtrudeModel extends _BaseModel.default {
194
194
  type: _l7Core.AttributeType.Attribute,
195
195
  descriptor: {
196
196
  name: 'a_Size',
197
- shaderLocation: _CommonStyleAttribute.ShaderLocation.SIZE,
197
+ shaderLocation: this.attributeLocation.SIZE,
198
198
  buffer: {
199
199
  usage: _l7Core.gl.DYNAMIC_DRAW,
200
200
  data: [],
@@ -1,6 +1,22 @@
1
1
  import type { IModel, ITexture2D } from '@antv/l7-core';
2
2
  import BaseModel from '../../core/BaseModel';
3
3
  export default class ExtrusionModel extends BaseModel {
4
+ protected get attributeLocation(): {
5
+ readonly POSITION: 0;
6
+ readonly POSITION_64LOW: 1;
7
+ readonly COLOR: 2;
8
+ readonly PICKING_COLOR: 3;
9
+ readonly STROKE: 4;
10
+ readonly OPACITY: 5;
11
+ readonly OFFSETS: 6;
12
+ readonly ROTATION: 7;
13
+ readonly MAX: 8;
14
+ } & Record<string, number> & {
15
+ MAX: 8;
16
+ SIZE: number;
17
+ NORMAL: number;
18
+ EXTRUSION_BASE: number;
19
+ };
4
20
  protected texture: ITexture2D;
5
21
  getUninforms(): {
6
22
  [x: string]: any;
@@ -10,17 +10,24 @@ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/obje
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
  var _l7Core = require("@antv/l7-core");
12
12
  var _BaseModel = _interopRequireDefault(require("../../core/BaseModel"));
13
- var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
14
13
  var _triangulation = require("../../core/triangulation");
15
14
  /* babel-plugin-inline-import '../shaders/extrusion/polygon_extrusion_frag.glsl' */
16
15
  const polygonExtrudeFrag = "\nin vec4 v_Color;\n#pragma include \"scene_uniforms\"\n#pragma include \"picking\"\nout vec4 outputColor;\nvoid main() {\n\n outputColor = v_Color;\n outputColor = filterColor(outputColor);\n}\n";
17
16
  /* babel-plugin-inline-import '../shaders/extrusion/polygon_extrusion_vert.glsl' */
18
- const polygonExtrudeVert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 9) in float a_Size;\nlayout(location = 13) in vec3 a_Normal;\n\nout vec4 v_Color;\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n \n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size + (1.0 - a_Position.z) * extrusionBase, 1.0);\n\n vec4 project_pos = project_position(pos);\n float lightWeight = calc_lighting(project_pos);\n v_Color = a_Color;\n v_Color = vec4(v_Color.rgb * lightWeight, v_Color.w * opacity);\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
17
+ const polygonExtrudeVert = "layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\nlayout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;\nlayout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;\nlayout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;\nlayout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal;\n\nout vec4 v_Color;\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size + (1.0 - a_Position.z) * extrusionBase, 1.0);\n\n vec4 project_pos = project_position(pos, a_Position64Low);\n float lightWeight = calc_lighting(project_pos);\n v_Color = a_Color;\n v_Color = vec4(v_Color.rgb * lightWeight, v_Color.w * opacity);\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
19
18
  class ExtrusionModel extends _BaseModel.default {
20
19
  constructor(...args) {
21
20
  super(...args);
22
21
  (0, _defineProperty2.default)(this, "texture", void 0);
23
22
  }
23
+ get attributeLocation() {
24
+ return Object.assign(super.attributeLocation, {
25
+ MAX: super.attributeLocation.MAX,
26
+ SIZE: 9,
27
+ NORMAL: 10,
28
+ EXTRUSION_BASE: 11
29
+ });
30
+ }
24
31
  getUninforms() {
25
32
  const commoninfo = this.getCommonUniformsInfo();
26
33
  const attributeInfo = this.getUniformsBufferInfo(this.getStyleAttribute());
@@ -51,6 +58,7 @@ class ExtrusionModel extends _BaseModel.default {
51
58
  moduleName: type,
52
59
  vertexShader: vert,
53
60
  fragmentShader: frag,
61
+ defines: _this2.getDefines(),
54
62
  inject: _this2.getInject(),
55
63
  triangulation: _triangulation.PolygonExtrudeTriangulation,
56
64
  depth: {
@@ -72,12 +80,14 @@ class ExtrusionModel extends _BaseModel.default {
72
80
  (_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
73
81
  }
74
82
  registerBuiltinAttributes() {
83
+ // 注册 Position 属性 64 位地位部分,经纬度数据开启双精度,避免大于 22 层级以上出现数据偏移
84
+ this.registerPosition64LowAttribute();
75
85
  this.styleAttributeService.registerStyleAttribute({
76
86
  name: 'normal',
77
87
  type: _l7Core.AttributeType.Attribute,
78
88
  descriptor: {
79
89
  name: 'a_Normal',
80
- shaderLocation: _CommonStyleAttribute.ShaderLocation.NORMAL,
90
+ shaderLocation: this.attributeLocation.NORMAL,
81
91
  buffer: {
82
92
  // give the WebGL driver a hint that this buffer may change
83
93
  usage: _l7Core.gl.STATIC_DRAW,
@@ -95,7 +105,7 @@ class ExtrusionModel extends _BaseModel.default {
95
105
  type: _l7Core.AttributeType.Attribute,
96
106
  descriptor: {
97
107
  name: 'a_Size',
98
- shaderLocation: _CommonStyleAttribute.ShaderLocation.SIZE,
108
+ shaderLocation: this.attributeLocation.SIZE,
99
109
  buffer: {
100
110
  usage: _l7Core.gl.DYNAMIC_DRAW,
101
111
  data: [],
@@ -110,6 +120,26 @@ class ExtrusionModel extends _BaseModel.default {
110
120
  }
111
121
  }
112
122
  });
123
+ this.styleAttributeService.registerStyleAttribute({
124
+ name: 'extrusionBase',
125
+ type: _l7Core.AttributeType.Attribute,
126
+ descriptor: {
127
+ name: 'a_ExtrusionBase',
128
+ shaderLocation: this.attributeLocation.EXTRUSION_BASE,
129
+ buffer: {
130
+ usage: _l7Core.gl.STATIC_DRAW,
131
+ data: [],
132
+ type: _l7Core.gl.FLOAT
133
+ },
134
+ size: 1,
135
+ update: feature => {
136
+ const {
137
+ extrusionBase: op = 0
138
+ } = feature;
139
+ return [op];
140
+ }
141
+ }
142
+ });
113
143
  }
114
144
  }
115
145
  exports.default = ExtrusionModel;
@@ -1,6 +1,20 @@
1
1
  import type { IModel } from '@antv/l7-core';
2
2
  import BaseModel from '../../core/BaseModel';
3
3
  export default class FillModel extends BaseModel {
4
+ protected get attributeLocation(): {
5
+ readonly POSITION: 0;
6
+ readonly POSITION_64LOW: 1;
7
+ readonly COLOR: 2;
8
+ readonly PICKING_COLOR: 3;
9
+ readonly STROKE: 4;
10
+ readonly OPACITY: 5;
11
+ readonly OFFSETS: 6;
12
+ readonly ROTATION: 7;
13
+ readonly MAX: 8;
14
+ } & Record<string, number> & {
15
+ MAX: 8;
16
+ LINEAR: number;
17
+ };
4
18
  getUninforms(): {
5
19
  [x: string]: any;
6
20
  };
@@ -9,17 +9,22 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
9
9
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
10
10
  var _l7Core = require("@antv/l7-core");
11
11
  var _BaseModel = _interopRequireDefault(require("../../core/BaseModel"));
12
- var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
13
12
  var _triangulation = require("../../core/triangulation");
14
13
  /* babel-plugin-inline-import '../shaders/fill/fill_frag.glsl' */
15
14
  const polygon_frag = "in vec4 v_color;\n#pragma include \"scene_uniforms\"\n#pragma include \"picking\"\nout vec4 outputColor;\nvoid main() {\n outputColor = v_color;\n outputColor = filterColor(outputColor);\n}\n";
16
15
  /* babel-plugin-inline-import '../shaders/fill/fill_linear_frag.glsl' */
17
16
  const polygon_linear_frag = "\nlayout(std140) uniform commonUniforms {\n float u_raisingHeight;\n float u_opacitylinear;\n float u_dir;\n};\n\nin vec4 v_color;\nin vec3 v_linear;\nin vec2 v_pos;\nout vec4 outputColor;\n#pragma include \"scene_uniforms\"\n#pragma include \"picking\"\n\nvoid main() {\n outputColor = v_color;\n if (u_opacitylinear > 0.0) {\n outputColor.a *= u_dir == 1.0 ? 1.0 - length(v_pos - v_linear.xy)/v_linear.z : length(v_pos - v_linear.xy)/v_linear.z;\n }\n outputColor = filterColor(outputColor);\n}\n";
18
17
  /* babel-plugin-inline-import '../shaders/fill/fill_linear_vert.glsl' */
19
- const polygon_linear_vert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 15) in vec3 a_linear;\n\nlayout(std140) uniform commonUniforms {\n float u_raisingHeight;\n float u_opacitylinear;\n float u_dir;\n};\n\nout vec4 v_color;\nout vec3 v_linear;\nout vec2 v_pos;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n if (u_opacitylinear > 0.0) {\n v_linear = a_linear;\n v_pos = a_Position.xy;\n }\n v_color = vec4(a_Color.xyz, a_Color.w * opacity);\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n project_pos.z += u_raisingHeight;\n\n if (u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));\n setPickingColor(a_PickingColor);\n}";
18
+ const polygon_linear_vert = "layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\nlayout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;\nlayout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;\nlayout(location = ATTRIBUTE_LOCATION_LINEAR) in vec3 a_linear;\n\nlayout(std140) uniform commonUniforms {\n float u_raisingHeight;\n float u_opacitylinear;\n float u_dir;\n};\n\nout vec4 v_color;\nout vec3 v_linear;\nout vec2 v_pos;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n if (u_opacitylinear > 0.0) {\n v_linear = a_linear;\n v_pos = a_Position.xy;\n }\n v_color = vec4(a_Color.xyz, a_Color.w * opacity);\n vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low);\n project_pos.z += u_raisingHeight;\n\n if (u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n setPickingColor(a_PickingColor);\n}\n";
20
19
  /* babel-plugin-inline-import '../shaders/fill/fill_vert.glsl' */
21
- const polygon_vert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\n\nlayout(std140) uniform commonUniforms {\n float u_raisingHeight;\n};\n\n\nout vec4 v_color;\n\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n v_color = vec4(a_Color.xyz, a_Color.w * opacity);\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 project_pos.z += u_raisingHeight;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n\n \n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n\n";
20
+ const polygon_vert = "layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\nlayout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;\nlayout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;\n\nlayout(std140) uniform commonUniforms {\n float u_raisingHeight;\n};\n\nout vec4 v_color;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n v_color = vec4(a_Color.xyz, a_Color.w * opacity);\n vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low);\n\n project_pos.z += u_raisingHeight;\n\n if (\n u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||\n u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET\n ) {\n float mapboxZoomScale = 4.0 / pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n\n";
22
21
  class FillModel extends _BaseModel.default {
22
+ get attributeLocation() {
23
+ return Object.assign(super.attributeLocation, {
24
+ MAX: super.attributeLocation.MAX,
25
+ LINEAR: 9
26
+ });
27
+ }
23
28
  getUninforms() {
24
29
  const commoninfo = this.getCommonUniformsInfo();
25
30
  const attributeInfo = this.getUniformsBufferInfo(this.getStyleAttribute());
@@ -63,6 +68,7 @@ class FillModel extends _BaseModel.default {
63
68
  moduleName: type,
64
69
  vertexShader: vert,
65
70
  fragmentShader: frag,
71
+ defines: _this2.getDefines(),
66
72
  inject: _this2.getInject(),
67
73
  triangulation,
68
74
  primitive: _l7Core.gl.TRIANGLES,
@@ -74,6 +80,8 @@ class FillModel extends _BaseModel.default {
74
80
  })();
75
81
  }
76
82
  registerBuiltinAttributes() {
83
+ // 注册 Position 属性 64 位地位部分,经纬度数据开启双精度,避免大于 22 层级以上出现数据偏移
84
+ this.registerPosition64LowAttribute();
77
85
  const {
78
86
  opacityLinear = {
79
87
  enable: false,
@@ -86,7 +94,7 @@ class FillModel extends _BaseModel.default {
86
94
  type: _l7Core.AttributeType.Attribute,
87
95
  descriptor: {
88
96
  name: 'a_linear',
89
- shaderLocation: _CommonStyleAttribute.ShaderLocation.LINEAR,
97
+ shaderLocation: this.attributeLocation.LINEAR,
90
98
  buffer: {
91
99
  // give the WebGL driver a hint that this buffer may change
92
100
  usage: _l7Core.gl.STATIC_DRAW,
@@ -1,6 +1,20 @@
1
1
  import type { IModel, IModelUniform } from '@antv/l7-core';
2
2
  import BaseModel from '../../core/BaseModel';
3
3
  export default class OceanModel extends BaseModel {
4
+ protected get attributeLocation(): {
5
+ readonly POSITION: 0;
6
+ readonly POSITION_64LOW: 1;
7
+ readonly COLOR: 2;
8
+ readonly PICKING_COLOR: 3;
9
+ readonly STROKE: 4;
10
+ readonly OPACITY: 5;
11
+ readonly OFFSETS: 6;
12
+ readonly ROTATION: 7;
13
+ readonly MAX: 8;
14
+ } & Record<string, number> & {
15
+ MAX: 8;
16
+ UV: number;
17
+ };
4
18
  private texture1;
5
19
  private texture2;
6
20
  private texture3;