@antv/l7-layers 2.16.0 → 2.16.2

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 (218) hide show
  1. package/es/core/BaseLayer.d.ts +3 -0
  2. package/es/core/BaseLayer.js +76 -80
  3. package/es/core/BaseModel.d.ts +9 -71
  4. package/es/core/BaseModel.js +75 -357
  5. package/es/core/CommonStyleAttribute.d.ts +2 -0
  6. package/es/core/CommonStyleAttribute.js +66 -0
  7. package/es/core/interface.d.ts +13 -3
  8. package/es/core/shape/extrude.js +18 -6
  9. package/es/core/triangulation.d.ts +12 -0
  10. package/es/core/triangulation.js +70 -0
  11. package/es/heatmap/models/grid.js +1 -1
  12. package/es/heatmap/models/grid3d.js +1 -1
  13. package/es/heatmap/models/heatmap.d.ts +1 -0
  14. package/es/heatmap/models/heatmap.js +17 -13
  15. package/es/heatmap/models/hexagon.js +1 -1
  16. package/es/heatmap/shaders/grid_vert.glsl +2 -2
  17. package/es/heatmap/shaders/hexagon_3d_vert.glsl +2 -2
  18. package/es/heatmap/shaders/hexagon_vert.glsl +2 -2
  19. package/es/line/index.d.ts +1 -0
  20. package/es/line/index.js +3 -2
  21. package/es/line/models/arc.js +9 -45
  22. package/es/line/models/arc_3d.js +12 -45
  23. package/es/line/models/earthArc_3d.js +6 -40
  24. package/es/line/models/{half.d.ts → flow.d.ts} +1 -11
  25. package/es/line/models/flow.js +167 -0
  26. package/es/line/models/great_circle.js +4 -38
  27. package/es/line/models/index.d.ts +1 -1
  28. package/es/line/models/index.js +3 -3
  29. package/es/line/models/line.js +7 -41
  30. package/es/line/models/linearline.js +4 -38
  31. package/es/line/models/simpleLine.d.ts +0 -1
  32. package/es/line/models/simpleLine.js +4 -43
  33. package/es/line/shaders/dash/arc_dash_frag.glsl +3 -6
  34. package/es/line/shaders/dash/arc_dash_vert.glsl +6 -46
  35. package/es/line/shaders/dash/line_dash_frag.glsl +4 -7
  36. package/es/line/shaders/dash/line_dash_vert.glsl +3 -33
  37. package/es/line/shaders/flow/flow_line_frag.glsl +13 -0
  38. package/es/line/shaders/flow/flow_line_vert.glsl +83 -0
  39. package/es/line/shaders/line_arc_3d_frag.glsl +6 -6
  40. package/es/line/shaders/line_arc_3d_vert.glsl +4 -34
  41. package/es/line/shaders/line_arc_frag.glsl +7 -11
  42. package/es/line/shaders/line_arc_great_circle_frag.glsl +5 -6
  43. package/es/line/shaders/line_arc_great_circle_vert.glsl +4 -32
  44. package/es/line/shaders/line_arc_vert.glsl +9 -45
  45. package/es/line/shaders/line_frag.glsl +15 -17
  46. package/es/line/shaders/line_vert.glsl +3 -34
  47. package/es/line/shaders/linear/arc3d_linear_frag.glsl +5 -19
  48. package/es/line/shaders/linear/arc3d_linear_vert.glsl +9 -48
  49. package/es/line/shaders/linear/arc_linear_frag.glsl +2 -30
  50. package/es/line/shaders/linear/arc_linear_vert.glsl +9 -45
  51. package/es/line/shaders/linear/line_linear_frag.glsl +5 -6
  52. package/es/line/shaders/linearLine/line_linear_frag.glsl +2 -14
  53. package/es/line/shaders/linearLine/line_linear_vert.glsl +14 -32
  54. package/es/line/shaders/simple/simpleline_frag.glsl +1 -5
  55. package/es/line/shaders/simple/simpleline_linear_frag.glsl +2 -6
  56. package/es/line/shaders/simple/simpleline_vert.glsl +7 -33
  57. package/es/plugins/DataMappingPlugin.js +20 -34
  58. package/es/plugins/LayerModelPlugin.js +13 -1
  59. package/es/plugins/ShaderUniformPlugin.js +3 -3
  60. package/es/point/index.d.ts +1 -0
  61. package/es/point/index.js +1 -0
  62. package/es/point/models/earthExtrude.d.ts +0 -3
  63. package/es/point/models/earthExtrude.js +2 -40
  64. package/es/point/models/earthFill.d.ts +0 -1
  65. package/es/point/models/earthFill.js +9 -60
  66. package/es/point/models/extrude.d.ts +0 -3
  67. package/es/point/models/extrude.js +3 -42
  68. package/es/point/models/fill.d.ts +0 -1
  69. package/es/point/models/fill.js +15 -76
  70. package/es/point/models/fillmage.js +6 -43
  71. package/es/point/models/image.js +7 -41
  72. package/es/point/models/normal.js +2 -2
  73. package/es/point/models/radar.d.ts +0 -1
  74. package/es/point/models/radar.js +4 -13
  75. package/es/point/models/simplePoint.d.ts +0 -1
  76. package/es/point/models/simplePoint.js +8 -49
  77. package/es/point/models/text.js +17 -47
  78. package/es/point/shaders/animate/wave_frag.glsl +1 -11
  79. package/es/point/shaders/earth/extrude_frag.glsl +5 -17
  80. package/es/point/shaders/earth/extrude_vert.glsl +14 -29
  81. package/es/point/shaders/earth/fill_frag.glsl +5 -14
  82. package/es/point/shaders/earth/fill_vert.glsl +1 -75
  83. package/es/point/shaders/extrude/extrude_frag.glsl +3 -29
  84. package/es/point/shaders/extrude/extrude_vert.glsl +27 -35
  85. package/es/point/shaders/fill_frag.glsl +9 -20
  86. package/es/point/shaders/fill_vert.glsl +16 -101
  87. package/es/point/shaders/image/fillImage_frag.glsl +2 -5
  88. package/es/point/shaders/image/fillImage_vert.glsl +4 -47
  89. package/es/point/shaders/image_frag.glsl +1 -5
  90. package/es/point/shaders/image_vert.glsl +1 -44
  91. package/es/point/shaders/normal_frag.glsl +0 -2
  92. package/es/point/shaders/normal_vert.glsl +2 -1
  93. package/es/point/shaders/radar/radar_vert.glsl +2 -2
  94. package/es/point/shaders/simplePoint_frag.glsl +0 -7
  95. package/es/point/shaders/simplePoint_vert.glsl +3 -45
  96. package/es/point/shaders/text_frag.glsl +6 -19
  97. package/es/point/shaders/text_vert.glsl +5 -66
  98. package/es/polygon/index.d.ts +1 -0
  99. package/es/polygon/index.js +1 -0
  100. package/es/polygon/models/extrude.d.ts +0 -3
  101. package/es/polygon/models/extrude.js +86 -82
  102. package/es/polygon/models/fill.d.ts +0 -4
  103. package/es/polygon/models/fill.js +8 -47
  104. package/es/polygon/shaders/extrude/polygon_extrude_frag.glsl +2 -23
  105. package/es/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +7 -5
  106. package/es/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +7 -32
  107. package/es/polygon/shaders/extrude/polygon_extrude_vert.glsl +33 -38
  108. package/es/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +12 -9
  109. package/es/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +16 -44
  110. package/es/polygon/shaders/polygon_frag.glsl +0 -5
  111. package/es/polygon/shaders/polygon_linear_frag.glsl +0 -8
  112. package/es/polygon/shaders/polygon_linear_vert.glsl +0 -32
  113. package/es/polygon/shaders/polygon_vert.glsl +1 -27
  114. package/es/utils/layerData.js +2 -2
  115. package/lib/core/BaseLayer.js +74 -78
  116. package/lib/core/BaseModel.js +74 -356
  117. package/lib/core/CommonStyleAttribute.js +72 -0
  118. package/lib/core/shape/extrude.js +18 -6
  119. package/lib/core/triangulation.js +72 -0
  120. package/lib/heatmap/models/grid.js +1 -1
  121. package/lib/heatmap/models/grid3d.js +1 -1
  122. package/lib/heatmap/models/heatmap.js +17 -13
  123. package/lib/heatmap/models/hexagon.js +1 -1
  124. package/lib/heatmap/shaders/grid_vert.glsl +2 -2
  125. package/lib/heatmap/shaders/hexagon_3d_vert.glsl +2 -2
  126. package/lib/heatmap/shaders/hexagon_vert.glsl +2 -2
  127. package/lib/line/index.js +3 -2
  128. package/lib/line/models/arc.js +9 -45
  129. package/lib/line/models/arc_3d.js +12 -45
  130. package/lib/line/models/earthArc_3d.js +6 -40
  131. package/lib/line/models/flow.js +174 -0
  132. package/lib/line/models/great_circle.js +4 -38
  133. package/lib/line/models/index.js +3 -3
  134. package/lib/line/models/line.js +7 -41
  135. package/lib/line/models/linearline.js +4 -38
  136. package/lib/line/models/simpleLine.js +4 -43
  137. package/lib/line/shaders/dash/arc_dash_frag.glsl +3 -6
  138. package/lib/line/shaders/dash/arc_dash_vert.glsl +6 -46
  139. package/lib/line/shaders/dash/line_dash_frag.glsl +4 -7
  140. package/lib/line/shaders/dash/line_dash_vert.glsl +3 -33
  141. package/lib/line/shaders/flow/flow_line_frag.glsl +13 -0
  142. package/lib/line/shaders/flow/flow_line_vert.glsl +83 -0
  143. package/lib/line/shaders/line_arc_3d_frag.glsl +6 -6
  144. package/lib/line/shaders/line_arc_3d_vert.glsl +4 -34
  145. package/lib/line/shaders/line_arc_frag.glsl +7 -11
  146. package/lib/line/shaders/line_arc_great_circle_frag.glsl +5 -6
  147. package/lib/line/shaders/line_arc_great_circle_vert.glsl +4 -32
  148. package/lib/line/shaders/line_arc_vert.glsl +9 -45
  149. package/lib/line/shaders/line_frag.glsl +15 -17
  150. package/lib/line/shaders/line_vert.glsl +3 -34
  151. package/lib/line/shaders/linear/arc3d_linear_frag.glsl +5 -19
  152. package/lib/line/shaders/linear/arc3d_linear_vert.glsl +9 -48
  153. package/lib/line/shaders/linear/arc_linear_frag.glsl +2 -30
  154. package/lib/line/shaders/linear/arc_linear_vert.glsl +9 -45
  155. package/lib/line/shaders/linear/line_linear_frag.glsl +5 -6
  156. package/lib/line/shaders/linearLine/line_linear_frag.glsl +2 -14
  157. package/lib/line/shaders/linearLine/line_linear_vert.glsl +14 -32
  158. package/lib/line/shaders/simple/simpleline_frag.glsl +1 -5
  159. package/lib/line/shaders/simple/simpleline_linear_frag.glsl +2 -6
  160. package/lib/line/shaders/simple/simpleline_vert.glsl +7 -33
  161. package/lib/plugins/DataMappingPlugin.js +20 -34
  162. package/lib/plugins/LayerModelPlugin.js +13 -1
  163. package/lib/plugins/ShaderUniformPlugin.js +3 -3
  164. package/lib/point/index.js +1 -0
  165. package/lib/point/models/earthExtrude.js +2 -40
  166. package/lib/point/models/earthFill.js +9 -60
  167. package/lib/point/models/extrude.js +3 -42
  168. package/lib/point/models/fill.js +15 -76
  169. package/lib/point/models/fillmage.js +6 -43
  170. package/lib/point/models/image.js +7 -41
  171. package/lib/point/models/normal.js +2 -2
  172. package/lib/point/models/radar.js +4 -13
  173. package/lib/point/models/simplePoint.js +8 -49
  174. package/lib/point/models/text.js +15 -45
  175. package/lib/point/shaders/animate/wave_frag.glsl +1 -11
  176. package/lib/point/shaders/earth/extrude_frag.glsl +5 -17
  177. package/lib/point/shaders/earth/extrude_vert.glsl +14 -29
  178. package/lib/point/shaders/earth/fill_frag.glsl +5 -14
  179. package/lib/point/shaders/earth/fill_vert.glsl +1 -75
  180. package/lib/point/shaders/extrude/extrude_frag.glsl +3 -29
  181. package/lib/point/shaders/extrude/extrude_vert.glsl +27 -35
  182. package/lib/point/shaders/fill_frag.glsl +9 -20
  183. package/lib/point/shaders/fill_vert.glsl +16 -101
  184. package/lib/point/shaders/image/fillImage_frag.glsl +2 -5
  185. package/lib/point/shaders/image/fillImage_vert.glsl +4 -47
  186. package/lib/point/shaders/image_frag.glsl +1 -5
  187. package/lib/point/shaders/image_vert.glsl +1 -44
  188. package/lib/point/shaders/normal_frag.glsl +0 -2
  189. package/lib/point/shaders/normal_vert.glsl +2 -1
  190. package/lib/point/shaders/radar/radar_vert.glsl +2 -2
  191. package/lib/point/shaders/simplePoint_frag.glsl +0 -7
  192. package/lib/point/shaders/simplePoint_vert.glsl +3 -45
  193. package/lib/point/shaders/text_frag.glsl +6 -19
  194. package/lib/point/shaders/text_vert.glsl +5 -66
  195. package/lib/polygon/index.js +1 -0
  196. package/lib/polygon/models/extrude.js +86 -82
  197. package/lib/polygon/models/fill.js +8 -47
  198. package/lib/polygon/shaders/extrude/polygon_extrude_frag.glsl +2 -23
  199. package/lib/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +7 -5
  200. package/lib/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +7 -32
  201. package/lib/polygon/shaders/extrude/polygon_extrude_vert.glsl +33 -38
  202. package/lib/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +12 -9
  203. package/lib/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +16 -44
  204. package/lib/polygon/shaders/polygon_frag.glsl +0 -5
  205. package/lib/polygon/shaders/polygon_linear_frag.glsl +0 -8
  206. package/lib/polygon/shaders/polygon_linear_vert.glsl +0 -32
  207. package/lib/polygon/shaders/polygon_vert.glsl +1 -27
  208. package/lib/utils/layerData.js +2 -2
  209. package/package.json +7 -7
  210. package/es/line/models/half.js +0 -267
  211. package/es/line/shaders/half/line_half_frag.glsl +0 -53
  212. package/es/line/shaders/half/line_half_vert.glsl +0 -169
  213. package/es/utils/dataMappingStyle.d.ts +0 -31
  214. package/es/utils/dataMappingStyle.js +0 -137
  215. package/lib/line/models/half.js +0 -274
  216. package/lib/line/shaders/half/line_half_frag.glsl +0 -53
  217. package/lib/line/shaders/half/line_half_vert.glsl +0 -169
  218. package/lib/utils/dataMappingStyle.js +0 -140
