@antv/l7-layers 2.18.0 → 2.19.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.js +1 -1
- package/es/citybuliding/shaders/build_vert.glsl +0 -1
- package/es/core/BaseModel.d.ts +0 -20
- package/es/core/BaseModel.js +6 -2
- package/es/core/CommonStyleAttribute.js +40 -0
- package/es/core/interface.d.ts +5 -0
- package/es/{Geometry → geometry}/models/billboard.js +1 -1
- package/es/{Geometry → geometry}/models/plane.js +1 -1
- package/es/{Geometry → geometry}/models/sprite.js +1 -1
- package/{lib/Geometry → es/geometry}/shaders/billboard_vert.glsl +1 -8
- package/es/geometry/shaders/plane_vert.glsl +31 -0
- package/es/{Geometry → geometry}/shaders/sprite_vert.glsl +2 -8
- package/es/heatmap/models/grid.js +1 -1
- package/es/heatmap/models/grid3d.js +1 -1
- package/es/heatmap/models/heatmap.js +1 -1
- package/es/heatmap/models/hexagon.js +1 -1
- package/es/heatmap/shaders/grid_vert.glsl +1 -1
- package/es/heatmap/shaders/heatmap_framebuffer_vert.glsl +1 -1
- package/es/heatmap/shaders/hexagon_3d_vert.glsl +1 -1
- package/es/heatmap/shaders/hexagon_vert.glsl +1 -1
- package/es/image/models/image.js +1 -1
- package/es/image/shaders/image_vert.glsl +3 -7
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/line/models/arc.js +3 -3
- package/es/line/models/arc_3d.js +2 -2
- package/es/line/models/earthArc_3d.js +2 -2
- package/es/line/models/flow.js +1 -1
- package/es/line/models/great_circle.js +1 -1
- package/es/line/models/line.js +2 -2
- package/es/line/models/linearline.js +1 -1
- package/es/line/models/simpleLine.js +1 -1
- package/es/line/models/wall.js +1 -1
- package/es/line/shaders/dash/arc_dash_vert.glsl +3 -6
- package/es/line/shaders/dash/line_dash_vert.glsl +2 -1
- package/es/line/shaders/flow/flow_line_vert.glsl +2 -7
- package/es/line/shaders/line_arc2d_vert.glsl +1 -1
- package/es/line/shaders/line_arc_3d_vert.glsl +3 -8
- package/es/line/shaders/line_arc_great_circle_vert.glsl +4 -6
- package/es/line/shaders/line_arc_vert.glsl +3 -9
- package/es/line/shaders/line_bezier_vert.glsl +1 -1
- package/es/line/shaders/line_vert.glsl +1 -1
- package/es/line/shaders/linear/arc3d_linear_vert.glsl +2 -8
- package/es/line/shaders/linear/arc_linear_vert.glsl +3 -6
- package/es/line/shaders/linearLine/line_linear_vert.glsl +1 -1
- package/es/line/shaders/simple/simpleline_vert.glsl +1 -1
- package/es/line/shaders/wall/wall_vert.glsl +1 -1
- package/es/mask/models/fill.js +1 -1
- package/es/mask/shaders/mask_vert.glsl +1 -1
- package/es/plugins/FeatureScalePlugin.js +2 -1
- package/es/point/index.js +5 -3
- package/es/point/models/{simplePoint.js → billboard_point.js} +3 -3
- package/es/point/models/earthExtrude.js +1 -1
- package/es/point/models/earthFill.js +1 -1
- package/es/point/models/extrude.js +1 -1
- package/es/point/models/fill.js +1 -1
- package/es/point/models/fillmage.js +8 -37
- package/es/point/models/image.js +7 -7
- package/es/point/models/index.js +1 -1
- package/es/point/models/normal.js +4 -4
- package/es/point/models/radar.js +2 -2
- package/es/point/models/text.js +1 -19
- package/es/point/shaders/{simplePoint_vert.glsl → billboard_point_vert.glsl} +2 -2
- package/es/point/shaders/earth/extrude_vert.glsl +1 -1
- package/es/point/shaders/earth/fill_vert.glsl +1 -1
- package/es/point/shaders/extrude/extrude_vert.glsl +2 -6
- package/es/point/shaders/fill_vert.glsl +6 -14
- package/es/point/shaders/image/fillImage_frag.glsl +2 -1
- package/es/point/shaders/image/fillImage_vert.glsl +11 -19
- package/es/point/shaders/image_frag.glsl +2 -4
- package/es/point/shaders/image_vert.glsl +6 -10
- package/es/point/shaders/normal_vert.glsl +2 -3
- package/es/point/shaders/radar/radar_frag.glsl +0 -6
- package/es/point/shaders/radar/radar_vert.glsl +2 -9
- package/es/point/shaders/text_vert.glsl +6 -13
- package/es/polygon/index.js +3 -1
- package/es/polygon/models/extrude.js +3 -3
- package/es/polygon/models/extrusion.d.ts +17 -0
- package/es/polygon/models/extrusion.js +137 -0
- package/es/polygon/models/fill.js +2 -2
- package/es/polygon/models/index.d.ts +1 -1
- package/es/polygon/models/index.js +3 -1
- package/es/polygon/models/ocean.js +1 -1
- package/es/polygon/models/water.js +1 -1
- package/es/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +2 -10
- package/es/polygon/shaders/extrude/polygon_extrude_vert.glsl +2 -8
- package/es/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +2 -8
- package/es/polygon/shaders/extrusion/polygon_extrusion_frag.glsl +13 -0
- package/es/polygon/shaders/extrusion/polygon_extrusion_vert.glsl +34 -0
- package/es/polygon/shaders/polygon_linear_vert.glsl +2 -7
- package/es/polygon/shaders/polygon_vert.glsl +3 -6
- package/es/polygon/shaders/water/polygon_ocean_vert.glsl +2 -7
- package/es/polygon/shaders/water/polygon_water_vert.glsl +2 -6
- package/es/raster/models/raster.js +1 -1
- package/es/raster/models/rasterRgb.js +1 -1
- package/es/raster/models/rasterTerrainRgb.js +1 -1
- package/es/raster/shaders/raster_2d_vert.glsl +2 -6
- package/es/raster/shaders/raster_vert.glsl +2 -12
- package/es/raster/shaders/rater_terrain_rgb_vert.glsl +2 -7
- package/es/wind/models/wind.js +1 -1
- package/es/wind/shaders/wind_vert.glsl +3 -7
- package/lib/citybuliding/models/build.js +1 -1
- package/lib/citybuliding/shaders/build_vert.glsl +0 -1
- package/lib/core/BaseModel.js +6 -2
- package/lib/core/CommonStyleAttribute.js +40 -0
- package/lib/{Geometry → geometry}/models/billboard.js +1 -1
- package/lib/{Geometry → geometry}/models/plane.js +1 -1
- package/lib/{Geometry → geometry}/models/sprite.js +1 -1
- package/{es/Geometry → lib/geometry}/shaders/billboard_vert.glsl +1 -8
- package/lib/geometry/shaders/plane_vert.glsl +31 -0
- package/lib/{Geometry → geometry}/shaders/sprite_vert.glsl +2 -8
- package/lib/heatmap/models/grid.js +1 -1
- package/lib/heatmap/models/grid3d.js +1 -1
- package/lib/heatmap/models/heatmap.js +1 -1
- package/lib/heatmap/models/hexagon.js +1 -1
- package/lib/heatmap/shaders/grid_vert.glsl +1 -1
- package/lib/heatmap/shaders/heatmap_framebuffer_vert.glsl +1 -1
- package/lib/heatmap/shaders/hexagon_3d_vert.glsl +1 -1
- package/lib/heatmap/shaders/hexagon_vert.glsl +1 -1
- package/lib/image/models/image.js +1 -1
- package/lib/image/shaders/image_vert.glsl +3 -7
- package/lib/index.js +2 -2
- package/lib/line/models/arc.js +3 -3
- package/lib/line/models/arc_3d.js +2 -2
- package/lib/line/models/earthArc_3d.js +2 -2
- package/lib/line/models/flow.js +1 -1
- package/lib/line/models/great_circle.js +1 -1
- package/lib/line/models/line.js +2 -2
- package/lib/line/models/linearline.js +1 -1
- package/lib/line/models/simpleLine.js +1 -1
- package/lib/line/models/wall.js +1 -1
- package/lib/line/shaders/dash/arc_dash_vert.glsl +3 -6
- package/lib/line/shaders/dash/line_dash_vert.glsl +2 -1
- package/lib/line/shaders/flow/flow_line_vert.glsl +2 -7
- package/lib/line/shaders/line_arc2d_vert.glsl +1 -1
- package/lib/line/shaders/line_arc_3d_vert.glsl +3 -8
- package/lib/line/shaders/line_arc_great_circle_vert.glsl +4 -6
- package/lib/line/shaders/line_arc_vert.glsl +3 -9
- package/lib/line/shaders/line_bezier_vert.glsl +1 -1
- package/lib/line/shaders/line_vert.glsl +1 -1
- package/lib/line/shaders/linear/arc3d_linear_vert.glsl +2 -8
- package/lib/line/shaders/linear/arc_linear_vert.glsl +3 -6
- package/lib/line/shaders/linearLine/line_linear_vert.glsl +1 -1
- package/lib/line/shaders/simple/simpleline_vert.glsl +1 -1
- package/lib/line/shaders/wall/wall_vert.glsl +1 -1
- package/lib/mask/models/fill.js +1 -1
- package/lib/mask/shaders/mask_vert.glsl +1 -1
- package/lib/plugins/FeatureScalePlugin.js +2 -1
- package/lib/point/index.js +5 -3
- package/lib/point/models/{simplePoint.js → billboard_point.js} +3 -3
- package/lib/point/models/earthExtrude.js +1 -1
- package/lib/point/models/earthFill.js +1 -1
- package/lib/point/models/extrude.js +1 -1
- package/lib/point/models/fill.js +1 -1
- package/lib/point/models/fillmage.js +8 -37
- package/lib/point/models/image.js +7 -7
- package/lib/point/models/index.js +2 -2
- package/lib/point/models/normal.js +4 -4
- package/lib/point/models/radar.js +2 -2
- package/lib/point/models/text.js +1 -19
- package/lib/point/shaders/{simplePoint_vert.glsl → billboard_point_vert.glsl} +2 -2
- package/lib/point/shaders/earth/extrude_vert.glsl +1 -1
- package/lib/point/shaders/earth/fill_vert.glsl +1 -1
- package/lib/point/shaders/extrude/extrude_vert.glsl +2 -6
- package/lib/point/shaders/fill_vert.glsl +6 -14
- package/lib/point/shaders/image/fillImage_frag.glsl +2 -1
- package/lib/point/shaders/image/fillImage_vert.glsl +11 -19
- package/lib/point/shaders/image_frag.glsl +2 -4
- package/lib/point/shaders/image_vert.glsl +6 -10
- package/lib/point/shaders/normal_vert.glsl +2 -3
- package/lib/point/shaders/radar/radar_frag.glsl +0 -6
- package/lib/point/shaders/radar/radar_vert.glsl +2 -9
- package/lib/point/shaders/text_vert.glsl +6 -13
- package/lib/polygon/index.js +3 -1
- package/lib/polygon/models/extrude.js +3 -3
- package/lib/polygon/models/extrusion.js +144 -0
- package/lib/polygon/models/fill.js +2 -2
- package/lib/polygon/models/index.js +3 -1
- package/lib/polygon/models/ocean.js +1 -1
- package/lib/polygon/models/water.js +1 -1
- package/lib/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +2 -10
- package/lib/polygon/shaders/extrude/polygon_extrude_vert.glsl +2 -8
- package/lib/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +2 -8
- package/lib/polygon/shaders/extrusion/polygon_extrusion_frag.glsl +13 -0
- package/lib/polygon/shaders/extrusion/polygon_extrusion_vert.glsl +34 -0
- package/lib/polygon/shaders/polygon_linear_vert.glsl +2 -7
- package/lib/polygon/shaders/polygon_vert.glsl +3 -6
- package/lib/polygon/shaders/water/polygon_ocean_vert.glsl +2 -7
- package/lib/polygon/shaders/water/polygon_water_vert.glsl +2 -6
- package/lib/raster/models/raster.js +1 -1
- package/lib/raster/models/rasterRgb.js +1 -1
- package/lib/raster/models/rasterTerrainRgb.js +1 -1
- package/lib/raster/shaders/raster_2d_vert.glsl +2 -6
- package/lib/raster/shaders/raster_vert.glsl +2 -12
- package/lib/raster/shaders/rater_terrain_rgb_vert.glsl +2 -7
- package/lib/wind/models/wind.js +1 -1
- package/lib/wind/shaders/wind_vert.glsl +3 -7
- package/package.json +7 -7
- package/es/Geometry/shaders/plane_vert.glsl +0 -53
- package/lib/Geometry/shaders/plane_vert.glsl +0 -53
- /package/es/{Geometry → geometry}/index.d.ts +0 -0
- /package/es/{Geometry → geometry}/index.js +0 -0
- /package/es/{Geometry → geometry}/models/billboard.d.ts +0 -0
- /package/es/{Geometry → geometry}/models/index.d.ts +0 -0
- /package/es/{Geometry → geometry}/models/index.js +0 -0
- /package/es/{Geometry → geometry}/models/plane.d.ts +0 -0
- /package/es/{Geometry → geometry}/models/sprite.d.ts +0 -0
- /package/es/{Geometry → geometry}/shaders/billboard_frag.glsl +0 -0
- /package/es/{Geometry → geometry}/shaders/plane_frag.glsl +0 -0
- /package/es/{Geometry → geometry}/shaders/sprite_frag.glsl +0 -0
- /package/es/point/models/{simplePoint.d.ts → billboard_point.d.ts} +0 -0
- /package/es/point/shaders/{simplePoint_frag.glsl → billboard_point_frag.glsl} +0 -0
- /package/lib/{Geometry → geometry}/index.js +0 -0
- /package/lib/{Geometry → geometry}/models/index.js +0 -0
- /package/lib/{Geometry → geometry}/shaders/billboard_frag.glsl +0 -0
- /package/lib/{Geometry → geometry}/shaders/plane_frag.glsl +0 -0
- /package/lib/{Geometry → geometry}/shaders/sprite_frag.glsl +0 -0
- /package/lib/point/shaders/{simplePoint_frag.glsl → billboard_point_frag.glsl} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
attribute vec3 a_Position;
|
|
3
3
|
uniform mat4 u_ModelMatrix;
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
attribute float a_Size;
|
|
6
6
|
attribute vec4 a_Color;
|
|
7
7
|
varying vec4 v_color;
|
|
@@ -31,7 +31,7 @@ void main() {
|
|
|
31
31
|
vec4 project_pos = project_position(vec4(a_Position, 1.0)) + vec4(a_Size / 2.,-a_Size /2.,0.,0.);
|
|
32
32
|
gl_Position = project_common_position_to_clipspace(vec4(vec2(project_pos.xy+offset),project_pos.z,project_pos.w));
|
|
33
33
|
}
|
|
34
|
-
|
|
34
|
+
|
|
35
35
|
gl_PointSize = a_Size * 2.0 * u_DevicePixelRatio;
|
|
36
36
|
setPickingColor(a_PickingColor);
|
|
37
37
|
}
|
|
@@ -14,7 +14,7 @@ attribute vec3 a_Normal;
|
|
|
14
14
|
uniform float u_heightfixed: 0.0; // 默认不固定
|
|
15
15
|
uniform float u_r;
|
|
16
16
|
uniform mat4 u_ModelMatrix;
|
|
17
|
-
|
|
17
|
+
|
|
18
18
|
varying vec4 v_color;
|
|
19
19
|
varying float v_lightWeight;
|
|
20
20
|
varying float v_barLinearZ;
|
|
@@ -103,11 +103,7 @@ void main() {
|
|
|
103
103
|
|
|
104
104
|
// gl_Position = project_common_position_to_clipspace(pos);
|
|
105
105
|
|
|
106
|
-
|
|
107
|
-
gl_Position = u_Mvp * pos;
|
|
108
|
-
} else {
|
|
109
|
-
gl_Position = project_common_position_to_clipspace(pos);
|
|
110
|
-
}
|
|
106
|
+
gl_Position = project_common_position_to_clipspace_v2(pos);
|
|
111
107
|
|
|
112
108
|
setPickingColor(a_PickingColor);
|
|
113
109
|
}
|
|
@@ -3,28 +3,26 @@ attribute vec3 a_Position;
|
|
|
3
3
|
attribute vec3 a_Extrude;
|
|
4
4
|
attribute float a_Size;
|
|
5
5
|
attribute float a_Shape;
|
|
6
|
-
|
|
7
6
|
uniform mat4 u_ModelMatrix;
|
|
8
|
-
|
|
7
|
+
|
|
9
8
|
uniform int u_size_unit;
|
|
10
9
|
|
|
11
10
|
varying vec4 v_data;
|
|
12
11
|
varying vec4 v_color;
|
|
13
12
|
varying float v_radius;
|
|
14
13
|
varying vec4 v_stroke;
|
|
15
|
-
|
|
16
|
-
// uniform float u_opacity : 1;
|
|
17
14
|
uniform float u_stroke_width: 2;
|
|
18
15
|
uniform vec3 u_blur_height_fixed: [0, 0, 0];
|
|
19
16
|
|
|
20
17
|
|
|
21
18
|
#pragma include "projection"
|
|
22
19
|
#pragma include "picking"
|
|
20
|
+
#pragma include "rotation_2d"
|
|
23
21
|
|
|
24
22
|
|
|
25
23
|
void main() {
|
|
26
24
|
// 透明度计算
|
|
27
|
-
|
|
25
|
+
v_stroke = stroke;
|
|
28
26
|
vec3 extrude = a_Extrude;
|
|
29
27
|
float shape_type = a_Shape;
|
|
30
28
|
/*
|
|
@@ -53,6 +51,7 @@ void main() {
|
|
|
53
51
|
vec3 aPosition = a_Position;
|
|
54
52
|
|
|
55
53
|
offset = project_pixel(offset);
|
|
54
|
+
offset = rotate_matrix(offset,rotation);
|
|
56
55
|
|
|
57
56
|
// TODP: /abs(extrude.x) 是为了兼容地球模式
|
|
58
57
|
v_data = vec4(extrude.x/abs(extrude.x), extrude.y/abs(extrude.y), antialiasblur,shape_type);
|
|
@@ -72,15 +71,8 @@ void main() {
|
|
|
72
71
|
raisingHeight = u_blur_height_fixed.y * mapboxZoomScale;
|
|
73
72
|
}
|
|
74
73
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
|
|
78
|
-
gl_Position = u_Mvp * vec4(project_pos.xy + offset, raisingHeight, 1.0);
|
|
79
|
-
} else {
|
|
80
|
-
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, raisingHeight, 1.0));
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));
|
|
74
|
+
|
|
75
|
+
gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy + offset, raisingHeight, 1.0));
|
|
84
76
|
|
|
85
77
|
setPickingColor(a_PickingColor);
|
|
86
78
|
}
|
|
@@ -6,12 +6,13 @@ uniform float u_opacity : 1;
|
|
|
6
6
|
#pragma include "picking"
|
|
7
7
|
varying vec2 v_uv; // 本身的 uv 坐标
|
|
8
8
|
varying vec2 v_Iconuv;
|
|
9
|
+
varying float v_opacity;
|
|
9
10
|
|
|
10
11
|
void main() {
|
|
11
12
|
|
|
12
13
|
vec2 pos = v_Iconuv / u_textSize + v_uv / u_textSize * 64.;
|
|
13
14
|
gl_FragColor = texture2D(u_texture, pos);
|
|
14
|
-
gl_FragColor.a *=
|
|
15
|
+
gl_FragColor.a *= v_opacity;
|
|
15
16
|
|
|
16
17
|
gl_FragColor = filterColor(gl_FragColor);
|
|
17
18
|
}
|
|
@@ -3,10 +3,9 @@ attribute vec3 a_Position;
|
|
|
3
3
|
attribute vec3 a_Extrude;
|
|
4
4
|
attribute float a_Size;
|
|
5
5
|
attribute vec2 a_Uv;
|
|
6
|
-
attribute float a_Rotate;
|
|
7
6
|
|
|
8
7
|
uniform mat4 u_ModelMatrix;
|
|
9
|
-
|
|
8
|
+
|
|
10
9
|
uniform mat2 u_RotateMatrix;
|
|
11
10
|
uniform int u_size_unit;
|
|
12
11
|
|
|
@@ -15,31 +14,30 @@ varying vec2 v_Iconuv; // icon 贴图的 uv 坐标
|
|
|
15
14
|
|
|
16
15
|
uniform float u_raisingHeight: 0.0;
|
|
17
16
|
uniform float u_heightfixed: 0.0;
|
|
18
|
-
|
|
19
|
-
uniform vec2 u_offsets;
|
|
20
|
-
|
|
17
|
+
varying float v_opacity;
|
|
18
|
+
// uniform vec2 u_offsets; // shader 注入
|
|
21
19
|
|
|
22
20
|
|
|
23
21
|
#pragma include "projection"
|
|
24
22
|
#pragma include "picking"
|
|
23
|
+
#pragma include "rotation_2d"
|
|
25
24
|
|
|
26
25
|
void main() {
|
|
27
26
|
vec3 extrude = a_Extrude;
|
|
28
27
|
v_uv = (a_Extrude.xy + 1.0)/2.0;
|
|
29
28
|
v_uv.y = 1.0 - v_uv.y;
|
|
30
29
|
v_Iconuv = a_Uv;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
highp float angle_sin = sin(a_Rotate);
|
|
34
|
-
highp float angle_cos = cos(a_Rotate);
|
|
35
|
-
mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos);
|
|
30
|
+
v_opacity = opacity;
|
|
36
31
|
float newSize = a_Size;
|
|
37
32
|
if(u_size_unit == 1) {
|
|
38
33
|
newSize = newSize * u_PixelsPerMeter.z;
|
|
39
34
|
}
|
|
40
|
-
|
|
35
|
+
|
|
41
36
|
// vec2 offset = (u_RotateMatrix * extrude.xy * (a_Size) + textrueOffsets);
|
|
42
|
-
vec2 offset = (
|
|
37
|
+
vec2 offset = (extrude.xy * (newSize) + offsets);
|
|
38
|
+
|
|
39
|
+
offset = rotate_matrix(offset,rotation);
|
|
40
|
+
|
|
43
41
|
vec3 aPosition = a_Position;
|
|
44
42
|
|
|
45
43
|
offset = project_pixel(offset);
|
|
@@ -55,13 +53,7 @@ void main() {
|
|
|
55
53
|
}
|
|
56
54
|
}
|
|
57
55
|
|
|
58
|
-
|
|
59
|
-
gl_Position = u_Mvp *vec4(project_pos.xy + offset, raisingHeight, 1.0);
|
|
60
|
-
} else {
|
|
61
|
-
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, raisingHeight, 1.0));
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));
|
|
56
|
+
gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy + offset, 0.0, 1.0));
|
|
65
57
|
|
|
66
58
|
setPickingColor(a_PickingColor);
|
|
67
59
|
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
uniform sampler2D u_texture;
|
|
3
3
|
varying vec4 v_color;
|
|
4
4
|
varying vec2 v_uv;
|
|
5
|
+
varying float v_opacity;
|
|
5
6
|
uniform vec2 u_textSize;
|
|
6
|
-
uniform float u_opacity : 1;
|
|
7
7
|
|
|
8
8
|
#pragma include "picking"
|
|
9
9
|
|
|
@@ -29,9 +29,7 @@ void main(){
|
|
|
29
29
|
}else {
|
|
30
30
|
gl_FragColor= step(0.01, textureColor.z) * v_color;
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
gl_FragColor.a = gl_FragColor.a * u_opacity;
|
|
34
|
-
|
|
32
|
+
gl_FragColor.a *= v_opacity;
|
|
35
33
|
if (gl_FragColor.a < 0.01) {
|
|
36
34
|
discard;
|
|
37
35
|
}
|
|
@@ -5,15 +5,13 @@ attribute vec2 a_Uv;
|
|
|
5
5
|
attribute float a_Size;
|
|
6
6
|
varying vec4 v_color;
|
|
7
7
|
varying vec2 v_uv;
|
|
8
|
+
varying float v_opacity;
|
|
8
9
|
uniform mat4 u_ModelMatrix;
|
|
9
|
-
uniform mat4 u_Mvp;
|
|
10
|
-
uniform vec2 u_offsets;
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
|
|
13
12
|
uniform float u_raisingHeight: 0.0;
|
|
14
13
|
uniform float u_heightfixed: 0.0;
|
|
15
14
|
|
|
16
|
-
|
|
17
15
|
#pragma include "projection"
|
|
18
16
|
#pragma include "picking"
|
|
19
17
|
|
|
@@ -21,10 +19,11 @@ void main() {
|
|
|
21
19
|
|
|
22
20
|
// cal style mapping - 数据纹理映射部分的计算
|
|
23
21
|
v_color = a_Color;
|
|
22
|
+
v_opacity = opacity;
|
|
24
23
|
v_uv = a_Uv;
|
|
25
24
|
vec4 project_pos = project_position(vec4(a_Position, 1.0));
|
|
26
25
|
|
|
27
|
-
vec2 offset = project_pixel(
|
|
26
|
+
vec2 offset = project_pixel(offsets);
|
|
28
27
|
|
|
29
28
|
float raisingHeight = u_raisingHeight;
|
|
30
29
|
if(u_heightfixed < 1.0) { // false
|
|
@@ -36,11 +35,8 @@ void main() {
|
|
|
36
35
|
}
|
|
37
36
|
}
|
|
38
37
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
} else {
|
|
42
|
-
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, raisingHeight, 1.0));
|
|
43
|
-
}
|
|
38
|
+
|
|
39
|
+
gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy + offset, raisingHeight, 1.0));
|
|
44
40
|
|
|
45
41
|
gl_PointSize = a_Size * 2.0 * u_DevicePixelRatio;
|
|
46
42
|
setPickingColor(a_PickingColor);
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
attribute vec3 a_Position;
|
|
3
3
|
uniform mat4 u_ModelMatrix;
|
|
4
|
-
|
|
5
|
-
uniform mat4 u_Mvp;
|
|
4
|
+
|
|
6
5
|
attribute float a_Size;
|
|
7
6
|
attribute vec4 a_Color;
|
|
8
7
|
|
|
@@ -12,7 +11,7 @@ varying vec4 v_color;
|
|
|
12
11
|
#pragma include "project"
|
|
13
12
|
|
|
14
13
|
void main() {
|
|
15
|
-
v_color = vec4(a_Color.xyz, a_Color.w *
|
|
14
|
+
v_color = vec4(a_Color.xyz, a_Color.w * opacity);
|
|
16
15
|
|
|
17
16
|
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
|
|
18
17
|
gl_Position = u_Mvp * vec4(a_Position.xy, a_Position.z, 1.0);
|
|
@@ -35,12 +35,6 @@ void main() {
|
|
|
35
35
|
vec2 dir = normalize(extrude);
|
|
36
36
|
vec2 baseDir = vec2(1.0, 0.0);
|
|
37
37
|
float pi = 3.14159265359;
|
|
38
|
-
// full circle
|
|
39
|
-
// float rades = dot(dir, baseDir);
|
|
40
|
-
// float flag = sign(dir.y);
|
|
41
|
-
// float radar_v = (flag - 1.0) * -0.5 + flag * acos(rades)/pi/2.0;
|
|
42
|
-
|
|
43
|
-
// half circle
|
|
44
38
|
float flag = sign(dir.y);
|
|
45
39
|
float rades = dot(dir, baseDir);
|
|
46
40
|
float radar_v = (flag - 1.0) * -0.5 * acos(rades)/pi;
|
|
@@ -6,7 +6,7 @@ uniform float u_speed: 1.0;
|
|
|
6
6
|
uniform float u_time;
|
|
7
7
|
|
|
8
8
|
uniform mat4 u_ModelMatrix;
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
uniform int u_size_unit;
|
|
11
11
|
|
|
12
12
|
varying vec4 v_data;
|
|
@@ -31,8 +31,6 @@ void main() {
|
|
|
31
31
|
// unpack color(vec2)
|
|
32
32
|
v_color = a_Color;
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
34
|
// anti-alias
|
|
37
35
|
float blur = 0.0;
|
|
38
36
|
float antialiasblur = -max(2.0 / u_DevicePixelRatio / a_Size, blur);
|
|
@@ -52,12 +50,7 @@ void main() {
|
|
|
52
50
|
v_data = vec4(extrude.x, extrude.y, antialiasblur, -1.0);
|
|
53
51
|
|
|
54
52
|
vec4 project_pos = project_position(vec4(aPosition.xy, 0.0, 1.0));
|
|
55
|
-
|
|
56
|
-
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
|
|
57
|
-
gl_Position = u_Mvp *vec4(project_pos.xy + offset, 0.0, 1.0);
|
|
58
|
-
} else {
|
|
59
|
-
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));
|
|
60
|
-
}
|
|
53
|
+
gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));
|
|
61
54
|
|
|
62
55
|
setPickingColor(a_PickingColor);
|
|
63
56
|
}
|
|
@@ -6,11 +6,10 @@ attribute vec2 a_tex;
|
|
|
6
6
|
attribute vec2 a_textOffsets;
|
|
7
7
|
attribute vec4 a_Color;
|
|
8
8
|
attribute float a_Size;
|
|
9
|
-
attribute float a_Rotate;
|
|
10
9
|
|
|
11
10
|
uniform vec2 u_sdf_map_size;
|
|
12
11
|
uniform mat4 u_ModelMatrix;
|
|
13
|
-
|
|
12
|
+
|
|
14
13
|
uniform float u_raisingHeight: 0.0;
|
|
15
14
|
|
|
16
15
|
varying vec2 v_uv;
|
|
@@ -18,13 +17,14 @@ varying float v_gamma_scale;
|
|
|
18
17
|
varying vec4 v_color;
|
|
19
18
|
varying vec4 v_stroke_color;
|
|
20
19
|
varying float v_fontScale;
|
|
21
|
-
// uniform float u_opacity : 1;
|
|
22
20
|
uniform float u_stroke_width : 2;
|
|
23
21
|
uniform vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];
|
|
24
22
|
|
|
25
23
|
|
|
24
|
+
|
|
26
25
|
#pragma include "projection"
|
|
27
26
|
#pragma include "picking"
|
|
27
|
+
#pragma include "rotation_2d"
|
|
28
28
|
|
|
29
29
|
void main() {
|
|
30
30
|
// cal style mapping - 数据纹理映射部分的计算
|
|
@@ -43,9 +43,7 @@ void main() {
|
|
|
43
43
|
vec4 project_pos = project_position(vec4(a_Position, 1.0));
|
|
44
44
|
// vec4 projected_position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
highp float angle_cos = cos(a_Rotate);
|
|
48
|
-
mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos);
|
|
46
|
+
vec2 offset = rotate_matrix(a_textOffsets,rotation);
|
|
49
47
|
|
|
50
48
|
// gl_Position = vec4(projected_position.xy / projected_position.w + rotation_matrix * a_textOffsets * fontScale / u_ViewportSize * 2.0 * u_DevicePixelRatio, 0.0, 1.0);
|
|
51
49
|
|
|
@@ -55,15 +53,10 @@ void main() {
|
|
|
55
53
|
raiseHeight = u_raisingHeight * mapboxZoomScale;
|
|
56
54
|
}
|
|
57
55
|
|
|
58
|
-
vec4 projected_position;
|
|
59
|
-
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
|
|
60
|
-
projected_position = u_Mvp *(vec4(a_Position.xyz + vec3(0.0, 0.0, raiseHeight), 1.0));
|
|
61
|
-
} else { // else
|
|
62
|
-
projected_position = project_common_position_to_clipspace(vec4(project_pos.xyz + vec3(0.0, 0.0, raiseHeight), 1.0));
|
|
63
|
-
}
|
|
56
|
+
vec4 projected_position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz + vec3(0.0, 0.0, raiseHeight), 1.0));
|
|
64
57
|
|
|
65
58
|
gl_Position = vec4(
|
|
66
|
-
projected_position.xy / projected_position.w +
|
|
59
|
+
projected_position.xy / projected_position.w + offset * fontScale / u_ViewportSize * 2.0 * u_DevicePixelRatio, 0.0, 1.0);
|
|
67
60
|
v_gamma_scale = gl_Position.w;
|
|
68
61
|
setPickingColor(a_PickingColor);
|
|
69
62
|
|
package/lib/polygon/index.js
CHANGED
|
@@ -29,7 +29,7 @@ var PolygonLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
29
29
|
}
|
|
30
30
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
31
31
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "type", 'PolygonLayer');
|
|
32
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "enableShaderEncodeStyles", ['opacity']);
|
|
32
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "enableShaderEncodeStyles", ['opacity', 'extrusionBase']);
|
|
33
33
|
return _this;
|
|
34
34
|
}
|
|
35
35
|
(0, _createClass2.default)(PolygonLayer, [{
|
|
@@ -65,6 +65,8 @@ var PolygonLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
65
65
|
return 'fill';
|
|
66
66
|
} else if (shape === 'extrude') {
|
|
67
67
|
return 'extrude';
|
|
68
|
+
} else if (shape === 'extrusion') {
|
|
69
|
+
return 'extrusion';
|
|
68
70
|
} else if (shape === 'water') {
|
|
69
71
|
return 'water';
|
|
70
72
|
} else if (shape === 'ocean') {
|
|
@@ -23,15 +23,15 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
23
23
|
/* babel-plugin-inline-import '../shaders/extrude/polygon_extrude_frag.glsl' */
|
|
24
24
|
var polygonExtrudeFrag = "uniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\nuniform float u_linearColor: 0;\n\nuniform float u_topsurface: 1.0;\nuniform float u_sidesurface: 1.0;\n\nvarying vec4 v_Color;\n\n#pragma include \"picking\"\n\nvoid main() {\n\n\n // top face\n if(u_topsurface < 1.0) {\n discard;\n }\n\n gl_FragColor = v_Color;\n \n\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
|
|
25
25
|
/* babel-plugin-inline-import '../shaders/extrude/polygon_extrude_vert.glsl' */
|
|
26
|
-
var polygonExtrudeVert = "precision highp float;\n\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Normal;\nattribute float a_Size;\nattribute vec3 a_uvs;\nuniform mat4 u_ModelMatrix;\nuniform
|
|
26
|
+
var polygonExtrudeVert = "precision highp float;\n\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Normal;\nattribute float a_Size;\nattribute vec3 a_uvs;\nuniform mat4 u_ModelMatrix;\n\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\nuniform float u_linearColor: 0;\n\nuniform float u_topsurface: 1.0;\nuniform float u_sidesurface: 1.0;\n\nvarying vec4 v_Color;\nuniform float u_heightfixed: 0.0; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\nuniform float u_raisingHeight: 0.0;\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n \n float isSide = a_Position.z;\n float topU = a_uvs[0];\n float topV = 1.0 - a_uvs[1];\n float sidey = a_uvs[2];\n\n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);\n float lightWeight = calc_lighting(pos);\n\n vec4 project_pos = project_position(pos);\n\n if(u_heightfixed > 0.0) { // \u5224\u65AD\u51E0\u4F55\u4F53\u662F\u5426\u56FA\u5B9A\u9AD8\u5EA6\n project_pos.z = a_Position.z * a_Size;\n project_pos.z += u_raisingHeight;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n }\n\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));\n\n // Tip: \u90E8\u5206\u673A\u578B GPU \u8BA1\u7B97\u7CBE\u5EA6\u517C\u5BB9\n if(isSide < 0.999) {\n // side face\n // if(u_sidesurface < 1.0) {\n // discard;\n // }\n\n if(u_linearColor == 1.0) {\n vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey);\n linearColor.rgb *= lightWeight;\n v_Color = linearColor;\n } else {\n v_Color = a_Color;\n }\n\n } else {\n v_Color = a_Color;\n }\n\n v_Color = vec4(v_Color.rgb * lightWeight, v_Color.w * opacity);\n\n\n setPickingColor(a_PickingColor);\n}\n"; // extrude
|
|
27
27
|
/* babel-plugin-inline-import '../shaders/extrude/polygon_extrudetex_frag.glsl' */
|
|
28
28
|
var polygonExtrudeTexFrag = "uniform sampler2D u_texture;\nuniform float u_opacity: 1.0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\nuniform float u_linearColor: 0;\n\nuniform float u_topsurface: 1.0;\nuniform float u_sidesurface: 1.0;\n\nvarying vec4 v_Color;\nvarying vec3 v_uvs;\nvarying vec2 v_texture_data;\n\n\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = u_opacity;\n float isSide = v_texture_data.x;\n float lightWeight = v_texture_data.y;\n float topU = v_uvs[0];\n float topV = 1.0 - v_uvs[1];\n float sidey = v_uvs[2];\n // Tip: \u90E8\u5206\u673A\u578B GPU \u8BA1\u7B97\u7CBE\u5EA6\u517C\u5BB9\n if(isSide < 0.999) {// \u662F\u5426\u662F\u8FB9\u7F18\n // side face\n if(u_sidesurface < 1.0) {\n discard;\n }\n\n if(u_linearColor == 1.0) {\n vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey);\n linearColor.rgb *= lightWeight;\n gl_FragColor = linearColor;\n } else {\n gl_FragColor = v_Color;\n }\n } else {\n\n // top face\n if(u_topsurface < 1.0) {\n discard;\n }\n\n gl_FragColor = texture2D(u_texture, vec2(topU, topV));\n // gl_FragColor = vec4(1.0, 0., 0., 1.0);\n }\n \n\n gl_FragColor.a *= opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}\n"; // texture
|
|
29
29
|
/* babel-plugin-inline-import '../shaders/extrude/polygon_extrudetex_vert.glsl' */
|
|
30
|
-
var polygonExtrudeTexVert = "precision highp float;\n\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Normal;\nattribute float a_Size;\nattribute vec3 a_uvs;\nuniform mat4 u_ModelMatrix;\nuniform
|
|
30
|
+
var polygonExtrudeTexVert = "precision highp float;\n\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Normal;\nattribute float a_Size;\nattribute vec3 a_uvs;\nuniform mat4 u_ModelMatrix;\n\nuniform sampler2D u_texture;\n\n\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\nuniform float u_topsurface: 1.0;\nuniform float u_sidesurface: 1.0;\nvarying vec4 v_Color;\nuniform float u_heightfixed: 0.0; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\nuniform float u_raisingHeight: 0.0;\nuniform float u_linearColor: 0.0;\n\nvarying vec2 v_texture_data;\nvarying vec3 v_uvs;\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n \n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);\n float lightWeight = calc_lighting(pos);\n vec4 project_pos = project_position(pos);\n v_uvs = a_uvs;\n\n v_texture_data = vec2(a_Position.z, lightWeight);\n\n if(u_heightfixed > 0.0) { // \u5224\u65AD\u51E0\u4F55\u4F53\u662F\u5426\u56FA\u5B9A\u9AD8\u5EA6\n project_pos.z = a_Position.z * a_Size;\n project_pos.z += u_raisingHeight;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n }\n\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));\n\n\n\n setPickingColor(a_PickingColor);\n}\n"; // extrude picking
|
|
31
31
|
/* babel-plugin-inline-import '../shaders/extrude/polygon_extrude_picklight_frag.glsl' */
|
|
32
32
|
var polygonExtrudePickLightFrag = "uniform float u_opacity: 1.0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\nuniform float u_linearColor: 0;\n\nuniform float u_topsurface: 1.0;\nuniform float u_sidesurface: 1.0;\n\nvarying vec4 v_Color;\nvarying vec3 v_uvs;\nvarying vec2 v_texture_data;\n\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = u_opacity;\n float isSide = v_texture_data.x;\n float sidey = v_uvs[2];\n float lightWeight = v_texture_data.y;\n\n // Tip: \u90E8\u5206\u673A\u578B GPU \u8BA1\u7B97\u7CBE\u5EA6\u517C\u5BB9\n if(isSide < 0.999) {\n // side face\n if(u_sidesurface < 1.0) {\n discard;\n }\n \n if( u_linearColor == 1.0) {\n // side use linear\n vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey);\n linearColor.rgb *= lightWeight;\n gl_FragColor = linearColor;\n } else {\n // side notuse linear\n gl_FragColor = v_Color;\n }\n } else {\n // top face\n if(u_topsurface < 1.0) {\n discard;\n }\n gl_FragColor = v_Color;\n }\n\n gl_FragColor.a *= opacity;\n gl_FragColor = filterColorAlpha(gl_FragColor, lightWeight);\n}\n";
|
|
33
33
|
/* babel-plugin-inline-import '../shaders/extrude/polygon_extrude_picklight_vert.glsl' */
|
|
34
|
-
var polygonExtrudePickLightVert = "precision highp float;\n\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Normal;\nattribute float a_Size;\nattribute vec3 a_uvs;\nuniform mat4 u_ModelMatrix;\
|
|
34
|
+
var polygonExtrudePickLightVert = "precision highp float;\n\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Normal;\nattribute float a_Size;\nattribute vec3 a_uvs;\nuniform mat4 u_ModelMatrix;\n\n\nuniform float u_heightfixed: 0.0; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\nuniform float u_raisingHeight: 0.0;\n\nvarying vec2 v_texture_data;\nvarying vec3 v_uvs;\nvarying vec4 v_Color;\n\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n\n\n v_uvs = a_uvs;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);\n vec4 project_pos = project_position(pos);\n\n if(u_heightfixed > 0.0) { // \u5224\u65AD\u51E0\u4F55\u4F53\u662F\u5426\u56FA\u5B9A\u9AD8\u5EA6\n project_pos.z = a_Position.z * a_Size;\n project_pos.z += u_raisingHeight;\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n }\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));\n float lightWeight = calc_lighting(pos);\n v_texture_data = vec2(a_Position.z,lightWeight);\n\n v_Color = vec4(a_Color.rgb * lightWeight, a_Color.w);\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
35
35
|
var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
36
36
|
(0, _inherits2.default)(ExtrudeModel, _BaseModel);
|
|
37
37
|
var _super = _createSuper(ExtrudeModel);
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
11
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
14
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
15
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
16
|
+
var _l7Core = require("@antv/l7-core");
|
|
17
|
+
var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
|
|
18
|
+
var _triangulation = require("../../core/triangulation");
|
|
19
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
20
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
21
|
+
/* babel-plugin-inline-import '../shaders/extrusion/polygon_extrusion_frag.glsl' */
|
|
22
|
+
var polygonExtrudeFrag = "\nuniform float u_opacity: 1.0;\nvarying vec4 v_Color;\nvarying vec2 v_texture_data;\n\n\n#pragma include \"picking\"\n\nvoid main() {\n\n gl_FragColor = v_Color;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
|
|
23
|
+
/* babel-plugin-inline-import '../shaders/extrusion/polygon_extrusion_vert.glsl' */
|
|
24
|
+
var polygonExtrudeVert = "precision highp float;\n\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Normal;\nattribute float a_Size;\nuniform mat4 u_ModelMatrix;\n\n\n\n\nvarying vec4 v_Color;\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n \n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size + (1.0 - a_Position.z) * extrusionBase * 1.5, 1.0);\n float lightWeight = calc_lighting(pos);\n vec4 project_pos = project_position(pos);\n // project_pos.z += extrusionBase * 2.0;\n v_Color = a_Color;\n v_Color = vec4(v_Color.rgb * lightWeight, v_Color.w * opacity);\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
25
|
+
var ExtrusionModel = /*#__PURE__*/function (_BaseModel) {
|
|
26
|
+
(0, _inherits2.default)(ExtrusionModel, _BaseModel);
|
|
27
|
+
var _super = _createSuper(ExtrusionModel);
|
|
28
|
+
function ExtrusionModel() {
|
|
29
|
+
(0, _classCallCheck2.default)(this, ExtrusionModel);
|
|
30
|
+
return _super.apply(this, arguments);
|
|
31
|
+
}
|
|
32
|
+
(0, _createClass2.default)(ExtrusionModel, [{
|
|
33
|
+
key: "getUninforms",
|
|
34
|
+
value: function getUninforms() {
|
|
35
|
+
return (0, _objectSpread2.default)({}, this.getStyleAttribute());
|
|
36
|
+
}
|
|
37
|
+
}, {
|
|
38
|
+
key: "initModels",
|
|
39
|
+
value: function () {
|
|
40
|
+
var _initModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
41
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
42
|
+
while (1) switch (_context.prev = _context.next) {
|
|
43
|
+
case 0:
|
|
44
|
+
return _context.abrupt("return", this.buildModels());
|
|
45
|
+
case 1:
|
|
46
|
+
case "end":
|
|
47
|
+
return _context.stop();
|
|
48
|
+
}
|
|
49
|
+
}, _callee, this);
|
|
50
|
+
}));
|
|
51
|
+
function initModels() {
|
|
52
|
+
return _initModels.apply(this, arguments);
|
|
53
|
+
}
|
|
54
|
+
return initModels;
|
|
55
|
+
}()
|
|
56
|
+
}, {
|
|
57
|
+
key: "buildModels",
|
|
58
|
+
value: function () {
|
|
59
|
+
var _buildModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
60
|
+
var _this$getShaders, frag, vert, type, model;
|
|
61
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
62
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
63
|
+
case 0:
|
|
64
|
+
_this$getShaders = this.getShaders(), frag = _this$getShaders.frag, vert = _this$getShaders.vert, type = _this$getShaders.type;
|
|
65
|
+
_context2.next = 3;
|
|
66
|
+
return this.layer.buildLayerModel({
|
|
67
|
+
moduleName: type,
|
|
68
|
+
vertexShader: vert,
|
|
69
|
+
fragmentShader: frag,
|
|
70
|
+
inject: this.getInject(),
|
|
71
|
+
triangulation: _triangulation.PolygonExtrudeTriangulation
|
|
72
|
+
});
|
|
73
|
+
case 3:
|
|
74
|
+
model = _context2.sent;
|
|
75
|
+
return _context2.abrupt("return", [model]);
|
|
76
|
+
case 5:
|
|
77
|
+
case "end":
|
|
78
|
+
return _context2.stop();
|
|
79
|
+
}
|
|
80
|
+
}, _callee2, this);
|
|
81
|
+
}));
|
|
82
|
+
function buildModels() {
|
|
83
|
+
return _buildModels.apply(this, arguments);
|
|
84
|
+
}
|
|
85
|
+
return buildModels;
|
|
86
|
+
}()
|
|
87
|
+
}, {
|
|
88
|
+
key: "getShaders",
|
|
89
|
+
value: function getShaders() {
|
|
90
|
+
return {
|
|
91
|
+
frag: polygonExtrudeFrag,
|
|
92
|
+
vert: polygonExtrudeVert,
|
|
93
|
+
type: 'polygonExtrude'
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
}, {
|
|
97
|
+
key: "clearModels",
|
|
98
|
+
value: function clearModels() {
|
|
99
|
+
var _this$texture;
|
|
100
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
|
|
101
|
+
}
|
|
102
|
+
}, {
|
|
103
|
+
key: "registerBuiltinAttributes",
|
|
104
|
+
value: function registerBuiltinAttributes() {
|
|
105
|
+
this.styleAttributeService.registerStyleAttribute({
|
|
106
|
+
name: 'normal',
|
|
107
|
+
type: _l7Core.AttributeType.Attribute,
|
|
108
|
+
descriptor: {
|
|
109
|
+
name: 'a_Normal',
|
|
110
|
+
buffer: {
|
|
111
|
+
// give the WebGL driver a hint that this buffer may change
|
|
112
|
+
usage: _l7Core.gl.STATIC_DRAW,
|
|
113
|
+
data: [],
|
|
114
|
+
type: _l7Core.gl.FLOAT
|
|
115
|
+
},
|
|
116
|
+
size: 3,
|
|
117
|
+
update: function update(feature, featureIdx, vertex, attributeIdx, normal) {
|
|
118
|
+
return normal;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
this.styleAttributeService.registerStyleAttribute({
|
|
123
|
+
name: 'size',
|
|
124
|
+
type: _l7Core.AttributeType.Attribute,
|
|
125
|
+
descriptor: {
|
|
126
|
+
name: 'a_Size',
|
|
127
|
+
buffer: {
|
|
128
|
+
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
129
|
+
data: [],
|
|
130
|
+
type: _l7Core.gl.FLOAT
|
|
131
|
+
},
|
|
132
|
+
size: 1,
|
|
133
|
+
update: function update(feature) {
|
|
134
|
+
var _feature$size = feature.size,
|
|
135
|
+
size = _feature$size === void 0 ? 10 : _feature$size;
|
|
136
|
+
return Array.isArray(size) ? [size[0]] : [size];
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
}]);
|
|
142
|
+
return ExtrusionModel;
|
|
143
|
+
}(_BaseModel2.default);
|
|
144
|
+
exports.default = ExtrusionModel;
|
|
@@ -24,9 +24,9 @@ var polygon_frag = "varying vec4 v_color;\n#pragma include \"picking\"\n\nvoid m
|
|
|
24
24
|
/* babel-plugin-inline-import '../shaders/polygon_linear_frag.glsl' */
|
|
25
25
|
var polygon_linear_frag = "#pragma include \"picking\"\nuniform float u_opacitylinear: 0.0;\nuniform float u_dir: 1.0;\nvarying vec3 v_linear;\nvarying vec2 v_pos;\nvarying vec4 v_Color;\n\n\nvoid main() {\n gl_FragColor = v_Color;\n if(u_opacitylinear > 0.0) {\n gl_FragColor.a *= u_dir == 1.0 ? 1.0 - length(v_pos - v_linear.xy)/v_linear.z : length(v_pos - v_linear.xy)/v_linear.z;\n }\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
|
|
26
26
|
/* babel-plugin-inline-import '../shaders/polygon_linear_vert.glsl' */
|
|
27
|
-
var polygon_linear_vert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\n\nuniform mat4 u_ModelMatrix;\nuniform
|
|
27
|
+
var polygon_linear_vert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\n\nuniform mat4 u_ModelMatrix;\n\nuniform float u_raisingHeight: 0.0;\n\nvarying vec4 v_Color;\n\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nuniform float u_opacitylinear: 0.0;\n\nattribute vec3 a_linear;\nvarying vec3 v_linear;\nvarying vec2 v_pos;\n\nvoid main() {\n if(u_opacitylinear > 0.0) {\n v_linear = a_linear;\n v_pos = a_Position.xy;\n }\n v_Color = vec4(a_Color.xyz, a_Color.w * opacity);\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n project_pos.z += u_raisingHeight;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));\n setPickingColor(a_PickingColor);\n}";
|
|
28
28
|
/* babel-plugin-inline-import '../shaders/polygon_vert.glsl' */
|
|
29
|
-
var polygon_vert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\n\nuniform mat4 u_ModelMatrix;\
|
|
29
|
+
var polygon_vert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\n\nuniform mat4 u_ModelMatrix;\n\n\nuniform float u_raisingHeight: 0.0;\n\nvarying vec4 v_color;\n\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n v_color = vec4(a_Color.xyz, a_Color.w * opacity);\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 project_pos.z += u_raisingHeight;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n\n \n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n\n";
|
|
30
30
|
var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
31
31
|
(0, _inherits2.default)(FillModel, _BaseModel);
|
|
32
32
|
var _super = _createSuper(FillModel);
|
|
@@ -12,6 +12,7 @@ var _image = _interopRequireDefault(require("../../point/models/image"));
|
|
|
12
12
|
var _normal = _interopRequireDefault(require("../../point/models/normal"));
|
|
13
13
|
var _text = _interopRequireDefault(require("../../point/models/text"));
|
|
14
14
|
var _extrude2 = _interopRequireDefault(require("./extrude"));
|
|
15
|
+
var _extrusion = _interopRequireDefault(require("./extrusion"));
|
|
15
16
|
var _fill2 = _interopRequireDefault(require("./fill"));
|
|
16
17
|
var _ocean = _interopRequireDefault(require("./ocean"));
|
|
17
18
|
var _water = _interopRequireDefault(require("./water"));
|
|
@@ -25,7 +26,8 @@ var PolygonModels = {
|
|
|
25
26
|
point_normal: _normal.default,
|
|
26
27
|
point_extrude: _extrude.default,
|
|
27
28
|
water: _water.default,
|
|
28
|
-
ocean: _ocean.default
|
|
29
|
+
ocean: _ocean.default,
|
|
30
|
+
extrusion: _extrusion.default
|
|
29
31
|
// point_fill: PointModels.fill,
|
|
30
32
|
};
|
|
31
33
|
var _default = PolygonModels;
|