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

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 +9 -9
@@ -1,13 +1,14 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
2
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
3
  import { AttributeType, gl } from '@antv/l7-core';
4
- import { fp64LowPart, rgb2arr } from '@antv/l7-utils';
4
+ import { rgb2arr } from '@antv/l7-utils';
5
5
  import BaseModel from "../../core/BaseModel";
6
+ import { ShaderLocation } from "../../core/CommonStyleAttribute";
6
7
  import { LineArcTriangulation } from "../../core/triangulation";
7
8
  /* babel-plugin-inline-import '../shaders/greatCircle/line_arc_great_circle_frag.glsl' */
8
9
  const line_arc_frag = "#define LineTypeSolid 0.0\n#define LineTypeDash 1.0\n#define Animate 0.0\n#define LineTexture 1.0\n\nuniform sampler2D u_texture;\nlayout(std140) uniform commonUniorm {\n vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n vec4 u_dash_array: [10.0, 5., 0, 0];\n vec4 u_sourceColor;\n vec4 u_targetColor;\n vec2 u_textSize;\n float segmentNumber;\n float u_line_type: 0.0;\n float u_icon_step: 100;\n float u_line_texture: 0.0;\n float u_textureBlend;\n float u_time;\n float u_linearColor: 0;\n};\n\nin vec4 v_line_data;\nin vec2 v_iconMapUV;\nin vec4 v_dash_array;\nin float v_distance_ratio;\nin vec4 v_color;\n\nout vec4 outputColor;\n#pragma include \"picking\"\n#pragma include \"project\"\n#pragma include \"projection\"\n\nvoid main() {\n\n float animateSpeed = 0.0;\n float d_segmentIndex = v_line_data.g;\n \n // \u8BBE\u7F6E\u5F27\u7EBF\u7684\u5E95\u8272\n if(u_linearColor == 1.0) { // \u4F7F\u7528\u6E10\u53D8\u989C\u8272\n outputColor = mix(u_sourceColor, u_targetColor, d_segmentIndex/segmentNumber);\n outputColor.a *= v_color.a;\n } else { // \u4F7F\u7528 color \u65B9\u6CD5\u4F20\u5165\u7684\u989C\u8272\n outputColor = v_color;\n }\n\n // float blur = 1.- smoothstep(u_blur, 1., length(v_normal.xy));\n // float blur = smoothstep(1.0, u_blur, length(v_normal.xy));\n if(u_line_type == LineTypeDash) {\n float dashLength = mod(v_distance_ratio, v_dash_array.x + v_dash_array.y + v_dash_array.z + v_dash_array.w);\n if(dashLength < v_dash_array.x || (dashLength > (v_dash_array.x + v_dash_array.y) && dashLength < v_dash_array.x + v_dash_array.y + v_dash_array.z)) {\n // \u5B9E\u7EBF\u90E8\u5206\n } else {\n // \u865A\u7EBF\u90E8\u5206\n discard;\n };\n }\n\n // \u8BBE\u7F6E\u5F27\u7EBF\u7684\u52A8\u753B\u6A21\u5F0F\n if(u_animate.x == Animate) {\n animateSpeed = u_time / u_animate.y;\n float alpha =1.0 - fract( mod(1.0- v_distance_ratio, u_animate.z)* (1.0/ u_animate.z) + u_time / u_animate.y);\n alpha = (alpha + u_animate.w -1.0) / u_animate.w;\n alpha = smoothstep(0., 1., alpha);\n outputColor.a *= alpha;\n }\n\n // \u8BBE\u7F6E\u5F27\u7EBF\u7684\u8D34\u56FE\n if(LineTexture == u_line_texture && u_line_type != LineTypeDash) { \n float arcRadio = smoothstep( 0.0, 1.0, (d_segmentIndex / (segmentNumber - 1.0)));\n // float arcRadio = d_segmentIndex / (segmentNumber - 1.0);\n float count = v_line_data.b; // \u8D34\u56FE\u5728\u5F27\u7EBF\u4E0A\u91CD\u590D\u7684\u6570\u91CF\n float u = fract(arcRadio * count - animateSpeed * count);\n // float u = fract(arcRadio * count - animateSpeed);\n if(u_animate.x == Animate) {\n u = outputColor.a/v_color.a;\n }\n\n float v = v_line_data.a; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;\n vec4 pattern = texture(SAMPLER_2D(u_texture), uv);\n \n // \u8BBE\u7F6E\u8D34\u56FE\u548C\u5E95\u8272\u7684\u53E0\u52A0\u6A21\u5F0F\n if(u_textureBlend == 0.0) { // normal\n pattern.a = 0.0;\n outputColor = filterColor(outputColor + pattern);\n } else { // replace\n pattern.a *= v_color.a;\n if(outputColor.a <= 0.0) {\n pattern.a = 0.0;\n }\n outputColor = filterColor(pattern);\n }\n } else {\n outputColor = filterColor(outputColor);\n }\n\n // gl_FragColor = filterColor(gl_FragColor);\n}";
9
10
  /* babel-plugin-inline-import '../shaders/greatCircle/line_arc_great_circle_vert.glsl' */