@@ -11,50 +11,31 @@ attribute float a_Size;
11
11
  attribute vec3 a_uvs;
12
12
  uniform mat4 u_ModelMatrix;
13
13
  uniform mat4 u_Mvp;
14
+ uniform vec4 u_sourceColor;
15
+ uniform vec4 u_targetColor;
16
+ uniform float u_linearColor: 0;
17
+
18
+ uniform float u_topsurface: 1.0;
19
+ uniform float u_sidesurface: 1.0;
14
20
 
15
21
  varying vec4 v_Color;
16
22
  uniform float u_heightfixed: 0.0; // 默认不固定
17
23
  uniform float u_raisingHeight: 0.0;
18
- uniform float u_opacity: 1.0;
19
- varying mat4 styleMappingMat; // 用于将在顶点着色器中计算好的样式值传递给片元
20
-
21
- #pragma include "styleMapping"
22
- #pragma include "styleMappingCalOpacity"
23
24
 
24
25
  #pragma include "projection"
25
26
  #pragma include "light"
26
27
  #pragma include "picking"
27
28
 
28
29
  void main() {
29
- // cal style mapping - 数据纹理映射部分的计算
30
- styleMappingMat = mat4(
31
- 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - isSide
32
- 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA
33
- 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]
34
- 0.0, 0.0, 0.0, 0.0 // sidey
35
- );
36
- styleMappingMat[0][3] = a_Position.z;
37
- styleMappingMat[3][0] = a_uvs[2];
38
-
39
- float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行
40
- float columnCount = u_cellTypeLayout[0][1]; // 当看到数据纹理有几列
41
- float columnWidth = 1.0/columnCount; // 列宽
42
- float rowHeight = 1.0/rowCount; // 行高
43
- float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets
44
- float id = a_vertexId; // 第n个顶点
45
- float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // 起始点在第几行
46
- float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // 起始点在第几列
47
-
48
- // cell 固定顺序 opacity -> strokeOpacity -> strokeWidth -> stroke ...
49
- // 按顺序从 cell 中取值、若没有则自动往下取值
50
- float textureOffset = 0.0; // 在 cell 中取值的偏移量
51
-
52
- vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);
53
- styleMappingMat[0][0] = opacityAndOffset.r;
54
- textureOffset = opacityAndOffset.g;
55
- // cal style mapping - 数据纹理映射部分的计算
30
+
31
+ float isSide = a_Position.z;
32
+ float topU = a_uvs[0];
33
+ float topV = 1.0 - a_uvs[1];
34
+ float sidey = a_uvs[2];
56
35
 
