@antv/l7-layers 2.21.9-beta.0 → 2.21.9

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 (283) hide show
  1. package/es/citybuliding/models/build.d.ts +0 -16
  2. package/es/citybuliding/models/build.js +20 -18
  3. package/es/citybuliding/shaders/build_frag.glsl +6 -6
  4. package/es/citybuliding/shaders/build_vert.glsl +14 -8
  5. package/es/core/BaseLayer.js +8 -12
  6. package/es/core/BaseModel.d.ts +2 -15
  7. package/es/core/BaseModel.js +62 -94
  8. package/es/core/CommonStyleAttribute.d.ts +18 -14
  9. package/es/core/CommonStyleAttribute.js +67 -23
  10. package/es/core/triangulation.js +39 -13
  11. package/es/earth/models/atmosphere.d.ts +0 -15
  12. package/es/earth/models/atmosphere.js +24 -30
  13. package/es/earth/models/base.d.ts +0 -15
  14. package/es/earth/models/base.js +24 -30
  15. package/es/earth/models/bloomsphere.d.ts +0 -15
  16. package/es/earth/models/bloomsphere.js +24 -30
  17. package/es/earth/shaders/atmosphere/atmosphere_vert.glsl +5 -7
  18. package/es/earth/shaders/base/base_vert.glsl +3 -3
  19. package/es/earth/shaders/bloomshpere/bloomsphere_vert.glsl +4 -5
  20. package/es/geometry/models/billboard.d.ts +0 -15
  21. package/es/geometry/models/billboard.js +8 -14
  22. package/es/geometry/models/plane.d.ts +0 -14
  23. package/es/geometry/models/plane.js +10 -10
  24. package/es/geometry/models/sprite.js +9 -3
  25. package/es/geometry/shaders/billboard_vert.glsl +25 -28
  26. package/es/geometry/shaders/plane_vert.glsl +6 -6
  27. package/es/geometry/shaders/sprite_vert.glsl +9 -7
  28. package/es/heatmap/models/grid.d.ts +0 -14
  29. package/es/heatmap/models/grid.js +3 -10
  30. package/es/heatmap/models/grid3d.d.ts +0 -16
  31. package/es/heatmap/models/grid3d.js +6 -14
  32. package/es/heatmap/models/heatmap.d.ts +1 -20
  33. package/es/heatmap/models/heatmap.js +83 -96
  34. package/es/heatmap/models/hexagon.d.ts +0 -14
  35. package/es/heatmap/models/hexagon.js +3 -9
  36. package/es/heatmap/shaders/grid/grid_vert.glsl +42 -30
  37. package/es/heatmap/shaders/grid3d/grid_3d_vert.glsl +26 -14
  38. package/es/heatmap/shaders/heatmap/heatmap_3d_vert.glsl +16 -19
  39. package/es/heatmap/shaders/heatmap/heatmap_framebuffer_vert.glsl +22 -16
  40. package/es/heatmap/shaders/heatmap/heatmap_vert.glsl +4 -3
  41. package/es/heatmap/shaders/hexagon/hexagon_vert.glsl +23 -13
  42. package/es/image/models/image.d.ts +0 -14
  43. package/es/image/models/image.js +3 -11
  44. package/es/image/shaders/image_vert.glsl +6 -7
  45. package/es/line/models/arc.d.ts +0 -18
  46. package/es/line/models/arc.js +8 -57
  47. package/es/line/models/arc_3d.d.ts +0 -18
  48. package/es/line/models/arc_3d.js +7 -55
  49. package/es/line/models/flow.d.ts +0 -17
  50. package/es/line/models/flow.js +7 -35
  51. package/es/line/models/great_circle.d.ts +0 -17
  52. package/es/line/models/great_circle.js +6 -34
  53. package/es/line/models/line.d.ts +0 -17
  54. package/es/line/models/line.js +8 -17
  55. package/es/line/models/simple_line.d.ts +0 -14
  56. package/es/line/models/simple_line.js +47 -12
  57. package/es/line/models/wall.d.ts +0 -17
  58. package/es/line/models/wall.js +48 -22
  59. package/es/line/shaders/arc/line_arc_vert.glsl +48 -42
  60. package/es/line/shaders/arc3d/line_arc_3d_vert.glsl +20 -15
  61. package/es/line/shaders/flow/flow_line_vert.glsl +48 -30
  62. package/es/line/shaders/greatCircle/line_arc_great_circle_vert.glsl +72 -56
  63. package/es/line/shaders/line/line_vert.glsl +48 -31
  64. package/es/line/shaders/simple/simpleline_vert.glsl +23 -18
  65. package/es/line/shaders/wall/wall_vert.glsl +45 -36
  66. package/es/mask/models/fill.js +1 -2
  67. package/es/mask/shaders/mask_vert.glsl +7 -2
  68. package/es/plugins/DataMappingPlugin.d.ts +1 -0
  69. package/es/plugins/DataMappingPlugin.js +24 -1
  70. package/es/plugins/PixelPickingPlugin.js +2 -2
  71. package/es/plugins/RegisterStyleAttributePlugin.d.ts +1 -0
  72. package/es/plugins/RegisterStyleAttributePlugin.js +25 -3
  73. package/es/plugins/ShaderUniformPlugin.d.ts +5 -0
  74. package/es/plugins/ShaderUniformPlugin.js +34 -2
  75. package/es/point/models/billboard_point.d.ts +0 -14
  76. package/es/point/models/billboard_point.js +3 -11
  77. package/es/point/models/earthExtrude.d.ts +0 -16
  78. package/es/point/models/earthExtrude.js +8 -15
  79. package/es/point/models/earthFill.d.ts +0 -16
  80. package/es/point/models/earthFill.js +5 -13
  81. package/es/point/models/extrude.d.ts +0 -16
  82. package/es/point/models/extrude.js +12 -19
  83. package/es/point/models/fill.d.ts +0 -16
  84. package/es/point/models/fill.js +5 -16
  85. package/es/point/models/fillImage.d.ts +0 -16
  86. package/es/point/models/fillImage.js +16 -16
  87. package/es/point/models/image.d.ts +0 -15
  88. package/es/point/models/image.js +4 -14
  89. package/es/point/models/normal.d.ts +0 -14
  90. package/es/point/models/normal.js +3 -11
  91. package/es/point/models/radar.d.ts +0 -15
  92. package/es/point/models/radar.js +4 -13
  93. package/es/point/models/text.d.ts +0 -16
  94. package/es/point/models/text.js +11 -18
  95. package/es/point/shaders/billboard/billboard_point_vert.glsl +13 -10
  96. package/es/point/shaders/earthExtrude/earthExtrude_vert.glsl +25 -15
  97. package/es/point/shaders/earthFill/earthFill_vert.glsl +6 -6
  98. package/es/point/shaders/extrude/extrude_vert.glsl +39 -35
  99. package/es/point/shaders/fill/fill_vert.glsl +14 -12
  100. package/es/point/shaders/fillImage/fillImage_vert.glsl +28 -16
  101. package/es/point/shaders/image/image_vert.glsl +12 -15
  102. package/es/point/shaders/normal/normal_vert.glsl +10 -7
  103. package/es/point/shaders/radar/radar_vert.glsl +11 -11
  104. package/es/point/shaders/text/text_vert.glsl +9 -10
  105. package/es/polygon/models/extrude.d.ts +0 -16
  106. package/es/polygon/models/extrude.js +26 -26
  107. package/es/polygon/models/extrusion.d.ts +0 -16
  108. package/es/polygon/models/extrusion.js +4 -34
  109. package/es/polygon/models/fill.d.ts +0 -14
  110. package/es/polygon/models/fill.js +4 -12
  111. package/es/polygon/models/ocean.d.ts +0 -14
  112. package/es/polygon/models/ocean.js +6 -11
  113. package/es/polygon/models/water.d.ts +0 -14
  114. package/es/polygon/models/water.js +6 -11
  115. package/es/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +15 -17
  116. package/es/polygon/shaders/extrude/polygon_extrude_vert.glsl +20 -22
  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 +6 -7
  120. package/es/polygon/shaders/fill/fill_vert.glsl +12 -10
  121. package/es/polygon/shaders/ocean/ocean_vert.glsl +4 -3
  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 +0 -14
  126. package/es/raster/models/raster.js +3 -12
  127. package/es/raster/models/rasterRgb.d.ts +0 -14
  128. package/es/raster/models/rasterRgb.js +3 -12
  129. package/es/raster/models/rasterTerrainRgb.d.ts +0 -14
  130. package/es/raster/models/rasterTerrainRgb.js +3 -11
  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 +16 -0
  135. package/es/tile/tile/Tile.d.ts +0 -2
  136. package/es/utils/extrude_polyline.d.ts +15 -0
  137. package/es/utils/extrude_polyline.js +217 -0
  138. package/es/utils/multiPassRender.js +2 -10
  139. package/es/wind/models/wind.d.ts +0 -14
  140. package/es/wind/models/wind.js +1 -9
  141. package/es/wind/shaders/wind_vert.glsl +5 -6
  142. package/lib/citybuliding/models/build.d.ts +0 -16
  143. package/lib/citybuliding/models/build.js +20 -18
  144. package/lib/citybuliding/shaders/build_frag.glsl +6 -6
  145. package/lib/citybuliding/shaders/build_vert.glsl +14 -8
  146. package/lib/core/BaseLayer.js +8 -12
  147. package/lib/core/BaseModel.d.ts +2 -15
  148. package/lib/core/BaseModel.js +60 -92
  149. package/lib/core/CommonStyleAttribute.d.ts +18 -14
  150. package/lib/core/CommonStyleAttribute.js +68 -23
  151. package/lib/core/triangulation.js +39 -13
  152. package/lib/earth/models/atmosphere.d.ts +0 -15
  153. package/lib/earth/models/atmosphere.js +24 -30
  154. package/lib/earth/models/base.d.ts +0 -15
  155. package/lib/earth/models/base.js +24 -30
  156. package/lib/earth/models/bloomsphere.d.ts +0 -15
  157. package/lib/earth/models/bloomsphere.js +24 -30
  158. package/lib/earth/shaders/atmosphere/atmosphere_vert.glsl +5 -7
  159. package/lib/earth/shaders/base/base_vert.glsl +3 -3
  160. package/lib/earth/shaders/bloomshpere/bloomsphere_vert.glsl +4 -5
  161. package/lib/geometry/models/billboard.d.ts +0 -15
  162. package/lib/geometry/models/billboard.js +8 -14
  163. package/lib/geometry/models/plane.d.ts +0 -14
  164. package/lib/geometry/models/plane.js +10 -10
  165. package/lib/geometry/models/sprite.js +9 -3
  166. package/lib/geometry/shaders/billboard_vert.glsl +25 -28
  167. package/lib/geometry/shaders/plane_vert.glsl +6 -6
  168. package/lib/geometry/shaders/sprite_vert.glsl +9 -7
  169. package/lib/heatmap/models/grid.d.ts +0 -14
  170. package/lib/heatmap/models/grid.js +3 -10
  171. package/lib/heatmap/models/grid3d.d.ts +0 -16
  172. package/lib/heatmap/models/grid3d.js +6 -14
  173. package/lib/heatmap/models/heatmap.d.ts +1 -20
  174. package/lib/heatmap/models/heatmap.js +82 -95
  175. package/lib/heatmap/models/hexagon.d.ts +0 -14
  176. package/lib/heatmap/models/hexagon.js +3 -9
  177. package/lib/heatmap/shaders/grid/grid_vert.glsl +42 -30
  178. package/lib/heatmap/shaders/grid3d/grid_3d_vert.glsl +26 -14
  179. package/lib/heatmap/shaders/heatmap/heatmap_3d_vert.glsl +16 -19
  180. package/lib/heatmap/shaders/heatmap/heatmap_framebuffer_vert.glsl +22 -16
  181. package/lib/heatmap/shaders/heatmap/heatmap_vert.glsl +4 -3
  182. package/lib/heatmap/shaders/hexagon/hexagon_vert.glsl +23 -13
  183. package/lib/image/models/image.d.ts +0 -14
  184. package/lib/image/models/image.js +3 -11
  185. package/lib/image/shaders/image_vert.glsl +6 -7
  186. package/lib/line/models/arc.d.ts +0 -18
  187. package/lib/line/models/arc.js +7 -56
  188. package/lib/line/models/arc_3d.d.ts +0 -18
  189. package/lib/line/models/arc_3d.js +7 -55
  190. package/lib/line/models/flow.d.ts +0 -17
  191. package/lib/line/models/flow.js +7 -35
  192. package/lib/line/models/great_circle.d.ts +0 -17
  193. package/lib/line/models/great_circle.js +5 -33
  194. package/lib/line/models/line.d.ts +0 -17
  195. package/lib/line/models/line.js +8 -17
  196. package/lib/line/models/simple_line.d.ts +0 -14
  197. package/lib/line/models/simple_line.js +47 -12
  198. package/lib/line/models/wall.d.ts +0 -17
  199. package/lib/line/models/wall.js +48 -22
  200. package/lib/line/shaders/arc/line_arc_vert.glsl +48 -42
  201. package/lib/line/shaders/arc3d/line_arc_3d_vert.glsl +20 -15
  202. package/lib/line/shaders/flow/flow_line_vert.glsl +48 -30
  203. package/lib/line/shaders/greatCircle/line_arc_great_circle_vert.glsl +72 -56
  204. package/lib/line/shaders/line/line_vert.glsl +48 -31
  205. package/lib/line/shaders/simple/simpleline_vert.glsl +23 -18
  206. package/lib/line/shaders/wall/wall_vert.glsl +45 -36
  207. package/lib/mask/models/fill.js +1 -2
  208. package/lib/mask/shaders/mask_vert.glsl +7 -2
  209. package/lib/plugins/DataMappingPlugin.d.ts +1 -0
  210. package/lib/plugins/DataMappingPlugin.js +23 -0
  211. package/lib/plugins/PixelPickingPlugin.js +1 -1
  212. package/lib/plugins/RegisterStyleAttributePlugin.d.ts +1 -0
  213. package/lib/plugins/RegisterStyleAttributePlugin.js +24 -2
  214. package/lib/plugins/ShaderUniformPlugin.d.ts +5 -0
  215. package/lib/plugins/ShaderUniformPlugin.js +34 -2
  216. package/lib/point/models/billboard_point.d.ts +0 -14
  217. package/lib/point/models/billboard_point.js +3 -11
  218. package/lib/point/models/earthExtrude.d.ts +0 -16
  219. package/lib/point/models/earthExtrude.js +7 -14
  220. package/lib/point/models/earthFill.d.ts +0 -16
  221. package/lib/point/models/earthFill.js +5 -13
  222. package/lib/point/models/extrude.d.ts +0 -16
  223. package/lib/point/models/extrude.js +11 -18
  224. package/lib/point/models/fill.d.ts +0 -16
  225. package/lib/point/models/fill.js +5 -16
  226. package/lib/point/models/fillImage.d.ts +0 -16
  227. package/lib/point/models/fillImage.js +16 -16
  228. package/lib/point/models/image.d.ts +0 -15
  229. package/lib/point/models/image.js +4 -14
  230. package/lib/point/models/normal.d.ts +0 -14
  231. package/lib/point/models/normal.js +3 -11
  232. package/lib/point/models/radar.d.ts +0 -15
  233. package/lib/point/models/radar.js +4 -13
  234. package/lib/point/models/text.d.ts +0 -16
  235. package/lib/point/models/text.js +11 -18
  236. package/lib/point/shaders/billboard/billboard_point_vert.glsl +13 -10
  237. package/lib/point/shaders/earthExtrude/earthExtrude_vert.glsl +25 -15
  238. package/lib/point/shaders/earthFill/earthFill_vert.glsl +6 -6
  239. package/lib/point/shaders/extrude/extrude_vert.glsl +39 -35
  240. package/lib/point/shaders/fill/fill_vert.glsl +14 -12
  241. package/lib/point/shaders/fillImage/fillImage_vert.glsl +28 -16
  242. package/lib/point/shaders/image/image_vert.glsl +12 -15
  243. package/lib/point/shaders/normal/normal_vert.glsl +10 -7
  244. package/lib/point/shaders/radar/radar_vert.glsl +11 -11
  245. package/lib/point/shaders/text/text_vert.glsl +9 -10
  246. package/lib/polygon/models/extrude.d.ts +0 -16
  247. package/lib/polygon/models/extrude.js +25 -25
  248. package/lib/polygon/models/extrusion.d.ts +0 -16
  249. package/lib/polygon/models/extrusion.js +4 -34
  250. package/lib/polygon/models/fill.d.ts +0 -14
  251. package/lib/polygon/models/fill.js +4 -12
  252. package/lib/polygon/models/ocean.d.ts +0 -14
  253. package/lib/polygon/models/ocean.js +6 -11
  254. package/lib/polygon/models/water.d.ts +0 -14
  255. package/lib/polygon/models/water.js +6 -11
  256. package/lib/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +15 -17
  257. package/lib/polygon/shaders/extrude/polygon_extrude_vert.glsl +20 -22
  258. package/lib/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +17 -17
  259. package/lib/polygon/shaders/extrusion/polygon_extrusion_vert.glsl +8 -8
  260. package/lib/polygon/shaders/fill/fill_linear_vert.glsl +6 -7
  261. package/lib/polygon/shaders/fill/fill_vert.glsl +12 -10
  262. package/lib/polygon/shaders/ocean/ocean_vert.glsl +4 -3
  263. package/lib/polygon/shaders/water/polygon_water_vert.glsl +5 -5
  264. package/lib/raster/index.d.ts +1 -1
  265. package/lib/raster/index.js +2 -2
  266. package/lib/raster/models/raster.d.ts +0 -14
  267. package/lib/raster/models/raster.js +3 -12
  268. package/lib/raster/models/rasterRgb.d.ts +0 -14
  269. package/lib/raster/models/rasterRgb.js +3 -12
  270. package/lib/raster/models/rasterTerrainRgb.d.ts +0 -14
  271. package/lib/raster/models/rasterTerrainRgb.js +3 -11
  272. package/lib/raster/shaders/raster/raster_2d_vert.glsl +6 -6
  273. package/lib/raster/shaders/rgb/raster_rgb_vert.glsl +11 -11
  274. package/lib/raster/shaders/terrain/terrain_rgb_vert.glsl +11 -11
  275. package/lib/tile/core/BaseLayer.js +16 -0
  276. package/lib/tile/tile/Tile.d.ts +0 -2
  277. package/lib/utils/extrude_polyline.d.ts +15 -0
  278. package/lib/utils/extrude_polyline.js +217 -0
  279. package/lib/utils/multiPassRender.js +2 -10
  280. package/lib/wind/models/wind.d.ts +0 -14
  281. package/lib/wind/models/wind.js +1 -9
  282. package/lib/wind/shaders/wind_vert.glsl +5 -6
  283. package/package.json +6 -6
