@antv/l7-layers 2.21.7 → 2.21.9-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/citybuliding/models/build.d.ts +16 -0
- package/es/citybuliding/models/build.js +18 -20
- package/es/citybuliding/shaders/build_frag.glsl +6 -6
- package/es/citybuliding/shaders/build_vert.glsl +8 -14
- package/es/core/BaseLayer.js +9 -8
- package/es/core/BaseModel.d.ts +15 -2
- package/es/core/BaseModel.js +94 -62
- package/es/core/CommonStyleAttribute.d.ts +14 -18
- package/es/core/CommonStyleAttribute.js +23 -67
- package/es/core/triangulation.js +13 -39
- package/es/earth/models/atmosphere.d.ts +15 -0
- package/es/earth/models/atmosphere.js +30 -24
- package/es/earth/models/base.d.ts +15 -0
- package/es/earth/models/base.js +30 -24
- package/es/earth/models/bloomsphere.d.ts +15 -0
- package/es/earth/models/bloomsphere.js +30 -24
- package/es/earth/shaders/atmosphere/atmosphere_vert.glsl +7 -5
- package/es/earth/shaders/base/base_vert.glsl +3 -3
- package/es/earth/shaders/bloomshpere/bloomsphere_vert.glsl +5 -4
- package/es/geometry/models/billboard.d.ts +15 -0
- package/es/geometry/models/billboard.js +14 -8
- package/es/geometry/models/plane.d.ts +14 -0
- package/es/geometry/models/plane.js +10 -10
- package/es/geometry/models/sprite.js +3 -9
- package/es/geometry/shaders/billboard_vert.glsl +28 -25
- package/es/geometry/shaders/plane_vert.glsl +6 -6
- package/es/geometry/shaders/sprite_vert.glsl +7 -9
- package/es/heatmap/models/grid.d.ts +14 -0
- package/es/heatmap/models/grid.js +10 -3
- package/es/heatmap/models/grid3d.d.ts +16 -0
- package/es/heatmap/models/grid3d.js +14 -6
- package/es/heatmap/models/heatmap.d.ts +20 -1
- package/es/heatmap/models/heatmap.js +96 -83
- package/es/heatmap/models/hexagon.d.ts +14 -0
- package/es/heatmap/models/hexagon.js +9 -3
- package/es/heatmap/shaders/grid/grid_vert.glsl +30 -42
- package/es/heatmap/shaders/grid3d/grid_3d_vert.glsl +14 -26
- package/es/heatmap/shaders/heatmap/heatmap_3d_vert.glsl +19 -16
- package/es/heatmap/shaders/heatmap/heatmap_framebuffer_vert.glsl +16 -22
- package/es/heatmap/shaders/heatmap/heatmap_vert.glsl +3 -4
- package/es/heatmap/shaders/hexagon/hexagon_vert.glsl +13 -23
- package/es/image/models/image.d.ts +14 -0
- package/es/image/models/image.js +11 -3
- package/es/image/shaders/image_vert.glsl +7 -6
- package/es/line/models/arc.d.ts +18 -0
- package/es/line/models/arc.js +57 -8
- package/es/line/models/arc_3d.d.ts +18 -0
- package/es/line/models/arc_3d.js +55 -7
- package/es/line/models/flow.d.ts +17 -0
- package/es/line/models/flow.js +35 -7
- package/es/line/models/great_circle.d.ts +17 -0
- package/es/line/models/great_circle.js +34 -6
- package/es/line/models/line.d.ts +17 -0
- package/es/line/models/line.js +17 -8
- package/es/line/models/simple_line.d.ts +14 -0
- package/es/line/models/simple_line.js +12 -47
- package/es/line/models/wall.d.ts +17 -0
- package/es/line/models/wall.js +22 -48
- package/es/line/shaders/arc/line_arc_vert.glsl +42 -48
- package/es/line/shaders/arc3d/line_arc_3d_vert.glsl +15 -20
- package/es/line/shaders/flow/flow_line_vert.glsl +30 -48
- package/es/line/shaders/greatCircle/line_arc_great_circle_vert.glsl +56 -72
- package/es/line/shaders/line/line_vert.glsl +31 -48
- package/es/line/shaders/simple/simpleline_vert.glsl +18 -23
- package/es/line/shaders/wall/wall_vert.glsl +36 -45
- package/es/mask/models/fill.js +2 -1
- package/es/mask/shaders/mask_vert.glsl +2 -7
- package/es/plugins/DataMappingPlugin.d.ts +0 -1
- package/es/plugins/DataMappingPlugin.js +1 -24
- package/es/plugins/PixelPickingPlugin.js +2 -2
- package/es/plugins/RegisterStyleAttributePlugin.d.ts +0 -1
- package/es/plugins/RegisterStyleAttributePlugin.js +3 -25
- package/es/plugins/ShaderUniformPlugin.d.ts +0 -5
- package/es/plugins/ShaderUniformPlugin.js +2 -34
- package/es/point/models/billboard_point.d.ts +14 -0
- package/es/point/models/billboard_point.js +11 -3
- package/es/point/models/earthExtrude.d.ts +16 -0
- package/es/point/models/earthExtrude.js +15 -8
- package/es/point/models/earthFill.d.ts +16 -0
- package/es/point/models/earthFill.js +13 -5
- package/es/point/models/extrude.d.ts +16 -0
- package/es/point/models/extrude.js +19 -12
- package/es/point/models/fill.d.ts +16 -0
- package/es/point/models/fill.js +16 -5
- package/es/point/models/fillImage.d.ts +16 -0
- package/es/point/models/fillImage.js +16 -16
- package/es/point/models/image.d.ts +15 -0
- package/es/point/models/image.js +14 -4
- package/es/point/models/normal.d.ts +14 -0
- package/es/point/models/normal.js +11 -3
- package/es/point/models/radar.d.ts +15 -0
- package/es/point/models/radar.js +13 -4
- package/es/point/models/text.d.ts +16 -0
- package/es/point/models/text.js +18 -11
- package/es/point/shaders/billboard/billboard_point_vert.glsl +10 -13
- package/es/point/shaders/earthExtrude/earthExtrude_vert.glsl +15 -25
- package/es/point/shaders/earthFill/earthFill_vert.glsl +6 -6
- package/es/point/shaders/extrude/extrude_vert.glsl +35 -39
- package/es/point/shaders/fill/fill_vert.glsl +12 -14
- package/es/point/shaders/fillImage/fillImage_vert.glsl +16 -28
- package/es/point/shaders/image/image_vert.glsl +15 -12
- package/es/point/shaders/normal/normal_vert.glsl +7 -10
- package/es/point/shaders/radar/radar_vert.glsl +11 -11
- package/es/point/shaders/text/text_vert.glsl +10 -9
- package/es/polygon/models/extrude.d.ts +16 -0
- package/es/polygon/models/extrude.js +26 -26
- package/es/polygon/models/extrusion.d.ts +16 -0
- package/es/polygon/models/extrusion.js +34 -4
- package/es/polygon/models/fill.d.ts +14 -0
- package/es/polygon/models/fill.js +12 -4
- package/es/polygon/models/ocean.d.ts +14 -0
- package/es/polygon/models/ocean.js +11 -6
- package/es/polygon/models/water.d.ts +14 -0
- package/es/polygon/models/water.js +11 -6
- package/es/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +17 -15
- package/es/polygon/shaders/extrude/polygon_extrude_vert.glsl +22 -20
- package/es/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +17 -17
- package/es/polygon/shaders/extrusion/polygon_extrusion_vert.glsl +8 -8
- package/es/polygon/shaders/fill/fill_linear_vert.glsl +7 -6
- package/es/polygon/shaders/fill/fill_vert.glsl +10 -12
- package/es/polygon/shaders/ocean/ocean_vert.glsl +3 -4
- package/es/polygon/shaders/water/polygon_water_vert.glsl +5 -5
- package/es/raster/index.d.ts +1 -1
- package/es/raster/index.js +1 -1
- package/es/raster/models/raster.d.ts +14 -0
- package/es/raster/models/raster.js +12 -3
- package/es/raster/models/rasterRgb.d.ts +14 -0
- package/es/raster/models/rasterRgb.js +12 -3
- package/es/raster/models/rasterTerrainRgb.d.ts +14 -0
- package/es/raster/models/rasterTerrainRgb.js +11 -3
- package/es/raster/shaders/raster/raster_2d_vert.glsl +6 -6
- package/es/raster/shaders/rgb/raster_rgb_vert.glsl +11 -11
- package/es/raster/shaders/terrain/terrain_rgb_vert.glsl +11 -11
- package/es/tile/core/BaseLayer.js +0 -16
- package/es/utils/extrude_polyline.d.ts +0 -15
- package/es/utils/extrude_polyline.js +0 -217
- package/es/wind/models/wind.d.ts +14 -0
- package/es/wind/models/wind.js +9 -1
- package/es/wind/shaders/wind_vert.glsl +6 -5
- package/lib/citybuliding/models/build.d.ts +16 -0
- package/lib/citybuliding/models/build.js +18 -20
- package/lib/citybuliding/shaders/build_frag.glsl +6 -6
- package/lib/citybuliding/shaders/build_vert.glsl +8 -14
- package/lib/core/BaseLayer.js +9 -8
- package/lib/core/BaseModel.d.ts +15 -2
- package/lib/core/BaseModel.js +92 -60
- package/lib/core/CommonStyleAttribute.d.ts +14 -18
- package/lib/core/CommonStyleAttribute.js +23 -68
- package/lib/core/triangulation.js +13 -39
- package/lib/earth/models/atmosphere.d.ts +15 -0
- package/lib/earth/models/atmosphere.js +30 -24
- package/lib/earth/models/base.d.ts +15 -0
- package/lib/earth/models/base.js +30 -24
- package/lib/earth/models/bloomsphere.d.ts +15 -0
- package/lib/earth/models/bloomsphere.js +30 -24
- package/lib/earth/shaders/atmosphere/atmosphere_vert.glsl +7 -5
- package/lib/earth/shaders/base/base_vert.glsl +3 -3
- package/lib/earth/shaders/bloomshpere/bloomsphere_vert.glsl +5 -4
- package/lib/geometry/models/billboard.d.ts +15 -0
- package/lib/geometry/models/billboard.js +14 -8
- package/lib/geometry/models/plane.d.ts +14 -0
- package/lib/geometry/models/plane.js +10 -10
- package/lib/geometry/models/sprite.js +3 -9
- package/lib/geometry/shaders/billboard_vert.glsl +28 -25
- package/lib/geometry/shaders/plane_vert.glsl +6 -6
- package/lib/geometry/shaders/sprite_vert.glsl +7 -9
- package/lib/heatmap/models/grid.d.ts +14 -0
- package/lib/heatmap/models/grid.js +10 -3
- package/lib/heatmap/models/grid3d.d.ts +16 -0
- package/lib/heatmap/models/grid3d.js +14 -6
- package/lib/heatmap/models/heatmap.d.ts +20 -1
- package/lib/heatmap/models/heatmap.js +95 -82
- package/lib/heatmap/models/hexagon.d.ts +14 -0
- package/lib/heatmap/models/hexagon.js +9 -3
- package/lib/heatmap/shaders/grid/grid_vert.glsl +30 -42
- package/lib/heatmap/shaders/grid3d/grid_3d_vert.glsl +14 -26
- package/lib/heatmap/shaders/heatmap/heatmap_3d_vert.glsl +19 -16
- package/lib/heatmap/shaders/heatmap/heatmap_framebuffer_vert.glsl +16 -22
- package/lib/heatmap/shaders/heatmap/heatmap_vert.glsl +3 -4
- package/lib/heatmap/shaders/hexagon/hexagon_vert.glsl +13 -23
- package/lib/image/models/image.d.ts +14 -0
- package/lib/image/models/image.js +11 -3
- package/lib/image/shaders/image_vert.glsl +7 -6
- package/lib/line/models/arc.d.ts +18 -0
- package/lib/line/models/arc.js +56 -7
- package/lib/line/models/arc_3d.d.ts +18 -0
- package/lib/line/models/arc_3d.js +55 -7
- package/lib/line/models/flow.d.ts +17 -0
- package/lib/line/models/flow.js +35 -7
- package/lib/line/models/great_circle.d.ts +17 -0
- package/lib/line/models/great_circle.js +33 -5
- package/lib/line/models/line.d.ts +17 -0
- package/lib/line/models/line.js +17 -8
- package/lib/line/models/simple_line.d.ts +14 -0
- package/lib/line/models/simple_line.js +12 -47
- package/lib/line/models/wall.d.ts +17 -0
- package/lib/line/models/wall.js +22 -48
- package/lib/line/shaders/arc/line_arc_vert.glsl +42 -48
- package/lib/line/shaders/arc3d/line_arc_3d_vert.glsl +15 -20
- package/lib/line/shaders/flow/flow_line_vert.glsl +30 -48
- package/lib/line/shaders/greatCircle/line_arc_great_circle_vert.glsl +56 -72
- package/lib/line/shaders/line/line_vert.glsl +31 -48
- package/lib/line/shaders/simple/simpleline_vert.glsl +18 -23
- package/lib/line/shaders/wall/wall_vert.glsl +36 -45
- package/lib/mask/models/fill.js +2 -1
- package/lib/mask/shaders/mask_vert.glsl +2 -7
- package/lib/plugins/DataMappingPlugin.d.ts +0 -1
- package/lib/plugins/DataMappingPlugin.js +0 -23
- package/lib/plugins/PixelPickingPlugin.js +1 -1
- package/lib/plugins/RegisterStyleAttributePlugin.d.ts +0 -1
- package/lib/plugins/RegisterStyleAttributePlugin.js +2 -24
- package/lib/plugins/ShaderUniformPlugin.d.ts +0 -5
- package/lib/plugins/ShaderUniformPlugin.js +2 -34
- package/lib/point/models/billboard_point.d.ts +14 -0
- package/lib/point/models/billboard_point.js +11 -3
- package/lib/point/models/earthExtrude.d.ts +16 -0
- package/lib/point/models/earthExtrude.js +14 -7
- package/lib/point/models/earthFill.d.ts +16 -0
- package/lib/point/models/earthFill.js +13 -5
- package/lib/point/models/extrude.d.ts +16 -0
- package/lib/point/models/extrude.js +18 -11
- package/lib/point/models/fill.d.ts +16 -0
- package/lib/point/models/fill.js +16 -5
- package/lib/point/models/fillImage.d.ts +16 -0
- package/lib/point/models/fillImage.js +16 -16
- package/lib/point/models/image.d.ts +15 -0
- package/lib/point/models/image.js +14 -4
- package/lib/point/models/normal.d.ts +14 -0
- package/lib/point/models/normal.js +11 -3
- package/lib/point/models/radar.d.ts +15 -0
- package/lib/point/models/radar.js +13 -4
- package/lib/point/models/text.d.ts +16 -0
- package/lib/point/models/text.js +18 -11
- package/lib/point/shaders/billboard/billboard_point_vert.glsl +10 -13
- package/lib/point/shaders/earthExtrude/earthExtrude_vert.glsl +15 -25
- package/lib/point/shaders/earthFill/earthFill_vert.glsl +6 -6
- package/lib/point/shaders/extrude/extrude_vert.glsl +35 -39
- package/lib/point/shaders/fill/fill_vert.glsl +12 -14
- package/lib/point/shaders/fillImage/fillImage_vert.glsl +16 -28
- package/lib/point/shaders/image/image_vert.glsl +15 -12
- package/lib/point/shaders/normal/normal_vert.glsl +7 -10
- package/lib/point/shaders/radar/radar_vert.glsl +11 -11
- package/lib/point/shaders/text/text_vert.glsl +10 -9
- package/lib/polygon/models/extrude.d.ts +16 -0
- package/lib/polygon/models/extrude.js +25 -25
- package/lib/polygon/models/extrusion.d.ts +16 -0
- package/lib/polygon/models/extrusion.js +34 -4
- package/lib/polygon/models/fill.d.ts +14 -0
- package/lib/polygon/models/fill.js +12 -4
- package/lib/polygon/models/ocean.d.ts +14 -0
- package/lib/polygon/models/ocean.js +11 -6
- package/lib/polygon/models/water.d.ts +14 -0
- package/lib/polygon/models/water.js +11 -6
- package/lib/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +17 -15
- package/lib/polygon/shaders/extrude/polygon_extrude_vert.glsl +22 -20
- package/lib/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +17 -17
- package/lib/polygon/shaders/extrusion/polygon_extrusion_vert.glsl +8 -8
- package/lib/polygon/shaders/fill/fill_linear_vert.glsl +7 -6
- package/lib/polygon/shaders/fill/fill_vert.glsl +10 -12
- package/lib/polygon/shaders/ocean/ocean_vert.glsl +3 -4
- package/lib/polygon/shaders/water/polygon_water_vert.glsl +5 -5
- package/lib/raster/index.d.ts +1 -1
- package/lib/raster/index.js +2 -2
- package/lib/raster/models/raster.d.ts +14 -0
- package/lib/raster/models/raster.js +12 -3
- package/lib/raster/models/rasterRgb.d.ts +14 -0
- package/lib/raster/models/rasterRgb.js +12 -3
- package/lib/raster/models/rasterTerrainRgb.d.ts +14 -0
- package/lib/raster/models/rasterTerrainRgb.js +11 -3
- package/lib/raster/shaders/raster/raster_2d_vert.glsl +6 -6
- package/lib/raster/shaders/rgb/raster_rgb_vert.glsl +11 -11
- package/lib/raster/shaders/terrain/terrain_rgb_vert.glsl +11 -11
- package/lib/tile/core/BaseLayer.js +0 -16
- package/lib/utils/extrude_polyline.d.ts +0 -15
- package/lib/utils/extrude_polyline.js +0 -217
- package/lib/wind/models/wind.d.ts +14 -0
- package/lib/wind/models/wind.js +9 -1
- package/lib/wind/shaders/wind_vert.glsl +6 -5
- package/package.json +6 -6
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
#define Animate (0.0)
|
|
1
2
|
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
layout(location =
|
|
5
|
-
layout(location =
|
|
6
|
-
layout(location =
|
|
7
|
-
layout(location =
|
|
8
|
-
layout(location =
|
|
9
|
-
layout(location = 14) in vec2 a_iconMapUV;
|
|
3
|
+
layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
|
|
4
|
+
layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;
|
|
5
|
+
layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
|
|
6
|
+
layout(location = ATTRIBUTE_LOCATION_SIZE) in vec2 a_Size;
|
|
7
|
+
layout(location = ATTRIBUTE_LOCATION_DISTANCE_INDEX) in vec3 a_DistanceAndIndexAndMiter;
|
|
8
|
+
layout(location = ATTRIBUTE_LOCATION_NORMAL) in vec4 a_Normal_Total_Distance;
|
|
9
|
+
layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_iconMapUV;
|
|
10
10
|
|
|
11
11
|
layout(std140) uniform commonUniorm {
|
|
12
12
|
vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
|
|
@@ -27,7 +27,6 @@ layout(std140) uniform commonUniorm {
|
|
|
27
27
|
float u_time;
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
|
|
31
30
|
out vec4 v_color;
|
|
32
31
|
out vec4 v_stroke;
|
|
33
32
|
//dash
|
|
@@ -50,69 +49,53 @@ void main() {
|
|
|
50
49
|
v_d_distance_ratio = a_DistanceAndIndex.x / a_Total_Distance;
|
|
51
50
|
|
|
52
51
|
// cal style mapping - 数据纹理映射部分的计算
|
|
53
|
-
float d_texPixelLen;
|
|
52
|
+
float d_texPixelLen; // 贴图的像素长度,根据地图层级缩放
|
|
54
53
|
v_iconMapUV = a_iconMapUV;
|
|
55
54
|
d_texPixelLen = project_float_pixel(u_icon_step);
|
|
56
|
-
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {
|
|
57
|
-
d_texPixelLen *= 10.0;
|
|
58
|
-
}
|
|
59
55
|
|
|
60
56
|
v_color = a_Color;
|
|
61
57
|
v_color.a *= opacity;
|
|
62
58
|
v_stroke = stroke;
|
|
63
59
|
|
|
64
|
-
vec3 size = a_Miter * setPickingSize(a_Size.x) *
|
|
65
|
-
|
|
60
|
+
vec3 size = a_Miter * setPickingSize(a_Size.x) * a_Normal;
|
|
61
|
+
|
|
66
62
|
vec2 offset = project_pixel(size.xy);
|
|
67
63
|
|
|
68
64
|
float lineDistance = a_DistanceAndIndex.x;
|
|
69
65
|
float currentLinePointRatio = lineDistance / a_Total_Distance;
|
|
70
|
-
|
|
71
66
|
|
|
72
67
|
float lineOffsetWidth = length(offset + offset * sign(a_Miter)); // 线横向偏移的距离(向两侧偏移的和)
|
|
73
|
-
float linePixelSize = project_pixel(a_Size.x) * 2.0;
|
|
74
|
-
float texV = lineOffsetWidth/linePixelSize; // 线图层贴图部分的 v 坐标值
|
|
75
|
-
|
|
68
|
+
float linePixelSize = project_pixel(a_Size.x) * 2.0; // 定点位置偏移,按地图等级缩放后的距离 单侧 * 2
|
|
69
|
+
float texV = lineOffsetWidth / linePixelSize; // 线图层贴图部分的 v 坐标值
|
|
70
|
+
|
|
76
71
|
v_texture_data = vec4(currentLinePointRatio, lineDistance, d_texPixelLen, texV);
|
|
77
72
|
// 设置数据集的参数
|
|
78
73
|
|
|
79
|
-
vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));
|
|
74
|
+
vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0), a_Position64Low);
|
|
80
75
|
|
|
81
76
|
// gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, a_Size.y, 1.0));
|
|
82
77
|
|
|
83
78
|
float h = float(a_Position.z) * u_vertexScale; // 线顶点的高度 - 兼容不存在第三个数值的情况 vertex height
|
|
84
79
|
float lineHeight = a_Size.y; // size 第二个参数代表的高度 [linewidth, lineheight]
|
|
85
80
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);
|
|
99
|
-
h *= mapboxZoomScale;
|
|
100
|
-
h += u_raisingHeight * mapboxZoomScale;
|
|
101
|
-
if(u_heightfixed > 0.0) {
|
|
102
|
-
lineHeight *= mapboxZoomScale;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
} else {
|
|
106
|
-
// amap
|
|
107
|
-
h += u_raisingHeight;
|
|
108
|
-
// lineHeight 顶点偏移高度
|
|
109
|
-
if(u_heightfixed < 1.0) {
|
|
110
|
-
lineHeight *= pow(2.0, 20.0 - u_Zoom);
|
|
111
|
-
}
|
|
81
|
+
// 兼容 mapbox 在线高度上的效果表现基本一致
|
|
82
|
+
if (
|
|
83
|
+
u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
|
|
84
|
+
u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET
|
|
85
|
+
) {
|
|
86
|
+
// mapbox
|
|
87
|
+
// 保持高度相对不变
|
|
88
|
+
float mapboxZoomScale = 4.0 / pow(2.0, 21.0 - u_Zoom);
|
|
89
|
+
h *= mapboxZoomScale;
|
|
90
|
+
h += u_raisingHeight * mapboxZoomScale;
|
|
91
|
+
if (u_heightfixed > 0.0) {
|
|
92
|
+
lineHeight *= mapboxZoomScale;
|
|
112
93
|
}
|
|
113
|
-
|
|
114
|
-
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, lineHeight + h, 1.0));
|
|
115
94
|
}
|
|
116
95
|
|
|
96
|
+
gl_Position = project_common_position_to_clipspace(
|
|
97
|
+
vec4(project_pos.xy + offset, lineHeight + h, 1.0)
|
|
98
|
+
);
|
|
99
|
+
|
|
117
100
|
setPickingColor(a_PickingColor);
|
|
118
101
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
layout(location =
|
|
2
|
-
layout(location =
|
|
3
|
-
layout(location =
|
|
1
|
+
layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
|
|
2
|
+
layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;
|
|
3
|
+
layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
|
|
4
|
+
layout(location = ATTRIBUTE_LOCATION_SIZE) in vec4 a_SizeDistanceAndTotalDistance;
|
|
4
5
|
|
|
5
6
|
layout(std140) uniform commonUniorm {
|
|
6
7
|
vec4 u_sourceColor;
|
|
@@ -21,30 +22,24 @@ void main() {
|
|
|
21
22
|
//dash输出
|
|
22
23
|
v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / a_SizeDistanceAndTotalDistance.a;
|
|
23
24
|
|
|
24
|
-
v_color = a_Color;
|
|
25
|
+
v_color = a_Color;
|
|
25
26
|
v_distanceScale = a_SizeDistanceAndTotalDistance.b / a_SizeDistanceAndTotalDistance.a;
|
|
26
27
|
v_color.a = v_color.a * opacity;
|
|
27
|
-
vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));
|
|
28
|
+
vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0), a_Position64Low);
|
|
28
29
|
|
|
29
30
|
float h = float(a_Position.z) * u_vertexScale; // 线顶点的高度 - 兼容不存在第三个数值的情况
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// amap1.x
|
|
42
|
-
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20 || u_CoordinateSystem == COORDINATE_SYSTEM_P20_OFFSET) {
|
|
43
|
-
// 保持高度相对不变
|
|
44
|
-
lineHeight *= pow(2.0, 20.0 - u_Zoom);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, lineHeight + h, 1.0));
|
|
48
|
-
gl_PointSize = 10.0;
|
|
32
|
+
float lineHeight = a_SizeDistanceAndTotalDistance.y;
|
|
33
|
+
// 兼容 mapbox 在线高度上的效果表现基本一致
|
|
34
|
+
if (
|
|
35
|
+
u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
|
|
36
|
+
u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET
|
|
37
|
+
) {
|
|
38
|
+
// 保持高度相对不变
|
|
39
|
+
h *= 2.0 / pow(2.0, 20.0 - u_Zoom);
|
|
49
40
|
}
|
|
41
|
+
|
|
42
|
+
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, lineHeight + h, 1.0));
|
|
43
|
+
gl_PointSize = 10.0;
|
|
44
|
+
|
|
50
45
|
}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
#define Animate 0.0
|
|
2
|
-
layout(location =
|
|
3
|
-
layout(location =
|
|
4
|
-
layout(location =
|
|
5
|
-
layout(location =
|
|
6
|
-
layout(location =
|
|
7
|
-
layout(location =
|
|
8
|
-
layout(location =
|
|
9
|
-
layout(location = 14) in vec2 a_iconMapUV;
|
|
10
|
-
layout(location = 15) in float a_Distance;
|
|
11
|
-
|
|
2
|
+
layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
|
|
3
|
+
layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;
|
|
4
|
+
layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
|
|
5
|
+
layout(location = ATTRIBUTE_LOCATION_SIZE) in vec2 a_Size;
|
|
6
|
+
layout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal;
|
|
7
|
+
layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_iconMapUV;
|
|
8
|
+
layout(location = ATTRIBUTE_LOCATION_DISTANCE_MITER_TOTAL) in vec3 a_Distance_Total_Miter;
|
|
12
9
|
|
|
13
10
|
layout(std140) uniform commonUniorm {
|
|
14
11
|
vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
|
|
@@ -23,6 +20,7 @@ layout(std140) uniform commonUniorm {
|
|
|
23
20
|
float u_iconStepCount;
|
|
24
21
|
float u_time;
|
|
25
22
|
};
|
|
23
|
+
|
|
26
24
|
#pragma include "projection"
|
|
27
25
|
#pragma include "light"
|
|
28
26
|
#pragma include "picking"
|
|
@@ -35,66 +33,59 @@ out float v_radio;
|
|
|
35
33
|
out vec4 v_dataset;
|
|
36
34
|
|
|
37
35
|
void main() {
|
|
38
|
-
|
|
36
|
+
float a_Distance = a_Distance_Total_Miter.x;
|
|
37
|
+
float a_Miter = a_Distance_Total_Miter.y;
|
|
38
|
+
float a_Total_Distance = a_Distance_Total_Miter.z;
|
|
39
39
|
|
|
40
40
|
float d_distance_ratio; // 当前点位距离占线总长的比例
|
|
41
|
-
float d_texPixelLen;
|
|
41
|
+
float d_texPixelLen; // 贴图的像素长度,根据地图层级缩放
|
|
42
42
|
|
|
43
43
|
v_iconMapUV = a_iconMapUV;
|
|
44
|
-
if(u_heightfixed < 1.0) {
|
|
44
|
+
if (u_heightfixed < 1.0) {
|
|
45
|
+
// 高度随 zoom 调整
|
|
45
46
|
d_texPixelLen = project_pixel(u_icon_step);
|
|
46
47
|
} else {
|
|
47
48
|
d_texPixelLen = u_icon_step;
|
|
48
49
|
}
|
|
49
|
-
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {
|
|
50
|
-
d_texPixelLen *= 10.0;
|
|
51
|
-
}
|
|
52
50
|
|
|
53
|
-
if(u_animate.x == Animate || u_linearColor == 1.0) {
|
|
54
|
-
|
|
51
|
+
if (u_animate.x == Animate || u_linearColor == 1.0) {
|
|
52
|
+
d_distance_ratio = a_Distance / a_Total_Distance;
|
|
55
53
|
}
|
|
56
54
|
|
|
57
|
-
float miter = (a_Miter + 1.0)/2.0;
|
|
55
|
+
float miter = (a_Miter + 1.0) / 2.0;
|
|
58
56
|
// 设置数据集的参数
|
|
59
57
|
v_dataset[0] = d_distance_ratio; // 当前点位距离占线总长的比例
|
|
60
|
-
v_dataset[1] = a_Distance;
|
|
61
|
-
v_dataset[2] = d_texPixelLen;
|
|
62
|
-
v_dataset[3] = miter;
|
|
58
|
+
v_dataset[1] = a_Distance; // 当前顶点的距离
|
|
59
|
+
v_dataset[2] = d_texPixelLen; // 贴图的像素长度,根据地图层级缩放
|
|
60
|
+
v_dataset[3] = miter; // 线图层贴图部分的 v 坐标值 0 - 1
|
|
63
61
|
|
|
64
|
-
vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));
|
|
62
|
+
vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0), a_Position64Low);
|
|
65
63
|
|
|
66
|
-
float originSize = a_Size.x;
|
|
67
|
-
if(u_heightfixed < 1.0) {
|
|
68
|
-
|
|
64
|
+
float originSize = a_Size.x; // 固定高度
|
|
65
|
+
if (u_heightfixed < 1.0) {
|
|
66
|
+
originSize = project_float_meter(a_Size.x); // 高度随 zoom 调整
|
|
69
67
|
}
|
|
70
68
|
|
|
71
|
-
|
|
72
69
|
float wallHeight = originSize * miter;
|
|
73
70
|
float lightWeight = calc_lighting(vec4(project_pos.xy, wallHeight, 1.0));
|
|
74
71
|
|
|
75
72
|
v_blur = min(project_float_pixel(2.0) / originSize, 0.05);
|
|
76
73
|
v_color = vec4(a_Color.rgb * lightWeight, a_Color.w * opacity);
|
|
77
74
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
} else {
|
|
91
|
-
// lineHeight 顶点偏移高度
|
|
92
|
-
if(u_heightfixed < 1.0) {
|
|
93
|
-
wallHeight *= pow(2.0, 20.0 - u_Zoom);
|
|
94
|
-
}
|
|
75
|
+
// 兼容 mapbox 在线高度上的效果表现基本一致
|
|
76
|
+
if (
|
|
77
|
+
u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
|
|
78
|
+
u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET
|
|
79
|
+
) {
|
|
80
|
+
// mapbox
|
|
81
|
+
// 保持高度相对不变
|
|
82
|
+
float mapboxZoomScale = 4.0 / pow(2.0, 21.0 - u_Zoom);
|
|
83
|
+
if (u_heightfixed > 0.0) {
|
|
84
|
+
wallHeight *= mapboxZoomScale;
|
|
95
85
|
}
|
|
96
|
-
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, wallHeight, 1.0));
|
|
97
86
|
}
|
|
98
87
|
|
|
88
|
+
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, wallHeight, 1.0));
|
|
89
|
+
|
|
99
90
|
setPickingColor(a_PickingColor);
|
|
100
91
|
}
|
package/lib/mask/models/fill.js
CHANGED
|
@@ -13,7 +13,7 @@ var _triangulation = require("../../core/triangulation");
|
|
|
13
13
|
/* babel-plugin-inline-import '../../shader/minify_frag.glsl' */
|
|
14
14
|
const mask_frag = "layout(std140) uniform commonUniorm {\n vec4 u_color;\n float u_opacity;\n};\n\nout vec4 outputColor;\n\nvoid main() {\n outputColor = u_color;\n outputColor.a *= u_opacity;\n}\n";
|
|
15
15
|
/* babel-plugin-inline-import '../shaders/mask_vert.glsl' */
|
|
16
|
-
const mask_vert = "layout(location =
|
|
16
|
+
const mask_vert = "layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\n\nlayout(std140) uniform commonUniorm {\n vec4 u_color;\n float u_opacity;\n};\n\n#pragma include \"projection\"\n\nvoid main() {\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n}\n\n";
|
|
17
17
|
class MaskModel extends _BaseModel.default {
|
|
18
18
|
getUninforms() {
|
|
19
19
|
const commoninfo = this.getCommonUniformsInfo();
|
|
@@ -47,6 +47,7 @@ class MaskModel extends _BaseModel.default {
|
|
|
47
47
|
moduleName: 'mask',
|
|
48
48
|
vertexShader: mask_vert,
|
|
49
49
|
fragmentShader: mask_frag,
|
|
50
|
+
defines: _this2.getDefines(),
|
|
50
51
|
triangulation: _triangulation.polygonTriangulation,
|
|
51
52
|
depth: {
|
|
52
53
|
enable: false
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
layout(location =
|
|
1
|
+
layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
|
|
2
2
|
|
|
3
3
|
layout(std140) uniform commonUniorm {
|
|
4
4
|
vec4 u_color;
|
|
@@ -9,11 +9,6 @@ layout(std140) uniform commonUniorm {
|
|
|
9
9
|
|
|
10
10
|
void main() {
|
|
11
11
|
vec4 project_pos = project_position(vec4(a_Position, 1.0));
|
|
12
|
-
|
|
13
|
-
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
|
|
14
|
-
gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));
|
|
15
|
-
} else {
|
|
16
|
-
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
|
|
17
|
-
}
|
|
12
|
+
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
|
|
18
13
|
}
|
|
19
14
|
|
|
@@ -5,7 +5,6 @@ export default class DataMappingPlugin implements ILayerPlugin {
|
|
|
5
5
|
apply(layer: ILayer, { styleAttributeService, mapService, fontService }: L7Container): void;
|
|
6
6
|
private generateMaping;
|
|
7
7
|
private mapping;
|
|
8
|
-
private adjustData2Amap2Coordinates;
|
|
9
8
|
private adjustData2SimpleCoordinates;
|
|
10
9
|
private unProjectCoordinates;
|
|
11
10
|
private applyAttributeMapping;
|
|
@@ -10,9 +10,6 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
var _l7Core = require("@antv/l7-core");
|
|
12
12
|
var _l7Utils = require("@antv/l7-utils");
|
|
13
|
-
const {
|
|
14
|
-
cloneDeep
|
|
15
|
-
} = _l7Utils.lodashUtil;
|
|
16
13
|
class DataMappingPlugin {
|
|
17
14
|
constructor() {
|
|
18
15
|
(0, _defineProperty2.default)(this, "mapService", void 0);
|
|
@@ -143,31 +140,11 @@ class DataMappingPlugin {
|
|
|
143
140
|
attributes.forEach(attribute => {
|
|
144
141
|
attribute.needRemapping = false;
|
|
145
142
|
});
|
|
146
|
-
// 调整数据兼容 Amap2.0
|
|
147
|
-
this.adjustData2Amap2Coordinates(mappedData, layer);
|
|
148
143
|
|
|
149
144
|
// 调整数据兼容 SimpleCoordinates
|
|
150
145
|
this.adjustData2SimpleCoordinates(mappedData);
|
|
151
146
|
return mappedData;
|
|
152
147
|
}
|
|
153
|
-
adjustData2Amap2Coordinates(mappedData, layer) {
|
|
154
|
-
// 根据地图的类型判断是否需要对点位数据进行处理, 若是高德2.0则需要对坐标进行相对偏移
|
|
155
|
-
if (mappedData.length > 0 && this.mapService.version === 'GAODE2.x') {
|
|
156
|
-
const layerCenter = layer.coordCenter || layer.getSource().center;
|
|
157
|
-
// 单个的点数据
|
|
158
|
-
// @ts-ignore
|
|
159
|
-
mappedData
|
|
160
|
-
// TODO: 避免经纬度被重复计算导致坐标位置偏移
|
|
161
|
-
.filter(d => !d.originCoordinates).map(d => {
|
|
162
|
-
d.version = 'GAODE2.x';
|
|
163
|
-
// @ts-ignore
|
|
164
|
-
d.originCoordinates = cloneDeep(d.coordinates); // 为了兼容高德1.x 需要保存一份原始的经纬度坐标数据(许多上层逻辑依赖经纬度数据)
|
|
165
|
-
// @ts-ignore
|
|
166
|
-
// d.coordinates = this.mapService.lngLatToCoord(d.coordinates);
|
|
167
|
-
d.coordinates = this.mapService.coordToAMap2RelativeCoordinates(d.coordinates, layerCenter);
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
148
|
adjustData2SimpleCoordinates(mappedData) {
|
|
172
149
|
if (mappedData.length > 0 && this.mapService.version === 'SIMPLE') {
|
|
173
150
|
mappedData.map(d => {
|
|
@@ -66,7 +66,7 @@ class PixelPickingPlugin {
|
|
|
66
66
|
type: _l7Core.AttributeType.Attribute,
|
|
67
67
|
descriptor: {
|
|
68
68
|
name: 'a_PickingColor',
|
|
69
|
-
shaderLocation: _CommonStyleAttribute.
|
|
69
|
+
shaderLocation: _CommonStyleAttribute.COMMON_ATTRIBUTE_LOCATION.PICKING_COLOR,
|
|
70
70
|
buffer: {
|
|
71
71
|
data: [],
|
|
72
72
|
type: _l7Core.gl.FLOAT
|
|
@@ -32,7 +32,6 @@ class RegisterStyleAttributePlugin {
|
|
|
32
32
|
this.registerPositionAttribute(styleAttributeService);
|
|
33
33
|
// this.registerFilterAttribute(styleAttributeService);//数据层数据过滤
|
|
34
34
|
this.registerColorAttribute(styleAttributeService);
|
|
35
|
-
this.registerVertexIdAttribute(styleAttributeService);
|
|
36
35
|
}
|
|
37
36
|
registerPositionAttribute(styleAttributeService) {
|
|
38
37
|
styleAttributeService.registerStyleAttribute({
|
|
@@ -40,7 +39,7 @@ class RegisterStyleAttributePlugin {
|
|
|
40
39
|
type: _l7Core.AttributeType.Attribute,
|
|
41
40
|
descriptor: {
|
|
42
41
|
name: 'a_Position',
|
|
43
|
-
shaderLocation: _CommonStyleAttribute.
|
|
42
|
+
shaderLocation: _CommonStyleAttribute.COMMON_ATTRIBUTE_LOCATION.POSITION,
|
|
44
43
|
buffer: {
|
|
45
44
|
data: [],
|
|
46
45
|
type: _l7Core.gl.FLOAT
|
|
@@ -58,7 +57,7 @@ class RegisterStyleAttributePlugin {
|
|
|
58
57
|
type: _l7Core.AttributeType.Attribute,
|
|
59
58
|
descriptor: {
|
|
60
59
|
name: 'a_Color',
|
|
61
|
-
shaderLocation: _CommonStyleAttribute.
|
|
60
|
+
shaderLocation: _CommonStyleAttribute.COMMON_ATTRIBUTE_LOCATION.COLOR,
|
|
62
61
|
buffer: {
|
|
63
62
|
// give the WebGL driver a hint that this buffer may change
|
|
64
63
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
@@ -75,26 +74,5 @@ class RegisterStyleAttributePlugin {
|
|
|
75
74
|
}
|
|
76
75
|
});
|
|
77
76
|
}
|
|
78
|
-
registerVertexIdAttribute(styleAttributeService) {
|
|
79
|
-
styleAttributeService.registerStyleAttribute({
|
|
80
|
-
// 统一注册每个顶点的唯一编号(目前用于样式的数据映射计算使用)
|
|
81
|
-
name: 'vertexId',
|
|
82
|
-
type: _l7Core.AttributeType.Attribute,
|
|
83
|
-
descriptor: {
|
|
84
|
-
name: 'a_vertexId',
|
|
85
|
-
shaderLocation: _CommonStyleAttribute.ShaderLocation.VERTEX_ID,
|
|
86
|
-
buffer: {
|
|
87
|
-
// give the WebGL driver a hint that this buffer may change
|
|
88
|
-
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
89
|
-
data: [],
|
|
90
|
-
type: _l7Core.gl.FLOAT
|
|
91
|
-
},
|
|
92
|
-
size: 1,
|
|
93
|
-
update: (feature, featureIdx) => {
|
|
94
|
-
return [featureIdx];
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
77
|
}
|
|
100
78
|
exports.default = RegisterStyleAttributePlugin;
|
|
@@ -13,10 +13,5 @@ export default class ShaderUniformPlugin implements ILayerPlugin {
|
|
|
13
13
|
private mapService;
|
|
14
14
|
private layerService;
|
|
15
15
|
apply(layer: ILayer, { rendererService, mapService, layerService, coordinateSystemService, cameraService, }: L7Container): void;
|
|
16
|
-
/**
|
|
17
|
-
* 对于每个 layer 都有不同的几何中心点,因此在绘制每个 layer 的时候都需要重新设置
|
|
18
|
-
* @param layer
|
|
19
|
-
*/
|
|
20
|
-
private setLayerCenter;
|
|
21
16
|
private generateUBO;
|
|
22
17
|
}
|
|
@@ -35,9 +35,6 @@ class ShaderUniformPlugin {
|
|
|
35
35
|
this.layerService = layerService;
|
|
36
36
|
this.coordinateSystemService = coordinateSystemService;
|
|
37
37
|
this.cameraService = cameraService;
|
|
38
|
-
const version = this.mapService.version;
|
|
39
|
-
let mvp = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]; // default matrix (for gaode2.x)
|
|
40
|
-
let sceneCenterMercator = [0, 0];
|
|
41
38
|
let uniformBuffer;
|
|
42
39
|
if (!this.rendererService.uniformBuffers[0]) {
|
|
43
40
|
// Create a Uniform Buffer Object(UBO).
|
|
@@ -52,19 +49,6 @@ class ShaderUniformPlugin {
|
|
|
52
49
|
const offset = layer.getLayerConfig().tileOrigin;
|
|
53
50
|
// 重新计算坐标系参数
|
|
54
51
|
this.coordinateSystemService.refresh(offset);
|
|
55
|
-
if (version === 'GAODE2.x') {
|
|
56
|
-
this.setLayerCenter(layer);
|
|
57
|
-
// @ts-ignore
|
|
58
|
-
mvp = this.mapService.map.customCoords.getMVPMatrix();
|
|
59
|
-
// mvp = amapCustomCoords.getMVPMatrix()
|
|
60
|
-
// @ts-ignore
|
|
61
|
-
sceneCenterMercator = this.mapService.getCustomCoordCenter();
|
|
62
|
-
const uniformBuffer = layer.getLayerUniformBuffer();
|
|
63
|
-
uniformBuffer.subData({
|
|
64
|
-
offset: 0,
|
|
65
|
-
data: new Uint8Array(new Float32Array([...mvp, ...sceneCenterMercator]).buffer)
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
52
|
const {
|
|
69
53
|
width,
|
|
70
54
|
height
|
|
@@ -72,7 +56,7 @@ class ShaderUniformPlugin {
|
|
|
72
56
|
const {
|
|
73
57
|
data,
|
|
74
58
|
uniforms
|
|
75
|
-
} = this.generateUBO(
|
|
59
|
+
} = this.generateUBO(width, height);
|
|
76
60
|
if (this.layerService.alreadyInRendering && this.rendererService.uniformBuffers[0]) {
|
|
77
61
|
const renderUniformBuffer = this.rendererService.uniformBuffers[0];
|
|
78
62
|
// Update only once since all models can share one UBO.
|
|
@@ -96,20 +80,7 @@ class ShaderUniformPlugin {
|
|
|
96
80
|
}
|
|
97
81
|
});
|
|
98
82
|
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* 对于每个 layer 都有不同的几何中心点,因此在绘制每个 layer 的时候都需要重新设置
|
|
102
|
-
* @param layer
|
|
103
|
-
*/
|
|
104
|
-
setLayerCenter(layer) {
|
|
105
|
-
if (layer.coordCenter === undefined) {
|
|
106
|
-
layer.coordCenter = layer.getSource().center;
|
|
107
|
-
}
|
|
108
|
-
if (this.mapService.setCoordCenter) {
|
|
109
|
-
this.mapService.setCoordCenter(layer.coordCenter);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
generateUBO(u_Mvp, sceneCenterMercator, width, height) {
|
|
83
|
+
generateUBO(width, height) {
|
|
113
84
|
const u_ProjectionMatrix = this.cameraService.getProjectionMatrix();
|
|
114
85
|
const u_ViewMatrix = this.cameraService.getViewMatrix();
|
|
115
86
|
const u_ViewProjectionMatrix = this.cameraService.getViewProjectionMatrix();
|
|
@@ -169,9 +140,6 @@ class ShaderUniformPlugin {
|
|
|
169
140
|
[_l7Core.CoordinateUniform.PixelsPerDegree]: u_PixelsPerDegree,
|
|
170
141
|
[_l7Core.CoordinateUniform.PixelsPerDegree2]: u_PixelsPerDegree2,
|
|
171
142
|
[_l7Core.CoordinateUniform.PixelsPerMeter]: u_PixelsPerMeter,
|
|
172
|
-
// 坐标系是高德2.0的时候单独计算
|
|
173
|
-
[_l7Core.CoordinateUniform.Mvp]: u_Mvp,
|
|
174
|
-
u_sceneCenterMercator: sceneCenterMercator,
|
|
175
143
|
// 其他参数,例如视口大小、DPR 等
|
|
176
144
|
u_ViewportSize: u_ViewportSize,
|
|
177
145
|
u_ModelMatrix,
|
|
@@ -7,6 +7,20 @@ export declare function PointTriangulation(feature: IEncodeFeature): {
|
|
|
7
7
|
size: number;
|
|
8
8
|
};
|
|
9
9
|
export default class SimplePointModel extends BaseModel {
|
|
10
|
+
protected get attributeLocation(): {
|
|
11
|
+
readonly POSITION: 0;
|
|
12
|
+
readonly POSITION_64LOW: 1;
|
|
13
|
+
readonly COLOR: 2;
|
|
14
|
+
readonly PICKING_COLOR: 3;
|
|
15
|
+
readonly STROKE: 4;
|
|
16
|
+
readonly OPACITY: 5;
|
|
17
|
+
readonly OFFSETS: 6;
|
|
18
|
+
readonly ROTATION: 7;
|
|
19
|
+
readonly MAX: 8;
|
|
20
|
+
} & Record<string, number> & {
|
|
21
|
+
MAX: 8;
|
|
22
|
+
SIZE: number;
|
|
23
|
+
};
|
|
10
24
|
getDefaultStyle(): Partial<IPointLayerStyleOptions>;
|
|
11
25
|
protected getCommonUniformsInfo(): {
|
|
12
26
|
uniformsArray: number[];
|
|
@@ -10,11 +10,10 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
|
10
10
|
var _l7Core = require("@antv/l7-core");
|
|
11
11
|
var _BaseModel = _interopRequireDefault(require("../../core/BaseModel"));
|
|
12
12
|
var _l7Utils = require("@antv/l7-utils");
|
|
13
|
-
var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
|
|
14
13
|
/* babel-plugin-inline-import '../shaders/billboard/billboard_point_frag.glsl' */
|
|
15
14
|
const simplePointFrag = "\nlayout(std140) uniform commonUniorm {\n vec4 u_stroke_color;\n float u_additive;\n float u_stroke_opacity;\n float u_stroke_width;\n};\n\nin vec4 v_color;\nin float v_blur;\nin float v_innerRadius;\n\nout vec4 outputColor;\n\n#pragma include \"picking\"\nvoid main() {\n vec2 center = vec2(0.5);\n\n // Tip: \u7247\u5143\u5230\u4E2D\u5FC3\u70B9\u7684\u8DDD\u79BB 0 - 1\n float fragmengTocenter = distance(center, gl_PointCoord) * 2.0;\n // Tip: \u7247\u5143\u7684\u526A\u5207\u6210\u5706\u5F62\n float circleClipOpacity = 1.0 - smoothstep(v_blur, 1.0, fragmengTocenter);\n\n\n if(v_innerRadius < 0.99) {\n // \u5F53\u5B58\u5728 stroke \u4E14 stroke > 0.01\n float blurWidth = (1.0 - v_blur)/2.0;\n vec4 stroke = vec4(u_stroke_color.rgb, u_stroke_opacity);\n if(fragmengTocenter > v_innerRadius + blurWidth) {\n outputColor = stroke;\n } else if(fragmengTocenter > v_innerRadius - blurWidth){\n float mixR = (fragmengTocenter - (v_innerRadius - blurWidth)) / (blurWidth * 2.0);\n outputColor = mix(v_color, stroke, mixR);\n } else {\n outputColor = v_color;\n }\n } else {\n // \u5F53\u4E0D\u5B58\u5728 stroke \u6216 stroke <= 0.01\n outputColor = v_color;\n }\n\n outputColor = filterColor(outputColor);\n \n if(u_additive > 0.0) {\n outputColor *= circleClipOpacity;\n } else {\n outputColor.a *= circleClipOpacity;\n }\n\n}\n";
|
|
16
15
|
/* babel-plugin-inline-import '../shaders/billboard/billboard_point_vert.glsl' */
|
|
17
|
-
const simplePointVert = "\nlayout(location =
|
|
16
|
+
const simplePointVert = "\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 float a_Size;\n\nlayout(std140) uniform commonUniorm {\n vec4 u_stroke_color;\n float u_additive;\n float u_stroke_opacity;\n float u_stroke_width;\n};\n\nout vec4 v_color;\nout float v_blur;\nout float v_innerRadius;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n#pragma include \"project\"\nvoid main() {\n v_color = vec4(a_Color.xyz, a_Color.w * opacity);\n v_blur = 1.0 - max(2.0 / a_Size, 0.05);\n v_innerRadius = max((a_Size - u_stroke_width) / a_Size, 0.0);\n\n vec2 offset = project_pixel(u_offsets);\n\n vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low);\n gl_Position = project_common_position_to_clipspace(vec4(vec2(project_pos.xy+offset),project_pos.z,project_pos.w));\n\n gl_PointSize = a_Size * 2.0 * u_DevicePixelRatio;\n setPickingColor(a_PickingColor);\n}\n";
|
|
18
17
|
function PointTriangulation(feature) {
|
|
19
18
|
const coordinates = feature.coordinates;
|
|
20
19
|
return {
|
|
@@ -24,6 +23,12 @@ function PointTriangulation(feature) {
|
|
|
24
23
|
};
|
|
25
24
|
}
|
|
26
25
|
class SimplePointModel extends _BaseModel.default {
|
|
26
|
+
get attributeLocation() {
|
|
27
|
+
return Object.assign(super.attributeLocation, {
|
|
28
|
+
MAX: super.attributeLocation.MAX,
|
|
29
|
+
SIZE: 9
|
|
30
|
+
});
|
|
31
|
+
}
|
|
27
32
|
getDefaultStyle() {
|
|
28
33
|
return {
|
|
29
34
|
blend: 'additive'
|
|
@@ -60,6 +65,7 @@ class SimplePointModel extends _BaseModel.default {
|
|
|
60
65
|
moduleName: 'pointSimple',
|
|
61
66
|
vertexShader: simplePointVert,
|
|
62
67
|
fragmentShader: simplePointFrag,
|
|
68
|
+
defines: _this2.getDefines(),
|
|
63
69
|
inject: _this2.getInject(),
|
|
64
70
|
triangulation: PointTriangulation,
|
|
65
71
|
depth: {
|
|
@@ -71,12 +77,14 @@ class SimplePointModel extends _BaseModel.default {
|
|
|
71
77
|
})();
|
|
72
78
|
}
|
|
73
79
|
registerBuiltinAttributes() {
|
|
80
|
+
// 注册 Position 属性 64 位地位部分,经纬度数据开启双精度,避免大于 22 层级以上出现数据偏移
|
|
81
|
+
this.registerPosition64LowAttribute();
|
|
74
82
|
this.styleAttributeService.registerStyleAttribute({
|
|
75
83
|
name: 'size',
|
|
76
84
|
type: _l7Core.AttributeType.Attribute,
|
|
77
85
|
descriptor: {
|
|
78
86
|
name: 'a_Size',
|
|
79
|
-
shaderLocation:
|
|
87
|
+
shaderLocation: this.attributeLocation.SIZE,
|
|
80
88
|
buffer: {
|
|
81
89
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
82
90
|
data: [],
|
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
import type { IModel } from '@antv/l7-core';
|
|
2
2
|
import BaseModel from '../../core/BaseModel';
|
|
3
3
|
export default class ExtrudeModel extends BaseModel {
|
|
4
|
+
protected get attributeLocation(): {
|
|
5
|
+
readonly POSITION: 0;
|
|
6
|
+
readonly POSITION_64LOW: 1;
|
|
7
|
+
readonly COLOR: 2;
|
|
8
|
+
readonly PICKING_COLOR: 3;
|
|
9
|
+
readonly STROKE: 4;
|
|
10
|
+
readonly OPACITY: 5;
|
|
11
|
+
readonly OFFSETS: 6;
|
|
12
|
+
readonly ROTATION: 7;
|
|
13
|
+
readonly MAX: 8;
|
|
14
|
+
} & Record<string, number> & {
|
|
15
|
+
MAX: 8;
|
|
16
|
+
SIZE: number;
|
|
17
|
+
POS: number;
|
|
18
|
+
NORMAL: number;
|
|
19
|
+
};
|
|
4
20
|
private raiseCount;
|
|
5
21
|
private raiseRepeat;
|
|
6
22
|
protected getCommonUniformsInfo(): {
|