57
36
  vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);
37
+ float lightWeight = calc_lighting(pos);
38
+
58
39
  vec4 project_pos = project_position(pos);
59
40
 
60
41
  if(u_heightfixed > 0.0) { // 判断几何体是否固定高度
@@ -68,10 +49,7 @@ void main() {
68
49
  }
69
50
  }
70
51
 
71
- // project_pos.z += 500000.0; // amap1
72
52
 
73
- // project_pos.z += (500000.0 * 4.0)/pow(2.0, 21.0 - u_Zoom); // mapbox
74
- // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
75
53
 
76
54
  if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
77
55
  // gl_Position = u_Mvp * (vec4(project_pos.xyz * vec3(1.0, 1.0, -1.0), 1.0));
@@ -80,11 +58,28 @@ void main() {
80
58
  gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
81
59
  }
82
60
 
83
- float lightWeight = calc_lighting(pos);
61
+ // Tip: 部分机型 GPU 计算精度兼容
62
+ if(isSide < 0.999) {
63
+ // side face
64
+ // if(u_sidesurface < 1.0) {
65
+ // discard;
66
+ // }
67
+
68
+ if(u_linearColor == 1.0) {
69
+ vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey);
70
+ linearColor.rgb *= lightWeight;
71
+ v_Color = linearColor;
72
+ } else {
73
+ v_Color = a_Color;
74
+ }
75
+
76
+ } else {
77
+ v_Color = a_Color;
78
+ }
79
+
84
80
  // v_Color = a_Color;