@@ -1,21 +1,6 @@
1
1
  import type { IModel, IModelUniform, ITexture2D } from '@antv/l7-core';
2
2
  import BaseModel from '../../core/BaseModel';
3
3
  export default class BillBoardModel 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
- EXTRUDE: number;
17
- UV: number;
18
- };
19
4
  protected texture: ITexture2D;
20
5
  private radian;
21
6
  planeGeometryTriangulation: () => {
@@ -10,10 +10,11 @@ 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");
13
14
  /* babel-plugin-inline-import '../shaders/billboard_frag.glsl' */
14
15
  const planeFrag = "layout(std140) uniform commonUniforms {\n vec2 u_size;\n float u_raisingHeight;\n float u_rotation;\n float u_opacity;\n};\n\nuniform sampler2D u_texture;\n\nin vec2 v_uv;\nout vec4 outputColor;\n\n#pragma include \"picking\"\nvoid main() {\n outputColor = texture(SAMPLER_2D(u_texture), vec2(v_uv.x, 1.0 - v_uv.y));\n outputColor.a *= u_opacity;\n outputColor = filterColor(outputColor);\n}\n";
15
16
  /* babel-plugin-inline-import '../shaders/billboard_vert.glsl' */
16
- const planeVert = "layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\nlayout(location = ATTRIBUTE_LOCATION_EXTRUDE) in vec3 a_Extrude;\nlayout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;\n\nlayout(std140) uniform commonUniforms {\n vec2 u_size;\n float u_raisingHeight;\n float u_rotation;\n float u_opacity;\n};\n\nout vec2 v_uv;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n#pragma include \"rotation_2d\"\nvoid main() {\n vec3 extrude = a_Extrude;\n v_uv = a_Uv;\n float raiseHeight = 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 raiseHeight = u_raisingHeight * mapboxZoomScale;\n }\n\n // \u8BA1\u7B97\u7ECF\u7EAC\u5EA6\u70B9\u4F4D\u5750\u6807\n vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));\n\n // \u8BA1\u7B97\u7ED5 z \u8F74\u65CB\u8F6C\u540E\u7684\u504F\u79FB\n vec2 offsetXY = project_pixel(rotate_matrix(vec2(extrude.x * u_size.x, 0.0), u_rotation));\n // \u7ED5 z \u8F74\u65CB\u8F6C\n float x = project_pos.x + offsetXY.x;\n float y = project_pos.y + offsetXY.y;\n // z \u8F74\u4E0D\u53C2\u4E0E\u65CB\u8F6C\n float z = project_pixel(extrude.y * u_size.y + raiseHeight);\n\n gl_Position = project_common_position_to_clipspace(vec4(x, y, z, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
17
+ const planeVert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 11) in vec3 a_Extrude;\nlayout(location = 14) in vec2 a_Uv;\n\nlayout(std140) uniform commonUniforms {\n vec2 u_size;\n float u_raisingHeight;\n float u_rotation;\n float u_opacity;\n};\n\nout vec2 v_uv;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n#pragma include \"rotation_2d\"\nvoid main() {\n vec3 extrude = a_Extrude;\n v_uv = a_Uv;\n float raiseHeight = 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 raiseHeight = u_raisingHeight * mapboxZoomScale;\n }\n\n // \u8BA1\u7B97\u7ECF\u7EAC\u5EA6\u70B9\u4F4D\u5750\u6807\n vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));\n\n // \u8BA1\u7B97\u7ED5 z \u8F74\u65CB\u8F6C\u540E\u7684\u504F\u79FB\n vec2 offsetXY = project_pixel(rotate_matrix(vec2(extrude.x * u_size.x, 0.0),u_rotation));\n // \u7ED5 z \u8F74\u65CB\u8F6C\n float x = project_pos.x + offsetXY.x;\n float y = project_pos.y + offsetXY.y;\n // z \u8F74\u4E0D\u53C2\u4E0E\u65CB\u8F6C\n float z = project_pixel(extrude.y * u_size.y + raiseHeight);\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(x , y, z , 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
17
18
  class BillBoardModel extends _BaseModel.default {
18
19
  constructor(...args) {
19
20
  super(...args);
@@ -31,13 +32,6 @@ class BillBoardModel extends _BaseModel.default {
31
32
  };
32
33
  });
