@antv/l7-layers 2.21.9-beta.0 → 2.21.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/citybuliding/models/build.d.ts +0 -16
- package/es/citybuliding/models/build.js +20 -18
- package/es/citybuliding/shaders/build_frag.glsl +6 -6
- package/es/citybuliding/shaders/build_vert.glsl +14 -8
- package/es/core/BaseLayer.js +8 -12
- package/es/core/BaseModel.d.ts +2 -15
- package/es/core/BaseModel.js +62 -94
- package/es/core/CommonStyleAttribute.d.ts +18 -14
- package/es/core/CommonStyleAttribute.js +67 -23
- package/es/core/triangulation.js +39 -13
- package/es/earth/models/atmosphere.d.ts +0 -15
- package/es/earth/models/atmosphere.js +24 -30
- package/es/earth/models/base.d.ts +0 -15
- package/es/earth/models/base.js +24 -30
- package/es/earth/models/bloomsphere.d.ts +0 -15
- package/es/earth/models/bloomsphere.js +24 -30
- package/es/earth/shaders/atmosphere/atmosphere_vert.glsl +5 -7
- package/es/earth/shaders/base/base_vert.glsl +3 -3
- package/es/earth/shaders/bloomshpere/bloomsphere_vert.glsl +4 -5
- package/es/geometry/models/billboard.d.ts +0 -15
- package/es/geometry/models/billboard.js +8 -14
- package/es/geometry/models/plane.d.ts +0 -14
- package/es/geometry/models/plane.js +10 -10
- package/es/geometry/models/sprite.js +9 -3
- package/es/geometry/shaders/billboard_vert.glsl +25 -28
- package/es/geometry/shaders/plane_vert.glsl +6 -6
- package/es/geometry/shaders/sprite_vert.glsl +9 -7
- package/es/heatmap/models/grid.d.ts +0 -14
- package/es/heatmap/models/grid.js +3 -10
- package/es/heatmap/models/grid3d.d.ts +0 -16
- package/es/heatmap/models/grid3d.js +6 -14
- package/es/heatmap/models/heatmap.d.ts +1 -20
- package/es/heatmap/models/heatmap.js +83 -96
- package/es/heatmap/models/hexagon.d.ts +0 -14
- package/es/heatmap/models/hexagon.js +3 -9
- package/es/heatmap/shaders/grid/grid_vert.glsl +42 -30
- package/es/heatmap/shaders/grid3d/grid_3d_vert.glsl +26 -14
- package/es/heatmap/shaders/heatmap/heatmap_3d_vert.glsl +16 -19
- package/es/heatmap/shaders/heatmap/heatmap_framebuffer_vert.glsl +22 -16
- package/es/heatmap/shaders/heatmap/heatmap_vert.glsl +4 -3
- package/es/heatmap/shaders/hexagon/hexagon_vert.glsl +23 -13
- package/es/image/models/image.d.ts +0 -14
- package/es/image/models/image.js +3 -11
- package/es/image/shaders/image_vert.glsl +6 -7
- package/es/line/models/arc.d.ts +0 -18
- package/es/line/models/arc.js +8 -57
- package/es/line/models/arc_3d.d.ts +0 -18
- package/es/line/models/arc_3d.js +7 -55
- package/es/line/models/flow.d.ts +0 -17
- package/es/line/models/flow.js +7 -35
- package/es/line/models/great_circle.d.ts +0 -17
- package/es/line/models/great_circle.js +6 -34
- package/es/line/models/line.d.ts +0 -17
- package/es/line/models/line.js +8 -17
- package/es/line/models/simple_line.d.ts +0 -14
- package/es/line/models/simple_line.js +47 -12
- package/es/line/models/wall.d.ts +0 -17
- package/es/line/models/wall.js +48 -22
- package/es/line/shaders/arc/line_arc_vert.glsl +48 -42
- package/es/line/shaders/arc3d/line_arc_3d_vert.glsl +20 -15
- package/es/line/shaders/flow/flow_line_vert.glsl +48 -30
- package/es/line/shaders/greatCircle/line_arc_great_circle_vert.glsl +72 -56
- package/es/line/shaders/line/line_vert.glsl +48 -31
- package/es/line/shaders/simple/simpleline_vert.glsl +23 -18
- package/es/line/shaders/wall/wall_vert.glsl +45 -36
- package/es/mask/models/fill.js +1 -2
- package/es/mask/shaders/mask_vert.glsl +7 -2
- package/es/plugins/DataMappingPlugin.d.ts +1 -0
- package/es/plugins/DataMappingPlugin.js +24 -1
- package/es/plugins/PixelPickingPlugin.js +2 -2
- package/es/plugins/RegisterStyleAttributePlugin.d.ts +1 -0
- package/es/plugins/RegisterStyleAttributePlugin.js +25 -3
- package/es/plugins/ShaderUniformPlugin.d.ts +5 -0
- package/es/plugins/ShaderUniformPlugin.js +34 -2
- package/es/point/models/billboard_point.d.ts +0 -14
- package/es/point/models/billboard_point.js +3 -11
- package/es/point/models/earthExtrude.d.ts +0 -16
- package/es/point/models/earthExtrude.js +8 -15
- package/es/point/models/earthFill.d.ts +0 -16
- package/es/point/models/earthFill.js +5 -13
- package/es/point/models/extrude.d.ts +0 -16
- package/es/point/models/extrude.js +12 -19
- package/es/point/models/fill.d.ts +0 -16
- package/es/point/models/fill.js +5 -16
- package/es/point/models/fillImage.d.ts +0 -16
- package/es/point/models/fillImage.js +16 -16
- package/es/point/models/image.d.ts +0 -15
- package/es/point/models/image.js +4 -14
- package/es/point/models/normal.d.ts +0 -14
- package/es/point/models/normal.js +3 -11
- package/es/point/models/radar.d.ts +0 -15
- package/es/point/models/radar.js +4 -13
- package/es/point/models/text.d.ts +0 -16
- package/es/point/models/text.js +11 -18
- package/es/point/shaders/billboard/billboard_point_vert.glsl +13 -10
- package/es/point/shaders/earthExtrude/earthExtrude_vert.glsl +25 -15
- package/es/point/shaders/earthFill/earthFill_vert.glsl +6 -6
- package/es/point/shaders/extrude/extrude_vert.glsl +39 -35
- package/es/point/shaders/fill/fill_vert.glsl +14 -12
- package/es/point/shaders/fillImage/fillImage_vert.glsl +28 -16
- package/es/point/shaders/image/image_vert.glsl +12 -15
- package/es/point/shaders/normal/normal_vert.glsl +10 -7
- package/es/point/shaders/radar/radar_vert.glsl +11 -11
- package/es/point/shaders/text/text_vert.glsl +9 -10
- package/es/polygon/models/extrude.d.ts +0 -16
- package/es/polygon/models/extrude.js +26 -26
- package/es/polygon/models/extrusion.d.ts +0 -16
- package/es/polygon/models/extrusion.js +4 -34
- package/es/polygon/models/fill.d.ts +0 -14
- package/es/polygon/models/fill.js +4 -12
- package/es/polygon/models/ocean.d.ts +0 -14
- package/es/polygon/models/ocean.js +6 -11
- package/es/polygon/models/water.d.ts +0 -14
- package/es/polygon/models/water.js +6 -11
- package/es/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +15 -17
- package/es/polygon/shaders/extrude/polygon_extrude_vert.glsl +20 -22
- 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 +6 -7
- package/es/polygon/shaders/fill/fill_vert.glsl +12 -10
- package/es/polygon/shaders/ocean/ocean_vert.glsl +4 -3
- 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 +0 -14
- package/es/raster/models/raster.js +3 -12
- package/es/raster/models/rasterRgb.d.ts +0 -14
- package/es/raster/models/rasterRgb.js +3 -12
- package/es/raster/models/rasterTerrainRgb.d.ts +0 -14
- package/es/raster/models/rasterTerrainRgb.js +3 -11
- 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 +16 -0
- package/es/tile/tile/Tile.d.ts +0 -2
- package/es/utils/extrude_polyline.d.ts +15 -0
- package/es/utils/extrude_polyline.js +217 -0
- package/es/utils/multiPassRender.js +2 -10
- package/es/wind/models/wind.d.ts +0 -14
- package/es/wind/models/wind.js +1 -9
- package/es/wind/shaders/wind_vert.glsl +5 -6
- package/lib/citybuliding/models/build.d.ts +0 -16
- package/lib/citybuliding/models/build.js +20 -18
- package/lib/citybuliding/shaders/build_frag.glsl +6 -6
- package/lib/citybuliding/shaders/build_vert.glsl +14 -8
- package/lib/core/BaseLayer.js +8 -12
- package/lib/core/BaseModel.d.ts +2 -15
- package/lib/core/BaseModel.js +60 -92
- package/lib/core/CommonStyleAttribute.d.ts +18 -14
- package/lib/core/CommonStyleAttribute.js +68 -23
- package/lib/core/triangulation.js +39 -13
- package/lib/earth/models/atmosphere.d.ts +0 -15
- package/lib/earth/models/atmosphere.js +24 -30
- package/lib/earth/models/base.d.ts +0 -15
- package/lib/earth/models/base.js +24 -30
- package/lib/earth/models/bloomsphere.d.ts +0 -15
- package/lib/earth/models/bloomsphere.js +24 -30
- package/lib/earth/shaders/atmosphere/atmosphere_vert.glsl +5 -7
- package/lib/earth/shaders/base/base_vert.glsl +3 -3
- package/lib/earth/shaders/bloomshpere/bloomsphere_vert.glsl +4 -5
- package/lib/geometry/models/billboard.d.ts +0 -15
- package/lib/geometry/models/billboard.js +8 -14
- package/lib/geometry/models/plane.d.ts +0 -14
- package/lib/geometry/models/plane.js +10 -10
- package/lib/geometry/models/sprite.js +9 -3
- package/lib/geometry/shaders/billboard_vert.glsl +25 -28
- package/lib/geometry/shaders/plane_vert.glsl +6 -6
- package/lib/geometry/shaders/sprite_vert.glsl +9 -7
- package/lib/heatmap/models/grid.d.ts +0 -14
- package/lib/heatmap/models/grid.js +3 -10
- package/lib/heatmap/models/grid3d.d.ts +0 -16
- package/lib/heatmap/models/grid3d.js +6 -14
- package/lib/heatmap/models/heatmap.d.ts +1 -20
- package/lib/heatmap/models/heatmap.js +82 -95
- package/lib/heatmap/models/hexagon.d.ts +0 -14
- package/lib/heatmap/models/hexagon.js +3 -9
- package/lib/heatmap/shaders/grid/grid_vert.glsl +42 -30
- package/lib/heatmap/shaders/grid3d/grid_3d_vert.glsl +26 -14
- package/lib/heatmap/shaders/heatmap/heatmap_3d_vert.glsl +16 -19
- package/lib/heatmap/shaders/heatmap/heatmap_framebuffer_vert.glsl +22 -16
- package/lib/heatmap/shaders/heatmap/heatmap_vert.glsl +4 -3
- package/lib/heatmap/shaders/hexagon/hexagon_vert.glsl +23 -13
- package/lib/image/models/image.d.ts +0 -14
- package/lib/image/models/image.js +3 -11
- package/lib/image/shaders/image_vert.glsl +6 -7
- package/lib/line/models/arc.d.ts +0 -18
- package/lib/line/models/arc.js +7 -56
- package/lib/line/models/arc_3d.d.ts +0 -18
- package/lib/line/models/arc_3d.js +7 -55
- package/lib/line/models/flow.d.ts +0 -17
- package/lib/line/models/flow.js +7 -35
- package/lib/line/models/great_circle.d.ts +0 -17
- package/lib/line/models/great_circle.js +5 -33
- package/lib/line/models/line.d.ts +0 -17
- package/lib/line/models/line.js +8 -17
- package/lib/line/models/simple_line.d.ts +0 -14
- package/lib/line/models/simple_line.js +47 -12
- package/lib/line/models/wall.d.ts +0 -17
- package/lib/line/models/wall.js +48 -22
- package/lib/line/shaders/arc/line_arc_vert.glsl +48 -42
- package/lib/line/shaders/arc3d/line_arc_3d_vert.glsl +20 -15
- package/lib/line/shaders/flow/flow_line_vert.glsl +48 -30
- package/lib/line/shaders/greatCircle/line_arc_great_circle_vert.glsl +72 -56
- package/lib/line/shaders/line/line_vert.glsl +48 -31
- package/lib/line/shaders/simple/simpleline_vert.glsl +23 -18
- package/lib/line/shaders/wall/wall_vert.glsl +45 -36
- package/lib/mask/models/fill.js +1 -2
- package/lib/mask/shaders/mask_vert.glsl +7 -2
- package/lib/plugins/DataMappingPlugin.d.ts +1 -0
- package/lib/plugins/DataMappingPlugin.js +23 -0
- package/lib/plugins/PixelPickingPlugin.js +1 -1
- package/lib/plugins/RegisterStyleAttributePlugin.d.ts +1 -0
- package/lib/plugins/RegisterStyleAttributePlugin.js +24 -2
- package/lib/plugins/ShaderUniformPlugin.d.ts +5 -0
- package/lib/plugins/ShaderUniformPlugin.js +34 -2
- package/lib/point/models/billboard_point.d.ts +0 -14
- package/lib/point/models/billboard_point.js +3 -11
- package/lib/point/models/earthExtrude.d.ts +0 -16
- package/lib/point/models/earthExtrude.js +7 -14
- package/lib/point/models/earthFill.d.ts +0 -16
- package/lib/point/models/earthFill.js +5 -13
- package/lib/point/models/extrude.d.ts +0 -16
- package/lib/point/models/extrude.js +11 -18
- package/lib/point/models/fill.d.ts +0 -16
- package/lib/point/models/fill.js +5 -16
- package/lib/point/models/fillImage.d.ts +0 -16
- package/lib/point/models/fillImage.js +16 -16
- package/lib/point/models/image.d.ts +0 -15
- package/lib/point/models/image.js +4 -14
- package/lib/point/models/normal.d.ts +0 -14
- package/lib/point/models/normal.js +3 -11
- package/lib/point/models/radar.d.ts +0 -15
- package/lib/point/models/radar.js +4 -13
- package/lib/point/models/text.d.ts +0 -16
- package/lib/point/models/text.js +11 -18
- package/lib/point/shaders/billboard/billboard_point_vert.glsl +13 -10
- package/lib/point/shaders/earthExtrude/earthExtrude_vert.glsl +25 -15
- package/lib/point/shaders/earthFill/earthFill_vert.glsl +6 -6
- package/lib/point/shaders/extrude/extrude_vert.glsl +39 -35
- package/lib/point/shaders/fill/fill_vert.glsl +14 -12
- package/lib/point/shaders/fillImage/fillImage_vert.glsl +28 -16
- package/lib/point/shaders/image/image_vert.glsl +12 -15
- package/lib/point/shaders/normal/normal_vert.glsl +10 -7
- package/lib/point/shaders/radar/radar_vert.glsl +11 -11
- package/lib/point/shaders/text/text_vert.glsl +9 -10
- package/lib/polygon/models/extrude.d.ts +0 -16
- package/lib/polygon/models/extrude.js +25 -25
- package/lib/polygon/models/extrusion.d.ts +0 -16
- package/lib/polygon/models/extrusion.js +4 -34
- package/lib/polygon/models/fill.d.ts +0 -14
- package/lib/polygon/models/fill.js +4 -12
- package/lib/polygon/models/ocean.d.ts +0 -14
- package/lib/polygon/models/ocean.js +6 -11
- package/lib/polygon/models/water.d.ts +0 -14
- package/lib/polygon/models/water.js +6 -11
- package/lib/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +15 -17
- package/lib/polygon/shaders/extrude/polygon_extrude_vert.glsl +20 -22
- 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 +6 -7
- package/lib/polygon/shaders/fill/fill_vert.glsl +12 -10
- package/lib/polygon/shaders/ocean/ocean_vert.glsl +4 -3
- 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 +0 -14
- package/lib/raster/models/raster.js +3 -12
- package/lib/raster/models/rasterRgb.d.ts +0 -14
- package/lib/raster/models/rasterRgb.js +3 -12
- package/lib/raster/models/rasterTerrainRgb.d.ts +0 -14
- package/lib/raster/models/rasterTerrainRgb.js +3 -11
- 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 +16 -0
- package/lib/tile/tile/Tile.d.ts +0 -2
- package/lib/utils/extrude_polyline.d.ts +15 -0
- package/lib/utils/extrude_polyline.js +217 -0
- package/lib/utils/multiPassRender.js +2 -10
- package/lib/wind/models/wind.d.ts +0 -14
- package/lib/wind/models/wind.js +1 -9
- package/lib/wind/shaders/wind_vert.glsl +5 -6
- package/package.json +9 -9
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
#define Animate
|
|
2
|
-
#define LineTexture
|
|
3
|
-
|
|
4
|
-
layout(location =
|
|
5
|
-
layout(location =
|
|
6
|
-
layout(location =
|
|
7
|
-
layout(location =
|
|
8
|
-
layout(location = ATTRIBUTE_LOCATION_INSTANCE_64LOW) in vec4 a_Instance64Low;
|
|
9
|
-
layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_iconMapUV;
|
|
1
|
+
#define Animate 0.0
|
|
2
|
+
#define LineTexture 1.0
|
|
3
|
+
layout(location = 0) in vec3 a_Position;
|
|
4
|
+
layout(location = 1) in vec4 a_Color;
|
|
5
|
+
layout(location = 9) in float a_Size;
|
|
6
|
+
layout(location = 12) in vec4 a_Instance;
|
|
7
|
+
layout(location = 14) in vec2 a_iconMapUV;
|
|
10
8
|
|
|
11
9
|
layout(std140) uniform commonUniorm {
|
|
12
10
|
vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
|
|
@@ -24,7 +22,6 @@ layout(std140) uniform commonUniorm {
|
|
|
24
22
|
float u_time;
|
|
25
23
|
float u_linearColor: 0.0;
|
|
26
24
|
};
|
|
27
|
-
|
|
28
25
|
out vec4 v_color;
|
|
29
26
|
out vec2 v_iconMapUV;
|
|
30
27
|
out vec4 v_lineData;
|
|
@@ -32,12 +29,13 @@ out vec4 v_lineData;
|
|
|
32
29
|
out vec4 v_dash_array;
|
|
33
30
|
out float v_distance_ratio;
|
|
34
31
|
|
|
32
|
+
|
|
35
33
|
#pragma include "projection"
|
|
36
34
|
#pragma include "project"
|
|
37
35
|
#pragma include "picking"
|
|
38
36
|
|
|
39
37
|
float bezier3(vec3 arr, float t) {
|
|
40
|
-
float ut = 1.
|
|
38
|
+
float ut = 1. - t;
|
|
41
39
|
return (arr.x * ut + arr.y * t) * ut + (arr.y * ut + arr.z * t) * t;
|
|
42
40
|
}
|
|
43
41
|
vec2 midPoint(vec2 source, vec2 target, float arcThetaOffset) {
|
|
@@ -47,12 +45,10 @@ vec2 midPoint(vec2 source, vec2 target, float arcThetaOffset) {
|
|
|
47
45
|
float thetaOffset = arcThetaOffset;
|
|
48
46
|
float r2 = r / 2.0 / cos(thetaOffset);
|
|
49
47
|
float theta2 = theta + thetaOffset;
|
|
50
|
-
vec2 mid = vec2(r2
|
|
51
|
-
if
|
|
52
|
-
// 正向
|
|
48
|
+
vec2 mid = vec2(r2*cos(theta2) + source.x, r2*sin(theta2) + source.y);
|
|
49
|
+
if(u_lineDir == 1.0) { // 正向
|
|
53
50
|
return mid;
|
|
54
|
-
} else {
|
|
55
|
-
// 逆向
|
|
51
|
+
} else { // 逆向
|
|
56
52
|
// (mid + vmin)/2 = (s + t)/2
|
|
57
53
|
vec2 vmid = source + target - mid;
|
|
58
54
|
return vmid;
|
|
@@ -60,23 +56,23 @@ vec2 midPoint(vec2 source, vec2 target, float arcThetaOffset) {
|
|
|
60
56
|
// return mid;
|
|
61
57
|
}
|
|
62
58
|
float getSegmentRatio(float index) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
59
|
+
// dash: index / (segmentNumber - 1.);
|
|
60
|
+
// normal: smoothstep(0.0, 1.0, index / (segmentNumber - 1.));
|
|
61
|
+
return smoothstep(0.0, 1.0, index / (segmentNumber - 1.));
|
|
62
|
+
// return index / (segmentNumber - 1.);
|
|
67
63
|
}
|
|
68
|
-
vec2 interpolate(vec2 source, vec2 target, float t, float arcThetaOffset) {
|
|
64
|
+
vec2 interpolate (vec2 source, vec2 target, float t, float arcThetaOffset) {
|
|
69
65
|
// if the angularDist is PI, linear interpolation is applied. otherwise, use spherical interpolation
|
|
70
66
|
vec2 mid = midPoint(source, target, arcThetaOffset);
|
|
71
67
|
vec3 x = vec3(source.x, mid.x, target.x);
|
|
72
68
|
vec3 y = vec3(source.y, mid.y, target.y);
|
|
73
|
-
return vec2(bezier3(x,
|
|
69
|
+
return vec2(bezier3(x ,t), bezier3(y,t));
|
|
74
70
|
}
|
|
75
71
|
vec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) {
|
|
76
72
|
// normalized direction of the line
|
|
77
73
|
vec2 dir_screenspace = normalize(line_clipspace);
|
|
78
74
|
// rotate by 90 degrees
|
|
79
|
-
|
|
75
|
+
dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);
|
|
80
76
|
vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size) / 2.0;
|
|
81
77
|
return offset;
|
|
82
78
|
}
|
|
@@ -85,34 +81,43 @@ vec2 getNormal(vec2 line_clipspace, float offset_direction) {
|
|
|
85
81
|
vec2 dir_screenspace = normalize(line_clipspace);
|
|
86
82
|
// rotate by 90 degrees
|
|
87
83
|
dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);
|
|
88
|
-
return dir_screenspace.xy * sign(offset_direction);
|
|
84
|
+
return reverse_offset_normal(vec3(dir_screenspace,1.0)).xy * sign(offset_direction);
|
|
89
85
|
}
|
|
90
86
|
|
|
91
87
|
void main() {
|
|
92
88
|
//vs中计算渐变色
|
|
93
|
-
if
|
|
89
|
+
if(u_linearColor==1.0){
|
|
94
90
|
float d_segmentIndex = a_Position.x + 1.0; // 当前顶点在弧线中所处的分段位置
|
|
95
|
-
v_color = mix(u_sourceColor, u_targetColor, d_segmentIndex
|
|
96
|
-
}
|
|
91
|
+
v_color = mix(u_sourceColor, u_targetColor, d_segmentIndex/segmentNumber);
|
|
92
|
+
}
|
|
93
|
+
else{
|
|
97
94
|
v_color = a_Color;
|
|
98
95
|
}
|
|
99
96
|
v_color.a = v_color.a * opacity;
|
|
100
97
|
|
|
101
|
-
vec2
|
|
102
|
-
vec2
|
|
98
|
+
vec2 source = a_Instance.rg; // 起始点
|
|
99
|
+
vec2 target = a_Instance.ba; // 终点
|
|
100
|
+
|
|
101
|
+
|
|
103
102
|
|
|
104
103
|
float segmentIndex = a_Position.x;
|
|
105
104
|
float segmentRatio = getSegmentRatio(segmentIndex);
|
|
106
105
|
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
//计算dashArray和distanceRatio 输出到片元
|
|
107
|
+
vec2 s = source;
|
|
108
|
+
vec2 t = target;
|
|
109
|
+
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
|
|
110
|
+
s = unProjCustomCoord(source);
|
|
111
|
+
t = unProjCustomCoord(target);
|
|
112
|
+
}
|
|
113
|
+
float total_Distance = pixelDistance(s, t) / 2.0 * PI;
|
|
109
114
|
v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / total_Distance;
|
|
110
115
|
v_distance_ratio = segmentIndex / segmentNumber;
|
|
111
116
|
|
|
112
117
|
float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));
|
|
113
118
|
float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);
|
|
114
119
|
float d_distance_ratio;
|
|
115
|
-
|
|
120
|
+
|
|
116
121
|
if(u_animate.x == Animate) {
|
|
117
122
|
d_distance_ratio = segmentIndex / segmentNumber;
|
|
118
123
|
if(u_lineDir != 1.0) {
|
|
@@ -122,21 +127,22 @@ void main() {
|
|
|
122
127
|
|
|
123
128
|
v_lineData.b = d_distance_ratio;
|
|
124
129
|
|
|
125
|
-
vec4
|
|
126
|
-
vec4
|
|
130
|
+
vec4 curr = project_position(vec4(interpolate(source, target, segmentRatio, thetaOffset), 0.0, 1.0));
|
|
131
|
+
vec4 next = project_position(vec4(interpolate(source, target, nextSegmentRatio, thetaOffset), 0.0, 1.0));
|
|
127
132
|
|
|
128
|
-
|
|
129
|
-
vec2
|
|
133
|
+
|
|
134
|
+
vec2 offset = project_pixel(getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y));
|
|
130
135
|
|
|
131
|
-
vec2 offset = project_pixel(
|
|
132
|
-
getExtrusionOffset((nextPos.xy - currPos.xy) * indexDir, a_Position.y)
|
|
133
|
-
);
|
|
134
136
|
|
|
135
137
|
float d_segmentIndex = a_Position.x + 1.0; // 当前顶点在弧线中所处的分段位置
|
|
136
138
|
v_lineData.r = d_segmentIndex;
|
|
137
139
|
|
|
138
140
|
if(LineTexture == u_line_texture) { // 开启贴图模式
|
|
141
|
+
|
|
139
142
|
float arcDistrance = length(source - target); // 起始点和终点的距离
|
|
143
|
+
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20) { // amap
|
|
144
|
+
arcDistrance *= 1000000.0;
|
|
145
|
+
}
|
|
140
146
|
if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) { // mapbox
|
|
141
147
|
// arcDistrance *= 8.0;
|
|
142
148
|
arcDistrance = project_pixel_allmap(arcDistrance);
|
|
@@ -144,15 +150,15 @@ void main() {
|
|
|
144
150
|
v_iconMapUV = a_iconMapUV;
|
|
145
151
|
|
|
146
152
|
float pixelLen = project_pixel_texture(u_icon_step); // 贴图沿弧线方向的长度 - 随地图缩放改变
|
|
147
|
-
float texCount = floor(arcDistrance
|
|
153
|
+
float texCount = floor(arcDistrance/pixelLen); // 贴图在弧线上重复的数量
|
|
148
154
|
v_lineData.g = texCount;
|
|
149
155
|
|
|
150
156
|
float lineOffsetWidth = length(offset + offset * sign(a_Position.y)); // 线横向偏移的距离
|
|
151
157
|
float linePixelSize = project_pixel(a_Size); // 定点位置偏移
|
|
152
|
-
v_lineData.a = lineOffsetWidth
|
|
158
|
+
v_lineData.a = lineOffsetWidth/linePixelSize; // 线图层贴图部分的 v 坐标值
|
|
153
159
|
}
|
|
154
160
|
|
|
155
|
-
gl_Position =
|
|
161
|
+
gl_Position = project_common_position_to_clipspace_v2(vec4(curr.xy + offset, 0, 1.0));
|
|
156
162
|
|
|
157
163
|
setPickingColor(a_PickingColor);
|
|
158
164
|
}
|
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
#define LineTypeDash 1.0
|
|
3
3
|
#define Animate 0.0
|
|
4
4
|
#define LineTexture 1.0
|
|
5
|
-
|
|
6
|
-
layout(location =
|
|
7
|
-
layout(location =
|
|
8
|
-
layout(location =
|
|
9
|
-
layout(location =
|
|
10
|
-
layout(location = ATTRIBUTE_LOCATION_INSTANCE_64LOW) in vec4 a_Instance64Low;
|
|
11
|
-
layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_iconMapUV;
|
|
5
|
+
layout(location = 0) in vec3 a_Position;
|
|
6
|
+
layout(location = 1) in vec4 a_Color;
|
|
7
|
+
layout(location = 9) in float a_Size;
|
|
8
|
+
layout(location = 12) in vec4 a_Instance;
|
|
9
|
+
layout(location = 14) in vec2 a_iconMapUV;
|
|
12
10
|
|
|
13
11
|
|
|
14
12
|
layout(std140) uniform commonUniorm {
|
|
@@ -77,7 +75,7 @@ vec2 getNormal(vec2 line_clipspace, float offset_direction) {
|
|
|
77
75
|
vec2 dir_screenspace = normalize(line_clipspace);
|
|
78
76
|
// rotate by 90 degrees
|
|
79
77
|
dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);
|
|
80
|
-
return dir_screenspace.xy * sign(offset_direction);
|
|
78
|
+
return reverse_offset_normal(vec3(dir_screenspace,1.0)).xy * sign(offset_direction);
|
|
81
79
|
}
|
|
82
80
|
|
|
83
81
|
float torad(float deg) {
|
|
@@ -109,8 +107,8 @@ void main() {
|
|
|
109
107
|
v_color = a_Color;
|
|
110
108
|
}
|
|
111
109
|
v_color.a = v_color.a * opacity;
|
|
112
|
-
vec2 source = project_position(vec4(a_Instance.rg, 0, 0)
|
|
113
|
-
vec2 target = project_position(vec4(a_Instance.ba, 0, 0)
|
|
110
|
+
vec2 source = project_position(vec4(a_Instance.rg, 0, 0)).xy;
|
|
111
|
+
vec2 target = project_position(vec4(a_Instance.ba, 0, 0)).xy;
|
|
114
112
|
float segmentIndex = a_Position.x;
|
|
115
113
|
float segmentRatio = getSegmentRatio(segmentIndex);
|
|
116
114
|
float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));
|
|
@@ -118,7 +116,14 @@ void main() {
|
|
|
118
116
|
float d_distance_ratio;
|
|
119
117
|
if(u_line_type == LineTypeDash) {
|
|
120
118
|
d_distance_ratio = segmentIndex / segmentNumber;
|
|
121
|
-
|
|
119
|
+
vec2 s = source;
|
|
120
|
+
vec2 t = target;
|
|
121
|
+
|
|
122
|
+
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
|
|
123
|
+
s = unProjCustomCoord(source);
|
|
124
|
+
t = unProjCustomCoord(target);
|
|
125
|
+
}
|
|
126
|
+
float total_Distance = pixelDistance(s, t) / 2.0 * PI;
|
|
122
127
|
v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / (total_Distance / segmentNumber * segmentIndex);
|
|
123
128
|
}
|
|
124
129
|
if(u_animate.x == Animate) {
|
|
@@ -134,7 +139,7 @@ void main() {
|
|
|
134
139
|
|
|
135
140
|
|
|
136
141
|
v_segmentIndex = a_Position.x;
|
|
137
|
-
if(LineTexture == u_line_texture && u_line_type != LineTypeDash) { // 开启贴图模式
|
|
142
|
+
if(LineTexture == u_line_texture && u_line_type != LineTypeDash) { // 开启贴图模式
|
|
138
143
|
|
|
139
144
|
float arcDistrance = length(source - target);
|
|
140
145
|
float pixelLen = project_pixel_texture(u_icon_step);
|
|
@@ -149,7 +154,7 @@ void main() {
|
|
|
149
154
|
}
|
|
150
155
|
|
|
151
156
|
|
|
152
|
-
gl_Position =
|
|
157
|
+
gl_Position = project_common_position_to_clipspace_v2(vec4(curr.xy + project_pixel(offset), curr.z * thetaOffset, 1.0));
|
|
153
158
|
|
|
154
159
|
// 地球模式
|
|
155
160
|
if(u_globel > 0.0) {
|
|
@@ -168,10 +173,10 @@ void main() {
|
|
|
168
173
|
float lineHeight = u_global_height * (-4.0*segmentRatio*segmentRatio + 4.0 * segmentRatio) * lnglatLength;
|
|
169
174
|
// 地球点位
|
|
170
175
|
vec3 globalPoint = normalize(mix(startLngLat, endLngLat, segmentRatio)) * (globalRadius + lineHeight) + lnglatOffset * a_Size;
|
|
171
|
-
|
|
176
|
+
|
|
172
177
|
gl_Position = u_ViewProjectionMatrix * vec4(globalPoint, 1.0);
|
|
173
178
|
}
|
|
174
|
-
|
|
179
|
+
|
|
175
180
|
|
|
176
181
|
setPickingColor(a_PickingColor);
|
|
177
182
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
layout(location =
|
|
2
|
-
layout(location =
|
|
3
|
-
layout(location =
|
|
4
|
-
layout(location =
|
|
5
|
-
layout(location =
|
|
6
|
-
layout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal;
|
|
1
|
+
layout(location = 0) in vec3 a_Position;
|
|
2
|
+
layout(location = 1) in vec4 a_Color;
|
|
3
|
+
layout(location = 9) in vec2 a_Size;
|
|
4
|
+
layout(location = 12) in vec4 a_Instance;
|
|
5
|
+
layout(location = 13) in vec3 a_Normal;
|
|
7
6
|
|
|
8
7
|
layout(std140) uniform commonUniorm {
|
|
9
8
|
float u_gap_width: 1.0;
|
|
@@ -18,59 +17,78 @@ layout(std140) uniform commonUniorm {
|
|
|
18
17
|
out vec4 v_color;
|
|
19
18
|
|
|
20
19
|
vec2 project_pixel_offset(vec2 offsets) {
|
|
21
|
-
vec2 data = project_pixel(offsets);
|
|
22
20
|
|
|
23
|
-
|
|
21
|
+
vec2 data = project_pixel(offsets);
|
|
22
|
+
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {
|
|
23
|
+
// P20_2 坐标系下,为了和 Web 墨卡托坐标系统一,zoom 默认减3
|
|
24
|
+
return data;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return vec2(data.x, -data.y);;
|
|
24
28
|
}
|
|
25
29
|
|
|
26
30
|
vec2 line_dir(vec2 target, vec2 source) {
|
|
31
|
+
|
|
32
|
+
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {
|
|
33
|
+
// P20_2 坐标系下,为了和 Web 墨卡托坐标系统一,zoom 默认减3
|
|
34
|
+
return normalize(target - source);
|
|
35
|
+
}
|
|
27
36
|
return normalize(ProjectFlat(target) - ProjectFlat(source));
|
|
28
37
|
}
|
|
29
38
|
|
|
39
|
+
float flag_gap() {
|
|
40
|
+
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {
|
|
41
|
+
// P20_2 坐标系下,为了和 Web 墨卡托坐标系统一,zoom 默认减3
|
|
42
|
+
return 1.;
|
|
43
|
+
}
|
|
44
|
+
return -1.;
|
|
30
45
|
|
|
31
|
-
|
|
32
|
-
// 透明度计算
|
|
33
|
-
vec2 source_world = a_Instance.rg; // 起点
|
|
34
|
-
vec2 target_world = a_Instance.ba; // 终点
|
|
35
|
-
vec2 flowlineDir = line_dir(target_world, source_world);
|
|
36
|
-
vec2 perpendicularDir = vec2(-flowlineDir.y, flowlineDir.x); // mapbox || 高德
|
|
46
|
+
}
|
|
37
47
|
|
|
38
|
-
vec2 position = mix(source_world, target_world, a_Position.x);
|
|
39
|
-
vec2 position64Low = mix(a_Instance64Low.rg, a_Instance64Low.ba, a_Position.x);
|
|
40
48
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
49
|
+
void main() {
|
|
50
|
+
|
|
51
|
+
// 透明度计算
|
|
52
|
+
vec2 source = a_Instance.rg; // 起始点
|
|
53
|
+
vec2 target = a_Instance.ba; // 终点
|
|
54
|
+
vec2 flowlineDir = line_dir(target,source);
|
|
55
|
+
vec2 perpendicularDir = vec2(-flowlineDir.y, flowlineDir.x); // mapbox || 高德
|
|
56
|
+
|
|
57
|
+
vec2 position = mix(source, target, a_Position.x);
|
|
58
|
+
|
|
59
|
+
float lengthCommon = length(project_position(vec4(target,0,1)) - project_position(vec4(source,0,1))); //
|
|
44
60
|
vec2 offsetDistances = a_Size.x * project_pixel_offset(vec2(a_Position.y, a_Position.z)); // Mapbox || 高德
|
|
45
|
-
vec2 limitedOffsetDistances = clamp(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
project_pixel(lengthCommon * 0.2)
|
|
61
|
+
vec2 limitedOffsetDistances = clamp(
|
|
62
|
+
offsetDistances,
|
|
63
|
+
project_pixel(-lengthCommon*.2), project_pixel(lengthCommon*.2)
|
|
49
64
|
);
|
|
50
65
|
|
|
66
|
+
|
|
51
67
|
float startOffsetCommon = project_pixel(offsets[0]);
|
|
52
68
|
float endOffsetCommon = project_pixel(offsets[1]);
|
|
53
69
|
float endpointOffset = mix(
|
|
54
|
-
clamp(startOffsetCommon, 0.0, lengthCommon
|
|
55
|
-
-clamp(endOffsetCommon, 0.0, lengthCommon
|
|
70
|
+
clamp(startOffsetCommon, 0.0, lengthCommon*.2),
|
|
71
|
+
-clamp(endOffsetCommon, 0.0, lengthCommon*.2),
|
|
56
72
|
a_Position.x
|
|
57
73
|
);
|
|
58
74
|
|
|
59
|
-
vec2 normalsCommon =
|
|
75
|
+
vec2 normalsCommon = u_stroke_width * project_pixel_offset(vec2(a_Normal.x, a_Normal.y)); // mapbox || 高德
|
|
60
76
|
|
|
61
|
-
float gapCommon =
|
|
77
|
+
float gapCommon = flag_gap() * project_pixel(u_gap_width);
|
|
62
78
|
vec3 offsetCommon = vec3(
|
|
63
79
|
flowlineDir * (limitedOffsetDistances[1] + normalsCommon.y + endpointOffset * 1.05) -
|
|
64
|
-
|
|
80
|
+
perpendicularDir * (limitedOffsetDistances[0] + gapCommon + normalsCommon.x),
|
|
65
81
|
0.0
|
|
66
82
|
);
|
|
67
83
|
|
|
68
|
-
vec4 project_pos = project_position(vec4(position.xy, 0, 1.0)
|
|
84
|
+
vec4 project_pos = project_position(vec4(position.xy, 0, 1.0));
|
|
69
85
|
|
|
70
86
|
vec4 fillColor = vec4(a_Color.rgb, a_Color.a * opacity);
|
|
71
87
|
v_color = mix(fillColor, vec4(u_stroke.xyz, u_stroke.w * fillColor.w * u_stroke_opacity), a_Normal.z);
|
|
72
88
|
|
|
73
|
-
gl_Position =
|
|
89
|
+
gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy + offsetCommon.xy, 0., 1.0));
|
|
90
|
+
|
|
91
|
+
|
|
74
92
|
|
|
75
93
|
setPickingColor(a_PickingColor);
|
|
76
94
|
}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
#define LineTypeSolid
|
|
2
|
-
#define LineTypeDash
|
|
3
|
-
#define Animate
|
|
4
|
-
#define LineTexture
|
|
5
|
-
|
|
6
|
-
layout(location =
|
|
7
|
-
layout(location =
|
|
8
|
-
layout(location =
|
|
9
|
-
layout(location =
|
|
10
|
-
layout(location =
|
|
11
|
-
layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_iconMapUV;
|
|
1
|
+
#define LineTypeSolid 0.0
|
|
2
|
+
#define LineTypeDash 1.0
|
|
3
|
+
#define Animate 0.0
|
|
4
|
+
#define LineTexture 1.0
|
|
5
|
+
|
|
6
|
+
layout(location = 0) in vec3 a_Position;
|
|
7
|
+
layout(location = 1) in vec4 a_Color;
|
|
8
|
+
layout(location = 9) in float a_Size;
|
|
9
|
+
layout(location = 12) in vec4 a_Instance;
|
|
10
|
+
layout(location = 14) in vec2 a_iconMapUV;
|
|
12
11
|
|
|
13
12
|
layout(std140) uniform commonUniorm {
|
|
14
13
|
vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
|
|
@@ -35,12 +34,12 @@ out float v_distance_ratio;
|
|
|
35
34
|
#pragma include "project"
|
|
36
35
|
#pragma include "picking"
|
|
37
36
|
|
|
38
|
-
float maps(float value, float start1, float stop1, float start2, float stop2) {
|
|
37
|
+
float maps (float value, float start1, float stop1, float start2, float stop2) {
|
|
39
38
|
return start2 + (stop2 - start2) * ((value - start1) / (stop1 - start1));
|
|
40
39
|
}
|
|
41
40
|
|
|
42
41
|
float getSegmentRatio(float index) {
|
|
43
|
-
return index / (segmentNumber - 1.
|
|
42
|
+
return index / (segmentNumber - 1.);
|
|
44
43
|
}
|
|
45
44
|
|
|
46
45
|
float paraboloid(vec2 source, vec2 target, float ratio) {
|
|
@@ -54,29 +53,33 @@ float paraboloid(vec2 source, vec2 target, float ratio) {
|
|
|
54
53
|
vec3 getPos(vec2 source, vec2 target, float segmentRatio) {
|
|
55
54
|
float vertex_height = paraboloid(source, target, segmentRatio);
|
|
56
55
|
|
|
57
|
-
return vec3(
|
|
56
|
+
return vec3(
|
|
57
|
+
mix(source, target, segmentRatio),
|
|
58
|
+
sqrt(max(0.0, vertex_height))
|
|
59
|
+
);
|
|
58
60
|
}
|
|
59
61
|
vec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) {
|
|
60
62
|
// normalized direction of the line
|
|
61
63
|
vec2 dir_screenspace = normalize(line_clipspace);
|
|
62
64
|
// rotate by 90 degrees
|
|
63
|
-
|
|
64
|
-
vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size)
|
|
65
|
+
dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);
|
|
66
|
+
vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size)/ 2.0;
|
|
65
67
|
return offset;
|
|
66
68
|
}
|
|
67
69
|
vec2 getNormal(vec2 line_clipspace, float offset_direction) {
|
|
68
70
|
// normalized direction of the line
|
|
69
71
|
vec2 dir_screenspace = normalize(line_clipspace);
|
|
70
72
|
// rotate by 90 degrees
|
|
71
|
-
|
|
72
|
-
|
|
73
|
+
dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);
|
|
74
|
+
return reverse_offset_normal(vec3(dir_screenspace,1.0)).xy * sign(offset_direction);
|
|
73
75
|
}
|
|
74
|
-
float getAngularDist(vec2 source, vec2 target) {
|
|
76
|
+
float getAngularDist (vec2 source, vec2 target) {
|
|
75
77
|
vec2 delta = source - target;
|
|
76
78
|
vec2 sin_half_delta = sin(delta / 2.0);
|
|
77
79
|
float a =
|
|
78
80
|
sin_half_delta.y * sin_half_delta.y +
|
|
79
|
-
cos(source.y) * cos(target.y) *
|
|
81
|
+
cos(source.y) * cos(target.y) *
|
|
82
|
+
sin_half_delta.x * sin_half_delta.x;
|
|
80
83
|
return 2.0 * atan(sqrt(a), sqrt(1.0 - a));
|
|
81
84
|
}
|
|
82
85
|
|
|
@@ -87,29 +90,37 @@ vec2 midPoint(vec2 source, vec2 target) {
|
|
|
87
90
|
float thetaOffset = 0.314;
|
|
88
91
|
float r2 = r / 2.0 / cos(thetaOffset);
|
|
89
92
|
float theta2 = theta + thetaOffset;
|
|
90
|
-
vec2 mid = vec2(r2
|
|
93
|
+
vec2 mid = vec2(r2*cos(theta2) + source.x, r2*sin(theta2) + source.y);
|
|
91
94
|
return mid;
|
|
92
95
|
}
|
|
93
96
|
float bezier3(vec3 arr, float t) {
|
|
94
|
-
float ut = 1.
|
|
97
|
+
float ut = 1. - t;
|
|
95
98
|
return (arr.x * ut + arr.y * t) * ut + (arr.y * ut + arr.z * t) * t;
|
|
96
99
|
}
|
|
97
100
|
|
|
98
|
-
vec2 interpolate(vec2 source, vec2 target, float angularDist, float t) {
|
|
99
|
-
if
|
|
100
|
-
|
|
101
|
+
vec2 interpolate (vec2 source, vec2 target, float angularDist, float t) {
|
|
102
|
+
// if the angularDist is PI, linear interpolation is applied. otherwise, use spherical interpolation
|
|
103
|
+
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
|
|
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)));
|
|
101
123
|
}
|
|
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
|
-
|
|
113
124
|
}
|
|
114
125
|
|
|
115
126
|
void main() {
|
|
@@ -122,49 +133,54 @@ void main() {
|
|
|
122
133
|
float segmentRatio = getSegmentRatio(segmentIndex);
|
|
123
134
|
float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));
|
|
124
135
|
|
|
125
|
-
if
|
|
136
|
+
if(u_line_type == LineTypeDash) {
|
|
126
137
|
v_distance_ratio = segmentIndex / segmentNumber;
|
|
127
|
-
|
|
128
|
-
|
|
138
|
+
vec2 s = source;
|
|
139
|
+
vec2 t = target;
|
|
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 调整默认的效果
|
|
129
147
|
v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / total_Distance;
|
|
130
148
|
}
|
|
131
149
|
|
|
132
|
-
if
|
|
133
|
-
|
|
150
|
+
if(u_animate.x == Animate) {
|
|
151
|
+
v_distance_ratio = segmentIndex / segmentNumber;
|
|
134
152
|
}
|
|
135
153
|
|
|
136
154
|
float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);
|
|
137
155
|
v_distance_ratio = segmentIndex / segmentNumber;
|
|
138
|
-
|
|
139
|
-
vec4
|
|
140
|
-
vec4 next = project_position(vec4(degrees(interpolate(source, target, angularDist, nextSegmentRatio)), 0.0, 1.0), a_Instance64Low.zw);
|
|
141
|
-
|
|
156
|
+
vec4 curr = project_position(vec4(degrees(interpolate(source, target, angularDist, segmentRatio)), 0.0, 1.0));
|
|
157
|
+
vec4 next = project_position(vec4(degrees(interpolate(source, target, angularDist, nextSegmentRatio)), 0.0, 1.0));
|
|
142
158
|
// v_normal = getNormal((next.xy - curr.xy) * indexDir, a_Position.y);
|
|
143
159
|
vec2 offset = project_pixel(getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y));
|
|
144
160
|
// vec4 project_pos = project_position(vec4(curr.xy, 0, 1.0));
|
|
145
161
|
// gl_Position = project_common_position_to_clipspace(vec4(curr.xy + offset, curr.z, 1.0));
|
|
146
162
|
|
|
147
163
|
v_line_data.g = a_Position.x; // 该顶点在弧线上的分段排序
|
|
148
|
-
if
|
|
164
|
+
if(LineTexture == u_line_texture) { // 开启贴图模式
|
|
165
|
+
// float mapZoomScale = u_CoordinateSystem !== COORDINATE_SYSTEM_P20_2?10000000.0:1.0;
|
|
149
166
|
float d_arcDistrance = length(source - target);
|
|
150
|
-
if
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
) {
|
|
154
|
-
// mapbox
|
|
167
|
+
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20) { // amap
|
|
168
|
+
d_arcDistrance = d_arcDistrance * 1000000.0;
|
|
169
|
+
}
|
|
170
|
+
if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) { // mapbox
|
|
155
171
|
d_arcDistrance = project_pixel_allmap(d_arcDistrance);
|
|
156
172
|
}
|
|
157
|
-
float d_pixelLen = project_pixel(u_icon_step)
|
|
158
|
-
v_line_data.b = floor(d_arcDistrance
|
|
173
|
+
float d_pixelLen = project_pixel(u_icon_step)/8.0;
|
|
174
|
+
v_line_data.b = floor(d_arcDistrance/d_pixelLen); // 贴图在弧线上重复的数量
|
|
159
175
|
|
|
160
176
|
float lineOffsetWidth = length(offset + offset * sign(a_Position.y)); // 线横向偏移的距离
|
|
161
|
-
float linePixelSize = project_pixel(a_Size);
|
|
162
|
-
v_line_data.a = lineOffsetWidth
|
|
177
|
+
float linePixelSize = project_pixel(a_Size); // 定点位置偏移,按地图等级缩放后的距离
|
|
178
|
+
v_line_data.a = lineOffsetWidth/linePixelSize; // 线图层贴图部分的 v 坐标值
|
|
163
179
|
|
|
164
180
|
v_iconMapUV = a_iconMapUV;
|
|
165
181
|
}
|
|
166
182
|
|
|
167
|
-
gl_Position =
|
|
183
|
+
gl_Position = project_common_position_to_clipspace_v2(vec4(curr.xy + offset, 0, 1.0));
|
|
168
184
|
setPickingColor(a_PickingColor);
|
|
169
185
|
}
|
|
170
186
|
|