85
- v_Color = vec4(a_Color.rgb * lightWeight, a_Color.w);
81
+ v_Color = vec4(a_Color.rgb * lightWeight, a_Color.w * opacity);
86
82
 
87
- styleMappingMat[3][1] = lightWeight;
88
83
 
89
84
  setPickingColor(a_PickingColor);
90
85
  }
@@ -8,19 +8,21 @@ uniform float u_topsurface: 1.0;
8
8
  uniform float u_sidesurface: 1.0;
9
9
 
10
10
  varying vec4 v_Color;
11
- varying mat4 styleMappingMat; // 传递从片元中传递的映射数据
11
+ varying vec3 v_uvs;
12
+ varying vec2 v_texture_data;
13
+
14
+
12
15
  #pragma include "picking"
13
16
 
14
17
  void main() {
15
- float opacity = styleMappingMat[0][0];
16
- float isSide = styleMappingMat[0][3];
17
- float lightWeight = styleMappingMat[3][1];
18
- float topU = styleMappingMat[2][2];
19
- float topV = styleMappingMat[2][3];
20
-
21
- float sidey = styleMappingMat[3][0];
18
+ float opacity = u_opacity;
19
+ float isSide = v_texture_data.x;
20
+ float lightWeight = v_texture_data.y;
21
+ float topU = v_uvs[0];
22
+ float topV = 1.0 - v_uvs[1];
23
+ float sidey = v_uvs[2];
22
24
  // Tip: 部分机型 GPU 计算精度兼容
23
- if(isSide < 0.999) {
25
+ if(isSide < 0.999) {// 是否是边缘
24
26
  // side face
25
27
  if(u_sidesurface < 1.0) {
26
28
  discard;
@@ -41,6 +43,7 @@ void main() {
41
43
  }
42
44
 
43
45
  gl_FragColor = texture2D(u_texture, vec2(topU, topV));
46
+ // gl_FragColor = vec4(1.0, 0., 0., 1.0);
44
47
  }
45
48
 
46
49
 
@@ -11,57 +11,33 @@ attribute float a_Size;
11
11
  attribute vec3 a_uvs;
12
12
  uniform mat4 u_ModelMatrix;
13
13
  uniform mat4 u_Mvp;
14
+ uniform sampler2D u_texture;
14
15
 
16
+
17
+ uniform vec4 u_sourceColor;
18
+ uniform vec4 u_targetColor;
19
+ uniform float u_topsurface: 1.0;
20
+ uniform float u_sidesurface: 1.0;
15
21
  varying vec4 v_Color;
16
22
  uniform float u_heightfixed: 0.0; // 默认不固定
17
23
  uniform float u_raisingHeight: 0.0;
18
- uniform float u_opacity: 1.0;
19
- varying mat4 styleMappingMat; // 用于将在顶点着色器中计算好的样式值传递给片元
24
+ uniform float u_linearColor: 0.0;
20
25
 
21
- #pragma include "styleMapping"
22
- #pragma include "styleMappingCalOpacity"
26
+ varying vec2 v_texture_data;
27
+ varying vec3 v_uvs;
23
28
 
24
29
  #pragma include "projection"
25
30
  #pragma include "light"
26
31
  #pragma include "picking"
27
32
 
28
33
  void main() {
29
- v_Color = a_Color;
30
-
31
- // cal style mapping - 数据纹理映射部分的计算
32
- styleMappingMat = mat4(
33
- 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - a_Position.z(judge side by a_Position.z)
34
- 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA
35
- 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1] - u - v
36
- 0.0, 0.0, 0.0, 0.0 // sidey
37
- );
38
-
39
- styleMappingMat[0][3] = a_Position.z;
40
- styleMappingMat[2][2] = a_uvs[0];
41
- styleMappingMat[2][3] = 1.0 - a_uvs[1];
42
- styleMappingMat[3][0] = a_uvs[2];
43
-
44
-
45
- float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行
46
- float columnCount = u_cellTypeLayout[0][1]; // 当看到数据纹理有几列
47
- float columnWidth = 1.0/columnCount; // 列宽
48
- float rowHeight = 1.0/rowCount; // 行高
49
- float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets
50
- float id = a_vertexId; // 第n个顶点
51
- float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // 起始点在第几行
52
- float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // 起始点在第几列
53
-
54
- // cell 固定顺序 opacity -> strokeOpacity -> strokeWidth -> stroke ...
55
- // 按顺序从 cell 中取值、若没有则自动往下取值
56
- float textureOffset = 0.0; // 在 cell 中取值的偏移量
57
-
58
- vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);
59
- styleMappingMat[0][0] = opacityAndOffset.r;
60
- textureOffset = opacityAndOffset.g;
61
- // cal style mapping - 数据纹理映射部分的计算
62
-
34
+
63
35
  vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);
36
+ float lightWeight = calc_lighting(pos);
64
37
  vec4 project_pos = project_position(pos);
38
+ v_uvs = a_uvs;
39
+
40
+ v_texture_data = vec2(a_Position.z, lightWeight);
65
41
 
66
42
  if(u_heightfixed > 0.0) { // 判断几何体是否固定高度
67
43
  project_pos.z = a_Position.z * a_Size;
@@ -74,10 +50,6 @@ void main() {
74
50
  }
75
51
  }
76
52
 
77
- // project_pos.z += 500000.0; // amap1
78
-
79
- // project_pos.z += (500000.0 * 4.0)/pow(2.0, 21.0 - u_Zoom); // mapbox
80
- // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
81
53
 
82
54
  if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
83
55
  // gl_Position = u_Mvp * (vec4(project_pos.xyz * vec3(1.0, 1.0, -1.0), 1.0));
@@ -86,8 +58,8 @@ void main() {
86
58
  gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
87
59
  }
88
60
 
89
- float lightWeight = calc_lighting(pos);
90
- styleMappingMat[3][1] = lightWeight;
61
+
62
+
91
63
 
92
64
  setPickingColor(a_PickingColor);
93
65
  }