33
34
  }
34
- get attributeLocation() {
35
- return Object.assign(super.attributeLocation, {
36
- MAX: super.attributeLocation.MAX,
37
- EXTRUDE: 9,
38
- UV: 10
39
- });
40
- }
41
35
  getUninforms() {
42
36
  const commoninfo = this.getCommonUniformsInfo();
43
37
  const attributeInfo = this.getUniformsBufferInfo(this.getStyleAttribute());
@@ -55,11 +49,12 @@ class BillBoardModel extends _BaseModel.default {
55
49
  /**
56
50
  * rotateFlag
57
51
  * DEFAULT 1
58
- * MAPBOX 1
59
- * AMAP -1
52
+ * MAPBOX 1
53
+ * GAODE2.x -1
54
+ * GAODE1.x -1
60
55
  */
61
56
  let rotateFlag = 1;
62
- if (this.mapService.getType() === 'amap') {
57
+ if (this.mapService.version === 'GAODE2.x' || this.mapService.version === 'GAODE1.x') {
63
58
  rotateFlag = -1;
64
59
  }
65
60
  // 控制图标的旋转角度(绕 Z 轴旋转)
@@ -101,7 +96,6 @@ class BillBoardModel extends _BaseModel.default {
101
96
  vertexShader: planeVert,
102
97
  fragmentShader: planeFrag,
103
98
  triangulation: _this.planeGeometryTriangulation,
104
- defines: _this.getDefines(),
105
99
  inject: _this.getInject(),
106
100
  primitive: _l7Core.gl.TRIANGLES,
107
101
  depth: {
@@ -147,7 +141,7 @@ class BillBoardModel extends _BaseModel.default {
147
141
  type: _l7Core.AttributeType.Attribute,
148
142
  descriptor: {
149
143
  name: 'a_Extrude',
150
- shaderLocation: this.attributeLocation.EXTRUDE,
144
+ shaderLocation: _CommonStyleAttribute.ShaderLocation.EXTRUDE,
151
145
  buffer: {
152
146
  usage: _l7Core.gl.DYNAMIC_DRAW,
153
147
  data: [],
@@ -166,7 +160,7 @@ class BillBoardModel extends _BaseModel.default {
166
160
  type: _l7Core.AttributeType.Attribute,
167
161
  descriptor: {
168
162
  name: 'a_Uv',
169
- shaderLocation: this.attributeLocation.UV,
163
+ shaderLocation: _CommonStyleAttribute.ShaderLocation.UV,
170
164
  buffer: {
171
165
  usage: _l7Core.gl.DYNAMIC_DRAW,
172
166
  data: [],
@@ -1,20 +1,6 @@
1
1
  import type { IModel, IModelUniform, ITexture2D } from '@antv/l7-core';
2
2
  import BaseModel from '../../core/BaseModel';
3
3
  export default class PlaneModel 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
- };
18
4
  protected texture: ITexture2D;
19
5
  protected terrainImage: HTMLImageElement;
20
6
  protected terrainImageLoaded: boolean;
@@ -10,11 +10,12 @@ 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");
13
14
  // import { mat4, vec3 } from 'gl-matrix';
14
15
  /* babel-plugin-inline-import '../shaders/plane_frag.glsl' */
15
16
  const planeFrag = "\nuniform sampler2D u_texture;\nlayout(std140) uniform commonUniforms {\n float u_opacity;\n float u_mapFlag;\n float u_terrainClipHeight;\n};\n\nin vec3 v_Color;\nin vec2 v_uv;\nin float v_clip;\nout vec4 outputColor;\n\n#pragma include \"picking\"\nvoid main() {\n // gl_FragColor = vec4(v_Color, u_opacity);\n if(u_mapFlag > 0.0) {\n outputColor = texture(SAMPLER_2D(u_texture), vec2(v_uv.x, 1.0 - v_uv.y));\n outputColor.a *= u_opacity;\n } else {\n // gl_FragColor = vec4(v_uv, 0.0, u_opacity);\n outputColor = vec4(v_Color, u_opacity);\n }\n outputColor.a *= v_clip;\n outputColor = filterColor(outputColor);\n}\n";
16
17
  /* babel-plugin-inline-import '../shaders/plane_vert.glsl' */
17
- const planeVert = "\nlayout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\nlayout(location = ATTRIBUTE_LOCATION_COLOR) in vec3 a_Color;\nlayout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;\n\nlayout(std140) uniform commonUniforms {\n float u_opacity;\n float u_mapFlag;\n float u_terrainClipHeight;\n};\n\nout vec3 v_Color;\nout vec2 v_uv;\nout float v_clip;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\nvoid main() {\n v_Color = a_Color;\n v_uv = a_Uv;\n\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n\n v_clip = 1.0;\n if(a_Position.z < u_terrainClipHeight) {\n v_clip = 0.0;\n }\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, a_Position.z, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
18
+ const planeVert = "\nlayout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec3 a_Color;\nlayout(location = 14) in vec2 a_Uv;\n\nlayout(std140) uniform commonUniforms {\n float u_opacity;\n float u_mapFlag;\n float u_terrainClipHeight;\n};\n\nout vec3 v_Color;\nout vec2 v_uv;\nout float v_clip;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\nvoid main() {\n v_Color = a_Color;\n v_uv = a_Uv;\n \n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n\n v_clip = 1.0;\n if(a_Position.z < u_terrainClipHeight) {\n v_clip = 0.0;\n }\n \n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy, a_Position.z, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
18
19
  class PlaneModel extends _BaseModel.default {
19
20
  constructor(...args) {
20
21
  super(...args);
@@ -46,12 +47,6 @@ class PlaneModel extends _BaseModel.default {
46
47
  };
47
48
  });
48
49
  }
49
- get attributeLocation() {
50
- return Object.assign(super.attributeLocation, {
51
- MAX: super.attributeLocation.MAX,
52
- UV: 10
53
- });
54
- }
55
50
  initPlane(width = 1, height = 1, widthSegments = 1, heightSegments = 1, lng = 120, lat = 30) {
56
51
  // https://github.com/mrdoob/three.js/blob/dev/src/geometries/PlaneGeometry.js
57
52
  const widthHalf = width / 2;
@@ -68,7 +63,13 @@ class PlaneModel extends _BaseModel.default {
68
63
  const y = iy * segmentHeight - heightHalf;
69
64
  for (let ix = 0; ix < gridX1; ix++) {
70
65
  const x = ix * segmentWidth - widthHalf;
71
- positions.push(x + lng, -y + lat, 0);
66
+ if (this.mapService.version === 'GAODE2.x') {
67
+ // @ts-ignore
68
+ const [a, b] = this.mapService.lngLatToCoord([x + lng, -y + lat]);
69
+ positions.push(a, b, 0);
70
+ } else {
71
+ positions.push(x + lng, -y + lat, 0);
72
+ }
72
73
  positions.push(ix / gridX);
73
74
  positions.push(1 - iy / gridY);
74
75
  }
@@ -145,7 +146,6 @@ class PlaneModel extends _BaseModel.default {
145
146
  vertexShader: planeVert,
146
147
  fragmentShader: planeFrag,
147
148
  triangulation: _this.planeGeometryTriangulation,
148
- defines: _this.getDefines(),
149
149
  inject: _this.getInject(),
150
150
  primitive: _l7Core.gl.TRIANGLES,
151
151
  depth: {
@@ -303,7 +303,7 @@ class PlaneModel extends _BaseModel.default {
303
303
  type: _l7Core.AttributeType.Attribute,
304
304
  descriptor: {
305
305
  name: 'a_Uv',
306
- shaderLocation: this.attributeLocation.UV,
306
+ shaderLocation: _CommonStyleAttribute.ShaderLocation.UV,
307
307
  buffer: {
308
308
  // give the WebGL driver a hint that this buffer may change
309
309
  usage: _l7Core.gl.DYNAMIC_DRAW,
@@ -13,7 +13,7 @@ var _BaseModel = _interopRequireDefault(require("../../core/BaseModel"));
13
13
  /* babel-plugin-inline-import '../shaders/sprite_frag.glsl' */
14
14
  const spriteFrag = "\nlayout(std140) uniform commonUniforms {\n float u_opacity;\n float u_mapFlag;\n float u_Scale;\n};\nuniform sampler2D u_texture;\n\nin vec3 v_Color;\nin float v_d;\nout vec4 outputColor;\n\nvoid main() {\n\n if(v_d < 0.0) {\n discard;\n }\n\n if(u_mapFlag > 0.0) {\n outputColor = texture(SAMPLER_2D(u_texture), gl_PointCoord);\n outputColor.a *= u_opacity;\n } else {\n outputColor = vec4(v_Color, u_opacity);\n }\n}\n";
15
15
  /* babel-plugin-inline-import '../shaders/sprite_vert.glsl' */
16
- const spriteVert = "layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\nlayout(location = ATTRIBUTE_LOCATION_COLOR) in vec3 a_Color;\n\nlayout(std140) uniform commonUniforms {\n float u_opacity;\n float u_mapFlag;\n float u_Scale;\n};\n\nout vec3 v_Color;\nout float v_d;\n\n#pragma include \"projection\"\nvoid main() {\n v_Color = a_Color.xyz;\n v_d = a_Position.z;\n\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, a_Position.z, 1.0));\n gl_PointSize = pow(u_Zoom - 1.0, 2.0) * u_Scale;\n}\n";
16
+ const spriteVert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec3 a_Color;\n\nlayout(std140) uniform commonUniforms {\n float u_opacity;\n float u_mapFlag;\n float u_Scale;\n};\n\nout vec3 v_Color;\nout float v_d;\n\n#pragma include \"projection\"\nvoid main() {\n v_Color = a_Color.xyz;\n \n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n\n v_d = a_Position.z;\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy, a_Position.z, 1.0));\ngl_PointSize = pow((u_Zoom - 1.0), 2.0) * u_Scale;\n}\n";
17
17
  var SPRITE_ANIMATE_DIR = /*#__PURE__*/function (SPRITE_ANIMATE_DIR) {
18
18
  SPRITE_ANIMATE_DIR["UP"] = "up";
19
19
  SPRITE_ANIMATE_DIR["DOWN"] = "down";
@@ -99,6 +99,7 @@ class SpriteModel extends _BaseModel.default {
99
99
  initSprite(radius = 10, spriteCount = 100, lng = 120, lat = 30) {
100
100
  const indices = [];
101
101
  const positions = [];
102
+ const mapService = this.mapService;
102
103
  const heightLimit = this.spriteAnimate === SPRITE_ANIMATE_DIR.UP ? -this.spriteTop : this.spriteTop;
103
104
  for (let i = 0; i < spriteCount; i++) {
104
105
  const height = Math.random() * heightLimit;
@@ -112,7 +113,13 @@ class SpriteModel extends _BaseModel.default {
112
113
  const randomY = radius * Math.random();
113
114
  const x = -radius / 2 + randomX;
114
115
  const y = -radius / 2 + randomY;
115
- return [x + lng, -y + lat, z, 0, 0];
116
+ if (mapService.version === 'GAODE2.x') {
117
+ // @ts-ignore
118
+ const [a, b] = mapService.lngLatToCoord([x + lng, -y + lat]);
119
+ return [a, b, z, 0, 0];
120
+ } else {
121
+ return [x + lng, -y + lat, z, 0, 0];
122
+ }
116
123
  }
117
124
  return {
118
125
  indices,
@@ -184,7 +191,6 @@ class SpriteModel extends _BaseModel.default {
184
191
  vertexShader: spriteVert,
185
192
  fragmentShader: spriteFrag,
186
193
  triangulation: _this.planeGeometryTriangulation,
187
- defines: _this.getDefines(),
188
194
  inject: _this.getInject(),
189
195
  primitive: _l7Core.gl.POINTS,
190
196
  depth: {
@@ -1,12 +1,12 @@
1
- layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
2
- layout(location = ATTRIBUTE_LOCATION_EXTRUDE) in vec3 a_Extrude;
3
- layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;
1
+ layout(location = 0) in vec3 a_Position;
2
+ layout(location = 11) in vec3 a_Extrude;
3
+ layout(location = 14) in vec2 a_Uv;
4
4
 
5
5
  layout(std140) uniform commonUniforms {
6
- vec2 u_size;
7
- float u_raisingHeight;
8
- float u_rotation;
9
- float u_opacity;
6
+ vec2 u_size;
7
+ float u_raisingHeight;
8
+ float u_rotation;
9
+ float u_opacity;
10
10
  };
11
11
 
12
12
  out vec2 v_uv;
@@ -15,29 +15,26 @@ out vec2 v_uv;
15
15
  #pragma include "picking"
16
16
  #pragma include "rotation_2d"
17
17
  void main() {
18
- vec3 extrude = a_Extrude;
19
- v_uv = a_Uv;
20
- float raiseHeight = u_raisingHeight;
21
- if (
22
- u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
23
- u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET
24
- ) {
25
- float mapboxZoomScale = 4.0 / pow(2.0, 21.0 - u_Zoom);
26
- raiseHeight = u_raisingHeight * mapboxZoomScale;
27
- }
18
+ vec3 extrude = a_Extrude;
19
+ v_uv = a_Uv;
20
+ float raiseHeight = u_raisingHeight;
21
+ if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
22
+ float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);
23
+ raiseHeight = u_raisingHeight * mapboxZoomScale;
24
+ }
28
25
 
29
- // 计算经纬度点位坐标
30
- vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));
26
+ // 计算经纬度点位坐标
27
+ vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));
31
28
 
32
- // 计算绕 z 轴旋转后的偏移
33
- vec2 offsetXY = project_pixel(rotate_matrix(vec2(extrude.x * u_size.x, 0.0), u_rotation));
34
- // 绕 z 轴旋转
35
- float x = project_pos.x + offsetXY.x;
36
- float y = project_pos.y + offsetXY.y;
37
- // z 轴不参与旋转
38
- float z = project_pixel(extrude.y * u_size.y + raiseHeight);
29
+ // 计算绕 z 轴旋转后的偏移
30
+ vec2 offsetXY = project_pixel(rotate_matrix(vec2(extrude.x * u_size.x, 0.0),u_rotation));
31
+ // 绕 z 轴旋转
32
+ float x = project_pos.x + offsetXY.x;
33
+ float y = project_pos.y + offsetXY.y;
34
+ // z 轴不参与旋转
35
+ float z = project_pixel(extrude.y * u_size.y + raiseHeight);
39
36
 
40
- gl_Position = project_common_position_to_clipspace(vec4(x, y, z, 1.0));
37
+ gl_Position = project_common_position_to_clipspace_v2(vec4(x , y, z , 1.0));
41
38
 
42
- setPickingColor(a_PickingColor);
39
+ setPickingColor(a_PickingColor);
43
40
  }
@@ -1,7 +1,7 @@
1
1
 
2
- layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
3
- layout(location = ATTRIBUTE_LOCATION_COLOR) in vec3 a_Color;
4
- layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;
2
+ layout(location = 0) in vec3 a_Position;
3
+ layout(location = 1) in vec3 a_Color;
4
+ layout(location = 14) in vec2 a_Uv;
5
5
 
6
6
  layout(std140) uniform commonUniforms {
7
7
  float u_opacity;
@@ -18,15 +18,15 @@ out float v_clip;
18
18
  void main() {
19
19
  v_Color = a_Color;
20
20
  v_uv = a_Uv;
21
-
21
+
22
22
  vec4 project_pos = project_position(vec4(a_Position, 1.0));
23
23
 
24
24
  v_clip = 1.0;
25
25
  if(a_Position.z < u_terrainClipHeight) {
26
26
  v_clip = 0.0;
27
27
  }
28
-
29
- gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, a_Position.z, 1.0));
28
+
29
+ gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy, a_Position.z, 1.0));
30
30
 
31
31
  setPickingColor(a_PickingColor);
32
32
  }
@@ -1,5 +1,5 @@
1
- layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
2
- layout(location = ATTRIBUTE_LOCATION_COLOR) in vec3 a_Color;
1
+ layout(location = 0) in vec3 a_Position;
2
+ layout(location = 1) in vec3 a_Color;
3
3
 
4
4
  layout(std140) uniform commonUniforms {
5
5
  float u_opacity;
@@ -12,10 +12,12 @@ out float v_d;
12
12
 
13
13
  #pragma include "projection"
14
14
  void main() {
15
- v_Color = a_Color.xyz;
16
- v_d = a_Position.z;
15
+ v_Color = a_Color.xyz;
16
+
17
+ vec4 project_pos = project_position(vec4(a_Position, 1.0));
17
18
 
18
- vec4 project_pos = project_position(vec4(a_Position, 1.0));
19
- gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, a_Position.z, 1.0));
20
- gl_PointSize = pow(u_Zoom - 1.0, 2.0) * u_Scale;
19
+ v_d = a_Position.z;
20
+
21
+ gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy, a_Position.z, 1.0));
22
+ gl_PointSize = pow((u_Zoom - 1.0), 2.0) * u_Scale;
21
23
  }
@@ -1,20 +1,6 @@
1
1
  import type { IModel, IModelUniform } from '@antv/l7-core';
2
2
  import BaseModel from '../../core/BaseModel';
3
3
  export default class GridModel 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
- POS: number;
17
- };
18
4
  getUninforms(): IModelUniform;
19
5
  protected getCommonUniformsInfo(): {
20
6
  uniformsArray: number[];
@@ -13,14 +13,8 @@ var _triangulation = require("../../core/triangulation");
13
13
  /* babel-plugin-inline-import '../shaders/grid/grid_frag.glsl' */
14
14
  const grid_frag = "in vec4 v_color;\n\n#pragma include \"scene_uniforms\"\n#pragma include \"picking\"\nout vec4 outputColor;\nvoid main() {\n outputColor = v_color;\n outputColor = filterColor(outputColor);\n}\n";
15
15
  /* babel-plugin-inline-import '../shaders/grid/grid_vert.glsl' */
16
- const grid_vert = "layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\nlayout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;\nlayout(location = ATTRIBUTE_LOCATION_POS) in vec3 a_Pos;\n\nlayout(std140) uniform commonUniforms {\n vec2 u_radius;\n float u_opacity;\n float u_coverage;\n float u_angle;\n};\n\nout vec4 v_color;\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"picking\"\n\nvoid main() {\n v_color = a_Color;\n v_color.a *= u_opacity;\n\n mat2 rotationMatrix = mat2(cos(u_angle), sin(u_angle), -sin(u_angle), cos(u_angle));\n vec2 offset = a_Position.xy * u_radius * rotationMatrix * u_coverage;\n\n vec2 lnglat = unProjectFlat(a_Pos.xy + offset);\n vec4 project_pos = project_position(vec4(lnglat, 0, 1.0));\n gl_Position = project_common_position_to_clipspace(project_pos);\n\n setPickingColor(a_PickingColor);\n}\n";
16
+ const grid_vert = "layout(location = 0) in vec3 a_Position;\r\nlayout(location = 1) in vec4 a_Color;\r\nlayout(location = 10) in vec3 a_Pos;\r\n\r\nlayout(std140) uniform commonUniforms {\r\n vec2 u_radius;\r\n float u_opacity;\r\n float u_coverage;\r\n float u_angle;\r\n};\r\n\r\n\r\nout vec4 v_color;\r\n\r\n\r\n#pragma include \"projection\"\r\n#pragma include \"project\"\r\n#pragma include \"picking\"\r\n\r\nvoid main() {\r\n v_color = a_Color;\r\n v_color.a *= u_opacity;\r\n\r\n mat2 rotationMatrix = mat2(cos(u_angle), sin(u_angle), -sin(u_angle), cos(u_angle));\r\n vec2 offset = a_Position.xy * u_radius * rotationMatrix * u_coverage ;\r\n // vec2 lnglat = unProjectFlat(a_Pos.xy + offset);\r\n // vec4 project_pos = project_position(vec4(lnglat, 0, 1.0));\r\n // gl_Position = project_common_position_to_clipspace(project_pos);\r\n\r\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\r\n vec2 lnglat = unProjectFlat(a_Pos.xy + offset);\r\n vec2 customLnglat = customProject(lnglat) - u_sceneCenterMercator; // \u5C06\u7ECF\u7EAC\u5EA6\u8F6C\u6362\u4E3A\u9AD8\u5FB72.0\u9700\u8981\u7684\u5E73\u9762\u5750\u6807\r\n vec4 project_pos = project_position(vec4(customLnglat, 0, 1.0));\r\n gl_Position = u_Mvp * (project_pos);\r\n } else {\r\n vec2 lnglat = unProjectFlat(a_Pos.xy + offset);\r\n vec4 project_pos = project_position(vec4(lnglat, 0, 1.0));\r\n gl_Position = project_common_position_to_clipspace(project_pos);\r\n }\r\n\r\n setPickingColor(a_PickingColor);\r\n}\r\n";
17
17
  class GridModel extends _BaseModel.default {
18
- get attributeLocation() {
19
- return Object.assign(super.attributeLocation, {
20
- MAX: super.attributeLocation.MAX,
21
- POS: 9
22
- });
23
- }
24
18
  getUninforms() {
25
19
  const commoninfo = this.getCommonUniformsInfo();
26
20
  const attributeInfo = this.getUniformsBufferInfo(this.getStyleAttribute());
@@ -56,7 +50,6 @@ class GridModel extends _BaseModel.default {
56
50
  moduleName: 'heatmapGrid',
57
51
  vertexShader: grid_vert,
58
52
  fragmentShader: grid_frag,
59
- defines: _this2.getDefines(),
60
53
  triangulation: _triangulation.HeatmapGridTriangulation,
61
54
  primitive: _l7Core.gl.TRIANGLES,
62
55
  depth: {
@@ -72,7 +65,7 @@ class GridModel extends _BaseModel.default {
72
65
  // 顶点经纬度位置
73
66
  type: _l7Core.AttributeType.Attribute,
74
67
  descriptor: {
75
- shaderLocation: this.attributeLocation.POS,
68
+ shaderLocation: 10,
76
69
  name: 'a_Pos',
77
70
  buffer: {
78
71
  usage: _l7Core.gl.DYNAMIC_DRAW,
@@ -81,7 +74,7 @@ class GridModel extends _BaseModel.default {
81
74
  },
82
75
  size: 3,
83
76
  update: feature => {
84
- const coordinates = feature.coordinates;
77
+ const coordinates = feature.version === 'GAODE2.x' ? feature.originCoordinates : feature.coordinates;
85
78
  return [coordinates[0], coordinates[1], 0];
86
79
  }
87
80
  }
@@ -1,22 +1,6 @@
1
1
  import type { IModel, IModelUniform } from '@antv/l7-core';
2
2
  import BaseModel from '../../core/BaseModel';
3
3
  export default class Grid3DModel 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
- POS: number;
18
- NORMAL: number;
19
- };
20
4
  getUninforms(): IModelUniform;
21
5
  protected getCommonUniformsInfo(): {
22
6
  uniformsArray: number[];
@@ -9,20 +9,13 @@ 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");
12
13
  var _triangulation = require("../../core/triangulation");
13
14
  /* babel-plugin-inline-import '../shaders/grid3d/grid_3d_frag.glsl' */
14
15
  const grid_3d_frag = "in vec4 v_color;\n\nlayout(std140) uniform commonUniforms {\n vec2 u_radius;\n float u_opacity;\n float u_coverage;\n float u_angle;\n};\n\n#pragma include \"scene_uniforms\"\n#pragma include \"picking\"\n\nout vec4 outputColor;\nvoid main() {\n outputColor = v_color;\n outputColor = filterColor(outputColor);\n}\n";
15
16
  /* babel-plugin-inline-import '../shaders/grid3d/grid_3d_vert.glsl' */
16
- const grid_3d_vert = "layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\nlayout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;\nlayout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;\nlayout(location = ATTRIBUTE_LOCATION_POS) in vec3 a_Pos;\nlayout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal;\n\nlayout(std140) uniform commonUniforms {\n vec2 u_radius;\n float u_opacity;\n float u_coverage;\n float u_angle;\n};\n\nout vec4 v_color;\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n mat2 rotationMatrix = mat2(cos(u_angle), sin(u_angle), -sin(u_angle), cos(u_angle));\n vec2 offset = vec2(a_Position.xy * u_radius * rotationMatrix * u_coverage);\n\n vec2 lnglat = unProjectFlat(a_Pos.xy + offset); // \u5B9E\u9645\u7684\u7ECF\u7EAC\u5EA6\n vec4 project_pos = project_position(vec4(lnglat, a_Position.z * a_Size, 1.0));\n\n float lightWeight = calc_lighting(project_pos);\n v_color = vec4(a_Color.rgb * lightWeight, a_Color.w);\n\n gl_Position = project_common_position_to_clipspace(project_pos);\n\n setPickingColor(a_PickingColor);\n}\n";
17
+ const grid_3d_vert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 9) in float a_Size;\nlayout(location = 10) in vec3 a_Pos;\nlayout(location = 13) in vec3 a_Normal;\n\nlayout(std140) uniform commonUniforms {\n vec2 u_radius;\n float u_opacity;\n float u_coverage;\n float u_angle;\n};\n\nout vec4 v_color;\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n mat2 rotationMatrix = mat2(cos(u_angle), sin(u_angle), -sin(u_angle), cos(u_angle));\n vec2 offset =(vec2(a_Position.xy * u_radius * rotationMatrix * u_coverage));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n \n vec2 lnglat = unProjectFlat(a_Pos.xy + offset); // \u7ECF\u7EAC\u5EA6\n vec2 customLnglat = customProject(lnglat) - u_sceneCenterMercator; // \u5C06\u7ECF\u7EAC\u5EA6\u8F6C\u6362\u4E3A\u9AD8\u5FB72.0\u9700\u8981\u7684\u5E73\u9762\u5750\u6807\n vec4 project_pos = project_position(vec4(customLnglat, a_Position.z * a_Size, 1.0));\n\n float lightWeight = calc_lighting(project_pos);\n v_color =vec4(a_Color.rgb*lightWeight, a_Color.w * u_opacity);\n \n gl_Position = u_Mvp * vec4(customLnglat , a_Position.z * a_Size, 1.0);\n } else {\n vec2 lnglat = unProjectFlat(a_Pos.xy + offset); // \u5B9E\u9645\u7684\u7ECF\u7EAC\u5EA6\n vec4 project_pos = project_position(vec4(lnglat, a_Position.z * a_Size, 1.0));\n \n float lightWeight = calc_lighting(project_pos);\n v_color =vec4(a_Color.rgb*lightWeight, a_Color.w);\n \n gl_Position = project_common_position_to_clipspace(project_pos);\n }\n\n setPickingColor(a_PickingColor);\n}\n";
17
18
  class Grid3DModel extends _BaseModel.default {
18
- get attributeLocation() {
19
- return Object.assign(super.attributeLocation, {
20
- MAX: super.attributeLocation.MAX,
21
- SIZE: 9,
22
- POS: 10,
23
- NORMAL: 11
24
- });
25
- }
26
19
  getUninforms() {
27
20
  const commoninfo = this.getCommonUniformsInfo();
28
21
  const attributeInfo = this.getUniformsBufferInfo(this.getStyleAttribute());
@@ -58,7 +51,6 @@ class Grid3DModel extends _BaseModel.default {
58
51
  moduleName: 'heatmapGrid3d',
59
52
  vertexShader: grid_3d_vert,
60
53
  fragmentShader: grid_3d_frag,
61
- defines: _this2.getDefines(),
62
54
  triangulation: _triangulation.PointExtrudeTriangulation,
63
55
  primitive: _l7Core.gl.TRIANGLES,
64
56
  depth: {
@@ -73,7 +65,7 @@ class Grid3DModel extends _BaseModel.default {
73
65
  name: 'size',
74
66
  type: _l7Core.AttributeType.Attribute,
75
67
  descriptor: {
76
- shaderLocation: this.attributeLocation.SIZE,
68
+ shaderLocation: _CommonStyleAttribute.ShaderLocation.SIZE,
77
69
  name: 'a_Size',
78
70
  buffer: {
79
71
  usage: _l7Core.gl.DYNAMIC_DRAW,
@@ -94,7 +86,7 @@ class Grid3DModel extends _BaseModel.default {
94
86
  type: _l7Core.AttributeType.Attribute,
95
87
  descriptor: {
96
88
  name: 'a_Normal',
97
- shaderLocation: this.attributeLocation.NORMAL,
89
+ shaderLocation: _CommonStyleAttribute.ShaderLocation.NORMAL,
98
90
  buffer: {
99
91
  usage: _l7Core.gl.STATIC_DRAW,
100
92
  data: [],
@@ -112,7 +104,7 @@ class Grid3DModel extends _BaseModel.default {
112
104
  type: _l7Core.AttributeType.Attribute,
113
105
  descriptor: {
114
106
  name: 'a_Pos',
115
- shaderLocation: this.attributeLocation.POS,
107
+ shaderLocation: 10,
116
108
  buffer: {
117
109
  usage: _l7Core.gl.DYNAMIC_DRAW,
118
110
  data: [],
@@ -120,7 +112,7 @@ class Grid3DModel extends _BaseModel.default {
120
112
  },
121
113
  size: 3,
122
114
  update: feature => {
123
- const coordinates = feature.coordinates;
115
+ const coordinates = feature.version === 'GAODE2.x' ? feature.originCoordinates : feature.coordinates;
124
116
  return [coordinates[0], coordinates[1], 0];
125
117
  }
126
118
  }
@@ -1,22 +1,6 @@
1
1
  import type { IFramebuffer, IModel, IModelUniform, IRenderOptions, ITexture2D } from '@antv/l7-core';
2
2
  import BaseModel from '../../core/BaseModel';
3
3
  export default class HeatMapModel 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
- UV: number;
18
- DIR: number;
19
- };
20
4
  protected texture: ITexture2D;
21
5
  protected colorTexture: ITexture2D;
22
6
  protected heatmapFramerBuffer: IFramebuffer;
@@ -33,14 +17,11 @@ export default class HeatMapModel extends BaseModel {
33
17
  initModels(): Promise<IModel[]>;
34
18
  buildModels(): Promise<IModel[]>;
35
19
  protected registerBuiltinAttributes(): void;
36
- /**
37
- * 热力图密度图
38
- */
39
20
  private buildHeatMapIntensity;
40
21
  private buildHeatmap;
41
- private build3dHeatMap;
42
22
  private drawIntensityMode;
43
23
  private drawHeatMap;
44
24
  private draw3DHeatMap;
25
+ private build3dHeatMap;
45
26
  private updateColorTexture;
46
27
  }