@antv/l7-layers 2.21.7 → 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
@@ -11,20 +11,25 @@ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/obje
11
11
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
12
12
  var _l7Core = require("@antv/l7-core");
13
13
  var _BaseModel = _interopRequireDefault(require("../../core/BaseModel"));
14
- var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
15
14
  var _triangulation = require("../../core/triangulation");
16
15
  const _excluded = ["data"],
17
16
  _excluded2 = ["rasterData"];
18
17
  /* babel-plugin-inline-import '../shaders/rgb/raster_rgb_frag.glsl' */
19
18
  const rasterFrag = "uniform sampler2D u_texture;\nlayout(std140) uniform commonUniforms {\n vec2 u_rminmax;\n vec2 u_gminmax;\n vec2 u_bminmax;\n float u_opacity;\n float u_noDataValue;\n};\n\nin vec2 v_texCoord;\n\nout vec4 outputColor;\n\nvoid main() {\n\n vec3 rgb = texture(SAMPLER_2D(u_texture),vec2(v_texCoord.x,v_texCoord.y)).rgb;\n\n if(rgb == vec3(u_noDataValue)) {\n outputColor = vec4(0.0, 0, 0, 0.0);\n } else {\n outputColor = vec4(rgb.r / (u_rminmax.y -u_rminmax.x), rgb.g /(u_gminmax.y -u_gminmax.x), rgb.b/ (u_bminmax.y - u_bminmax.x), u_opacity);\n }\n\n if(outputColor.a < 0.01)\n discard;\n \n}";
20
19
  /* babel-plugin-inline-import '../shaders/rgb/raster_rgb_vert.glsl' */