@@ -1,12 +1,7 @@
1
- uniform float u_opacity: 1.0;
2
1
  varying vec4 v_color;
3
- varying mat4 styleMappingMat; // 传递从片元中传递的映射数据
4
-
5
2
  #pragma include "picking"
6
3
 
7
4
  void main() {
8
- float opacity = styleMappingMat[0][0];
9
5
  gl_FragColor = v_color;
10
- gl_FragColor.a *= opacity;
11
6
  gl_FragColor = filterColor(gl_FragColor);
12
7
  }
@@ -1,7 +1,3 @@
1
- uniform float u_opacity: 1.0;
2
- varying vec4 v_Color;
3
- varying mat4 styleMappingMat; // 传递从片元中传递的映射数据
4
-
5
1
  #pragma include "picking"
6
2
  uniform float u_opacitylinear: 0.0;
7
3
  uniform float u_dir: 1.0;
@@ -10,13 +6,9 @@ varying vec2 v_pos;
10
6
 
11
7
 
12
8
  void main() {
13
- float opacity = styleMappingMat[0][0];
14
- gl_FragColor = v_Color;
15
9
 
16
10
  if(u_opacitylinear > 0.0) {
17
11
  gl_FragColor.a *= u_dir == 1.0 ? 1.0 - length(v_pos - v_linear.xy)/v_linear.z : length(v_pos - v_linear.xy)/v_linear.z;
18
12
  }
19
-
20
- gl_FragColor.a *= opacity;
21
13
  gl_FragColor = filterColor(gl_FragColor);
22
14
  }
