@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,9 +1,9 @@
|
|
|
1
|
-
layout(location =
|
|
2
|
-
layout(location =
|
|
3
|
-
layout(location =
|
|
4
|
-
layout(location =
|
|
5
|
-
layout(location =
|
|
6
|
-
|
|
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 float a_Size;
|
|
5
|
+
layout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal;
|
|
6
|
+
layout(location = ATTRIBUTE_LOCATION_UV) in vec3 a_uvs;
|
|
7
7
|
|
|
8
8
|
layout(std140) uniform commonUniforms {
|
|
9
9
|
vec4 u_sourceColor;
|
|
@@ -24,31 +24,31 @@ out vec2 v_texture_data;
|
|
|
24
24
|
#pragma include "picking"
|
|
25
25
|
|
|
26
26
|
void main() {
|
|
27
|
-
|
|
28
27
|
vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
vec4 project_pos = project_position(pos, a_Position64Low);
|
|
29
|
+
float lightWeight = calc_lighting(project_pos);
|
|
31
30
|
v_uvs = a_uvs;
|
|
32
31
|
v_Color = a_Color;
|
|
33
32
|
v_Color.a *= opacity;
|
|
34
|
-
|
|
33
|
+
|
|
35
34
|
v_texture_data = vec2(a_Position.z, lightWeight);
|
|
36
35
|
|
|
37
|
-
if(u_heightfixed > 0.0) {
|
|
36
|
+
if (u_heightfixed > 0.0) {
|
|
37
|
+
// 判断几何体是否固定高度
|
|
38
38
|
project_pos.z = a_Position.z * a_Size;
|
|
39
39
|
project_pos.z += u_raisingHeight;
|
|
40
40
|
|
|
41
|
-
if(
|
|
42
|
-
|
|
41
|
+
if (
|
|
42
|
+
u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
|
|
43
|
+
u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET
|
|
44
|
+
) {
|
|
45
|
+
float mapboxZoomScale = 4.0 / pow(2.0, 21.0 - u_Zoom);
|
|
43
46
|
project_pos.z *= mapboxZoomScale;
|
|
44
47
|
project_pos.z += u_raisingHeight * mapboxZoomScale;
|
|
45
48
|
}
|
|
46
49
|
}
|
|
47
50
|
|
|
48
|
-
|
|
49
|
-
gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
|
|
52
52
|
|
|
53
53
|
setPickingColor(a_PickingColor);
|
|
54
54
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
layout(location =
|
|
2
|
-
layout(location =
|
|
3
|
-
layout(location =
|
|
4
|
-
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 float a_Size;
|
|
5
|
+
layout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal;
|
|
5
6
|
|
|
6
7
|
out vec4 v_Color;
|
|
7
8
|
|
|
@@ -10,15 +11,14 @@ out vec4 v_Color;
|
|
|
10
11
|
#pragma include "picking"
|
|
11
12
|
|
|
12
13
|
void main() {
|
|
13
|
-
|
|
14
14
|
vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size + (1.0 - a_Position.z) * extrusionBase, 1.0);
|
|
15
15
|
|
|
16
|
-
vec4 project_pos = project_position(pos);
|
|
17
|
-
|
|
16
|
+
vec4 project_pos = project_position(pos, a_Position64Low);
|
|
17
|
+
float lightWeight = calc_lighting(project_pos);
|
|
18
18
|
v_Color = a_Color;
|
|
19
19
|
v_Color = vec4(v_Color.rgb * lightWeight, v_Color.w * opacity);
|
|
20
20
|
|
|
21
|
-
gl_Position =
|
|
21
|
+
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
|
|
22
22
|
|
|
23
23
|
setPickingColor(a_PickingColor);
|
|
24
24
|
}
|
|
@@ -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_LINEAR) in vec3 a_linear;
|
|
4
5
|
|
|
5
6
|
layout(std140) uniform commonUniforms {
|
|
6
7
|
float u_raisingHeight;
|
|
@@ -21,7 +22,7 @@ void main() {
|
|
|
21
22
|
v_pos = a_Position.xy;
|
|
22
23
|
}
|
|
23
24
|
v_color = vec4(a_Color.xyz, a_Color.w * opacity);
|
|
24
|
-
vec4 project_pos = project_position(vec4(a_Position, 1.0));
|
|
25
|
+
vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low);
|
|
25
26
|
project_pos.z += u_raisingHeight;
|
|
26
27
|
|
|
27
28
|
if (u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
|
|
@@ -30,6 +31,6 @@ void main() {
|
|
|
30
31
|
project_pos.z += u_raisingHeight * mapboxZoomScale;
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
gl_Position =
|
|
34
|
+
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
|
|
34
35
|
setPickingColor(a_PickingColor);
|
|
35
|
-
}
|
|
36
|
+
}
|
|
@@ -1,36 +1,34 @@
|
|
|
1
|
-
layout(location =
|
|
2
|
-
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;
|
|
3
4
|
|
|
4
5
|
layout(std140) uniform commonUniforms {
|
|
5
6
|
float u_raisingHeight;
|
|
6
7
|
};
|
|
7
8
|
|
|
8
|
-
|
|
9
9
|
out vec4 v_color;
|
|
10
10
|
|
|
11
|
-
|
|
12
11
|
#pragma include "projection"
|
|
13
12
|
#pragma include "picking"
|
|
14
13
|
|
|
15
14
|
void main() {
|
|
16
15
|
// cal style mapping - 数据纹理映射部分的计算
|
|
17
16
|
|
|
18
|
-
// cal style mapping - 数据纹理映射部分的计算
|
|
19
|
-
|
|
20
17
|
v_color = vec4(a_Color.xyz, a_Color.w * opacity);
|
|
21
|
-
vec4 project_pos = project_position(vec4(a_Position, 1.0));
|
|
22
|
-
// gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
|
|
18
|
+
vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low);
|
|
23
19
|
|
|
24
20
|
project_pos.z += u_raisingHeight;
|
|
25
21
|
|
|
26
|
-
if(
|
|
27
|
-
|
|
22
|
+
if (
|
|
23
|
+
u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
|
|
24
|
+
u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET
|
|
25
|
+
) {
|
|
26
|
+
float mapboxZoomScale = 4.0 / pow(2.0, 21.0 - u_Zoom);
|
|
28
27
|
project_pos.z *= mapboxZoomScale;
|
|
29
28
|
project_pos.z += u_raisingHeight * mapboxZoomScale;
|
|
30
29
|
}
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));
|
|
31
|
+
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
|
|
34
32
|
|
|
35
33
|
setPickingColor(a_PickingColor);
|
|
36
34
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
layout(location =
|
|
2
|
-
layout(location =
|
|
1
|
+
layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
|
|
2
|
+
layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_uv;
|
|
3
3
|
|
|
4
4
|
layout(std140) uniform commonUniforms {
|
|
5
5
|
vec4 u_watercolor;
|
|
@@ -7,7 +7,6 @@ layout(std140) uniform commonUniforms {
|
|
|
7
7
|
float u_time;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
|
|
11
10
|
out vec2 v_uv;
|
|
12
11
|
out float v_opacity;
|
|
13
12
|
|
|
@@ -17,6 +16,6 @@ void main() {
|
|
|
17
16
|
v_uv = a_uv;
|
|
18
17
|
v_opacity = opacity;
|
|
19
18
|
vec4 project_pos = project_position(vec4(a_Position, 1.0));
|
|
20
|
-
gl_Position =
|
|
19
|
+
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
|
|
21
20
|
}
|
|
22
21
|
|
|
@@ -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_COLOR) in vec4 a_Color;
|
|
3
|
+
layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_uv;
|
|
4
|
+
|
|
4
5
|
layout(std140) uniform commonUniforms {
|
|
5
6
|
float u_speed;
|
|
6
7
|
float u_time;
|
|
@@ -8,7 +9,6 @@ layout(std140) uniform commonUniforms {
|
|
|
8
9
|
out vec4 v_Color;
|
|
9
10
|
out vec2 v_uv;
|
|
10
11
|
|
|
11
|
-
|
|
12
12
|
#pragma include "projection"
|
|
13
13
|
|
|
14
14
|
void main() {
|
|
@@ -17,6 +17,6 @@ void main() {
|
|
|
17
17
|
v_Color.a *= opacity;
|
|
18
18
|
vec4 project_pos = project_position(vec4(a_Position, 1.0));
|
|
19
19
|
|
|
20
|
-
gl_Position =
|
|
20
|
+
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
|
|
21
21
|
}
|
|
22
22
|
|
package/lib/raster/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { ILegend } from '@antv/l7-core';
|
|
|
2
2
|
import BaseLayer from '../core/BaseLayer';
|
|
3
3
|
import type { IRasterLayerStyleOptions } from '../core/interface';
|
|
4
4
|
import type { RasterModelType } from './models/index';
|
|
5
|
-
export default class
|
|
5
|
+
export default class RasterLayer extends BaseLayer<IRasterLayerStyleOptions> {
|
|
6
6
|
type: string;
|
|
7
7
|
buildModels(): Promise<void>;
|
|
8
8
|
protected getDefaultConfig(): {} | {} | {} | {};
|
package/lib/raster/index.js
CHANGED
|
@@ -10,7 +10,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
10
10
|
var _BaseLayer = _interopRequireDefault(require("../core/BaseLayer"));
|
|
11
11
|
var _rampcolor_legend = require("../utils/rampcolor_legend");
|
|
12
12
|
var _index = _interopRequireDefault(require("./models/index"));
|
|
13
|
-
class
|
|
13
|
+
class RasterLayer extends _BaseLayer.default {
|
|
14
14
|
constructor(...args) {
|
|
15
15
|
super(...args);
|
|
16
16
|
(0, _defineProperty2.default)(this, "type", 'RasterLayer');
|
|
@@ -59,4 +59,4 @@ class RaterLayer extends _BaseLayer.default {
|
|
|
59
59
|
return (0, _rampcolor_legend.rampColor2legend)(rampColors, name);
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
exports.default =
|
|
62
|
+
exports.default = RasterLayer;
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
import type { IModel, ITexture2D } from '@antv/l7-core';
|
|
2
2
|
import BaseModel from '../../core/BaseModel';
|
|
3
3
|
export default class RasterModel extends BaseModel {
|
|
4
|
+
protected get attributeLocation(): {
|
|
5
|
+
readonly POSITION: 0;
|
|
6
|
+
readonly POSITION_64LOW: 1;
|
|
7
|
+
readonly COLOR: 2;
|
|
8
|
+
readonly PICKING_COLOR: 3;
|
|
9
|
+
readonly STROKE: 4;
|
|
10
|
+
readonly OPACITY: 5;
|
|
11
|
+
readonly OFFSETS: 6;
|
|
12
|
+
readonly ROTATION: 7;
|
|
13
|
+
readonly MAX: 8;
|
|
14
|
+
} & Record<string, number> & {
|
|
15
|
+
MAX: 8;
|
|
16
|
+
UV: number;
|
|
17
|
+
};
|
|
4
18
|
protected texture: ITexture2D;
|
|
5
19
|
protected colorTexture: ITexture2D;
|
|
6
20
|
getUninforms(): {
|
|
@@ -11,18 +11,23 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
11
11
|
var _l7Core = require("@antv/l7-core");
|
|
12
12
|
var _l7Utils = require("@antv/l7-utils");
|
|
13
13
|
var _BaseModel = _interopRequireDefault(require("../../core/BaseModel"));
|
|
14
|
-
var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
|
|
15
14
|
var _triangulation = require("../../core/triangulation");
|
|
16
15
|
/* babel-plugin-inline-import '../shaders/raster/raster_2d_frag.glsl' */
|
|
17
16
|
const rasterFrag = "layout(std140) uniform commonUniforms {\n vec2 u_domain;\n float u_opacity;\n float u_noDataValue;\n float u_clampLow;\n float u_clampHigh;\n};\n\nuniform sampler2D u_rasterTexture;\nuniform sampler2D u_colorTexture;\n\nin vec2 v_texCoord;\n\nbool isnan_emu(float x) { return (x > 0.0 || x < 0.0) ? x != x : x != 0.0; }\n\nout vec4 outputColor;\n\nvoid main() {\n // Can use any component here since u_rasterTexture is under luminance format.\n float value = texture(SAMPLER_2D(u_rasterTexture), vec2(v_texCoord.x, v_texCoord.y)).r;\n if (value == u_noDataValue || isnan_emu(value)) {\n discard;\n } else if ((u_clampLow < 0.5 && value < u_domain[0]) || (u_clampHigh < 0.5 && value > u_domain[1])) {\n discard;\n } else {\n float normalisedValue =(value - u_domain[0]) / (u_domain[1] - u_domain[0]);\n vec4 color = texture(SAMPLER_2D(u_colorTexture), vec2(normalisedValue, 0));\n \n outputColor = color;\n outputColor.a = outputColor.a * u_opacity ;\n if (outputColor.a < 0.01)\n discard;\n }\n}\n";
|
|
18
17
|
/* babel-plugin-inline-import '../shaders/raster/raster_2d_vert.glsl' */
|
|
19
|
-
const rasterVert = "
|
|
18
|
+
const rasterVert = "layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\nlayout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;\nlayout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;\n\nlayout(std140) uniform commonUniforms {\n vec2 u_domain;\n float u_opacity;\n float u_noDataValue;\n float u_clampLow;\n float u_clampHigh;\n};\n\nout vec2 v_texCoord;\n\n#pragma include \"projection\"\n\nvoid main() {\n v_texCoord = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low);\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0.0, 1.0));\n}\n";
|
|
20
19
|
class RasterModel extends _BaseModel.default {
|
|
21
20
|
constructor(...args) {
|
|
22
21
|
super(...args);
|
|
23
22
|
(0, _defineProperty2.default)(this, "texture", void 0);
|
|
24
23
|
(0, _defineProperty2.default)(this, "colorTexture", void 0);
|
|
25
24
|
}
|
|
25
|
+
get attributeLocation() {
|
|
26
|
+
return Object.assign(super.attributeLocation, {
|
|
27
|
+
MAX: super.attributeLocation.MAX,
|
|
28
|
+
UV: 9
|
|
29
|
+
});
|
|
30
|
+
}
|
|
26
31
|
getUninforms() {
|
|
27
32
|
const commoninfo = this.getCommonUniformsInfo();
|
|
28
33
|
const attributeInfo = this.getUniformsBufferInfo(this.getStyleAttribute());
|
|
@@ -105,6 +110,7 @@ class RasterModel extends _BaseModel.default {
|
|
|
105
110
|
height,
|
|
106
111
|
/**
|
|
107
112
|
* WebGL1 allow the combination of gl.LUMINANCE & gl.FLOAT with OES_texture_float
|
|
113
|
+
* TODO: https://github.com/antvis/g-device-api/issues/188
|
|
108
114
|
*/
|
|
109
115
|
format: queryVerdorInfo() === 'WebGL1' ? _l7Core.gl.LUMINANCE : _l7Core.gl.RED,
|
|
110
116
|
type: _l7Core.gl.FLOAT,
|
|
@@ -114,6 +120,7 @@ class RasterModel extends _BaseModel.default {
|
|
|
114
120
|
moduleName: 'rasterImageData',
|
|
115
121
|
vertexShader: rasterVert,
|
|
116
122
|
fragmentShader: rasterFrag,
|
|
123
|
+
defines: _this2.getDefines(),
|
|
117
124
|
triangulation: _triangulation.RasterImageTriangulation,
|
|
118
125
|
primitive: _l7Core.gl.TRIANGLES,
|
|
119
126
|
depth: {
|
|
@@ -130,12 +137,15 @@ class RasterModel extends _BaseModel.default {
|
|
|
130
137
|
(_this$colorTexture = this.colorTexture) === null || _this$colorTexture === void 0 || _this$colorTexture.destroy();
|
|
131
138
|
}
|
|
132
139
|
registerBuiltinAttributes() {
|
|
140
|
+
// 注册 Position 属性 64 位地位部分,经纬度数据开启双精度,避免大于 22 层级以上出现数据偏移
|
|
141
|
+
this.registerPosition64LowAttribute();
|
|
142
|
+
|
|
133
143
|
// point layer size;
|
|
134
144
|
this.styleAttributeService.registerStyleAttribute({
|
|
135
145
|
name: 'uv',
|
|
136
146
|
type: _l7Core.AttributeType.Attribute,
|
|
137
147
|
descriptor: {
|
|
138
|
-
shaderLocation:
|
|
148
|
+
shaderLocation: this.attributeLocation.UV,
|
|
139
149
|
name: 'a_Uv',
|
|
140
150
|
buffer: {
|
|
141
151
|
// give the WebGL driver a hint that this buffer may change
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
import type { IModel, ITexture2D } from '@antv/l7-core';
|
|
2
2
|
import BaseModel from '../../core/BaseModel';
|
|
3
3
|
export default class RasterModel extends BaseModel {
|
|
4
|
+
protected get attributeLocation(): {
|
|
5
|
+
readonly POSITION: 0;
|
|
6
|
+
readonly POSITION_64LOW: 1;
|
|
7
|
+
readonly COLOR: 2;
|
|
8
|
+
readonly PICKING_COLOR: 3;
|
|
9
|
+
readonly STROKE: 4;
|
|
10
|
+
readonly OPACITY: 5;
|
|
11
|
+
readonly OFFSETS: 6;
|
|
12
|
+
readonly ROTATION: 7;
|
|
13
|
+
readonly MAX: 8;
|
|
14
|
+
} & Record<string, number> & {
|
|
15
|
+
MAX: 8;
|
|
16
|
+
UV: number;
|
|
17
|
+
};
|
|
4
18
|
protected texture: ITexture2D;
|
|
5
19
|
protected dataOption: any;
|
|
6
20
|
getUninforms(): {
|
|
@@ -11,20 +11,25 @@ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/obje
|
|
|
11
11
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
12
|
var _l7Core = require("@antv/l7-core");
|
|
13
13
|
var _BaseModel = _interopRequireDefault(require("../../core/BaseModel"));
|
|
14
|
-
var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
|
|
15
14
|
var _triangulation = require("../../core/triangulation");
|
|
16
15
|
const _excluded = ["data"],
|
|
17
16
|
_excluded2 = ["rasterData"];
|
|
18
17
|
/* babel-plugin-inline-import '../shaders/rgb/raster_rgb_frag.glsl' */
|
|
19
18
|
const rasterFrag = "uniform sampler2D u_texture;\nlayout(std140) uniform commonUniforms {\n vec2 u_rminmax;\n vec2 u_gminmax;\n vec2 u_bminmax;\n float u_opacity;\n float u_noDataValue;\n};\n\nin vec2 v_texCoord;\n\nout vec4 outputColor;\n\nvoid main() {\n\n vec3 rgb = texture(SAMPLER_2D(u_texture),vec2(v_texCoord.x,v_texCoord.y)).rgb;\n\n if(rgb == vec3(u_noDataValue)) {\n outputColor = vec4(0.0, 0, 0, 0.0);\n } else {\n outputColor = vec4(rgb.r / (u_rminmax.y -u_rminmax.x), rgb.g /(u_gminmax.y -u_gminmax.x), rgb.b/ (u_bminmax.y - u_bminmax.x), u_opacity);\n }\n\n if(outputColor.a < 0.01)\n discard;\n \n}";
|
|
20
19
|
/* babel-plugin-inline-import '../shaders/rgb/raster_rgb_vert.glsl' */
|
|
21
|
-
const rasterVert = "
|
|
20
|
+
const rasterVert = "layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\nlayout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;\nlayout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;\n\nlayout(std140) uniform commonUniforms {\n vec2 u_rminmax;\n vec2 u_gminmax;\n vec2 u_bminmax;\n float u_opacity;\n float u_noDataValue;\n};\n\nout vec2 v_texCoord;\n\n#pragma include \"projection\"\n\nvoid main() {\n v_texCoord = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low);\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0.0, 1.0));\n}\n";
|
|
22
21
|
class RasterModel extends _BaseModel.default {
|
|
23
22
|
constructor(...args) {
|
|
24
23
|
super(...args);
|
|
25
24
|
(0, _defineProperty2.default)(this, "texture", void 0);
|
|
26
25
|
(0, _defineProperty2.default)(this, "dataOption", {});
|
|
27
26
|
}
|
|
27
|
+
get attributeLocation() {
|
|
28
|
+
return Object.assign(super.attributeLocation, {
|
|
29
|
+
MAX: super.attributeLocation.MAX,
|
|
30
|
+
UV: 9
|
|
31
|
+
});
|
|
32
|
+
}
|
|
28
33
|
getUninforms() {
|
|
29
34
|
const commoninfo = this.getCommonUniformsInfo();
|
|
30
35
|
const attributeInfo = this.getUniformsBufferInfo(this.getStyleAttribute());
|
|
@@ -112,6 +117,7 @@ class RasterModel extends _BaseModel.default {
|
|
|
112
117
|
moduleName: 'rasterImageDataRGBA',
|
|
113
118
|
vertexShader: rasterVert,
|
|
114
119
|
fragmentShader: rasterFrag,
|
|
120
|
+
defines: _this2.getDefines(),
|
|
115
121
|
triangulation: _triangulation.RasterImageTriangulation,
|
|
116
122
|
primitive: _l7Core.gl.TRIANGLES,
|
|
117
123
|
depth: {
|
|
@@ -133,13 +139,16 @@ class RasterModel extends _BaseModel.default {
|
|
|
133
139
|
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
|
|
134
140
|
}
|
|
135
141
|
registerBuiltinAttributes() {
|
|
142
|
+
// 注册 Position 属性 64 位地位部分,经纬度数据开启双精度,避免大于 22 层级以上出现数据偏移
|
|
143
|
+
this.registerPosition64LowAttribute();
|
|
144
|
+
|
|
136
145
|
// point layer size;
|
|
137
146
|
this.styleAttributeService.registerStyleAttribute({
|
|
138
147
|
name: 'uv',
|
|
139
148
|
type: _l7Core.AttributeType.Attribute,
|
|
140
149
|
descriptor: {
|
|
141
150
|
name: 'a_Uv',
|
|
142
|
-
shaderLocation:
|
|
151
|
+
shaderLocation: this.attributeLocation.UV,
|
|
143
152
|
buffer: {
|
|
144
153
|
// give the WebGL driver a hint that this buffer may change
|
|
145
154
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
import type { IModel, ITexture2D } from '@antv/l7-core';
|
|
2
2
|
import BaseModel from '../../core/BaseModel';
|
|
3
3
|
export default class RasterTerrainRGB extends BaseModel {
|
|
4
|
+
protected get attributeLocation(): {
|
|
5
|
+
readonly POSITION: 0;
|
|
6
|
+
readonly POSITION_64LOW: 1;
|
|
7
|
+
readonly COLOR: 2;
|
|
8
|
+
readonly PICKING_COLOR: 3;
|
|
9
|
+
readonly STROKE: 4;
|
|
10
|
+
readonly OPACITY: 5;
|
|
11
|
+
readonly OFFSETS: 6;
|
|
12
|
+
readonly ROTATION: 7;
|
|
13
|
+
readonly MAX: 8;
|
|
14
|
+
} & Record<string, number> & {
|
|
15
|
+
MAX: 8;
|
|
16
|
+
UV: number;
|
|
17
|
+
};
|
|
4
18
|
protected texture: ITexture2D;
|
|
5
19
|
protected getCommonUniformsInfo(): {
|
|
6
20
|
uniformsArray: number[];
|
|
@@ -10,17 +10,22 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
10
10
|
var _l7Core = require("@antv/l7-core");
|
|
11
11
|
var _l7Utils = require("@antv/l7-utils");
|
|
12
12
|
var _BaseModel = _interopRequireDefault(require("../../core/BaseModel"));
|
|
13
|
-
var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
|
|
14
13
|
var _triangulation = require("../../core/triangulation");
|
|
15
14
|
/* babel-plugin-inline-import '../shaders/terrain/terrain_rgb_frag.glsl' */
|
|
16
15
|
const Raster_terrainFrag = "uniform sampler2D u_texture;\nuniform sampler2D u_colorTexture;\n\nlayout(std140) uniform commonUniforms {\n vec4 u_unpack;\n vec2 u_domain;\n float u_opacity;\n float u_noDataValue;\n float u_clampLow;\n float u_clampHigh;\n};\n\nin vec2 v_texCoord;\nout vec4 outputColor;\n\n\nfloat getElevation(vec2 coord, float bias) {\n // Convert encoded elevation value to meters\n vec4 data = texture(SAMPLER_2D(u_texture), coord,bias) * 255.0;\n data.a = -1.0;\n return dot(data, u_unpack);\n}\n\nvec4 getColor(float value) {\n float normalisedValue =(value- u_domain[0]) / (u_domain[1] - u_domain[0]);\n vec2 coord = vec2(normalisedValue, 0);\n return texture(SAMPLER_2D(u_colorTexture), coord);\n}\n\nvoid main() {\n float value = getElevation(v_texCoord,0.0);\n if (value == u_noDataValue) {\n outputColor = vec4(0.0, 0, 0, 0.0);\n } else if ((u_clampLow < 0.5 && value < u_domain[0]) || (u_clampHigh < 0.5 && value > u_domain[1])) {\n outputColor = vec4(0.0, 0, 0, 0.0);\n } else {\n \n outputColor = getColor(value);\n outputColor.a = outputColor.a * u_opacity ;\n if(outputColor.a < 0.01)\n discard;\n }\n}\n";
|
|
17
16
|
/* babel-plugin-inline-import '../shaders/terrain/terrain_rgb_vert.glsl' */
|
|
18
|
-
const Raster_terrainVert = "layout(location =
|
|
17
|
+
const Raster_terrainVert = "layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\nlayout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;\n\nlayout(std140) uniform commonUniforms {\n vec4 u_unpack;\n vec2 u_domain;\n float u_opacity;\n float u_noDataValue;\n float u_clampLow;\n float u_clampHigh;\n};\nout vec2 v_texCoord;\n#pragma include \"projection\"\n\nvoid main() {\n v_texCoord = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0.0, 1.0));\n}\n";
|
|
19
18
|
class RasterTerrainRGB extends _BaseModel.default {
|
|
20
19
|
constructor(...args) {
|
|
21
20
|
super(...args);
|
|
22
21
|
(0, _defineProperty2.default)(this, "texture", void 0);
|
|
23
22
|
}
|
|
23
|
+
get attributeLocation() {
|
|
24
|
+
return Object.assign(super.attributeLocation, {
|
|
25
|
+
MAX: super.attributeLocation.MAX,
|
|
26
|
+
UV: 9
|
|
27
|
+
});
|
|
28
|
+
}
|
|
24
29
|
getCommonUniformsInfo() {
|
|
25
30
|
const {
|
|
26
31
|
opacity,
|
|
@@ -76,6 +81,7 @@ class RasterTerrainRGB extends _BaseModel.default {
|
|
|
76
81
|
moduleName: 'RasterTileDataImage',
|
|
77
82
|
vertexShader: Raster_terrainVert,
|
|
78
83
|
fragmentShader: Raster_terrainFrag,
|
|
84
|
+
defines: _this.getDefines(),
|
|
79
85
|
triangulation: _triangulation.RasterImageTriangulation,
|
|
80
86
|
primitive: _l7Core.gl.TRIANGLES,
|
|
81
87
|
depth: {
|
|
@@ -96,12 +102,14 @@ class RasterTerrainRGB extends _BaseModel.default {
|
|
|
96
102
|
})();
|
|
97
103
|
}
|
|
98
104
|
registerBuiltinAttributes() {
|
|
105
|
+
// 注册 Position 属性 64 位地位部分,经纬度数据开启双精度,避免大于 22 层级以上出现数据偏移
|
|
106
|
+
this.registerPosition64LowAttribute();
|
|
99
107
|
this.styleAttributeService.registerStyleAttribute({
|
|
100
108
|
name: 'uv',
|
|
101
109
|
type: _l7Core.AttributeType.Attribute,
|
|
102
110
|
descriptor: {
|
|
103
111
|
name: 'a_Uv',
|
|
104
|
-
shaderLocation:
|
|
112
|
+
shaderLocation: this.attributeLocation.UV,
|
|
105
113
|
buffer: {
|
|
106
114
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
107
115
|
data: [],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
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_UV) in vec2 a_Uv;
|
|
4
4
|
|
|
5
5
|
layout(std140) uniform commonUniforms {
|
|
6
6
|
vec2 u_domain;
|
|
@@ -15,7 +15,7 @@ out vec2 v_texCoord;
|
|
|
15
15
|
#pragma include "projection"
|
|
16
16
|
|
|
17
17
|
void main() {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
gl_Position =
|
|
18
|
+
v_texCoord = a_Uv;
|
|
19
|
+
vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low);
|
|
20
|
+
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0.0, 1.0));
|
|
21
21
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
|
|
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_UV) in vec2 a_Uv;
|
|
4
4
|
|
|
5
5
|
layout(std140) uniform commonUniforms {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
vec2 u_rminmax;
|
|
7
|
+
vec2 u_gminmax;
|
|
8
|
+
vec2 u_bminmax;
|
|
9
|
+
float u_opacity;
|
|
10
|
+
float u_noDataValue;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
out vec2 v_texCoord;
|
|
@@ -15,7 +15,7 @@ out vec2 v_texCoord;
|
|
|
15
15
|
#pragma include "projection"
|
|
16
16
|
|
|
17
17
|
void main() {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
v_texCoord = a_Uv;
|
|
19
|
+
vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low);
|
|
20
|
+
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0.0, 1.0));
|
|
21
21
|
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
layout(location =
|
|
2
|
-
layout(location =
|
|
1
|
+
layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
|
|
2
|
+
layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;
|
|
3
3
|
|
|
4
4
|
layout(std140) uniform commonUniforms {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
vec4 u_unpack;
|
|
6
|
+
vec2 u_domain;
|
|
7
|
+
float u_opacity;
|
|
8
|
+
float u_noDataValue;
|
|
9
|
+
float u_clampLow;
|
|
10
|
+
float u_clampHigh;
|
|
11
11
|
};
|
|
12
12
|
out vec2 v_texCoord;
|
|
13
13
|
#pragma include "projection"
|
|
14
14
|
|
|
15
15
|
void main() {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
v_texCoord = a_Uv;
|
|
17
|
+
vec4 project_pos = project_position(vec4(a_Position, 1.0));
|
|
18
|
+
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0.0, 1.0));
|
|
19
19
|
}
|
|
@@ -39,22 +39,6 @@ class BaseTileLayer {
|
|
|
39
39
|
latLonBounds,
|
|
40
40
|
zoom
|
|
41
41
|
} = this.getCurrentView();
|
|
42
|
-
if (this.mapService.version === 'GAODE1.x') {
|
|
43
|
-
const {
|
|
44
|
-
visible
|
|
45
|
-
} = this.parent.getLayerConfig();
|
|
46
|
-
if (zoom < 2 && visible) {
|
|
47
|
-
this.parent.updateLayerConfig({
|
|
48
|
-
visible: false
|
|
49
|
-
});
|
|
50
|
-
this.layerService.reRender();
|
|
51
|
-
} else if (zoom >= 2 && !visible) {
|
|
52
|
-
this.parent.updateLayerConfig({
|
|
53
|
-
visible: true
|
|
54
|
-
});
|
|
55
|
-
this.layerService.reRender();
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
42
|
if (this.lastViewStates && this.lastViewStates.zoom === zoom && this.lastViewStates.latLonBounds.toString() === latLonBounds.toString()) {
|
|
59
43
|
return;
|
|
60
44
|
}
|
|
@@ -39,20 +39,6 @@ export default class ExtrudePolyline {
|
|
|
39
39
|
startIndex: number;
|
|
40
40
|
indexes: number[];
|
|
41
41
|
};
|
|
42
|
-
simpleExtrude_gaode2(points: number[][], originPoints: number[][]): {
|
|
43
|
-
positions: number[];
|
|
44
|
-
indices: number[];
|
|
45
|
-
normals: number[];
|
|
46
|
-
startIndex: number;
|
|
47
|
-
indexes: number[];
|
|
48
|
-
};
|
|
49
|
-
extrude_gaode2(points: number[][], originPoints: number[][]): {
|
|
50
|
-
positions: number[];
|
|
51
|
-
indices: number[];
|
|
52
|
-
normals: number[];
|
|
53
|
-
startIndex: number;
|
|
54
|
-
indexes: number[];
|
|
55
|
-
};
|
|
56
42
|
extrude(points: number[][]): {
|
|
57
43
|
positions: number[];
|
|
58
44
|
indices: number[];
|
|
@@ -61,7 +47,6 @@ export default class ExtrudePolyline {
|
|
|
61
47
|
indexes: number[];
|
|
62
48
|
};
|
|
63
49
|
private simpleSegment;
|
|
64
|
-
private segment_gaode2;
|
|
65
50
|
private segment;
|
|
66
51
|
private extrusions;
|
|
67
52
|
private lineSegmentDistance;
|