21
- const rasterVert = "\nlayout(location = 0) in vec3 a_Position;\nlayout(location = 14) in vec2 a_Uv;\n\nlayout(std140) uniform commonUniforms {\n vec2 u_rminmax;\n vec2 u_gminmax;\n vec2 u_bminmax;\n float u_opacity;\n float u_noDataValue;\n};\n\nout vec2 v_texCoord;\n\n#pragma include \"projection\"\n\nvoid main() {\n v_texCoord = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy,0., 1.0));\n}\n";
20
+ const rasterVert = "layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\nlayout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;\nlayout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;\n\nlayout(std140) uniform commonUniforms {\n vec2 u_rminmax;\n vec2 u_gminmax;\n vec2 u_bminmax;\n float u_opacity;\n float u_noDataValue;\n};\n\nout vec2 v_texCoord;\n\n#pragma include \"projection\"\n\nvoid main() {\n v_texCoord = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low);\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0.0, 1.0));\n}\n";
22
21
  class RasterModel extends _BaseModel.default {
23
22
  constructor(...args) {
24
23
  super(...args);
25
24
  (0, _defineProperty2.default)(this, "texture", void 0);
26
25
  (0, _defineProperty2.default)(this, "dataOption", {});
27
26
  }
27
+ get attributeLocation() {
28
+ return Object.assign(super.attributeLocation, {
29
+ MAX: super.attributeLocation.MAX,
30
+ UV: 9
31
+ });
32
+ }
28
33
  getUninforms() {
29
34
  const commoninfo = this.getCommonUniformsInfo();
30
35
  const attributeInfo = this.getUniformsBufferInfo(this.getStyleAttribute());
@@ -112,6 +117,7 @@ class RasterModel extends _BaseModel.default {
112
117
  moduleName: 'rasterImageDataRGBA',
113
118
  vertexShader: rasterVert,
114
119
  fragmentShader: rasterFrag,
120
+ defines: _this2.getDefines(),
115
121
  triangulation: _triangulation.RasterImageTriangulation,
116
122
  primitive: _l7Core.gl.TRIANGLES,
117
123
  depth: {
@@ -133,13 +139,16 @@ class RasterModel extends _BaseModel.default {
133
139
  (_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
134
140
  }
135
141
  registerBuiltinAttributes() {
142
+ // 注册 Position 属性 64 位地位部分,经纬度数据开启双精度,避免大于 22 层级以上出现数据偏移
143
+ this.registerPosition64LowAttribute();
144
+
136
145
  // point layer size;
137
146
  this.styleAttributeService.registerStyleAttribute({
138
147
  name: 'uv',
139
148
  type: _l7Core.AttributeType.Attribute,
140
149
  descriptor: {
141
150
  name: 'a_Uv',
142
- shaderLocation: _CommonStyleAttribute.ShaderLocation.UV,
151
+ shaderLocation: this.attributeLocation.UV,
143
152
  buffer: {
144
153
  // give the WebGL driver a hint that this buffer may change
145
154
  usage: _l7Core.gl.DYNAMIC_DRAW,
@@ -1,6 +1,20 @@
1
1
  import type { IModel, ITexture2D } from '@antv/l7-core';
2
2
  import BaseModel from '../../core/BaseModel';
3
3
  export default class RasterTerrainRGB 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
  protected texture: ITexture2D;
5
19
  protected getCommonUniformsInfo(): {
6
20
  uniformsArray: number[];
@@ -10,17 +10,22 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
10
10
  var _l7Core = require("@antv/l7-core");
11
11
  var _l7Utils = require("@antv/l7-utils");
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/terrain/terrain_rgb_frag.glsl' */
16
15
  const Raster_terrainFrag = "uniform sampler2D u_texture;\nuniform sampler2D u_colorTexture;\n\nlayout(std140) uniform commonUniforms {\n vec4 u_unpack;\n vec2 u_domain;\n float u_opacity;\n float u_noDataValue;\n float u_clampLow;\n float u_clampHigh;\n};\n\nin vec2 v_texCoord;\nout vec4 outputColor;\n\n\nfloat getElevation(vec2 coord, float bias) {\n // Convert encoded elevation value to meters\n vec4 data = texture(SAMPLER_2D(u_texture), coord,bias) * 255.0;\n data.a = -1.0;\n return dot(data, u_unpack);\n}\n\nvec4 getColor(float value) {\n float normalisedValue =(value- u_domain[0]) / (u_domain[1] - u_domain[0]);\n vec2 coord = vec2(normalisedValue, 0);\n return texture(SAMPLER_2D(u_colorTexture), coord);\n}\n\nvoid main() {\n float value = getElevation(v_texCoord,0.0);\n if (value == u_noDataValue) {\n outputColor = vec4(0.0, 0, 0, 0.0);\n } else if ((u_clampLow < 0.5 && value < u_domain[0]) || (u_clampHigh < 0.5 && value > u_domain[1])) {\n outputColor = vec4(0.0, 0, 0, 0.0);\n } else {\n \n outputColor = getColor(value);\n outputColor.a = outputColor.a * u_opacity ;\n if(outputColor.a < 0.01)\n discard;\n }\n}\n";
17
16
  /* babel-plugin-inline-import '../shaders/terrain/terrain_rgb_vert.glsl' */
18
- const Raster_terrainVert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 14) in vec2 a_Uv;\n\nlayout(std140) uniform commonUniforms {\n vec4 u_unpack;\n vec2 u_domain;\n float u_opacity;\n float u_noDataValue;\n float u_clampLow;\n float u_clampHigh;\n};\nout vec2 v_texCoord;\n#pragma include \"projection\"\n\nvoid main() {\n v_texCoord = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy,0., 1.0));\n}\n";
17
+ const Raster_terrainVert = "layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\nlayout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;\n\nlayout(std140) uniform commonUniforms {\n vec4 u_unpack;\n vec2 u_domain;\n float u_opacity;\n float u_noDataValue;\n float u_clampLow;\n float u_clampHigh;\n};\nout vec2 v_texCoord;\n#pragma include \"projection\"\n\nvoid main() {\n v_texCoord = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0.0, 1.0));\n}\n";
19
18
  class RasterTerrainRGB 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
+ UV: 9
27
+ });
28
+ }
24
29
  getCommonUniformsInfo() {
25
30
  const {
26
31
  opacity,
@@ -76,6 +81,7 @@ class RasterTerrainRGB extends _BaseModel.default {
76
81
  moduleName: 'RasterTileDataImage',
77
82
  vertexShader: Raster_terrainVert,
78
83
  fragmentShader: Raster_terrainFrag,
84
+ defines: _this.getDefines(),
79
85
  triangulation: _triangulation.RasterImageTriangulation,
80
86
  primitive: _l7Core.gl.TRIANGLES,
81
87
  depth: {
@@ -96,12 +102,14 @@ class RasterTerrainRGB extends _BaseModel.default {
96
102
  })();
97
103
  }
98
104
  registerBuiltinAttributes() {
105
+ // 注册 Position 属性 64 位地位部分,经纬度数据开启双精度,避免大于 22 层级以上出现数据偏移
106
+ this.registerPosition64LowAttribute();
99
107
  this.styleAttributeService.registerStyleAttribute({
100
108
  name: 'uv',
101
109
  type: _l7Core.AttributeType.Attribute,
102
110
  descriptor: {
103
111
  name: 'a_Uv',
104
- shaderLocation: _CommonStyleAttribute.ShaderLocation.UV,
112
+ shaderLocation: this.attributeLocation.UV,
105
113
  buffer: {
106
114
  usage: _l7Core.gl.DYNAMIC_DRAW,
107
115
  data: [],
@@ -1,6 +1,6 @@
1
-
2
- layout(location = 0) in vec3 a_Position;
3
- 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_UV) in vec2 a_Uv;
4
4
 
5
5
  layout(std140) uniform commonUniforms {
6
6
  vec2 u_domain;
@@ -15,7 +15,7 @@ out vec2 v_texCoord;
15
15
  #pragma include "projection"
16
16
 
17
17
  void main() {
18
- v_texCoord = a_Uv;
19
- vec4 project_pos = project_position(vec4(a_Position, 1.0));
20
- gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy,0., 1.0));
18
+ v_texCoord = a_Uv;
19
+ vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low);
20
+ gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0.0, 1.0));
21
21
  }
@@ -1,13 +1,13 @@
1
-
2
- layout(location = 0) in vec3 a_Position;
3
- 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_UV) in vec2 a_Uv;
4
4
 
5
5
  layout(std140) uniform commonUniforms {
6
- vec2 u_rminmax;
7
- vec2 u_gminmax;
8
- vec2 u_bminmax;
9
- float u_opacity;
10
- float u_noDataValue;
6
+ vec2 u_rminmax;
7
+ vec2 u_gminmax;
8
+ vec2 u_bminmax;
9
+ float u_opacity;
10
+ float u_noDataValue;
11
11
  };
12
12
 
13
13
  out vec2 v_texCoord;
@@ -15,7 +15,7 @@ out vec2 v_texCoord;
15
15
  #pragma include "projection"
16
16
 
17
17
  void main() {
18
- v_texCoord = a_Uv;
19
- vec4 project_pos = project_position(vec4(a_Position, 1.0));
20
- gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy,0., 1.0));
18
+ v_texCoord = a_Uv;
19
+ vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low);
20
+ gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0.0, 1.0));
21
21
  }
@@ -1,19 +1,19 @@
1
- layout(location = 0) in vec3 a_Position;
2
- layout(location = 14) in vec2 a_Uv;
1
+ layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
2
+ layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;
3
3
 
4
4
  layout(std140) uniform commonUniforms {
5
- vec4 u_unpack;
6
- vec2 u_domain;
7
- float u_opacity;
8
- float u_noDataValue;
9
- float u_clampLow;
10
- float u_clampHigh;
5
+ vec4 u_unpack;
6
+ vec2 u_domain;
7
+ float u_opacity;
8
+ float u_noDataValue;
9
+ float u_clampLow;
10
+ float u_clampHigh;
11
11
  };
12
12
  out vec2 v_texCoord;
13
13
  #pragma include "projection"
14
14
 
15
15
  void main() {
16
- v_texCoord = a_Uv;
17
- vec4 project_pos = project_position(vec4(a_Position, 1.0));
18
- gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy,0., 1.0));
16
+ v_texCoord = a_Uv;
17
+ vec4 project_pos = project_position(vec4(a_Position, 1.0));
18
+ gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0.0, 1.0));
19
19
  }