@@ -3,14 +3,10 @@ attribute vec3 a_Position;
3
3
 
4
4
  uniform mat4 u_ModelMatrix;
5
5
  uniform mat4 u_Mvp;
6
- uniform float u_opacity: 1.0;
7
6
  uniform float u_raisingHeight: 0.0;
8
7
 
9
8
  varying vec4 v_Color;
10
- varying mat4 styleMappingMat; // 用于将在顶点着色器中计算好的样式值传递给片元
11
9
 
12
- #pragma include "styleMapping"
13
- #pragma include "styleMappingCalOpacity"
14
10
 
15
11
  #pragma include "projection"
16
12
  #pragma include "picking"
@@ -26,34 +22,6 @@ void main() {
26
22
  v_linear = a_linear;
27
23
  v_pos = a_Position.xy;
28
24
  }
29
-
30
- // cal style mapping - 数据纹理映射部分的计算
31
- styleMappingMat = mat4(
32
- 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty
33
- 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA
34
- 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]
35
- 0.0, 0.0, 0.0, 0.0
36
- );
37
-
38
- float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行
39
- float columnCount = u_cellTypeLayout[0][1]; // 当看到数据纹理有几列
40
- float columnWidth = 1.0/columnCount; // 列宽
41
- float rowHeight = 1.0/rowCount; // 行高
42
- float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets
43
- float id = a_vertexId; // 第n个顶点
44
- float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // 起始点在第几行
45
- float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // 起始点在第几列
46
-
47
- // cell 固定顺序 opacity -> strokeOpacity -> strokeWidth -> stroke ...
48
- // 按顺序从 cell 中取值、若没有则自动往下取值
49
- float textureOffset = 0.0; // 在 cell 中取值的偏移量
50
-
51
- vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);
52
- styleMappingMat[0][0] = opacityAndOffset.r;
53
- textureOffset = opacityAndOffset.g;
54
- // cal style mapping - 数据纹理映射部分的计算
55
-
56
- v_Color = a_Color;
57
25
  vec4 project_pos = project_position(vec4(a_Position, 1.0));