10
- const line_arc2d_vert = "#define LineTypeSolid (0.0)\n#define LineTypeDash (1.0)\n#define Animate (0.0)\n#define LineTexture (1.0)\n\nlayout(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_INSTANCE) in vec4 a_Instance;\nlayout(location = ATTRIBUTE_LOCATION_INSTANCE_64LOW) in vec4 a_Instance64Low;\nlayout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_iconMapUV;\n\nlayout(std140) uniform commonUniorm {\n vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n vec4 u_dash_array: [10.0, 5., 0, 0];\n vec4 u_sourceColor;\n vec4 u_targetColor;\n vec2 u_textSize;\n float segmentNumber;\n float u_line_type: 0.0;\n float u_icon_step: 100;\n float u_line_texture: 0.0;\n float u_textureBlend;\n float u_time;\n float u_linearColor: 0;\n};\n\nout vec4 v_dash_array;\nout vec4 v_color;\nout vec2 v_iconMapUV;\nout vec4 v_line_data;\nout float v_distance_ratio;\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"picking\"\n\nfloat maps(float value, float start1, float stop1, float start2, float stop2) {\n return start2 + (stop2 - start2) * ((value - start1) / (stop1 - start1));\n}\n\nfloat getSegmentRatio(float index) {\n return index / (segmentNumber - 1.0);\n}\n\nfloat paraboloid(vec2 source, vec2 target, float ratio) {\n vec2 x = mix(source, target, ratio);\n vec2 center = mix(source, target, 0.5);\n float dSourceCenter = distance(source, center);\n float dXCenter = distance(x, center);\n return (dSourceCenter + dXCenter) * (dSourceCenter - dXCenter);\n}\n\nvec3 getPos(vec2 source, vec2 target, float segmentRatio) {\n float vertex_height = paraboloid(source, target, segmentRatio);\n\n return vec3(mix(source, target, segmentRatio), sqrt(max(0.0, vertex_height)));\n}\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size) / 2.0;\n return offset;\n}\nvec2 getNormal(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n return dir_screenspace.xy * sign(offset_direction);\n}\nfloat getAngularDist(vec2 source, vec2 target) {\n vec2 delta = source - target;\n vec2 sin_half_delta = sin(delta / 2.0);\n float a =\n sin_half_delta.y * sin_half_delta.y +\n cos(source.y) * cos(target.y) * sin_half_delta.x * sin_half_delta.x;\n return 2.0 * atan(sqrt(a), sqrt(1.0 - a));\n}\n\nvec2 midPoint(vec2 source, vec2 target) {\n vec2 center = target - source;\n float r = length(center);\n float theta = atan(center.y, center.x);\n float thetaOffset = 0.314;\n float r2 = r / 2.0 / cos(thetaOffset);\n float theta2 = theta + thetaOffset;\n vec2 mid = vec2(r2 * cos(theta2) + source.x, r2 * sin(theta2) + source.y);\n return mid;\n}\nfloat bezier3(vec3 arr, float t) {\n float ut = 1.0 - t;\n return (arr.x * ut + arr.y * t) * ut + (arr.y * ut + arr.z * t) * t;\n}\n\nvec2 interpolate(vec2 source, vec2 target, float angularDist, float t) {\n if (abs(angularDist - PI) < 0.001) {\n return (1.0 - t) * source + t * target;\n }\n float a = sin((1.0 - t) * angularDist) / sin(angularDist);\n float b = sin(t * angularDist) / sin(angularDist);\n vec2 sin_source = sin(source);\n vec2 cos_source = cos(source);\n vec2 sin_target = sin(target);\n vec2 cos_target = cos(target);\n float x = a * cos_source.y * cos_source.x + b * cos_target.y * cos_target.x;\n float y = a * cos_source.y * sin_source.x + b * cos_target.y * sin_target.x;\n float z = a * sin_source.y + b * sin_target.y;\n return vec2(atan(y, x), atan(z, sqrt(x * x + y * y)));\n\n}\n\nvoid main() {\n v_color = a_Color;\n v_color.a = v_color.a * opacity;\n vec2 source = radians(a_Instance.rg);\n vec2 target = radians(a_Instance.ba);\n float angularDist = getAngularDist(source, target);\n float segmentIndex = a_Position.x;\n float segmentRatio = getSegmentRatio(segmentIndex);\n float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));\n\n if (u_line_type == LineTypeDash) {\n v_distance_ratio = segmentIndex / segmentNumber;\n float total_Distance = pixelDistance(source, target) / 2.0 * PI;\n total_Distance = total_Distance * 16.0; // total_Distance*16.0 \u8C03\u6574\u9ED8\u8BA4\u7684\u6548\u679C\n v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / total_Distance;\n }\n\n if (u_animate.x == Animate) {\n v_distance_ratio = segmentIndex / segmentNumber;\n }\n\n float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);\n v_distance_ratio = segmentIndex / segmentNumber;\n\n vec4 curr = project_position(vec4(degrees(interpolate(source, target, angularDist, segmentRatio)), 0.0, 1.0), a_Instance64Low.xy);\n vec4 next = project_position(vec4(degrees(interpolate(source, target, angularDist, nextSegmentRatio)), 0.0, 1.0), a_Instance64Low.zw);\n\n // v_normal = getNormal((next.xy - curr.xy) * indexDir, a_Position.y);\n vec2 offset = project_pixel(getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y));\n // vec4 project_pos = project_position(vec4(curr.xy, 0, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(curr.xy + offset, curr.z, 1.0));\n\n v_line_data.g = a_Position.x; // \u8BE5\u9876\u70B9\u5728\u5F27\u7EBF\u4E0A\u7684\u5206\u6BB5\u6392\u5E8F\n if (LineTexture == u_line_texture) {\n float d_arcDistrance = length(source - target);\n if (\n u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||\n u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET\n ) {\n // mapbox\n d_arcDistrance = project_pixel_allmap(d_arcDistrance);\n }\n float d_pixelLen = project_pixel(u_icon_step) / 8.0;\n v_line_data.b = floor(d_arcDistrance / d_pixelLen); // \u8D34\u56FE\u5728\u5F27\u7EBF\u4E0A\u91CD\u590D\u7684\u6570\u91CF\n\n float lineOffsetWidth = length(offset + offset * sign(a_Position.y)); // \u7EBF\u6A2A\u5411\u504F\u79FB\u7684\u8DDD\u79BB\n float linePixelSize = project_pixel(a_Size); // \u5B9A\u70B9\u4F4D\u7F6E\u504F\u79FB\uFF0C\u6309\u5730\u56FE\u7B49\u7EA7\u7F29\u653E\u540E\u7684\u8DDD\u79BB\n v_line_data.a = lineOffsetWidth / linePixelSize; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n v_iconMapUV = a_iconMapUV;\n }\n\n gl_Position = project_common_position_to_clipspace(vec4(curr.xy + offset, 0, 1.0));\n setPickingColor(a_PickingColor);\n}\n\n";
11
+ const line_arc2d_vert = "#define LineTypeSolid 0.0\n#define LineTypeDash 1.0\n#define Animate 0.0\n#define LineTexture 1.0\n\nlayout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 9) in float a_Size;\nlayout(location = 12) in vec4 a_Instance;\nlayout(location = 14) in vec2 a_iconMapUV;\n\nlayout(std140) uniform commonUniorm {\n vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n vec4 u_dash_array: [10.0, 5., 0, 0];\n vec4 u_sourceColor;\n vec4 u_targetColor;\n vec2 u_textSize;\n float segmentNumber;\n float u_line_type: 0.0;\n float u_icon_step: 100;\n float u_line_texture: 0.0;\n float u_textureBlend;\n float u_time;\n float u_linearColor: 0;\n};\n\nout vec4 v_dash_array;\nout vec4 v_color;\nout vec2 v_iconMapUV;\nout vec4 v_line_data;\nout float v_distance_ratio;\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"picking\"\n\nfloat maps (float value, float start1, float stop1, float start2, float stop2) {\n return start2 + (stop2 - start2) * ((value - start1) / (stop1 - start1));\n}\n\nfloat getSegmentRatio(float index) {\n return index / (segmentNumber - 1.);\n}\n\nfloat paraboloid(vec2 source, vec2 target, float ratio) {\n vec2 x = mix(source, target, ratio);\n vec2 center = mix(source, target, 0.5);\n float dSourceCenter = distance(source, center);\n float dXCenter = distance(x, center);\n return (dSourceCenter + dXCenter) * (dSourceCenter - dXCenter);\n}\n\nvec3 getPos(vec2 source, vec2 target, float segmentRatio) {\n float vertex_height = paraboloid(source, target, segmentRatio);\n\n return vec3(\n mix(source, target, segmentRatio),\n sqrt(max(0.0, vertex_height))\n );\n}\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size)/ 2.0;\n return offset;\n}\nvec2 getNormal(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n return reverse_offset_normal(vec3(dir_screenspace,1.0)).xy * sign(offset_direction);\n}\nfloat getAngularDist (vec2 source, vec2 target) {\n vec2 delta = source - target;\n vec2 sin_half_delta = sin(delta / 2.0);\n float a =\n sin_half_delta.y * sin_half_delta.y +\n cos(source.y) * cos(target.y) *\n sin_half_delta.x * sin_half_delta.x;\n return 2.0 * atan(sqrt(a), sqrt(1.0 - a));\n}\n\nvec2 midPoint(vec2 source, vec2 target) {\n vec2 center = target - source;\n float r = length(center);\n float theta = atan(center.y, center.x);\n float thetaOffset = 0.314;\n float r2 = r / 2.0 / cos(thetaOffset);\n float theta2 = theta + thetaOffset;\n vec2 mid = vec2(r2*cos(theta2) + source.x, r2*sin(theta2) + source.y);\n return mid;\n}\nfloat bezier3(vec3 arr, float t) {\n float ut = 1. - t;\n return (arr.x * ut + arr.y * t) * ut + (arr.y * ut + arr.z * t) * t;\n}\n\nvec2 interpolate (vec2 source, vec2 target, float angularDist, float t) {\n // if the angularDist is PI, linear interpolation is applied. otherwise, use spherical interpolation\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n vec2 mid = midPoint(source, target);\n vec3 x = vec3(source.x, mid.x, target.x);\n vec3 y = vec3(source.y, mid.y, target.y);\n return vec2(bezier3(x ,t), bezier3(y,t));\n }\n else {\n if(abs(angularDist - PI) < 0.001) {\n return (1.0 - t) * source + t * target;\n }\n float a = sin((1.0 - t) * angularDist) / sin(angularDist);\n float b = sin(t * angularDist) / sin(angularDist);\n vec2 sin_source = sin(source);\n vec2 cos_source = cos(source);\n vec2 sin_target = sin(target);\n vec2 cos_target = cos(target);\n float x = a * cos_source.y * cos_source.x + b * cos_target.y * cos_target.x;\n float y = a * cos_source.y * sin_source.x + b * cos_target.y * sin_target.x;\n float z = a * sin_source.y + b * sin_target.y;\n return vec2(atan(y, x), atan(z, sqrt(x * x + y * y)));\n }\n}\n\nvoid main() {\n v_color = a_Color;\n v_color.a = v_color.a * opacity;\n vec2 source = radians(a_Instance.rg);\n vec2 target = radians(a_Instance.ba);\n float angularDist = getAngularDist(source, target);\n float segmentIndex = a_Position.x;\n float segmentRatio = getSegmentRatio(segmentIndex);\n float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));\n\n if(u_line_type == LineTypeDash) {\n v_distance_ratio = segmentIndex / segmentNumber;\n vec2 s = source;\n vec2 t = target;\n \n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n s = unProjCustomCoord(source);\n t = unProjCustomCoord(target);\n }\n float total_Distance = pixelDistance(s, t) / 2.0 * PI;\n total_Distance = total_Distance*16.0; // total_Distance*16.0 \u8C03\u6574\u9ED8\u8BA4\u7684\u6548\u679C\n v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / total_Distance;\n }\n\n if(u_animate.x == Animate) {\n v_distance_ratio = segmentIndex / segmentNumber;\n }\n\n float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);\n v_distance_ratio = segmentIndex / segmentNumber;\n vec4 curr = project_position(vec4(degrees(interpolate(source, target, angularDist, segmentRatio)), 0.0, 1.0));\n vec4 next = project_position(vec4(degrees(interpolate(source, target, angularDist, nextSegmentRatio)), 0.0, 1.0));\n // v_normal = getNormal((next.xy - curr.xy) * indexDir, a_Position.y);\n vec2 offset = project_pixel(getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y));\n // vec4 project_pos = project_position(vec4(curr.xy, 0, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(curr.xy + offset, curr.z, 1.0));\n\n v_line_data.g = a_Position.x; // \u8BE5\u9876\u70B9\u5728\u5F27\u7EBF\u4E0A\u7684\u5206\u6BB5\u6392\u5E8F\n if(LineTexture == u_line_texture) { // \u5F00\u542F\u8D34\u56FE\u6A21\u5F0F \n // float mapZoomScale = u_CoordinateSystem !== COORDINATE_SYSTEM_P20_2?10000000.0:1.0;\n float d_arcDistrance = length(source - target);\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20) { // amap\n d_arcDistrance = d_arcDistrance * 1000000.0;\n }\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) { // mapbox\n d_arcDistrance = project_pixel_allmap(d_arcDistrance);\n }\n float d_pixelLen = project_pixel(u_icon_step)/8.0;\n v_line_data.b = floor(d_arcDistrance/d_pixelLen); // \u8D34\u56FE\u5728\u5F27\u7EBF\u4E0A\u91CD\u590D\u7684\u6570\u91CF\n\n float lineOffsetWidth = length(offset + offset * sign(a_Position.y)); // \u7EBF\u6A2A\u5411\u504F\u79FB\u7684\u8DDD\u79BB\n float linePixelSize = project_pixel(a_Size); // \u5B9A\u70B9\u4F4D\u7F6E\u504F\u79FB\uFF0C\u6309\u5730\u56FE\u7B49\u7EA7\u7F29\u653E\u540E\u7684\u8DDD\u79BB\n v_line_data.a = lineOffsetWidth/linePixelSize; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n v_iconMapUV = a_iconMapUV;\n }\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(curr.xy + offset, 0, 1.0));\n setPickingColor(a_PickingColor);\n}\n\n";
11
12
  const lineStyleObj = {
12
13
  solid: 0.0,
13
14
  dash: 1.0
@@ -38,15 +39,6 @@ export default class GreatCircleModel extends BaseModel {
38
39
  this.textures = [this.texture];
39
40
  });
