@antv/l7-layers 2.21.9 → 2.21.11-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.d.ts +0 -1
- package/es/core/BaseLayer.js +9 -19
- package/es/core/BaseModel.d.ts +15 -2
- package/es/core/BaseModel.js +98 -64
- package/es/core/CommonStyleAttribute.d.ts +14 -18
- package/es/core/CommonStyleAttribute.js +23 -67
- package/es/core/shape/extrude.js +6 -3
- package/es/core/triangulation.js +22 -50
- package/es/core/utils.d.ts +4 -0
- package/es/core/utils.js +33 -0
- 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 -7
- 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 +44 -52
- 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 +53 -74
- 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 +4 -35
- 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 +13 -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.d.ts +0 -1
- package/lib/core/BaseLayer.js +9 -19
- package/lib/core/BaseModel.d.ts +15 -2
- package/lib/core/BaseModel.js +96 -62
- package/lib/core/CommonStyleAttribute.d.ts +14 -18
- package/lib/core/CommonStyleAttribute.js +23 -68
- package/lib/core/shape/extrude.js +6 -3
- package/lib/core/triangulation.js +22 -50
- package/lib/core/utils.d.ts +4 -0
- package/lib/core/utils.js +35 -0
- 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 -7
- 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 +44 -52
- 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 +53 -74
- 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 +4 -35
- 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 +13 -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 +9 -9
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
#define LineTypeSolid 0.0
|
|
2
|
-
#define LineTypeDash 1.0
|
|
3
|
-
#define Animate 0.0
|
|
4
|
-
#define LineTexture 1.0
|
|
5
|
-
|
|
6
|
-
layout(location =
|
|
7
|
-
layout(location =
|
|
8
|
-
layout(location =
|
|
9
|
-
layout(location =
|
|
10
|
-
layout(location =
|
|
1
|
+
#define LineTypeSolid (0.0)
|
|
2
|
+
#define LineTypeDash (1.0)
|
|
3
|
+
#define Animate (0.0)
|
|
4
|
+
#define LineTexture (1.0)
|
|
5
|
+
|
|
6
|
+
layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
|
|
7
|
+
layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
|
|
8
|
+
layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;
|
|
9
|
+
layout(location = ATTRIBUTE_LOCATION_INSTANCE) in vec4 a_Instance;
|
|
10
|
+
layout(location = ATTRIBUTE_LOCATION_INSTANCE_64LOW) in vec4 a_Instance64Low;
|
|
11
|
+
layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_iconMapUV;
|
|
11
12
|
|
|
12
13
|
layout(std140) uniform commonUniorm {
|
|
13
14
|
vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
|
|
@@ -34,12 +35,12 @@ out float v_distance_ratio;
|
|
|
34
35
|
#pragma include "project"
|
|
35
36
|
#pragma include "picking"
|
|
36
37
|
|
|
37
|
-
float maps
|
|
38
|
+
float maps(float value, float start1, float stop1, float start2, float stop2) {
|
|
38
39
|
return start2 + (stop2 - start2) * ((value - start1) / (stop1 - start1));
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
float getSegmentRatio(float index) {
|
|
42
|
-
return index / (segmentNumber - 1.);
|
|
43
|
+
return index / (segmentNumber - 1.0);
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
float paraboloid(vec2 source, vec2 target, float ratio) {
|
|
@@ -53,33 +54,29 @@ float paraboloid(vec2 source, vec2 target, float ratio) {
|
|
|
53
54
|
vec3 getPos(vec2 source, vec2 target, float segmentRatio) {
|
|
54
55
|
float vertex_height = paraboloid(source, target, segmentRatio);
|
|
55
56
|
|
|
56
|
-
return vec3(
|
|
57
|
-
mix(source, target, segmentRatio),
|
|
58
|
-
sqrt(max(0.0, vertex_height))
|
|
59
|
-
);
|
|
57
|
+
return vec3(mix(source, target, segmentRatio), sqrt(max(0.0, vertex_height)));
|
|
60
58
|
}
|
|
61
59
|
vec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) {
|
|
62
60
|
// normalized direction of the line
|
|
63
61
|
vec2 dir_screenspace = normalize(line_clipspace);
|
|
64
62
|
// rotate by 90 degrees
|
|
65
|
-
|
|
66
|
-
vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size)/ 2.0;
|
|
63
|
+
dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);
|
|
64
|
+
vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size) / 2.0;
|
|
67
65
|
return offset;
|
|
68
66
|
}
|
|
69
67
|
vec2 getNormal(vec2 line_clipspace, float offset_direction) {
|
|
70
68
|
// normalized direction of the line
|
|
71
69
|
vec2 dir_screenspace = normalize(line_clipspace);
|
|
72
70
|
// rotate by 90 degrees
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);
|
|
72
|
+
return dir_screenspace.xy * sign(offset_direction);
|
|
75
73
|
}
|
|
76
|
-
float getAngularDist
|
|
74
|
+
float getAngularDist(vec2 source, vec2 target) {
|
|
77
75
|
vec2 delta = source - target;
|
|
78
76
|
vec2 sin_half_delta = sin(delta / 2.0);
|
|
79
77
|
float a =
|
|
80
78
|
sin_half_delta.y * sin_half_delta.y +
|
|
81
|
-
cos(source.y) * cos(target.y) *
|
|
82
|
-
sin_half_delta.x * sin_half_delta.x;
|
|
79
|
+
cos(source.y) * cos(target.y) * sin_half_delta.x * sin_half_delta.x;
|
|
83
80
|
return 2.0 * atan(sqrt(a), sqrt(1.0 - a));
|
|
84
81
|
}
|
|
85
82
|
|
|
@@ -90,37 +87,29 @@ vec2 midPoint(vec2 source, vec2 target) {
|
|
|
90
87
|
float thetaOffset = 0.314;
|
|
91
88
|
float r2 = r / 2.0 / cos(thetaOffset);
|
|
92
89
|
float theta2 = theta + thetaOffset;
|
|
93
|
-
vec2 mid = vec2(r2*cos(theta2) + source.x, r2*sin(theta2) + source.y);
|
|
90
|
+
vec2 mid = vec2(r2 * cos(theta2) + source.x, r2 * sin(theta2) + source.y);
|
|
94
91
|
return mid;
|
|
95
92
|
}
|
|
96
93
|
float bezier3(vec3 arr, float t) {
|
|
97
|
-
float ut = 1. - t;
|
|
94
|
+
float ut = 1.0 - t;
|
|
98
95
|
return (arr.x * ut + arr.y * t) * ut + (arr.y * ut + arr.z * t) * t;
|
|
99
96
|
}
|
|
100
97
|
|
|
101
|
-
vec2 interpolate
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
vec2 mid = midPoint(source, target);
|
|
105
|
-
vec3 x = vec3(source.x, mid.x, target.x);
|
|
106
|
-
vec3 y = vec3(source.y, mid.y, target.y);
|
|
107
|
-
return vec2(bezier3(x ,t), bezier3(y,t));
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
if(abs(angularDist - PI) < 0.001) {
|
|
111
|
-
return (1.0 - t) * source + t * target;
|
|
112
|
-
}
|
|
113
|
-
float a = sin((1.0 - t) * angularDist) / sin(angularDist);
|
|
114
|
-
float b = sin(t * angularDist) / sin(angularDist);
|
|
115
|
-
vec2 sin_source = sin(source);
|
|
116
|
-
vec2 cos_source = cos(source);
|
|
117
|
-
vec2 sin_target = sin(target);
|
|
118
|
-
vec2 cos_target = cos(target);
|
|
119
|
-
float x = a * cos_source.y * cos_source.x + b * cos_target.y * cos_target.x;
|
|
120
|
-
float y = a * cos_source.y * sin_source.x + b * cos_target.y * sin_target.x;
|
|
121
|
-
float z = a * sin_source.y + b * sin_target.y;
|
|
122
|
-
return vec2(atan(y, x), atan(z, sqrt(x * x + y * y)));
|
|
98
|
+
vec2 interpolate(vec2 source, vec2 target, float angularDist, float t) {
|
|
99
|
+
if (abs(angularDist - PI) < 0.001) {
|
|
100
|
+
return (1.0 - t) * source + t * target;
|
|
123
101
|
}
|
|
102
|
+
float a = sin((1.0 - t) * angularDist) / sin(angularDist);
|
|
103
|
+
float b = sin(t * angularDist) / sin(angularDist);
|
|
104
|
+
vec2 sin_source = sin(source);
|
|
105
|
+
vec2 cos_source = cos(source);
|
|
106
|
+
vec2 sin_target = sin(target);
|
|
107
|
+
vec2 cos_target = cos(target);
|
|
108
|
+
float x = a * cos_source.y * cos_source.x + b * cos_target.y * cos_target.x;
|
|
109
|
+
float y = a * cos_source.y * sin_source.x + b * cos_target.y * sin_target.x;
|
|
110
|
+
float z = a * sin_source.y + b * sin_target.y;
|
|
111
|
+
return vec2(atan(y, x), atan(z, sqrt(x * x + y * y)));
|
|
112
|
+
|
|
124
113
|
}
|
|
125
114
|
|
|
126
115
|
void main() {
|
|
@@ -133,54 +122,44 @@ void main() {
|
|
|
133
122
|
float segmentRatio = getSegmentRatio(segmentIndex);
|
|
134
123
|
float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));
|
|
135
124
|
|
|
136
|
-
if(u_line_type == LineTypeDash) {
|
|
125
|
+
if (u_line_type == LineTypeDash) {
|
|
137
126
|
v_distance_ratio = segmentIndex / segmentNumber;
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
|
|
142
|
-
s = unProjCustomCoord(source);
|
|
143
|
-
t = unProjCustomCoord(target);
|
|
144
|
-
}
|
|
145
|
-
float total_Distance = pixelDistance(s, t) / 2.0 * PI;
|
|
146
|
-
total_Distance = total_Distance*16.0; // total_Distance*16.0 调整默认的效果
|
|
127
|
+
float total_Distance = pixelDistance(source, target) / 2.0 * PI;
|
|
128
|
+
total_Distance = total_Distance * 16.0; // total_Distance*16.0 调整默认的效果
|
|
147
129
|
v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / total_Distance;
|
|
148
130
|
}
|
|
149
131
|
|
|
150
|
-
if(u_animate.x == Animate) {
|
|
151
|
-
|
|
132
|
+
if (u_animate.x == Animate) {
|
|
133
|
+
v_distance_ratio = segmentIndex / segmentNumber;
|
|
152
134
|
}
|
|
153
135
|
|
|
154
136
|
float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);
|
|
155
137
|
v_distance_ratio = segmentIndex / segmentNumber;
|
|
156
|
-
|
|
157
|
-
vec4
|
|
138
|
+
|
|
139
|
+
vec4 curr = project_position(vec4(degrees(interpolate(source, target, angularDist, segmentRatio)), 0.0, 1.0), a_Instance64Low.xy);
|
|
140
|
+
vec4 next = project_position(vec4(degrees(interpolate(source, target, angularDist, nextSegmentRatio)), 0.0, 1.0), a_Instance64Low.zw);
|
|
141
|
+
|
|
158
142
|
// v_normal = getNormal((next.xy - curr.xy) * indexDir, a_Position.y);
|
|
159
143
|
vec2 offset = project_pixel(getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y));
|
|
160
144
|
// vec4 project_pos = project_position(vec4(curr.xy, 0, 1.0));
|
|
161
145
|
// gl_Position = project_common_position_to_clipspace(vec4(curr.xy + offset, curr.z, 1.0));
|
|
162
146
|
|
|
163
147
|
v_line_data.g = a_Position.x; // 该顶点在弧线上的分段排序
|
|
164
|
-
if(LineTexture == u_line_texture) {
|
|
165
|
-
// float mapZoomScale = u_CoordinateSystem !== COORDINATE_SYSTEM_P20_2?10000000.0:1.0;
|
|
148
|
+
if (LineTexture == u_line_texture) {
|
|
166
149
|
float d_arcDistrance = length(source - target);
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
d_arcDistrance = project_pixel_allmap(d_arcDistrance);
|
|
172
|
-
}
|
|
173
|
-
float d_pixelLen = project_pixel(u_icon_step)/8.0;
|
|
174
|
-
v_line_data.b = floor(d_arcDistrance/d_pixelLen); // 贴图在弧线上重复的数量
|
|
150
|
+
d_arcDistrance = project_pixel(d_arcDistrance);
|
|
151
|
+
|
|
152
|
+
float d_pixelLen = project_pixel(u_icon_step) / 8.0;
|
|
153
|
+
v_line_data.b = floor(d_arcDistrance / d_pixelLen); // 贴图在弧线上重复的数量
|
|
175
154
|
|
|
176
155
|
float lineOffsetWidth = length(offset + offset * sign(a_Position.y)); // 线横向偏移的距离
|
|
177
|
-
float linePixelSize = project_pixel(a_Size);
|
|
178
|
-
v_line_data.a = lineOffsetWidth/linePixelSize;
|
|
156
|
+
float linePixelSize = project_pixel(a_Size); // 定点位置偏移,按地图等级缩放后的距离
|
|
157
|
+
v_line_data.a = lineOffsetWidth / linePixelSize; // 线图层贴图部分的 v 坐标值
|
|
179
158
|
|
|
180
159
|
v_iconMapUV = a_iconMapUV;
|
|
181
160
|
}
|
|
182
161
|
|
|
183
|
-
gl_Position =
|
|
162
|
+
gl_Position = project_common_position_to_clipspace(vec4(curr.xy + offset, 0, 1.0));
|
|
184
163
|
setPickingColor(a_PickingColor);
|
|
185
164
|
}
|
|
186
165
|
|
|
@@ -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/es/mask/models/fill.js
CHANGED
|
@@ -6,7 +6,7 @@ import { polygonTriangulation } from "../../core/triangulation";
|
|
|
6
6
|
/* babel-plugin-inline-import '../../shader/minify_frag.glsl' */
|
|
7
7
|
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";
|
|
8
8
|
/* babel-plugin-inline-import '../shaders/mask_vert.glsl' */
|
|
9
|
-
const mask_vert = "layout(location =
|
|
9
|
+
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";
|
|
10
10
|
export default class MaskModel extends BaseModel {
|
|
11
11
|
getUninforms() {
|
|
12
12
|
const commoninfo = this.getCommonUniformsInfo();
|
|
@@ -40,6 +40,7 @@ export default class MaskModel extends BaseModel {
|
|
|
40
40
|
moduleName: 'mask',
|
|
41
41
|
vertexShader: mask_vert,
|
|
42
42
|
fragmentShader: mask_frag,
|
|
43
|
+
defines: _this2.getDefines(),
|
|
43
44
|
triangulation: polygonTriangulation,
|
|
44
45
|
depth: {
|
|
45
46
|
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;
|
|
@@ -2,10 +2,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
4
|
import { IDebugLog, ILayerStage } from '@antv/l7-core';
|
|
5
|
-
import {
|
|
6
|
-
const {
|
|
7
|
-
cloneDeep
|
|
8
|
-
} = lodashUtil;
|
|
5
|
+
import { normalize, rgb2arr } from '@antv/l7-utils';
|
|
9
6
|
export default class DataMappingPlugin {
|
|
10
7
|
constructor() {
|
|
11
8
|
_defineProperty(this, "mapService", void 0);
|
|
@@ -136,31 +133,11 @@ export default class DataMappingPlugin {
|
|
|
136
133
|
attributes.forEach(attribute => {
|
|
137
134
|
attribute.needRemapping = false;
|
|
138
135
|
});
|
|
139
|
-
// 调整数据兼容 Amap2.0
|
|
140
|
-
this.adjustData2Amap2Coordinates(mappedData, layer);
|
|
141
136
|
|
|
142
137
|
// 调整数据兼容 SimpleCoordinates
|
|
143
138
|
this.adjustData2SimpleCoordinates(mappedData);
|
|
144
139
|
return mappedData;
|
|
145
140
|
}
|
|
146
|
-
adjustData2Amap2Coordinates(mappedData, layer) {
|
|
147
|
-
// 根据地图的类型判断是否需要对点位数据进行处理, 若是高德2.0则需要对坐标进行相对偏移
|
|
148
|
-
if (mappedData.length > 0 && this.mapService.version === 'GAODE2.x') {
|
|
149
|
-
const layerCenter = layer.coordCenter || layer.getSource().center;
|
|
150
|
-
// 单个的点数据
|
|
151
|
-
// @ts-ignore
|
|
152
|
-
mappedData
|
|
153
|
-
// TODO: 避免经纬度被重复计算导致坐标位置偏移
|
|
154
|
-
.filter(d => !d.originCoordinates).map(d => {
|
|
155
|
-
d.version = 'GAODE2.x';
|
|
156
|
-
// @ts-ignore
|
|
157
|
-
d.originCoordinates = cloneDeep(d.coordinates); // 为了兼容高德1.x 需要保存一份原始的经纬度坐标数据(许多上层逻辑依赖经纬度数据)
|
|
158
|
-
// @ts-ignore
|
|
159
|
-
// d.coordinates = this.mapService.lngLatToCoord(d.coordinates);
|
|
160
|
-
d.coordinates = this.mapService.coordToAMap2RelativeCoordinates(d.coordinates, layerCenter);
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
141
|
adjustData2SimpleCoordinates(mappedData) {
|
|
165
142
|
if (mappedData.length > 0 && this.mapService.version === 'SIMPLE') {
|
|
166
143
|
mappedData.map(d => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
3
3
|
import { decodePickingColor, encodePickingColor, lodashUtil, rgb2arr } from '@antv/l7-utils';
|
|
4
|
-
import {
|
|
4
|
+
import { COMMON_ATTRIBUTE_LOCATION } from "../core/CommonStyleAttribute";
|
|
5
5
|
const {
|
|
6
6
|
isNumber
|
|
7
7
|
} = lodashUtil;
|
|
@@ -59,7 +59,7 @@ export default class PixelPickingPlugin {
|
|
|
59
59
|
type: AttributeType.Attribute,
|
|
60
60
|
descriptor: {
|
|
61
61
|
name: 'a_PickingColor',
|
|
62
|
-
shaderLocation:
|
|
62
|
+
shaderLocation: COMMON_ATTRIBUTE_LOCATION.PICKING_COLOR,
|
|
63
63
|
buffer: {
|
|
64
64
|
data: [],
|
|
65
65
|
type: gl.FLOAT
|