58
26
  // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
59
27
  project_pos.z += u_raisingHeight;
@@ -4,46 +4,20 @@ attribute vec3 a_Position;
4
4
  uniform mat4 u_ModelMatrix;
5
5
  uniform mat4 u_Mvp;
6
6
 
7
- uniform float u_opacity: 1.0;
8
7
  uniform float u_raisingHeight: 0.0;
9
8
 
10
9
  varying vec4 v_color;
11
- varying mat4 styleMappingMat; // 用于将在顶点着色器中计算好的样式值传递给片元
12
10
 
13
- #pragma include "styleMapping"
14
- #pragma include "styleMappingCalOpacity"
15
11
 
16
12
  #pragma include "projection"
17
13
  #pragma include "picking"
18
14
 
19
15
  void main() {
20
16
  // cal style mapping - 数据纹理映射部分的计算
21
- styleMappingMat = mat4(
22
- 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty
23
- 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA
24
- 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]
25
- 0.0, 0.0, 0.0, 0.0
26
- );
27
17
 
28
- float rowCount = u_cellTypeLayout[0][0]; // 当前的数据纹理有几行
29
- float columnCount = u_cellTypeLayout[0][1]; // 当看到数据纹理有几列
30
- float columnWidth = 1.0/columnCount; // 列宽
31
- float rowHeight = 1.0/rowCount; // 行高
32
- float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets
33
- float id = a_vertexId; // 第n个顶点
34
- float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // 起始点在第几行
35
- float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // 起始点在第几列
36
-
37
- // cell 固定顺序 opacity -> strokeOpacity -> strokeWidth -> stroke ...
38
- // 按顺序从 cell 中取值、若没有则自动往下取值
39
- float textureOffset = 0.0; // 在 cell 中取值的偏移量
40
-
41
- vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);
42
- styleMappingMat[0][0] = opacityAndOffset.r;
43
- textureOffset = opacityAndOffset.g;
44
18
  // cal style mapping - 数据纹理映射部分的计算