40
41
  }
41
- get attributeLocation() {
42
- return Object.assign(super.attributeLocation, {
43
- MAX: super.attributeLocation.MAX,
44
- SIZE: 9,
45
- INSTANCE: 10,
46
- INSTANCE_64LOW: 11,
47
- UV: 12
48
- });
49
- }
50
42
  getCommonUniformsInfo() {
51
43
  const {
52
44
  sourceColor,
@@ -139,7 +131,6 @@ export default class GreatCircleModel extends BaseModel {
139
131
  styleOption: {
140
132
  segmentNumber
141
133
  },
142
- defines: _this2.getDefines(),
143
134
  inject: _this2.getInject(),
144
135
  depth: {
145
136
  enable: false
@@ -154,7 +145,7 @@ export default class GreatCircleModel extends BaseModel {
154
145
  type: AttributeType.Attribute,
155
146
  descriptor: {
156
147
  name: 'a_Size',
157
- shaderLocation: this.attributeLocation.SIZE,
148
+ shaderLocation: ShaderLocation.SIZE,
158
149
  buffer: {
159
150
  // give the WebGL driver a hint that this buffer may change
160
151
  usage: gl.DYNAMIC_DRAW,
@@ -176,7 +167,7 @@ export default class GreatCircleModel extends BaseModel {
176
167
  type: AttributeType.Attribute,
177
168
  descriptor: {
178
169
  name: 'a_Instance',
179
- shaderLocation: this.attributeLocation.INSTANCE,
170
+ shaderLocation: 12,
180
171
  buffer: {
181
172
  usage: gl.STATIC_DRAW,
182
173
  data: [],
@@ -188,31 +179,12 @@ export default class GreatCircleModel extends BaseModel {
188
179
  }
189
180
  }
190
181
  });
191
-
192
- // save low part for enabled double precision INSTANCE attribute
193
- this.styleAttributeService.registerStyleAttribute({
194
- name: 'instance64Low',
195
- type: AttributeType.Attribute,
196
- descriptor: {
197
- name: 'a_Instance64Low',
198
- shaderLocation: this.attributeLocation.INSTANCE_64LOW,
199
- buffer: {
200
- usage: gl.STATIC_DRAW,
201
- data: [],
202
- type: gl.FLOAT
203
- },
204
- size: 4,
205
- update: (feature, featureIdx, vertex) => {
206
- return [fp64LowPart(vertex[3]), fp64LowPart(vertex[4]), fp64LowPart(vertex[5]), fp64LowPart(vertex[6])];
207
- }
208
- }
209
- });
210
182
  this.styleAttributeService.registerStyleAttribute({
211
183
  name: 'uv',
212
184
  type: AttributeType.Attribute,
213
185
  descriptor: {
214
186
  name: 'a_iconMapUV',
215
- shaderLocation: this.attributeLocation.UV,
187
+ shaderLocation: 14,
216
188
  buffer: {
217
189
  // give the WebGL driver a hint that this buffer may change
218
190
  usage: gl.DYNAMIC_DRAW,
@@ -1,23 +1,6 @@
1
1
  import type { IModel, ITexture2D } from '@antv/l7-core';
2
2
  import BaseModel from '../../core/BaseModel';
3
3
  export default class LineModel 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
- DISTANCE_INDEX: number;
18
- NORMAL: number;
19
- UV: number;
20
- };
21
4
  private textureEventFlag;
22
5
  protected texture: ITexture2D;
23
6
  protected getCommonUniformsInfo(): {
@@ -5,10 +5,11 @@ import { rgb2arr } from '@antv/l7-utils';
5
5
  import BaseModel from "../../core/BaseModel";
6
6
  import { LinearDir, TextureBlend } from "../../core/interface";
7
7
  import { LineTriangulation } from "../../core/triangulation";
8
+ import { ShaderLocation } from "../../core/CommonStyleAttribute";
8
9
  /* babel-plugin-inline-import '../shaders/line/line_frag.glsl' */
9
10
  const line_frag = "// #extension GL_OES_standard_derivatives : enable\n#define Animate 0.0\n#define LineTexture 1.0\n\nuniform sampler2D u_texture;\nlayout(std140) uniform commonUniorm {\n vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n vec4 u_dash_array;\n vec4 u_blur;\n vec4 u_sourceColor;\n vec4 u_targetColor;\n vec2 u_textSize;\n float u_icon_step: 100;\n float u_heightfixed: 0.0;\n float u_vertexScale: 1.0;\n float u_raisingHeight: 0.0;\n float u_strokeWidth: 0.0;\n float u_textureBlend;\n float u_line_texture;\n float u_linearDir: 1.0;\n float u_linearColor: 0;\n float u_time;\n};\n\nin vec4 v_color;\nin vec4 v_stroke;\n// dash\nin vec4 v_dash_array;\nin float v_d_distance_ratio;\nin vec2 v_iconMapUV;\nin vec4 v_texture_data;\n\nout vec4 outputColor;\n#pragma include \"picking\"\n\n// [animate, duration, interval, trailLength],\nvoid main() {\n if(u_dash_array!=vec4(0.0)){\n float dashLength = mod(v_d_distance_ratio, v_dash_array.x + v_dash_array.y + v_dash_array.z + v_dash_array.w);\n if(!(dashLength < v_dash_array.x || (dashLength > (v_dash_array.x + v_dash_array.y) && dashLength < v_dash_array.x + v_dash_array.y + v_dash_array.z))) {\n // \u865A\u7EBF\u90E8\u5206\n discard;\n };\n }\n float animateSpeed = 0.0; // \u8FD0\u52A8\u901F\u5EA6\n float d_distance_ratio = v_texture_data.r; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n if(u_linearDir < 1.0) {\n d_distance_ratio = v_texture_data.a;\n }\n if(u_linearColor == 1.0) { // \u4F7F\u7528\u6E10\u53D8\u989C\u8272\n outputColor = mix(u_sourceColor, u_targetColor, d_distance_ratio);\n outputColor.a *= v_color.a;\n } else { // \u4F7F\u7528 color \u65B9\u6CD5\u4F20\u5165\u7684\u989C\u8272\n outputColor = v_color;\n }\n // anti-alias\n // float blur = 1.0 - smoothstep(u_blur, 1., length(v_normal.xy));\n if(u_animate.x == Animate) {\n animateSpeed = u_time / u_animate.y;\n float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_animate.z)* (1.0/ u_animate.z) + animateSpeed);\n alpha = (alpha + u_animate.w -1.0) / u_animate.w;\n alpha = smoothstep(0., 1., alpha);\n outputColor.a *= alpha;\n }\n\n if(u_line_texture == LineTexture) { // while load texture\n float aDistance = v_texture_data.g; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n float d_texPixelLen = v_texture_data.b; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n float u = fract(mod(aDistance, d_texPixelLen)/d_texPixelLen - animateSpeed);\n float v = v_texture_data.a; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n // v = max(smoothstep(0.95, 1.0, v), v);\n vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;\n vec4 pattern = texture(SAMPLER_2D(u_texture), uv);\n\n if(u_textureBlend == 0.0) { // normal\n pattern.a = 0.0;\n outputColor += pattern;\n } else { // replace\n pattern.a *= v_color.a;\n if(outputColor.a <= 0.0) {\n pattern.a = 0.0;\n }\n outputColor = pattern;\n }\n } \n\n float v = v_texture_data.a;\n float strokeWidth = min(0.5, u_strokeWidth);\n // \u7ED8\u5236 border\n if(strokeWidth > 0.01) {\n float borderOuterWidth = strokeWidth / 2.0;\n\n\n if(v >= 1.0 - strokeWidth || v <= strokeWidth) {\n if(v > strokeWidth) { // \u5916\u4FA7\n float linear = smoothstep(0.0, 1.0, (v - (1.0 - strokeWidth))/strokeWidth);\n // float linear = step(0.0, (v - (1.0 - borderWidth))/borderWidth);\n outputColor.rgb = mix(outputColor.rgb, v_stroke.rgb, linear);\n } else if(v <= strokeWidth) {\n float linear = smoothstep(0.0, 1.0, v/strokeWidth);\n outputColor.rgb = mix(v_stroke.rgb, outputColor.rgb, linear);\n }\n }\n\n if(v < borderOuterWidth) {\n outputColor.a = mix(0.0, outputColor.a, v/borderOuterWidth);\n } else if(v > 1.0 - borderOuterWidth) {\n outputColor.a = mix(outputColor.a, 0.0, (v - (1.0 - borderOuterWidth))/borderOuterWidth);\n }\n }\n\n // blur\n float blurV = v_texture_data.a;\n if(blurV < 0.5) {\n outputColor.a *= mix(u_blur.r, u_blur.g, blurV/0.5);\n } else {\n outputColor.a *= mix(u_blur.g, u_blur.b, (blurV - 0.5)/0.5);\n }\n \n outputColor = filterColor(outputColor);\n}\n";
10
11
  /* babel-plugin-inline-import '../shaders/line/line_vert.glsl' */
11
- const line_vert = "#define Animate (0.0)\n\nlayout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\nlayout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;\nlayout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;\nlayout(location = ATTRIBUTE_LOCATION_SIZE) in vec2 a_Size;\nlayout(location = ATTRIBUTE_LOCATION_DISTANCE_INDEX) in vec3 a_DistanceAndIndexAndMiter;\nlayout(location = ATTRIBUTE_LOCATION_NORMAL) in vec4 a_Normal_Total_Distance;\nlayout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_iconMapUV;\n\nlayout(std140) uniform commonUniorm {\n vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n vec4 u_dash_array;\n vec4 u_blur;\n vec4 u_sourceColor;\n vec4 u_targetColor;\n vec2 u_textSize;\n float u_icon_step: 100;\n float u_heightfixed: 0.0;\n float u_vertexScale: 1.0;\n float u_raisingHeight: 0.0;\n float u_strokeWidth: 0.0;\n float u_textureBlend;\n float u_line_texture;\n float u_linearDir: 1.0;\n float u_linearColor: 0;\n float u_time;\n};\n\nout vec4 v_color;\nout vec4 v_stroke;\n//dash\nout vec4 v_dash_array;\nout float v_d_distance_ratio;\n// texV \u7EBF\u56FE\u5C42 - \u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\uFF08\u7EBF\u7684\u5BBD\u5EA6\u65B9\u5411\uFF09\nout vec2 v_iconMapUV;\nout vec4 v_texture_data;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n vec2 a_DistanceAndIndex = a_DistanceAndIndexAndMiter.xy;\n float a_Miter = a_DistanceAndIndexAndMiter.z;\n vec3 a_Normal = a_Normal_Total_Distance.xyz;\n float a_Total_Distance = a_Normal_Total_Distance.w;\n //dash\u8F93\u51FA\n v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / a_Total_Distance;\n v_d_distance_ratio = a_DistanceAndIndex.x / a_Total_Distance;\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n float d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n v_iconMapUV = a_iconMapUV;\n d_texPixelLen = project_float_pixel(u_icon_step);\n\n v_color = a_Color;\n v_color.a *= opacity;\n v_stroke = stroke;\n\n vec3 size = a_Miter * setPickingSize(a_Size.x) * a_Normal;\n\n vec2 offset = project_pixel(size.xy);\n\n float lineDistance = a_DistanceAndIndex.x;\n float currentLinePointRatio = lineDistance / a_Total_Distance;\n\n float lineOffsetWidth = length(offset + offset * sign(a_Miter)); // \u7EBF\u6A2A\u5411\u504F\u79FB\u7684\u8DDD\u79BB\uFF08\u5411\u4E24\u4FA7\u504F\u79FB\u7684\u548C\uFF09\n float linePixelSize = project_pixel(a_Size.x) * 2.0; // \u5B9A\u70B9\u4F4D\u7F6E\u504F\u79FB\uFF0C\u6309\u5730\u56FE\u7B49\u7EA7\u7F29\u653E\u540E\u7684\u8DDD\u79BB \u5355\u4FA7 * 2\n float texV = lineOffsetWidth / linePixelSize; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n v_texture_data = vec4(currentLinePointRatio, lineDistance, d_texPixelLen, texV);\n // \u8BBE\u7F6E\u6570\u636E\u96C6\u7684\u53C2\u6570\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0), a_Position64Low);\n\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, a_Size.y, 1.0));\n\n float h = float(a_Position.z) * u_vertexScale; // \u7EBF\u9876\u70B9\u7684\u9AD8\u5EA6 - \u517C\u5BB9\u4E0D\u5B58\u5728\u7B2C\u4E09\u4E2A\u6570\u503C\u7684\u60C5\u51B5 vertex height\n float lineHeight = a_Size.y; // size \u7B2C\u4E8C\u4E2A\u53C2\u6570\u4EE3\u8868\u7684\u9AD8\u5EA6 [linewidth, lineheight]\n\n // \u517C\u5BB9 mapbox \u5728\u7EBF\u9AD8\u5EA6\u4E0A\u7684\u6548\u679C\u8868\u73B0\u57FA\u672C\u4E00\u81F4\n if (\n u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||\n u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET\n ) {\n // mapbox\n // \u4FDD\u6301\u9AD8\u5EA6\u76F8\u5BF9\u4E0D\u53D8\n float mapboxZoomScale = 4.0 / pow(2.0, 21.0 - u_Zoom);\n h *= mapboxZoomScale;\n h += u_raisingHeight * mapboxZoomScale;\n if (u_heightfixed > 0.0) {\n lineHeight *= mapboxZoomScale;\n }\n }\n\n gl_Position = project_common_position_to_clipspace(\n vec4(project_pos.xy + offset, lineHeight + h, 1.0)\n );\n\n setPickingColor(a_PickingColor);\n}\n";
12
+ const line_vert = "\n#define Animate 0.0\n\nlayout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 9) in vec2 a_Size;\nlayout(location = 10) in vec3 a_DistanceAndIndexAndMiter;\nlayout(location = 13) in vec4 a_Normal_Total_Distance;\nlayout(location = 14) in vec2 a_iconMapUV;\n\nlayout(std140) uniform commonUniorm {\n vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n vec4 u_dash_array;\n vec4 u_blur;\n vec4 u_sourceColor;\n vec4 u_targetColor;\n vec2 u_textSize;\n float u_icon_step: 100;\n float u_heightfixed: 0.0;\n float u_vertexScale: 1.0;\n float u_raisingHeight: 0.0;\n float u_strokeWidth: 0.0;\n float u_textureBlend;\n float u_line_texture;\n float u_linearDir: 1.0;\n float u_linearColor: 0;\n float u_time;\n};\n\n\nout vec4 v_color;\nout vec4 v_stroke;\n//dash\nout vec4 v_dash_array;\nout float v_d_distance_ratio;\n// texV \u7EBF\u56FE\u5C42 - \u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\uFF08\u7EBF\u7684\u5BBD\u5EA6\u65B9\u5411\uFF09\nout vec2 v_iconMapUV;\nout vec4 v_texture_data;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n vec2 a_DistanceAndIndex = a_DistanceAndIndexAndMiter.xy;\n float a_Miter = a_DistanceAndIndexAndMiter.z;\n vec3 a_Normal = a_Normal_Total_Distance.xyz;\n float a_Total_Distance = a_Normal_Total_Distance.w;\n //dash\u8F93\u51FA\n v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / a_Total_Distance;\n v_d_distance_ratio = a_DistanceAndIndex.x / a_Total_Distance;\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n float d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n v_iconMapUV = a_iconMapUV;\n d_texPixelLen = project_float_pixel(u_icon_step);\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {\n d_texPixelLen *= 10.0;\n }\n\n v_color = a_Color;\n v_color.a *= opacity;\n v_stroke = stroke;\n\n vec3 size = a_Miter * setPickingSize(a_Size.x) * reverse_offset_normal(a_Normal);\n \n vec2 offset = project_pixel(size.xy);\n\n float lineDistance = a_DistanceAndIndex.x;\n float currentLinePointRatio = lineDistance / a_Total_Distance;\n \n\n float lineOffsetWidth = length(offset + offset * sign(a_Miter)); // \u7EBF\u6A2A\u5411\u504F\u79FB\u7684\u8DDD\u79BB\uFF08\u5411\u4E24\u4FA7\u504F\u79FB\u7684\u548C\uFF09\n float linePixelSize = project_pixel(a_Size.x) * 2.0; // \u5B9A\u70B9\u4F4D\u7F6E\u504F\u79FB\uFF0C\u6309\u5730\u56FE\u7B49\u7EA7\u7F29\u653E\u540E\u7684\u8DDD\u79BB \u5355\u4FA7 * 2\n float texV = lineOffsetWidth/linePixelSize; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n \n v_texture_data = vec4(currentLinePointRatio, lineDistance, d_texPixelLen, texV);\n // \u8BBE\u7F6E\u6570\u636E\u96C6\u7684\u53C2\u6570\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, a_Size.y, 1.0));\n\n float h = float(a_Position.z) * u_vertexScale; // \u7EBF\u9876\u70B9\u7684\u9AD8\u5EA6 - \u517C\u5BB9\u4E0D\u5B58\u5728\u7B2C\u4E09\u4E2A\u6570\u503C\u7684\u60C5\u51B5 vertex height\n float lineHeight = a_Size.y; // size \u7B2C\u4E8C\u4E2A\u53C2\u6570\u4EE3\u8868\u7684\u9AD8\u5EA6 [linewidth, lineheight]\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n lineHeight *= 0.2; // \u4FDD\u6301\u548C amap/mapbox \u4E00\u81F4\u7684\u6548\u679C\n h *= 0.2;\n if(u_heightfixed < 1.0) {\n lineHeight = project_pixel(a_Size.y);\n }\n gl_Position = u_Mvp * (vec4(project_pos.xy + offset, lineHeight + h + u_raisingHeight, 1.0));\n } else {\n // \u517C\u5BB9 mapbox \u5728\u7EBF\u9AD8\u5EA6\u4E0A\u7684\u6548\u679C\u8868\u73B0\u57FA\u672C\u4E00\u81F4\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n // mapbox\n // \u4FDD\u6301\u9AD8\u5EA6\u76F8\u5BF9\u4E0D\u53D8\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n h *= mapboxZoomScale;\n h += u_raisingHeight * mapboxZoomScale;\n if(u_heightfixed > 0.0) {\n lineHeight *= mapboxZoomScale;\n }\n \n } else {\n // amap\n h += u_raisingHeight;\n // lineHeight \u9876\u70B9\u504F\u79FB\u9AD8\u5EA6\n if(u_heightfixed < 1.0) {\n lineHeight *= pow(2.0, 20.0 - u_Zoom);\n }\n }\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, lineHeight + h, 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}\n";
12
13
  export default class LineModel extends BaseModel {
13
14
  constructor(...args) {
14
15
  super(...args);
@@ -42,15 +43,6 @@ export default class LineModel extends BaseModel {
42
43
  });
43
44
  });
44
45
  }
45
- get attributeLocation() {
46
- return Object.assign(super.attributeLocation, {
47
- MAX: super.attributeLocation.MAX,
48
- SIZE: 9,
49
- DISTANCE_INDEX: 10,
50
- NORMAL: 11,
51
- UV: 12
52
- });
53
- }
54
46
  getCommonUniformsInfo() {
55
47
  const {
56
48
  sourceColor,
@@ -159,7 +151,6 @@ export default class LineModel extends BaseModel {
159
151
  vertexShader: vert,
160
152
  fragmentShader: frag,
161
153
  triangulation: LineTriangulation,
162
- defines: _this2.getDefines(),
163
154
  inject: _this2.getInject(),
164
155
  depth: {
165
156
  enable: depth
@@ -181,14 +172,12 @@ export default class LineModel extends BaseModel {
181
172
  };
182
173
  }
183
174
  registerBuiltinAttributes() {
184
- // 注册 Position 属性 64 位地位部分,经纬度数据开启双精度,避免大于 20层级以上出现数据偏移
185
- this.registerPosition64LowAttribute();
186
175
  this.styleAttributeService.registerStyleAttribute({
187
176
  name: 'distanceAndIndex',
188
177
  type: AttributeType.Attribute,
189
178
  descriptor: {
190
179
  name: 'a_DistanceAndIndexAndMiter',
191
- shaderLocation: this.attributeLocation.DISTANCE_INDEX,
180
+ shaderLocation: 10,
192
181
  buffer: {
193
182
  // give the WebGL driver a hint that this buffer may change
194
183
  usage: gl.STATIC_DRAW,
@@ -206,7 +195,7 @@ export default class LineModel extends BaseModel {
206
195
  type: AttributeType.Attribute,
207
196
  descriptor: {
208
197
  name: 'a_Size',
209
- shaderLocation: this.attributeLocation.SIZE,
198
+ shaderLocation: ShaderLocation.SIZE,
210
199
  buffer: {
211
200
  // give the WebGL driver a hint that this buffer may change
212
201
  usage: gl.DYNAMIC_DRAW,
@@ -222,12 +211,14 @@ export default class LineModel extends BaseModel {
222
211
  }
223
212
  }
224
213
  });
214
+
215
+ // point layer size;
225
216
  this.styleAttributeService.registerStyleAttribute({
226
217
  name: 'normal_total_distance',
227
218
  type: AttributeType.Attribute,
228
219
  descriptor: {
229
220
  name: 'a_Normal_Total_Distance',
230
- shaderLocation: this.attributeLocation.NORMAL,
221
+ shaderLocation: ShaderLocation.NORMAL,
231
222
  buffer: {
232
223
  // give the WebGL driver a hint that this buffer may change
233
224
  usage: gl.STATIC_DRAW,
@@ -245,7 +236,7 @@ export default class LineModel extends BaseModel {
245
236
  type: AttributeType.Attribute,
246
237
  descriptor: {
247
238
  name: 'a_iconMapUV',
248
- shaderLocation: this.attributeLocation.UV,
239
+ shaderLocation: ShaderLocation.UV,
249
240
  buffer: {
250
241
  // give the WebGL driver a hint that this buffer may change
251
242
  usage: gl.DYNAMIC_DRAW,
@@ -1,20 +1,6 @@
1
1
  import type { IModel } from '@antv/l7-core';
2
2
  import BaseModel from '../../core/BaseModel';
3
3
  export default class SimpleLineModel 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
- };
18
4
  protected getCommonUniformsInfo(): {
19
5
  uniformsArray: number[];
20
6
  uniformsLength: number;
@@ -2,18 +2,13 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
2
  import { AttributeType, gl } from '@antv/l7-core';
3
3
  import { rgb2arr } from '@antv/l7-utils';
4
4
  import BaseModel from "../../core/BaseModel";
5
+ import { ShaderLocation } from "../../core/CommonStyleAttribute";
5
6
  import { SimpleLineTriangulation } from "../../core/triangulation";
6
7
  /* babel-plugin-inline-import '../shaders/simple/simpleline_frag.glsl' */
7
8
  const simple_line_frag = "\nlayout(std140) uniform commonUniorm {\n vec4 u_sourceColor;\n vec4 u_targetColor;\n vec4 u_dash_array;\n float u_vertexScale: 1.0;\n float u_linearColor: 0;\n};\nin float v_distanceScale;\nin vec4 v_color;\n//dash\nin vec4 v_dash_array;\n\nout vec4 outputColor;\nvoid main() {\n if(u_dash_array!=vec4(0.0)){\n float dashLength = mod(v_distanceScale, v_dash_array.x + v_dash_array.y + v_dash_array.z + v_dash_array.w);\n if(!(dashLength < v_dash_array.x || (dashLength > (v_dash_array.x + v_dash_array.y) && dashLength < v_dash_array.x + v_dash_array.y + v_dash_array.z))) {\n // \u865A\u7EBF\u90E8\u5206\n discard;\n };\n }\n if(u_linearColor==1.0){\n outputColor = mix(u_sourceColor, u_targetColor, v_distanceScale);\n outputColor.a *= v_color.a; // \u5168\u5C40\u900F\u660E\u5EA6\n }\n else{\n outputColor = v_color;\n }\n}\n";
8
9
  /* babel-plugin-inline-import '../shaders/simple/simpleline_vert.glsl' */
9
- const simple_line_vert = "layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\nlayout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;\nlayout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;\nlayout(location = ATTRIBUTE_LOCATION_SIZE) in vec4 a_SizeDistanceAndTotalDistance;\n\nlayout(std140) uniform commonUniorm {\n vec4 u_sourceColor;\n vec4 u_targetColor;\n vec4 u_dash_array;\n float u_vertexScale: 1.0;\n float u_linearColor: 0;\n};\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nout vec4 v_color;\nout float v_distanceScale;\nout vec4 v_dash_array;\n\nvoid main() {\n //dash\u8F93\u51FA\n v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / a_SizeDistanceAndTotalDistance.a;\n\n v_color = a_Color;\n v_distanceScale = a_SizeDistanceAndTotalDistance.b / a_SizeDistanceAndTotalDistance.a;\n v_color.a = v_color.a * opacity;\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0), a_Position64Low);\n\n float h = float(a_Position.z) * u_vertexScale; // \u7EBF\u9876\u70B9\u7684\u9AD8\u5EA6 - \u517C\u5BB9\u4E0D\u5B58\u5728\u7B2C\u4E09\u4E2A\u6570\u503C\u7684\u60C5\u51B5\n\n float lineHeight = a_SizeDistanceAndTotalDistance.y;\n // \u517C\u5BB9 mapbox \u5728\u7EBF\u9AD8\u5EA6\u4E0A\u7684\u6548\u679C\u8868\u73B0\u57FA\u672C\u4E00\u81F4\n if (\n u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||\n u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET\n ) {\n // \u4FDD\u6301\u9AD8\u5EA6\u76F8\u5BF9\u4E0D\u53D8\n h *= 2.0 / pow(2.0, 20.0 - u_Zoom);\n }\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, lineHeight + h, 1.0));\n gl_PointSize = 10.0;\n\n}\n";
10
+ const simple_line_vert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 9) in vec4 a_SizeDistanceAndTotalDistance;\n\nlayout(std140) uniform commonUniorm {\n vec4 u_sourceColor;\n vec4 u_targetColor;\n vec4 u_dash_array;\n float u_vertexScale: 1.0;\n float u_linearColor: 0;\n};\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nout vec4 v_color;\nout float v_distanceScale;\nout vec4 v_dash_array;\n\nvoid main() {\n //dash\u8F93\u51FA\n v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / a_SizeDistanceAndTotalDistance.a;\n\n v_color = a_Color; \n v_distanceScale = a_SizeDistanceAndTotalDistance.b / a_SizeDistanceAndTotalDistance.a;\n v_color.a = v_color.a * opacity;\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n float h = float(a_Position.z) * u_vertexScale; // \u7EBF\u9876\u70B9\u7684\u9AD8\u5EA6 - \u517C\u5BB9\u4E0D\u5B58\u5728\u7B2C\u4E09\u4E2A\u6570\u503C\u7684\u60C5\u51B5\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy, project_pixel(a_SizeDistanceAndTotalDistance.y) + h * 0.2, 1.0));\n } else {\n float lineHeight = a_SizeDistanceAndTotalDistance.y;\n // \u517C\u5BB9 mapbox \u5728\u7EBF\u9AD8\u5EA6\u4E0A\u7684\u6548\u679C\u8868\u73B0\u57FA\u672C\u4E00\u81F4\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n // \u4FDD\u6301\u9AD8\u5EA6\u76F8\u5BF9\u4E0D\u53D8\n h *= 2.0/pow(2.0, 20.0 - u_Zoom);\n }\n\n // amap1.x\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20 || u_CoordinateSystem == COORDINATE_SYSTEM_P20_OFFSET) {\n // \u4FDD\u6301\u9AD8\u5EA6\u76F8\u5BF9\u4E0D\u53D8\n lineHeight *= pow(2.0, 20.0 - u_Zoom);\n }\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, lineHeight + h, 1.0));\n gl_PointSize = 10.0;\n }\n}\n";
10
11
  export default class SimpleLineModel extends BaseModel {
11
- get attributeLocation() {
12
- return Object.assign(super.attributeLocation, {
13
- MAX: super.attributeLocation.MAX,
14
- SIZE: 9
15
- });
16
- }
17
12
  getCommonUniformsInfo() {
18
13
  const {
19
14
  sourceColor,
@@ -77,7 +72,6 @@ export default class SimpleLineModel extends BaseModel {
77
72
  vertexShader: vert,
78
73
  fragmentShader: frag,
79
74
  triangulation: SimpleLineTriangulation,
80
- defines: _this2.getDefines(),
81
75
  inject: _this2.getInject(),
82
76
  primitive: gl.LINES,
83
77
  depth: {
@@ -89,16 +83,57 @@ export default class SimpleLineModel extends BaseModel {
89
83
  })();
90
84
  }
91
85
  registerBuiltinAttributes() {
92
- // 注册 Position 属性 64 位地位部分,经纬度数据开启双精度,避免大于 20层级以上出现数据偏移
93
- this.registerPosition64LowAttribute();
94
-
86
+ // this.styleAttributeService.registerStyleAttribute({
87
+ // name: 'distance',
88
+ // type: AttributeType.Attribute,
89
+ // descriptor: {
90
+ // name: 'a_Distance',
91
+ // shaderLocation: 14,
92
+ // buffer: {
93
+ // // give the WebGL driver a hint that this buffer may change
94
+ // usage: gl.STATIC_DRAW,
95
+ // data: [],
96
+ // type: gl.FLOAT,
97
+ // },
98
+ // size: 1,
99
+ // update: (
100
+ // feature: IEncodeFeature,
101
+ // featureIdx: number,
102
+ // vertex: number[],
103
+ // ) => {
104
+ // return [vertex[3]];
105
+ // },
106
+ // },
107
+ // });
108
+ // this.styleAttributeService.registerStyleAttribute({
109
+ // name: 'total_distance',
110
+ // type: AttributeType.Attribute,
111
+ // descriptor: {
112
+ // name: 'a_Total_Distance',
113
+ // shaderLocation: 13,//枚举不够了,先固定写值吧,在shader中location也成一致的并且不与其他的重复就行了
114
+ // buffer: {
115
+ // // give the WebGL driver a hint that this buffer may change
116
+ // usage: gl.STATIC_DRAW,
117
+ // data: [],
118
+ // type: gl.FLOAT,
119
+ // },
120
+ // size: 1,
121
+ // update: (
122
+ // feature: IEncodeFeature,
123
+ // featureIdx: number,
124
+ // vertex: number[],
125
+ // ) => {
126
+ // return [vertex[5]];
127
+ // },
128
+ // },
129
+ // });
95
130
  //size.x,size,y,distance,totalDistance
96
131
  this.styleAttributeService.registerStyleAttribute({
97
132
  name: 'sizeDistanceAndTotalDistance',
98
133
  type: AttributeType.Attribute,
99
134
  descriptor: {
100
135
  name: 'a_SizeDistanceAndTotalDistance',
101
- shaderLocation: this.attributeLocation.SIZE,
136
+ shaderLocation: ShaderLocation.SIZE,
102
137
  buffer: {
103
138
  usage: gl.STATIC_DRAW,
104
139
  data: [],
@@ -1,23 +1,6 @@
1
1
  import type { IModel, ITexture2D } from '@antv/l7-core';
2
2
  import BaseModel from '../../core/BaseModel';
3
3
  export default class LineWallModel extends BaseModel {
4
- protected get attributeLocation(): {
5
- readonly POSITION: 0;
6
- readonly POSITION_64LOW: 1;
7
- readonly COLOR: 2;
8
- readonly PICKING_COLOR: 3;
9
- readonly STROKE: 4;
10
- readonly OPACITY: 5;
11
- readonly OFFSETS: 6;
12
- readonly ROTATION: 7;
13
- readonly MAX: 8;
14
- } & Record<string, number> & {
15
- MAX: 8;
16
- SIZE: number;
17
- NORMAL: number;
18
- UV: number;
19
- DISTANCE_MITER_TOTAL: number;
20
- };
21
4
  protected texture: ITexture2D;
22
5
  protected getCommonUniformsInfo(): {
23
6
  uniformsArray: number[];
@@ -3,11 +3,12 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
3
  import { AttributeType, gl } from '@antv/l7-core';
4
4
  import { rgb2arr } from '@antv/l7-utils';
5
5
  import BaseModel from "../../core/BaseModel";
6
+ import { ShaderLocation } from "../../core/CommonStyleAttribute";
6
7
  import { LineTriangulation } from "../../core/triangulation";
7
8
  /* babel-plugin-inline-import '../shaders/wall/wall_frag.glsl' */
8
9
  const line_frag = "#define Animate 0.0\n#define LineTexture 1.0\n\n// line texture\n\nuniform sampler2D u_texture;\nlayout(std140) uniform commonUniorm {\n vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n vec4 u_sourceColor;\n vec4 u_targetColor;\n vec2 u_textSize;\n float u_icon_step: 100;\n float u_heightfixed;\n float u_linearColor: 0;\n float u_line_texture;\n float u_textureBlend;\n float u_iconStepCount;\n float u_time;\n};\nin vec2 v_iconMapUV;\nin float v_blur;\nin float v_radio;\nin vec4 v_color;\nin vec4 v_dataset;\n\nout vec4 outputColor;\n#pragma include \"picking\"\n\nvoid main() {\n float animateSpeed = 0.0; // \u8FD0\u52A8\u901F\u5EA6\n float d_distance_ratio = v_dataset.r; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n float v = v_dataset.a;\n\n if(u_linearColor == 1.0) { // \u4F7F\u7528\u6E10\u53D8\u989C\u8272\n outputColor = mix(u_sourceColor, u_targetColor, v);\n } else { // \u4F7F\u7528 color \u65B9\u6CD5\u4F20\u5165\u7684\u989C\u8272\n outputColor = v_color;\n }\n\n outputColor.a *= v_color.a; // \u5168\u5C40\u900F\u660E\u5EA6\n if(u_animate.x == Animate) {\n animateSpeed = u_time / u_animate.y;\n float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_animate.z)* (1.0/ u_animate.z) + animateSpeed);\n alpha = (alpha + u_animate.w -1.0) / u_animate.w;\n alpha = smoothstep(0., 1., alpha);\n outputColor.a *= alpha;\n }\n\n if(u_line_texture == LineTexture) { // while load texture\n float aDistance = v_dataset.g; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n float d_texPixelLen = v_dataset.b; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n float u = fract(mod(aDistance, d_texPixelLen)/d_texPixelLen - animateSpeed);\n float v = v_dataset.a; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n // \u8BA1\u7B97\u7EB9\u7406\u95F4\u9694 start\n float flag = 0.0;\n if(u > 1.0/u_iconStepCount) {\n flag = 1.0;\n }\n u = fract(u*u_iconStepCount);\n // \u8BA1\u7B97\u7EB9\u7406\u95F4\u9694 end\n\n vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;\n vec4 pattern = texture(SAMPLER_2D(u_texture), uv);\n\n // Tip: \u5224\u65AD\u7EB9\u7406\u95F4\u9694\n if(flag > 0.0) {\n pattern = vec4(0.0);\n }\n\n if(u_textureBlend == 0.0) { // normal\n pattern.a = 0.0;\n outputColor = filterColor(outputColor + pattern);\n } else { // replace\n pattern.a *= v_color.a;\n if(outputColor.a <= 0.0) {\n pattern.a = 0.0;\n }\n outputColor = filterColor(pattern);\n }\n }\n \n\n // blur - AA\n if(v < v_blur) {\n outputColor.a = mix(0.0, outputColor.a, v/v_blur);\n } else if(v > 1.0 - v_blur) {\n outputColor.a = mix(outputColor.a, 0.0, (v - (1.0 - v_blur))/v_blur);\n }\n\n outputColor = filterColor(outputColor);\n}\n";
9
10
  /* babel-plugin-inline-import '../shaders/wall/wall_vert.glsl' */
10
- const line_vert = "#define Animate 0.0\nlayout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\nlayout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;\nlayout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;\nlayout(location = ATTRIBUTE_LOCATION_SIZE) in vec2 a_Size;\nlayout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal;\nlayout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_iconMapUV;\nlayout(location = ATTRIBUTE_LOCATION_DISTANCE_MITER_TOTAL) in vec3 a_Distance_Total_Miter;\n\nlayout(std140) uniform commonUniorm {\n vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n vec4 u_sourceColor;\n vec4 u_targetColor;\n vec2 u_textSize;\n float u_icon_step: 100;\n float u_heightfixed;\n float u_linearColor: 0;\n float u_line_texture;\n float u_textureBlend;\n float u_iconStepCount;\n float u_time;\n};\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\n// texV \u7EBF\u56FE\u5C42 - \u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\uFF08\u7EBF\u7684\u5BBD\u5EA6\u65B9\u5411\uFF09\nout vec2 v_iconMapUV;\nout vec4 v_color;\nout float v_blur;\nout float v_radio;\nout vec4 v_dataset;\n\nvoid main() {\n float a_Distance = a_Distance_Total_Miter.x;\n float a_Miter = a_Distance_Total_Miter.y;\n float a_Total_Distance = a_Distance_Total_Miter.z;\n\n float d_distance_ratio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n float d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n\n v_iconMapUV = a_iconMapUV;\n if (u_heightfixed < 1.0) {\n // \u9AD8\u5EA6\u968F zoom \u8C03\u6574\n d_texPixelLen = project_pixel(u_icon_step);\n } else {\n d_texPixelLen = u_icon_step;\n }\n\n if (u_animate.x == Animate || u_linearColor == 1.0) {\n d_distance_ratio = a_Distance / a_Total_Distance;\n }\n\n float miter = (a_Miter + 1.0) / 2.0;\n // \u8BBE\u7F6E\u6570\u636E\u96C6\u7684\u53C2\u6570\n v_dataset[0] = d_distance_ratio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n v_dataset[1] = a_Distance; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n v_dataset[2] = d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n v_dataset[3] = miter; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C 0 - 1\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0), a_Position64Low);\n\n float originSize = a_Size.x; // \u56FA\u5B9A\u9AD8\u5EA6\n if (u_heightfixed < 1.0) {\n originSize = project_float_meter(a_Size.x); // \u9AD8\u5EA6\u968F zoom \u8C03\u6574\n }\n\n float wallHeight = originSize * miter;\n float lightWeight = calc_lighting(vec4(project_pos.xy, wallHeight, 1.0));\n\n v_blur = min(project_float_pixel(2.0) / originSize, 0.05);\n v_color = vec4(a_Color.rgb * lightWeight, a_Color.w * opacity);\n\n // \u517C\u5BB9 mapbox \u5728\u7EBF\u9AD8\u5EA6\u4E0A\u7684\u6548\u679C\u8868\u73B0\u57FA\u672C\u4E00\u81F4\n if (\n u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||\n u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET\n ) {\n // mapbox\n // \u4FDD\u6301\u9AD8\u5EA6\u76F8\u5BF9\u4E0D\u53D8\n float mapboxZoomScale = 4.0 / pow(2.0, 21.0 - u_Zoom);\n if (u_heightfixed > 0.0) {\n wallHeight *= mapboxZoomScale;\n }\n }\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, wallHeight, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
11
+ const line_vert = "#define Animate 0.0\nlayout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 9) in vec2 a_Size;\nlayout(location = 10) in float a_Miter;\nlayout(location = 11) in float a_Total_Distance;\nlayout(location = 12) in vec4 a_Instance;\nlayout(location = 13) in vec3 a_Normal;\nlayout(location = 14) in vec2 a_iconMapUV;\nlayout(location = 15) in float a_Distance;\n\n\nlayout(std140) uniform commonUniorm {\n vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n vec4 u_sourceColor;\n vec4 u_targetColor;\n vec2 u_textSize;\n float u_icon_step: 100;\n float u_heightfixed;\n float u_linearColor: 0;\n float u_line_texture;\n float u_textureBlend;\n float u_iconStepCount;\n float u_time;\n};\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\n// texV \u7EBF\u56FE\u5C42 - \u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\uFF08\u7EBF\u7684\u5BBD\u5EA6\u65B9\u5411\uFF09\nout vec2 v_iconMapUV;\nout vec4 v_color;\nout float v_blur;\nout float v_radio;\nout vec4 v_dataset;\n\nvoid main() {\n\n\n float d_distance_ratio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n float d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n\n v_iconMapUV = a_iconMapUV;\n if(u_heightfixed < 1.0) { // \u9AD8\u5EA6\u968F zoom \u8C03\u6574\n d_texPixelLen = project_pixel(u_icon_step);\n } else {\n d_texPixelLen = u_icon_step;\n }\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {\n d_texPixelLen *= 10.0;\n }\n\n if(u_animate.x == Animate || u_linearColor == 1.0) {\n d_distance_ratio = a_Distance / a_Total_Distance;\n }\n\n float miter = (a_Miter + 1.0)/2.0;\n // \u8BBE\u7F6E\u6570\u636E\u96C6\u7684\u53C2\u6570\n v_dataset[0] = d_distance_ratio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n v_dataset[1] = a_Distance; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n v_dataset[2] = d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n v_dataset[3] = miter; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C 0 - 1\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n float originSize = a_Size.x; // \u56FA\u5B9A\u9AD8\u5EA6\n if(u_heightfixed < 1.0) { \n originSize = project_float_meter(a_Size.x); // \u9AD8\u5EA6\u968F zoom \u8C03\u6574\n }\n\n\n float wallHeight = originSize * miter;\n float lightWeight = calc_lighting(vec4(project_pos.xy, wallHeight, 1.0));\n\n v_blur = min(project_float_pixel(2.0) / originSize, 0.05);\n v_color = vec4(a_Color.rgb * lightWeight, a_Color.w * opacity);\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy, wallHeight, 1.0));\n } else {\n// \u517C\u5BB9 mapbox \u5728\u7EBF\u9AD8\u5EA6\u4E0A\u7684\u6548\u679C\u8868\u73B0\u57FA\u672C\u4E00\u81F4\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n // mapbox\n // \u4FDD\u6301\u9AD8\u5EA6\u76F8\u5BF9\u4E0D\u53D8\n float mapboxZoomScale = 4.0 / pow(2.0, 21.0 - u_Zoom);\n if(u_heightfixed > 0.0) {\n wallHeight *= mapboxZoomScale;\n }\n \n } else {\n // lineHeight \u9876\u70B9\u504F\u79FB\u9AD8\u5EA6\n if(u_heightfixed < 1.0) {\n wallHeight *= pow(2.0, 20.0 - u_Zoom);\n }\n }\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, wallHeight, 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}\n";
11
12
  export default class LineWallModel extends BaseModel {
12
13
  constructor(...args) {
13
14
  super(...args);
@@ -34,15 +35,6 @@ export default class LineWallModel extends BaseModel {
34
35
  this.textures = [this.texture];
35
36
  });
36
37
  }
37
- get attributeLocation() {
38
- return Object.assign(super.attributeLocation, {
39
- MAX: super.attributeLocation.MAX,
40
- SIZE: 9,
41
- NORMAL: 12,
42
- UV: 13,
43
- DISTANCE_MITER_TOTAL: 15
44
- });
45
- }
46
38
  getCommonUniformsInfo() {
47
39
  const {
48
40
  sourceColor,
@@ -118,7 +110,6 @@ export default class LineWallModel extends BaseModel {
118
110
  vertexShader: line_vert,
119
111
  fragmentShader: line_frag,
120
112
  triangulation: LineTriangulation,
121
- defines: _this2.getDefines(),
122
113
  inject: _this2.getInject(),
123
114
  depth: {
124
115
  enable: false
@@ -129,14 +120,48 @@ export default class LineWallModel extends BaseModel {
129
120
  })();
130
121
  }
131
122
  registerBuiltinAttributes() {
132
- // 注册 Position 属性 64 位地位部分,经纬度数据开启双精度,避免大于 20层级以上出现数据偏移
133
- this.registerPosition64LowAttribute();
123
+ this.styleAttributeService.registerStyleAttribute({
124
+ name: 'distance',
125
+ type: AttributeType.Attribute,
126
+ descriptor: {
127
+ name: 'a_Distance',
128
+ shaderLocation: 15,
129
+ buffer: {
130
+ // give the WebGL driver a hint that this buffer may change
131
+ usage: gl.STATIC_DRAW,
132
+ data: [],
133
+ type: gl.FLOAT
134
+ },
135
+ size: 1,
136
+ update: (feature, featureIdx, vertex) => {
137
+ return [vertex[3]];
138
+ }
139
+ }
140
+ });
141
+ this.styleAttributeService.registerStyleAttribute({
142
+ name: 'total_distance',
143
+ type: AttributeType.Attribute,
144
+ descriptor: {
145
+ name: 'a_Total_Distance',
146
+ shaderLocation: 11,
147
+ buffer: {
148
+ // give the WebGL driver a hint that this buffer may change
149
+ usage: gl.STATIC_DRAW,
150
+ data: [],
151
+ type: gl.FLOAT
152
+ },
153
+ size: 1,
154
+ update: (feature, featureIdx, vertex) => {
155
+ return [vertex[5]];
156
+ }
157
+ }
158
+ });
134
159
  this.styleAttributeService.registerStyleAttribute({
135
160
  name: 'size',
136
161
  type: AttributeType.Attribute,
137
162
  descriptor: {
138
163
  name: 'a_Size',
139
- shaderLocation: this.attributeLocation.SIZE,
164
+ shaderLocation: ShaderLocation.SIZE,
140
165
  buffer: {
141
166
  // give the WebGL driver a hint that this buffer may change
142
167
  usage: gl.DYNAMIC_DRAW,
@@ -152,12 +177,14 @@ export default class LineWallModel extends BaseModel {
152
177
  }
153
178
  }
154
179
  });
180
+
181
+ // point layer size;
155
182
  this.styleAttributeService.registerStyleAttribute({
156
183
  name: 'normal',
157
184
  type: AttributeType.Attribute,
158
185
  descriptor: {
159
186
  name: 'a_Normal',
160
- shaderLocation: this.attributeLocation.NORMAL,
187
+ shaderLocation: ShaderLocation.NORMAL,
161
188
  buffer: {
162
189
  // give the WebGL driver a hint that this buffer may change
163
190
  usage: gl.STATIC_DRAW,
@@ -172,21 +199,20 @@ export default class LineWallModel extends BaseModel {
172
199
  }
173
200
  });
174
201
  this.styleAttributeService.registerStyleAttribute({
175
- name: 'distanceAndTotalAndMiter',
202
+ name: 'miter',
176
203
  type: AttributeType.Attribute,
177
204
  descriptor: {
178
- name: 'a_Distance_Total_Miter',
179
- shaderLocation: this.attributeLocation.DISTANCE_MITER_TOTAL,
205
+ name: 'a_Miter',
206
+ shaderLocation: 10,
180
207
  buffer: {
181
208
  // give the WebGL driver a hint that this buffer may change
182
209
  usage: gl.STATIC_DRAW,
183
210
  data: [],
184
211
  type: gl.FLOAT
185
212
  },
186
- size: 3,
213
+ size: 1,
187
214
  update: (feature, featureIdx, vertex) => {
188
- // [distance, miter, total_distance]
189
- return [vertex[3], vertex[4], vertex[5]];
215
+ return [vertex[4]];
190
216
  }
191
217
  }
192
218
  });
@@ -195,7 +221,7 @@ export default class LineWallModel extends BaseModel {
195
221
  type: AttributeType.Attribute,
196
222
  descriptor: {
197
223
  name: 'a_iconMapUV',
198
- shaderLocation: this.attributeLocation.UV,
224
+ shaderLocation: 14,
199
225
  buffer: {
200
226
  // give the WebGL driver a hint that this buffer may change
201
227
  usage: gl.DYNAMIC_DRAW,