@@ -39,22 +39,6 @@ class BaseTileLayer {
39
39
  latLonBounds,
40
40
  zoom
41
41
  } = this.getCurrentView();
42
- if (this.mapService.version === 'GAODE1.x') {
43
- const {
44
- visible
45
- } = this.parent.getLayerConfig();
46
- if (zoom < 2 && visible) {
47
- this.parent.updateLayerConfig({
48
- visible: false
49
- });
50
- this.layerService.reRender();
51
- } else if (zoom >= 2 && !visible) {
52
- this.parent.updateLayerConfig({
53
- visible: true
54
- });
55
- this.layerService.reRender();
56
- }
57
- }
58
42
  if (this.lastViewStates && this.lastViewStates.zoom === zoom && this.lastViewStates.latLonBounds.toString() === latLonBounds.toString()) {
59
43
  return;
60
44
  }
@@ -39,20 +39,6 @@ export default class ExtrudePolyline {
39
39
  startIndex: number;
40
40
  indexes: number[];
41
41
  };
42
- simpleExtrude_gaode2(points: number[][], originPoints: number[][]): {
43
- positions: number[];
44
- indices: number[];
45
- normals: number[];
46
- startIndex: number;
47
- indexes: number[];
48
- };
49
- extrude_gaode2(points: number[][], originPoints: number[][]): {
50
- positions: number[];
51
- indices: number[];
52
- normals: number[];
53
- startIndex: number;
54
- indexes: number[];
55
- };
56
42
  extrude(points: number[][]): {
57
43
  positions: number[];
58
44
  indices: number[];
@@ -61,7 +47,6 @@ export default class ExtrudePolyline {
61
47
  indexes: number[];
62
48
  };
63
49
  private simpleSegment;
64
- private segment_gaode2;
65
50
  private segment;
66
51
  private extrusions;
67
52
  private lineSegmentDistance;
@@ -102,98 +102,6 @@ class ExtrudePolyline {
102
102
  complex.startIndex = complex.positions.length / 6;
103
103
  return complex;
104
104
  }
105
- simpleExtrude_gaode2(points, originPoints) {
106
- const complex = this.complex;
107
- if (points.length <= 1) {
108
- return complex;
109
- }
110
- this.lastFlip = -1;
111
- this.started = false;
112
- this.normal = null;
113
- this.totalDistance = 0;
114
- // 去除数组里重复的点
115
- // points = getArrayUnique(points);
116
- const total = points.length;
117
- let count = complex.startIndex;
118
- for (let i = 1; i < total; i++) {
119
- var _originPoints$, _originPoints$i$, _originPoints$2;
120
- const last = points[i - 1];
121
- last.push((_originPoints$ = originPoints[i - 1][2]) !== null && _originPoints$ !== void 0 ? _originPoints$ : 0);
122
- // @ts-ignore
123
- const originLast = originPoints[i - 1];
124
- const cur = points[i];
125
- cur.push((_originPoints$i$ = originPoints[i][2]) !== null && _originPoints$i$ !== void 0 ? _originPoints$i$ : 0);
126
- // @ts-ignore
127
- const originCur = originPoints[i];
128
- const next = i < points.length - 1 ? [...points[i + 1], (_originPoints$2 = originPoints[i + 1][2]) !== null && _originPoints$2 !== void 0 ? _originPoints$2 : 0] : null;
129
- const originNext = i < originPoints.length - 1 ? originPoints[i + 1] : null;
130
- const amt = this.simpleSegment(complex, count,
131
- // @ts-ignore
132
- last,
133
- // @ts-ignore
134
- cur,
135
- // @ts-ignore
136
- next,
137
- // @ts-ignore
138
- originLast, originCur,
139
- // @ts-ignore
140
- originNext);
141
- count += amt;
142
- }
143
- if (this.dash) {
144
- for (let i = 0; i < complex.positions.length / 6; i++) {
145
- complex.positions[i * 6 + 5] = this.totalDistance;
146
- }
147
- }
148
- complex.startIndex = complex.positions.length / 6;
149
- return complex;
150
- }
151
- extrude_gaode2(points, originPoints) {
152
- const complex = this.complex;
153
- if (points.length <= 1) {
154
- return complex;
155
- }
156
- this.lastFlip = -1;
157
- this.started = false;
158
- this.normal = null;
159
- this.totalDistance = 0;
160
- // 去除数组里重复的点
161
- // points = getArrayUnique(points);
162
- const total = points.length;
163
- let count = complex.startIndex;
164
- for (let i = 1; i < total; i++) {
165
- var _originPoints$3, _originPoints$i$2, _originPoints$4;
166
- const last = points[i - 1];
167
- last.push((_originPoints$3 = originPoints[i - 1][2]) !== null && _originPoints$3 !== void 0 ? _originPoints$3 : 0);
168
- // @ts-ignore
169
- const originLast = originPoints[i - 1];
170
- const cur = points[i];
171
- cur.push((_originPoints$i$2 = originPoints[i][2]) !== null && _originPoints$i$2 !== void 0 ? _originPoints$i$2 : 0);
172
- // @ts-ignore
173
- const originCur = originPoints[i];
174
- const next = i < points.length - 1 ? [...points[i + 1], (_originPoints$4 = originPoints[i + 1][2]) !== null && _originPoints$4 !== void 0 ? _originPoints$4 : 0] : null;
175
- const originNext = i < originPoints.length - 1 ? originPoints[i + 1] : null;
176
- const amt = this.segment_gaode2(complex, count,
177
- // @ts-ignore
178
- last,
179
- // @ts-ignore
180
- cur,
181
- // @ts-ignore
182
- next,
183
- // @ts-ignore
184
- originLast, originCur,
185
- // @ts-ignore
186
- originNext);
187
- count += amt;
188
- }
189
- if (this.dash) {
190
- for (let i = 0; i < complex.positions.length / 6; i++) {
191
- complex.positions[i * 6 + 5] = this.totalDistance;
192
- }
193
- }
194
- complex.startIndex = complex.positions.length / 6;
195
- return complex;
196
- }
197
105
  extrude(points) {
198
106
  const complex = this.complex;
199
107
  if (points.length <= 1) {
@@ -276,131 +184,6 @@ class ExtrudePolyline {
276
184
  }
277
185
  return count;
278
186
  }
279
- segment_gaode2(complex, index, last, cur, next, originLast, originCur,
280
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
281
- originNext) {
282
- let count = 0;
283
- const indices = complex.indices;
284
- const positions = complex.positions;
285
- const normals = complex.normals;
286
- const capSquare = this.cap === 'square';
287
- const joinBevel = this.join === 'bevel';
288
- const flatCur = (0, _l7Utils.aProjectFlat)([originCur[0], originCur[1]]);
289
- const flatLast = (0, _l7Utils.aProjectFlat)([originLast[0], originLast[1]]);
290
- // @ts-ignore
291
- direction(lineA, cur, last);
292
- let segmentDistance = 0;
293
- if (this.dash) {
294
- // @ts-ignore
295
- segmentDistance = this.lineSegmentDistance(flatCur, flatLast);
296
- this.totalDistance += segmentDistance;
297
- }
298
- if (!this.normal) {
299
- this.normal = _glMatrix.vec2.create();
300
- computeNormal(this.normal, lineA);
301
- }
302
- if (!this.started) {
303
- this.started = true;
304
-
305
- // if the end cap is type square, we can just push the verts out a bit
306
- if (capSquare) {
307
- // vec2.scaleAndAdd(capEnd, last, lineA, -this.thickness);
308
- const out1 = _glMatrix.vec2.create();
309
- const out2 = _glMatrix.vec2.create();
310
- _glMatrix.vec2.add(out1, this.normal, lineA);
311
- _glMatrix.vec2.add(out2, this.normal, lineA);
312
- normals.push(out2[0], out2[1], 0);
313
- normals.push(out1[0], out1[1], 0);
314
- positions.push(last[0], last[1], last[2] | 0, this.totalDistance - segmentDistance, -this.thickness, last[2] | 0);
315
- this.complex.indexes.push(this.currentIndex);
316
- positions.push(last[0], last[1], last[2] | 0, this.totalDistance - segmentDistance, this.thickness, last[2] | 0);
317
- this.complex.indexes.push(this.currentIndex);
318
- this.currentIndex++;
319
- } else {
320
- this.extrusions(positions, normals, last, this.normal, this.thickness, this.totalDistance - segmentDistance);
321
- }
322
- }
323
- indices.push(index + 0, index + 1, index + 2);
324
- if (!next) {
325
- computeNormal(this.normal, lineA);
326
- if (capSquare) {
327
- const out1 = _glMatrix.vec2.create();
328
- const out2 = _glMatrix.vec2.create();
329
- _glMatrix.vec2.sub(out2, lineA, this.normal);
330
- _glMatrix.vec2.add(out1, lineA, this.normal);
331
- normals.push(out2[0], out2[1], 0);
332
- normals.push(out1[0], out1[1], 0);
333
- positions.push(cur[0], cur[1], cur[2] | 0, this.totalDistance, this.thickness, cur[2] | 0);
334
- this.complex.indexes.push(this.currentIndex);
335
- positions.push(cur[0], cur[1], cur[2] | 0, this.totalDistance, this.thickness, cur[2] | 0);
336
- this.complex.indexes.push(this.currentIndex);
337
- this.currentIndex++;
338
- } else {
339
- this.extrusions(positions, normals, cur, this.normal, this.thickness, this.totalDistance);
340
- }
341
- indices.push(...(this.lastFlip === 1 ? [index, index + 2, index + 3] : [index + 2, index + 1, index + 3]));
342
- count += 2;
343
- } else {
344
- // @ts-ignore
345
- if (isPointEqual(cur, next)) {
346
- _glMatrix.vec2.add(
347
- // @ts-ignore
348
- next,
349
- // @ts-ignore
350
- cur, _glMatrix.vec2.normalize(
351
- // @ts-ignore
352
- next,
353
- // @ts-ignore
354
- _glMatrix.vec2.subtract(next, cur, last)));
355
- }
356
- // @ts-ignore
357
- direction(lineB, next, cur);
358
- // stores tangent & miter
359
-
360
- const [miterLen, miter] = computeMiter(tangent, _glMatrix.vec2.create(), lineA, lineB, this.thickness);
361
- // normal(tmp, lineA)
362
-
363
- // get orientation
364
- let flip = _glMatrix.vec2.dot(tangent, this.normal) < 0 ? -1 : 1;
365
- let bevel = joinBevel;
366
- if (!bevel && this.join === 'miter') {
367
- const limit = miterLen;
368
- if (limit > this.miterLimit) {
369
- bevel = true;
370
- }
371
- }
372
- if (bevel) {
373
- normals.push(this.normal[0], this.normal[1], 0);
374
- normals.push(miter[0], miter[1], 0);
375
- positions.push(cur[0], cur[1], cur[2] | 0, this.totalDistance, -this.thickness * flip, cur[2] | 0);
376
- this.complex.indexes.push(this.currentIndex);
377
- positions.push(cur[0], cur[1], cur[2] | 0, this.totalDistance, this.thickness * flip, cur[2] | 0);
378
- this.complex.indexes.push(this.currentIndex);
379
- this.currentIndex++;
380
- indices.push(...(this.lastFlip !== -flip ? [index, index + 2, index + 3] : [index + 2, index + 1, index + 3]));
381
-
382
- // now add the bevel triangle
383
- indices.push(index + 2, index + 3, index + 4);
384
- computeNormal(tmp, lineB);
385
- _glMatrix.vec2.copy(this.normal, tmp); // store normal for next round
386
- normals.push(this.normal[0], this.normal[1], 0);
387
- positions.push(cur[0], cur[1], cur[2] | 0, this.totalDistance, -this.thickness * flip, cur[2] | 0);
388
- this.complex.indexes.push(this.currentIndex);
389
- this.currentIndex++;
390
- count += 3;
391
- } else {
392
- this.extrusions(positions, normals, cur, miter, miterLen, this.totalDistance);
393
- indices.push(...(this.lastFlip === 1 ? [index, index + 2, index + 3] : [index + 2, index + 1, index + 3]));
394
- flip = -1;
395
-
396
- // the miter is now the normal for our next join
397
- _glMatrix.vec2.copy(this.normal, miter);
398
- count += 2;
399
- }
400
- this.lastFlip = flip;
401
- }
402
- return count;
403
- }
404
187
  segment(complex, index, last, cur, next) {
405
188
  let count = 0;
406
189
  const indices = complex.indices;
@@ -1,6 +1,20 @@
1
1
  import type { IModel, IModelUniform, IRenderOptions, ITexture2D } from '@antv/l7-core';
2
2
  import BaseModel from '../../core/BaseModel';
3
3
  export default class WindModel 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
  protected texture: ITexture2D;
5
19
  private colorModel;
6
20
  private wind;
@@ -15,7 +15,7 @@ var _windRender = require("./windRender");
15
15
  /* babel-plugin-inline-import '../shaders/wind_frag.glsl' */
16
16
  const WindFrag = "precision mediump float;\nuniform float u_opacity: 1.0;\nuniform sampler2D u_texture;\nvarying vec2 v_texCoord;\nvoid main() {\n vec4 color = texture2D(u_texture,vec2(v_texCoord.x,v_texCoord.y));\n gl_FragColor = color;\n gl_FragColor.a *= u_opacity;\n}\n";
17
17
  /* babel-plugin-inline-import '../shaders/wind_vert.glsl' */
18
- const WindVert = "precision highp float;\nuniform mat4 u_ModelMatrix;\n\nattribute vec3 a_Position;\nattribute vec2 a_Uv;\nvarying vec2 v_texCoord;\n#pragma include \"projection\"\nvoid main() {\n v_texCoord = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy,0., 1.0));\n}\n";
18
+ const WindVert = "precision highp float;\nuniform mat4 u_ModelMatrix;\n\nlayout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\nlayout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;\n\nvarying vec2 v_texCoord;\n#pragma include \"projection\"\nvoid main() {\n v_texCoord = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0.0, 1.0));\n}\n";
19
19
  const defaultRampColors = {
20
20
  0.0: '#3288bd',
21
21
  0.1: '#66c2a5',
@@ -39,6 +39,12 @@ class WindModel extends _BaseModel.default {
39
39
  (0, _defineProperty2.default)(this, "frequency", new _l7Utils.FrequencyController(7.2));
40
40
  (0, _defineProperty2.default)(this, "cacheZoom", void 0);
41
41
  }
42
+ get attributeLocation() {
43
+ return Object.assign(super.attributeLocation, {
44
+ MAX: super.attributeLocation.MAX,
45
+ UV: 9
46
+ });
47
+ }
42
48
  render(options) {
43
49
  this.drawColorMode(options);
44
50
  // Tip: 控制风场的平均更新频率
@@ -115,6 +121,7 @@ class WindModel extends _BaseModel.default {
115
121
  moduleName: 'wind',
116
122
  vertexShader: WindVert,
117
123
  fragmentShader: WindFrag,
124
+ defines: _this.getDefines(),
118
125
  triangulation: _triangulation.RasterImageTriangulation,
119
126
  primitive: _l7Core.gl.TRIANGLES,
120
127
  depth: {
@@ -153,6 +160,7 @@ class WindModel extends _BaseModel.default {
153
160
  type: _l7Core.AttributeType.Attribute,
154
161
  descriptor: {
155
162
  name: 'a_Uv',
163
+ shaderLocation: this.attributeLocation.UV,
156
164
  buffer: {
157
165
  // give the WebGL driver a hint that this buffer may change
158
166
  usage: _l7Core.gl.DYNAMIC_DRAW,
@@ -1,13 +1,14 @@
1
1
  precision highp float;
2
2
  uniform mat4 u_ModelMatrix;
3
3
 
4
- attribute vec3 a_Position;
5
- attribute vec2 a_Uv;
4
+ layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
5
+ layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;
6
+
6
7
  varying vec2 v_texCoord;
7
8
  #pragma include "projection"
8
9
  void main() {
9
- v_texCoord = a_Uv;
10
- vec4 project_pos = project_position(vec4(a_Position, 1.0));
10
+ v_texCoord = a_Uv;
11
+ vec4 project_pos = project_position(vec4(a_Position, 1.0));
11
12
 
12
- gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy,0., 1.0));
13
+ gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0.0, 1.0));
13
14
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/l7-layers",
3
- "version": "2.21.7",
3
+ "version": "2.21.9-beta.0",
4
4
  "description": "L7's collection of built-in layers",
5
5
  "license": "MIT",
6
6
  "author": "https://github.com/orgs/antvis/people",
@@ -33,10 +33,10 @@
33
33
  "gl-matrix": "^3.1.0",
34
34
  "gl-vec2": "^1.3.0",
35
35
  "polyline-miter-util": "^1.0.1",
36
- "@antv/l7-core": "2.21.7",
37
- "@antv/l7-maps": "2.21.7",
38
- "@antv/l7-source": "2.21.7",
39
- "@antv/l7-utils": "2.21.7"
36
+ "@antv/l7-core": "2.21.9-beta.0",
37
+ "@antv/l7-maps": "2.21.9-beta.0",
38
+ "@antv/l7-source": "2.21.9-beta.0",
39
+ "@antv/l7-utils": "2.21.9-beta.0"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/d3-array": "^2.0.0",
@@ -45,7 +45,7 @@
45
45
  "@types/d3-scale": "^2.1.1",
46
46
  "@types/earcut": "^2.1.0",
47
47
  "@types/gl-matrix": "^2.4.5",
48
- "@antv/l7-test-utils": "^2.21.7"
48
+ "@antv/l7-test-utils": "^2.21.9-beta.0"
49
49
  },
50
50
  "publishConfig": {
51
51
  "access": "public",