45
19
 
46
- v_color = a_Color;
20
+ v_color = vec4(a_Color.xyz, a_Color.w * opacity);
47
21
  vec4 project_pos = project_position(vec4(a_Position, 1.0));
48
22
  // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
49
23
 
@@ -25,7 +25,7 @@ function adjustData2Amap2Coordinates(mappedData, mapService, layer) {
25
25
  d.originCoordinates = cloneDeep(d.coordinates); // 为了兼容高德1.x 需要保存一份原始的经纬度坐标数据(许多上层逻辑依赖经纬度数据)
26
26
  // @ts-ignore
27
27
  // d.coordinates = mapService.lngLatToCoord(d.coordinates);
28
- d.coordinates = mapService.lngLatToCoordByLayer(d.coordinates, layerCenter);
28
+ d.coordinates = mapService.coordToAMap2RelativeCoordinates(d.coordinates, layerCenter);
29
29
  });
30
30
  } else {
31
31
  // 连续的线、面数据
@@ -40,7 +40,7 @@ function adjustData2Amap2Coordinates(mappedData, mapService, layer) {
40
40
  d.originCoordinates = cloneDeep(d.coordinates); // 为了兼容高德1.x 需要保存一份原始的经纬度坐标数据(许多上层逻辑依赖经纬度数据)
41
41
  // @ts-ignore
42
42
  // d.coordinates = mapService.lngLatToCoords(d.coordinates);
43
- d.coordinates = mapService.lngLatToCoordsByLayer(d.coordinates, layerCenter);
43
+ d.coordinates = mapService.coordToAMap2RelativeCoordinates(d.coordinates, layerCenter);
44
44
  });
45
45
  }
46
46
  }