@antv/l7-layers 2.21.10 → 2.21.11-beta.1
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 +6 -6
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
layout(location =
|
|
2
|
-
layout(location =
|
|
3
|
-
layout(location =
|
|
4
|
-
|
|
1
|
+
layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
|
|
2
|
+
layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;
|
|
3
|
+
layout(location = ATTRIBUTE_LOCATION_DIR) in vec2 a_Dir;
|
|
5
4
|
|
|
6
5
|
layout(std140) uniform commonUniforms {
|
|
7
6
|
float u_radius;
|
|
@@ -13,30 +12,25 @@ layout(std140) uniform commonUniforms {
|
|
|
13
12
|
out vec2 v_extrude;
|
|
14
13
|
out float v_weight;
|
|
15
14
|
|
|
16
|
-
#define GAUSS_COEF
|
|
15
|
+
#define GAUSS_COEF (0.3989422804014327)
|
|
17
16
|
|
|
18
17
|
#pragma include "projection"
|
|
19
18
|
#pragma include "picking"
|
|
20
19
|
|
|
21
|
-
void main(){
|
|
22
|
-
|
|
20
|
+
void main() {
|
|
21
|
+
vec3 picking_color_placeholder = u_PickingColor;
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
v_weight = a_Size;
|
|
24
|
+
float ZERO = 1.0 / 255.0 / 16.0;
|
|
25
|
+
float extrude_x = a_Dir.x * 2.0 - 1.0;
|
|
26
|
+
float extrude_y = a_Dir.y * 2.0 - 1.0;
|
|
27
|
+
vec2 extrude_dir = normalize(vec2(extrude_x, extrude_y));
|
|
28
|
+
float S = sqrt(-2.0 * log(ZERO / a_Size / u_intensity / GAUSS_COEF)) / 2.5;
|
|
29
|
+
v_extrude = extrude_dir * S;
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
vec2 offset = project_pixel(v_extrude * u_radius);
|
|
32
|
+
vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));
|
|
34
33
|
|
|
35
|
-
|
|
34
|
+
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));
|
|
36
35
|
|
|
37
|
-
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
|
|
38
|
-
gl_Position = u_Mvp * (vec4(project_pos.xy + offset, 0.0, 1.0));
|
|
39
|
-
} else {
|
|
40
|
-
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));
|
|
41
|
-
}
|
|
42
36
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
1
|
layout(location = 0) in vec3 a_Position;
|
|
3
|
-
layout(location =
|
|
2
|
+
layout(location = 10) in vec2 a_Uv;
|
|
4
3
|
|
|
5
4
|
layout(std140) uniform commonUniforms {
|
|
6
5
|
float u_opacity;
|
|
@@ -15,8 +14,8 @@ out vec2 v_texCoord;
|
|
|
15
14
|
void main() {
|
|
16
15
|
v_texCoord = a_Uv;
|
|
17
16
|
#ifdef VIEWPORT_ORIGIN_TL
|
|
18
|
-
|
|
17
|
+
v_texCoord.y = 1.0 - v_texCoord.y;
|
|
19
18
|
#endif
|
|
20
19
|
|
|
21
|
-
gl_Position = vec4(a_Position.xy, 0, 1.);
|
|
20
|
+
gl_Position = vec4(a_Position.xy, 0, 1.0);
|
|
22
21
|
}
|
|
@@ -1,17 +1,16 @@
|
|
|
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_POS) in vec3 a_Pos;
|
|
4
4
|
|
|
5
5
|
layout(std140) uniform commonUniforms {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
vec2 u_radius;
|
|
7
|
+
float u_opacity;
|
|
8
|
+
float u_coverage;
|
|
9
|
+
float u_angle;
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
out vec4 v_color;
|
|
13
13
|
|
|
14
|
-
|
|
15
14
|
#pragma include "projection"
|
|
16
15
|
#pragma include "project"
|
|
17
16
|
#pragma include "picking"
|
|
@@ -19,22 +18,13 @@ out vec4 v_color;
|
|
|
19
18
|
void main() {
|
|
20
19
|
v_color = a_Color;
|
|
21
20
|
v_color.a *= u_opacity;
|
|
22
|
-
|
|
21
|
+
|
|
23
22
|
mat2 rotationMatrix = mat2(cos(u_angle), sin(u_angle), -sin(u_angle), cos(u_angle));
|
|
24
|
-
vec2 offset =
|
|
23
|
+
vec2 offset = vec2(a_Position.xy * u_radius * rotationMatrix * u_coverage);
|
|
25
24
|
vec2 lnglat = unProjectFlat(a_Pos.xy + offset);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
// gl_Position = u_Mvp * (vec4(project_pos.xy, 0., 1.0));
|
|
31
|
-
// gl_Position = u_Mvp * (vec4(a_Pos.xy + offset, 0., 1.0));
|
|
32
|
-
vec2 customLnglat = customProject(lnglat) - u_sceneCenterMercator;
|
|
33
|
-
vec4 project_pos = project_position(vec4(customLnglat, 0, 1.0));
|
|
34
|
-
gl_Position = u_Mvp * vec4(project_pos.xy, 0.0, 1.0);
|
|
35
|
-
} else {
|
|
36
|
-
vec4 project_pos = project_position(vec4(lnglat, 0, 1.0));
|
|
37
|
-
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0., 1.0));
|
|
38
|
-
}
|
|
25
|
+
|
|
26
|
+
vec4 project_pos = project_position(vec4(lnglat, 0, 1.0));
|
|
27
|
+
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0.0, 1.0));
|
|
28
|
+
|
|
39
29
|
setPickingColor(a_PickingColor);
|
|
40
30
|
}
|
|
@@ -2,6 +2,20 @@ import type { IModel, ITexture2D } from '@antv/l7-core';
|
|
|
2
2
|
import BaseModel from '../../core/BaseModel';
|
|
3
3
|
export default class ImageModel extends BaseModel {
|
|
4
4
|
protected texture: ITexture2D;
|
|
5
|
+
protected get attributeLocation(): {
|
|
6
|
+
readonly POSITION: 0;
|
|
7
|
+
readonly POSITION_64LOW: 1;
|
|
8
|
+
readonly COLOR: 2;
|
|
9
|
+
readonly PICKING_COLOR: 3;
|
|
10
|
+
readonly STROKE: 4;
|
|
11
|
+
readonly OPACITY: 5;
|
|
12
|
+
readonly OFFSETS: 6;
|
|
13
|
+
readonly ROTATION: 7;
|
|
14
|
+
readonly MAX: 8;
|
|
15
|
+
} & Record<string, number> & {
|
|
16
|
+
MAX: 8;
|
|
17
|
+
UV: number;
|
|
18
|
+
};
|
|
5
19
|
protected getCommonUniformsInfo(): {
|
|
6
20
|
uniformsArray: number[];
|
|
7
21
|
uniformsLength: number;
|
package/es/image/models/image.js
CHANGED
|
@@ -3,17 +3,22 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
|
3
3
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
4
4
|
import { defaultValue } from '@antv/l7-utils';
|
|
5
5
|
import BaseModel from "../../core/BaseModel";
|
|
6
|
-
import { ShaderLocation } from "../../core/CommonStyleAttribute";
|
|
7
6
|
import { RasterImageTriangulation } from "../../core/triangulation";
|
|
8
7
|
/* babel-plugin-inline-import '../shaders/image_frag.glsl' */
|
|
9
8
|
const ImageFrag = "uniform sampler2D u_texture;\nlayout(std140) uniform commonUniforms {\n float u_opacity:1.0;\n float u_brightness:1.0;\n float u_contrast:1.0;\n float u_saturation:1.0;\n float u_gamma:1.0;\n};\n\nin vec2 v_texCoord;\nout vec4 outputColor;\nvec3 setContrast(vec3 rgb, float contrast) {\n vec3 color = mix(vec3(0.5), rgb, contrast);\n color = clamp(color, 0.0, 1.0);\n return color;\n}\nvec3 setSaturation(vec3 rgb, float adjustment) {\n const vec3 grayVector = vec3(0.2125, 0.7154, 0.0721);\n vec3 intensity = vec3(dot(rgb, grayVector));\n vec3 color = mix(intensity, rgb, adjustment);\n color = clamp(color, 0.0, 1.0);\n return color;\n}\nvoid main() {\n vec4 color = texture(SAMPLER_2D(u_texture),vec2(v_texCoord.x,v_texCoord.y));\n //brightness\n color.rgb = mix(vec3(0.0, 0.0, 0.0), color.rgb, u_brightness);\n //contrast\n color.rgb = setContrast(color.rgb, u_contrast);\n // saturation\n color.rgb = setSaturation(color.rgb, u_saturation);\n // gamma\n color.rgb = pow(color.rgb, vec3(u_gamma));\n outputColor = color;\n outputColor.a *= u_opacity;\n if(outputColor.a < 0.01)\n discard;\n}\n";
|
|
10
9
|
/* babel-plugin-inline-import '../shaders/image_vert.glsl' */
|
|
11
|
-
const ImageVert = "layout(location =
|
|
10
|
+
const ImageVert = "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 float u_opacity:1.0;\n float u_brightness:1.0;\n float u_contrast:1.0;\n float u_saturation:1.0;\n float u_gamma:1.0;\n};\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), a_Position64Low);\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0.0, 1.0));\n}\n";
|
|
12
11
|
export default class ImageModel extends BaseModel {
|
|
13
12
|
constructor(...args) {
|
|
14
13
|
super(...args);
|
|
15
14
|
_defineProperty(this, "texture", void 0);
|
|
16
15
|
}
|
|
16
|
+
get attributeLocation() {
|
|
17
|
+
return Object.assign(super.attributeLocation, {
|
|
18
|
+
MAX: super.attributeLocation.MAX,
|
|
19
|
+
UV: 9
|
|
20
|
+
});
|
|
21
|
+
}
|
|
17
22
|
getCommonUniformsInfo() {
|
|
18
23
|
const {
|
|
19
24
|
opacity,
|
|
@@ -50,10 +55,6 @@ export default class ImageModel extends BaseModel {
|
|
|
50
55
|
const {
|
|
51
56
|
createTexture2D
|
|
52
57
|
} = _this2.rendererService;
|
|
53
|
-
_this2.texture = createTexture2D({
|
|
54
|
-
height: 1,
|
|
55
|
-
width: 1
|
|
56
|
-
});
|
|
57
58
|
const source = _this2.layer.getSource();
|
|
58
59
|
const imageData = yield source.data.images;
|
|
59
60
|
_this2.texture = createTexture2D({
|
|
@@ -73,6 +74,7 @@ export default class ImageModel extends BaseModel {
|
|
|
73
74
|
moduleName: 'rasterImage',
|
|
74
75
|
vertexShader: ImageVert,
|
|
75
76
|
fragmentShader: ImageFrag,
|
|
77
|
+
defines: _this3.getDefines(),
|
|
76
78
|
triangulation: RasterImageTriangulation,
|
|
77
79
|
primitive: gl.TRIANGLES,
|
|
78
80
|
blend: {
|
|
@@ -88,12 +90,14 @@ export default class ImageModel extends BaseModel {
|
|
|
88
90
|
})();
|
|
89
91
|
}
|
|
90
92
|
registerBuiltinAttributes() {
|
|
93
|
+
// 注册 Position 属性 64 位地位部分,经纬度数据开启双精度,避免大于 22 层级以上出现数据偏移
|
|
94
|
+
this.registerPosition64LowAttribute();
|
|
91
95
|
this.styleAttributeService.registerStyleAttribute({
|
|
92
96
|
name: 'uv',
|
|
93
97
|
type: AttributeType.Attribute,
|
|
94
98
|
descriptor: {
|
|
95
99
|
name: 'a_Uv',
|
|
96
|
-
shaderLocation:
|
|
100
|
+
shaderLocation: this.attributeLocation.UV,
|
|
97
101
|
buffer: {
|
|
98
102
|
usage: gl.DYNAMIC_DRAW,
|
|
99
103
|
data: [],
|
|
@@ -1,5 +1,6 @@
|
|
|
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_UV) in vec2 a_Uv;
|
|
3
4
|
|
|
4
5
|
layout(std140) uniform commonUniforms {
|
|
5
6
|
float u_opacity:1.0;
|
|
@@ -11,9 +12,9 @@ layout(std140) uniform commonUniforms {
|
|
|
11
12
|
|
|
12
13
|
out vec2 v_texCoord;
|
|
13
14
|
#pragma include "projection"
|
|
15
|
+
|
|
14
16
|
void main() {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
v_texCoord = a_Uv;
|
|
18
|
+
vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low);
|
|
19
|
+
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0.0, 1.0));
|
|
19
20
|
}
|
package/es/line/models/arc.d.ts
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
import type { IModel, ITexture2D } from '@antv/l7-core';
|
|
2
2
|
import BaseModel from '../../core/BaseModel';
|
|
3
3
|
export default class ArcModel extends BaseModel {
|
|
4
|
+
protected get attributeLocation(): {
|
|
5
|
+
readonly POSITION: 0;
|
|
6
|
+
readonly POSITION_64LOW: 1;
|
|
7
|
+
readonly COLOR: 2;
|
|
8
|
+
readonly PICKING_COLOR: 3;
|
|
9
|
+
readonly STROKE: 4;
|
|
10
|
+
readonly OPACITY: 5;
|
|
11
|
+
readonly OFFSETS: 6;
|
|
12
|
+
readonly ROTATION: 7;
|
|
13
|
+
readonly MAX: 8;
|
|
14
|
+
} & Record<string, number> & {
|
|
15
|
+
MAX: 8;
|
|
16
|
+
SIZE: number;
|
|
17
|
+
INSTANCE: number;
|
|
18
|
+
INSTANCE_64LOW: number;
|
|
19
|
+
UV: number;
|
|
20
|
+
THETA_OFFSET: number;
|
|
21
|
+
};
|
|
4
22
|
protected texture: ITexture2D;
|
|
5
23
|
protected getCommonUniformsInfo(): {
|
|
6
24
|
uniformsArray: number[];
|
package/es/line/models/arc.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
3
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
4
|
-
import { rgb2arr } from '@antv/l7-utils';
|
|
4
|
+
import { fp64LowPart, rgb2arr } from '@antv/l7-utils';
|
|
5
5
|
import BaseModel from "../../core/BaseModel";
|
|
6
|
-
import { ShaderLocation } from "../../core/CommonStyleAttribute";
|
|
7
6
|
import { LineArcTriangulation } from "../../core/triangulation";
|
|
8
7
|
/* babel-plugin-inline-import '../shaders/arc/line_arc_frag.glsl' */
|
|
9
8
|
const arc_line_frag = "\n#define Animate 0.0\n#define LineTexture 1.0\nuniform sampler2D u_texture;\nlayout(std140) uniform commonUniorm {\n vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n vec4 u_dash_array;\n vec4 u_sourceColor;\n vec4 u_targetColor;\n vec2 u_textSize;\n float segmentNumber;\n float u_lineDir: 1.0;\n float u_icon_step: 100;\n float u_line_texture: 0.0;\n float u_textureBlend;\n float u_blur : 0.9;\n float u_line_type: 0.0;\n float u_time;\n float u_linearColor: 0.0;\n};\n\nin vec4 v_color;\nin vec2 v_iconMapUV;\nin vec4 v_lineData;\n//dash\nin vec4 v_dash_array;\nin float v_distance_ratio;\n\nout vec4 outputColor;\n#pragma include \"picking\"\n\nvoid main() {\n if(u_dash_array!=vec4(0.0)){\n float dashLength = mod(v_distance_ratio, v_dash_array.x + v_dash_array.y + v_dash_array.z + v_dash_array.w);\n if(!(dashLength < v_dash_array.x || (dashLength > (v_dash_array.x + v_dash_array.y) && dashLength < v_dash_array.x + v_dash_array.y + v_dash_array.z))) {\n discard;\n };\n }\n float animateSpeed = 0.0; // \u8FD0\u52A8\u901F\u5EA6\n outputColor = v_color;\n if(u_animate.x == Animate && u_line_texture != LineTexture) {\n animateSpeed = u_time / u_animate.y;\n float alpha =1.0 - fract( mod(1.0- v_lineData.b, u_animate.z)* (1.0/ u_animate.z) + u_time / u_animate.y);\n alpha = (alpha + u_animate.w -1.0) / u_animate.w;\n // alpha = smoothstep(0., 1., alpha);\n alpha = clamp(alpha, 0.0, 1.0);\n outputColor.a *= alpha;\n }\n\n // \u5F53\u5B58\u5728\u8D34\u56FE\u65F6\u5728\u5E95\u8272\u4E0A\u8D34\u4E0A\u8D34\u56FE\n if(u_line_texture == LineTexture) { // while load texture\n float arcRadio = smoothstep( 0.0, 1.0, (v_lineData.r / segmentNumber));\n // float arcRadio = smoothstep( 0.0, 1.0, d_distance_ratio);\n\n float count = v_lineData.g; // \u8D34\u56FE\u5728\u5F27\u7EBF\u4E0A\u91CD\u590D\u7684\u6570\u91CF\n\n float time = 0.0;\n if(u_animate.x == Animate) {\n time = u_time / u_animate.y;\n }\n float redioCount = arcRadio * count;\n\n float u = fract(redioCount - time);\n float v = v_lineData.a; // \u6A2A\u5411 v\n vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;\n\n vec4 pattern = texture(SAMPLER_2D(u_texture), uv);\n\n if(u_animate.x == Animate) {\n float currentPlane = floor(redioCount - time);\n float textureStep = floor(count * u_animate.z);\n float a = mod(currentPlane, textureStep);\n if(a < textureStep - 1.0) {\n pattern = vec4(0.0);\n }\n }\n\n if(u_textureBlend == 0.0) { // normal\n pattern.a = 0.0;\n outputColor = filterColor(outputColor + pattern);\n } else { // replace\n pattern.a *= v_color.a;\n if(outputColor.a <= 0.0) {\n pattern.a = 0.0;\n }\n outputColor = filterColor(pattern);\n }\n \n } else {\n outputColor = filterColor(outputColor);\n }\n}";
|
|
10
9
|
/* babel-plugin-inline-import '../shaders/arc/line_arc_vert.glsl' */
|
|
11
|
-
const arc_line_vert = "#define Animate 0.0\n#define LineTexture 1.0\nlayout(location =
|
|
10
|
+
const arc_line_vert = "#define Animate (0.0)\n#define LineTexture (1.0)\n\nlayout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\nlayout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;\nlayout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;\nlayout(location = ATTRIBUTE_LOCATION_INSTANCE) in vec4 a_Instance;\nlayout(location = ATTRIBUTE_LOCATION_INSTANCE_64LOW) in vec4 a_Instance64Low;\nlayout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_iconMapUV;\n\nlayout(std140) uniform commonUniorm {\n vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n vec4 u_dash_array;\n vec4 u_sourceColor;\n vec4 u_targetColor;\n vec2 u_textSize;\n float segmentNumber;\n float u_lineDir: 1.0;\n float u_icon_step: 100;\n float u_line_texture: 0.0;\n float u_textureBlend;\n float u_blur : 0.9;\n float u_line_type: 0.0;\n float u_time;\n float u_linearColor: 0.0;\n};\n\nout vec4 v_color;\nout vec2 v_iconMapUV;\nout vec4 v_lineData;\n//dash\nout vec4 v_dash_array;\nout float v_distance_ratio;\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"picking\"\n\nfloat bezier3(vec3 arr, float t) {\n float ut = 1.0 - t;\n return (arr.x * ut + arr.y * t) * ut + (arr.y * ut + arr.z * t) * t;\n}\nvec2 midPoint(vec2 source, vec2 target, float arcThetaOffset) {\n vec2 center = target - source;\n float r = length(center);\n float theta = atan(center.y, center.x);\n float thetaOffset = arcThetaOffset;\n float r2 = r / 2.0 / cos(thetaOffset);\n float theta2 = theta + thetaOffset;\n vec2 mid = vec2(r2 * cos(theta2) + source.x, r2 * sin(theta2) + source.y);\n if (u_lineDir == 1.0) {\n // \u6B63\u5411\n return mid;\n } else {\n // \u9006\u5411\n // (mid + vmin)/2 = (s + t)/2\n vec2 vmid = source + target - mid;\n return vmid;\n }\n // return mid;\n}\nfloat getSegmentRatio(float index) {\n // dash: index / (segmentNumber - 1.);\n // normal: smoothstep(0.0, 1.0, index / (segmentNumber - 1.));\n return smoothstep(0.0, 1.0, index / (segmentNumber - 1.0));\n // return index / (segmentNumber - 1.);\n}\nvec2 interpolate(vec2 source, vec2 target, float t, float arcThetaOffset) {\n // if the angularDist is PI, linear interpolation is applied. otherwise, use spherical interpolation\n vec2 mid = midPoint(source, target, arcThetaOffset);\n vec3 x = vec3(source.x, mid.x, target.x);\n vec3 y = vec3(source.y, mid.y, target.y);\n return vec2(bezier3(x, t), bezier3(y, t));\n}\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size) / 2.0;\n return offset;\n}\nvec2 getNormal(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n return dir_screenspace.xy * sign(offset_direction);\n}\n\nvoid main() {\n //vs\u4E2D\u8BA1\u7B97\u6E10\u53D8\u8272\n if (u_linearColor == 1.0) {\n float d_segmentIndex = a_Position.x + 1.0; // \u5F53\u524D\u9876\u70B9\u5728\u5F27\u7EBF\u4E2D\u6240\u5904\u7684\u5206\u6BB5\u4F4D\u7F6E\n v_color = mix(u_sourceColor, u_targetColor, d_segmentIndex / segmentNumber);\n } else {\n v_color = a_Color;\n }\n v_color.a = v_color.a * opacity;\n\n vec2 source_world = a_Instance.rg; // \u8D77\u59CB\u70B9\n vec2 target_world = a_Instance.ba; // \u7EC8\u70B9\n\n float segmentIndex = a_Position.x;\n float segmentRatio = getSegmentRatio(segmentIndex);\n\n // \u8BA1\u7B97 dashArray \u548C distanceRatio \u8F93\u51FA\u5230\u7247\u5143\n float total_Distance = pixelDistance(source_world, target_world) / 2.0 * PI;\n v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / total_Distance;\n v_distance_ratio = segmentIndex / segmentNumber;\n\n float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));\n float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);\n float d_distance_ratio;\n\n if(u_animate.x == Animate) {\n d_distance_ratio = segmentIndex / segmentNumber;\n if(u_lineDir != 1.0) {\n d_distance_ratio = 1.0 - d_distance_ratio;\n }\n }\n\n v_lineData.b = d_distance_ratio;\n\n vec4 source = project_position(vec4(source_world, 0, 1.), a_Instance64Low.xy);\n vec4 target = project_position(vec4(target_world, 0, 1.), a_Instance64Low.zw);\n\n vec2 currPos = interpolate(source.xy, target.xy, segmentRatio, thetaOffset);\n vec2 nextPos = interpolate(source.xy, target.xy, nextSegmentRatio, thetaOffset);\n\n vec2 offset = project_pixel(\n getExtrusionOffset((nextPos.xy - currPos.xy) * indexDir, a_Position.y)\n );\n\n float d_segmentIndex = a_Position.x + 1.0; // \u5F53\u524D\u9876\u70B9\u5728\u5F27\u7EBF\u4E2D\u6240\u5904\u7684\u5206\u6BB5\u4F4D\u7F6E\n v_lineData.r = d_segmentIndex;\n\n if(LineTexture == u_line_texture) { // \u5F00\u542F\u8D34\u56FE\u6A21\u5F0F\n float arcDistrance = length(source - target); // \u8D77\u59CB\u70B9\u548C\u7EC8\u70B9\u7684\u8DDD\u79BB\n arcDistrance = project_pixel(arcDistrance);\n\n v_iconMapUV = a_iconMapUV;\n\n float pixelLen = project_pixel_texture(u_icon_step); // \u8D34\u56FE\u6CBF\u5F27\u7EBF\u65B9\u5411\u7684\u957F\u5EA6 - \u968F\u5730\u56FE\u7F29\u653E\u6539\u53D8\n float texCount = floor(arcDistrance / pixelLen); // \u8D34\u56FE\u5728\u5F27\u7EBF\u4E0A\u91CD\u590D\u7684\u6570\u91CF\n v_lineData.g = texCount;\n\n float lineOffsetWidth = length(offset + offset * sign(a_Position.y)); // \u7EBF\u6A2A\u5411\u504F\u79FB\u7684\u8DDD\u79BB\n float linePixelSize = project_pixel(a_Size); // \u5B9A\u70B9\u4F4D\u7F6E\u504F\u79FB\n v_lineData.a = lineOffsetWidth / linePixelSize; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n }\n\n gl_Position = project_common_position_to_clipspace(vec4(currPos.xy + offset, 0, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
12
11
|
const lineStyleObj = {
|
|
13
12
|
solid: 0.0,
|
|
14
13
|
dash: 1.0
|
|
@@ -39,6 +38,16 @@ export default class ArcModel extends BaseModel {
|
|
|
39
38
|
this.textures = [this.texture];
|
|
40
39
|
});
|
|
41
40
|
}
|
|
41
|
+
get attributeLocation() {
|
|
42
|
+
return Object.assign(super.attributeLocation, {
|
|
43
|
+
MAX: super.attributeLocation.MAX,
|
|
44
|
+
SIZE: 9,
|
|
45
|
+
INSTANCE: 10,
|
|
46
|
+
INSTANCE_64LOW: 11,
|
|
47
|
+
UV: 12,
|
|
48
|
+
THETA_OFFSET: 13
|
|
49
|
+
});
|
|
50
|
+
}
|
|
42
51
|
getCommonUniformsInfo() {
|
|
43
52
|
const {
|
|
44
53
|
sourceColor,
|
|
@@ -145,6 +154,7 @@ export default class ArcModel extends BaseModel {
|
|
|
145
154
|
moduleName: 'lineArc2d' + type,
|
|
146
155
|
vertexShader: vert,
|
|
147
156
|
fragmentShader: frag,
|
|
157
|
+
defines: _this2.getDefines(),
|
|
148
158
|
inject: _this2.getInject(),
|
|
149
159
|
triangulation: LineArcTriangulation,
|
|
150
160
|
depth: {
|
|
@@ -163,7 +173,7 @@ export default class ArcModel extends BaseModel {
|
|
|
163
173
|
type: AttributeType.Attribute,
|
|
164
174
|
descriptor: {
|
|
165
175
|
name: 'a_Size',
|
|
166
|
-
shaderLocation:
|
|
176
|
+
shaderLocation: this.attributeLocation.SIZE,
|
|
167
177
|
buffer: {
|
|
168
178
|
// give the WebGL driver a hint that this buffer may change
|
|
169
179
|
usage: gl.DYNAMIC_DRAW,
|
|
@@ -179,13 +189,14 @@ export default class ArcModel extends BaseModel {
|
|
|
179
189
|
}
|
|
180
190
|
}
|
|
181
191
|
});
|
|
192
|
+
|
|
193
|
+
// 弧线起始点信息
|
|
182
194
|
this.styleAttributeService.registerStyleAttribute({
|
|
183
195
|
name: 'instance',
|
|
184
|
-
// 弧线起始点信息
|
|
185
196
|
type: AttributeType.Attribute,
|
|
186
197
|
descriptor: {
|
|
187
198
|
name: 'a_Instance',
|
|
188
|
-
shaderLocation:
|
|
199
|
+
shaderLocation: this.attributeLocation.INSTANCE,
|
|
189
200
|
buffer: {
|
|
190
201
|
usage: gl.STATIC_DRAW,
|
|
191
202
|
data: [],
|
|
@@ -197,14 +208,32 @@ export default class ArcModel extends BaseModel {
|
|
|
197
208
|
}
|
|
198
209
|
}
|
|
199
210
|
});
|
|
211
|
+
|
|
212
|
+
// save low part for enabled double precision INSTANCE attribute
|
|
213
|
+
this.styleAttributeService.registerStyleAttribute({
|
|
214
|
+
name: 'instance64Low',
|
|
215
|
+
type: AttributeType.Attribute,
|
|
216
|
+
descriptor: {
|
|
217
|
+
name: 'a_Instance64Low',
|
|
218
|
+
shaderLocation: this.attributeLocation.INSTANCE_64LOW,
|
|
219
|
+
buffer: {
|
|
220
|
+
usage: gl.STATIC_DRAW,
|
|
221
|
+
data: [],
|
|
222
|
+
type: gl.FLOAT
|
|
223
|
+
},
|
|
224
|
+
size: 4,
|
|
225
|
+
update: (feature, featureIdx, vertex) => {
|
|
226
|
+
return [fp64LowPart(vertex[3]), fp64LowPart(vertex[4]), fp64LowPart(vertex[5]), fp64LowPart(vertex[6])];
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
});
|
|
200
230
|
this.styleAttributeService.registerStyleAttribute({
|
|
201
231
|
name: 'uv',
|
|
202
232
|
type: AttributeType.Attribute,
|
|
203
233
|
descriptor: {
|
|
204
234
|
name: 'a_iconMapUV',
|
|
205
|
-
shaderLocation:
|
|
235
|
+
shaderLocation: this.attributeLocation.UV,
|
|
206
236
|
buffer: {
|
|
207
|
-
// give the WebGL driver a hint that this buffer may change
|
|
208
237
|
usage: gl.DYNAMIC_DRAW,
|
|
209
238
|
data: [],
|
|
210
239
|
type: gl.FLOAT
|
|
@@ -226,5 +255,25 @@ export default class ArcModel extends BaseModel {
|
|
|
226
255
|
}
|
|
227
256
|
}
|
|
228
257
|
});
|
|
258
|
+
this.styleAttributeService.registerStyleAttribute({
|
|
259
|
+
name: 'thetaOffset',
|
|
260
|
+
type: AttributeType.Attribute,
|
|
261
|
+
descriptor: {
|
|
262
|
+
name: 'a_ThetaOffset',
|
|
263
|
+
shaderLocation: this.attributeLocation.THETA_OFFSET,
|
|
264
|
+
buffer: {
|
|
265
|
+
usage: gl.STATIC_DRAW,
|
|
266
|
+
data: [],
|
|
267
|
+
type: gl.FLOAT
|
|
268
|
+
},
|
|
269
|
+
size: 1,
|
|
270
|
+
update: feature => {
|
|
271
|
+
const {
|
|
272
|
+
thetaOffset: op = 1
|
|
273
|
+
} = feature;
|
|
274
|
+
return [op];
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
});
|
|
229
278
|
}
|
|
230
279
|
}
|
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
import type { IModel, ITexture2D } from '@antv/l7-core';
|
|
2
2
|
import BaseModel from '../../core/BaseModel';
|
|
3
3
|
export default class Arc3DModel extends BaseModel {
|
|
4
|
+
protected get attributeLocation(): {
|
|
5
|
+
readonly POSITION: 0;
|
|
6
|
+
readonly POSITION_64LOW: 1;
|
|
7
|
+
readonly COLOR: 2;
|
|
8
|
+
readonly PICKING_COLOR: 3;
|
|
9
|
+
readonly STROKE: 4;
|
|
10
|
+
readonly OPACITY: 5;
|
|
11
|
+
readonly OFFSETS: 6;
|
|
12
|
+
readonly ROTATION: 7;
|
|
13
|
+
readonly MAX: 8;
|
|
14
|
+
} & Record<string, number> & {
|
|
15
|
+
MAX: 8;
|
|
16
|
+
SIZE: number;
|
|
17
|
+
INSTANCE: number;
|
|
18
|
+
INSTANCE_64LOW: number;
|
|
19
|
+
UV: number;
|
|
20
|
+
THETA_OFFSET: number;
|
|
21
|
+
};
|
|
4
22
|
protected texture: ITexture2D;
|
|
5
23
|
protected getCommonUniformsInfo(): {
|
|
6
24
|
uniformsArray: number[];
|
package/es/line/models/arc_3d.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
3
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
4
|
-
import { rgb2arr } from '@antv/l7-utils';
|
|
4
|
+
import { fp64LowPart, rgb2arr } from '@antv/l7-utils';
|
|
5
5
|
import BaseModel from "../../core/BaseModel";
|
|
6
6
|
import { LineArcTriangulation } from "../../core/triangulation";
|
|
7
7
|
import { EARTH_RADIUS } from "../../earth/utils";
|
|
8
8
|
// arc3d line layer
|
|
9
|
-
import { ShaderLocation } from "../../core/CommonStyleAttribute";
|
|
10
9
|
/* babel-plugin-inline-import '../shaders/arc3d/line_arc_3d_frag.glsl' */
|
|
11
10
|
const arc3d_line_frag = "#define LineTypeSolid 0.0\n#define LineTypeDash 1.0\n#define Animate 0.0\n#define LineTexture 1.0\n\nuniform sampler2D u_texture;\n\nlayout(std140) uniform commonUniorm {\n vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n vec4 u_dash_array: [10.0, 5., 0, 0];\n vec4 u_sourceColor;\n vec4 u_targetColor;\n vec2 u_textSize;\n float u_globel;\n float u_globel_radius;\n float u_global_height: 10;\n float segmentNumber;\n float u_line_type: 0.0;\n float u_icon_step: 100;\n float u_line_texture: 0.0;\n float u_textureBlend;\n float u_time;\n float u_linearColor: 0.0;\n};\n\n// varying vec2 v_normal;\nin vec4 v_dash_array;\nin vec4 v_color;\nin vec4 v_line_data;\nin float v_segmentIndex;\nin vec2 v_iconMapUV;\n\nout vec4 outputColor;\n\n#pragma include \"picking\"\n\nvoid main() {\n float animateSpeed = 0.0; // \u8FD0\u52A8\u901F\u5EA6\n float d_distance_ratio = v_line_data.g; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n outputColor = v_color;\n\n if(u_line_type == LineTypeDash) {\n float flag = 0.;\n float dashLength = mod(d_distance_ratio, v_dash_array.x + v_dash_array.y + v_dash_array.z + v_dash_array.w);\n if(dashLength < v_dash_array.x || (dashLength > (v_dash_array.x + v_dash_array.y) && dashLength < v_dash_array.x + v_dash_array.y + v_dash_array.z)) {\n flag = 1.;\n }\n outputColor.a *=flag;\n }\n\n if(u_animate.x == Animate && u_line_texture != LineTexture) {\n animateSpeed = u_time / u_animate.y;\n float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_animate.z)* (1.0/ u_animate.z) + u_time / u_animate.y);\n\n alpha = (alpha + u_animate.w -1.0) / u_animate.w;\n // alpha = smoothstep(0., 1., alpha);\n alpha = clamp(alpha, 0.0, 1.0);\n outputColor.a *= alpha;\n\n // u_animate \n // x enable\n // y duration\n // z interval\n // w trailLength\n }\n\n if(u_line_texture == LineTexture && u_line_type != LineTypeDash) { // while load texture\n // float arcRadio = smoothstep( 0.0, 1.0, (v_segmentIndex / segmentNumber));\n float arcRadio = v_segmentIndex / (segmentNumber - 1.0);\n float count = v_line_data.b; // // \u8D34\u56FE\u5728\u5F27\u7EBF\u4E0A\u91CD\u590D\u7684\u6570\u91CF\n\n float time = 0.0;\n if(u_animate.x == Animate) {\n time = u_time / u_animate.y;\n }\n float redioCount = arcRadio * count;\n\n float u = fract(redioCount - time);\n\n float v = v_line_data.a; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;\n vec4 pattern = texture(SAMPLER_2D(u_texture), uv);\n\n if(u_animate.x == Animate) {\n float currentPlane = floor(redioCount - time);\n float textureStep = floor(count * u_animate.z);\n float a = mod(currentPlane, textureStep);\n if(a < textureStep - 1.0) {\n pattern = vec4(0.0);\n }\n }\n\n if(u_textureBlend == 0.0) { // normal\n pattern.a = 0.0;\n outputColor = filterColor(outputColor + pattern);\n } else { // replace\n pattern.a *= v_color.a;\n if(outputColor.a <= 0.0) {\n pattern.a = 0.0;\n discard;\n } else {\n outputColor = filterColor(pattern);\n }\n }\n\n } else {\n outputColor = filterColor(outputColor);\n }\n}\n";
|
|
12
11
|
/* babel-plugin-inline-import '../shaders/arc3d/line_arc_3d_vert.glsl' */
|
|
13
|
-
const arc3d_line_vert = "#define LineTypeSolid 0.0\n#define LineTypeDash 1.0\n#define Animate 0.0\n#define LineTexture 1.0\nlayout(location =
|
|
12
|
+
const arc3d_line_vert = "#define LineTypeSolid 0.0\n#define LineTypeDash 1.0\n#define Animate 0.0\n#define LineTexture 1.0\n\nlayout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\nlayout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;\nlayout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;\nlayout(location = ATTRIBUTE_LOCATION_INSTANCE) in vec4 a_Instance;\nlayout(location = ATTRIBUTE_LOCATION_INSTANCE_64LOW) in vec4 a_Instance64Low;\nlayout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_iconMapUV;\n\n\nlayout(std140) uniform commonUniorm {\n vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n vec4 u_dash_array: [10.0, 5., 0, 0];\n vec4 u_sourceColor;\n vec4 u_targetColor;\n vec2 u_textSize;\n float u_globel;\n float u_globel_radius;\n float u_global_height: 10;\n float segmentNumber;\n float u_line_type: 0.0;\n float u_icon_step: 100;\n float u_line_texture: 0.0;\n float u_textureBlend;\n float u_time;\n float u_linearColor: 0.0;\n};\nout vec4 v_color;\nout vec4 v_dash_array;\nout float v_segmentIndex;\nout vec2 v_iconMapUV;\nout vec4 v_line_data;\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"picking\"\n\nfloat maps (float value, float start1, float stop1, float start2, float stop2) {\n return start2 + (stop2 - start2) * ((value - start1) / (stop1 - start1));\n}\n\nfloat getSegmentRatio(float index) {\n return smoothstep(0.0, 1.0, index / (segmentNumber - 1.0));\n}\n\nfloat paraboloid(vec2 source, vec2 target, float ratio) {\n vec2 x = mix(source, target, ratio);\n vec2 center = mix(source, target, 0.5);\n float dSourceCenter = distance(source, center);\n float dXCenter = distance(x, center);\n return (dSourceCenter + dXCenter) * (dSourceCenter - dXCenter);\n}\n\nvec3 getPos(vec2 source, vec2 target, float segmentRatio) {\n float vertex_height = paraboloid(source, target, segmentRatio);\n\n return vec3(\n mix(source, target, segmentRatio),\n sqrt(max(0.0, vertex_height))\n );\n}\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n\n vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size) / 2.0;\n\n return offset;\n}\nvec2 getNormal(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n return dir_screenspace.xy * sign(offset_direction);\n}\n\nfloat torad(float deg) {\n return (deg / 180.0) * acos(-1.0);\n}\n\nvec3 lglt2xyz(vec2 lnglat) {\n float pi = 3.1415926;\n // + Math.PI/2 \u662F\u4E3A\u4E86\u5BF9\u9F50\u5750\u6807\n float lng = torad(lnglat.x) + pi / 2.0;\n float lat = torad(lnglat.y);\n\n // \u624B\u52A8\u589E\u52A0\u4E00\u4E9B\u504F\u79FB\uFF0C\u51CF\u8F7B\u9762\u7684\u51B2\u7A81\n float radius = u_globel_radius;\n\n float z = radius * cos(lat) * cos(lng);\n float x = radius * cos(lat) * sin(lng);\n float y = radius * sin(lat);\n return vec3(x, y, z);\n}\n\nvoid main() {\n //vs\u4E2D\u8BA1\u7B97\u6E10\u53D8\u8272\n if(u_linearColor==1.0){\n float d_segmentIndex = a_Position.x + 1.0; // \u5F53\u524D\u9876\u70B9\u5728\u5F27\u7EBF\u4E2D\u6240\u5904\u7684\u5206\u6BB5\u4F4D\u7F6E\n v_color = mix(u_sourceColor, u_targetColor, d_segmentIndex/segmentNumber);\n }\n else{\n v_color = a_Color;\n }\n v_color.a = v_color.a * opacity;\n vec2 source = project_position(vec4(a_Instance.rg, 0, 0), a_Instance64Low.xy).xy;\n vec2 target = project_position(vec4(a_Instance.ba, 0, 0), a_Instance64Low.zw).xy;\n float segmentIndex = a_Position.x;\n float segmentRatio = getSegmentRatio(segmentIndex);\n float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));\n\n float d_distance_ratio;\n if(u_line_type == LineTypeDash) {\n d_distance_ratio = segmentIndex / segmentNumber;\n float total_Distance = pixelDistance(source, target) / 2.0 * PI;\n v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / (total_Distance / segmentNumber * segmentIndex);\n }\n if(u_animate.x == Animate) {\n d_distance_ratio = segmentIndex / segmentNumber;\n }\n v_line_data.g = d_distance_ratio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n\n float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);\n vec3 curr = getPos(source, target, segmentRatio);\n vec3 next = getPos(source, target, nextSegmentRatio);\n vec2 offset = getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y);\n // v_normal = getNormal((next.xy - curr.xy) * indexDir, a_Position.y);\n\n\n v_segmentIndex = a_Position.x;\n if(LineTexture == u_line_texture && u_line_type != LineTypeDash) { // \u5F00\u542F\u8D34\u56FE\u6A21\u5F0F\n\n float arcDistrance = length(source - target);\n float pixelLen = project_pixel_texture(u_icon_step);\n v_line_data.b = floor(arcDistrance/pixelLen); // \u8D34\u56FE\u5728\u5F27\u7EBF\u4E0A\u91CD\u590D\u7684\u6570\u91CF\n\n vec2 projectOffset = project_pixel(offset);\n float lineOffsetWidth = length(projectOffset + projectOffset * sign(a_Position.y)); // \u7EBF\u6A2A\u5411\u504F\u79FB\u7684\u8DDD\u79BB\n float linePixelSize = project_pixel(a_Size); // \u5B9A\u70B9\u4F4D\u7F6E\u504F\u79FB\uFF0C\u6309\u5730\u56FE\u7B49\u7EA7\u7F29\u653E\u540E\u7684\u8DDD\u79BB\n v_line_data.a = lineOffsetWidth/linePixelSize; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n v_iconMapUV = a_iconMapUV;\n }\n\n\n gl_Position = project_common_position_to_clipspace(vec4(curr.xy + project_pixel(offset), curr.z * thetaOffset, 1.0));\n\n // \u5730\u7403\u6A21\u5F0F\n if(u_globel > 0.0) {\n vec3 startLngLat = lglt2xyz(a_Instance.rg);\n vec3 endLngLat = lglt2xyz(a_Instance.ba);\n float globalRadius = length(startLngLat);\n\n vec3 lineDir = normalize(endLngLat - startLngLat);\n vec3 midPointDir = normalize((startLngLat + endLngLat)/2.0);\n\n // \u7EBF\u7684\u504F\u79FB\n vec3 lnglatOffset = cross(lineDir, midPointDir) * a_Position.y;\n // \u8BA1\u7B97\u8D77\u59CB\u70B9\u548C\u7EC8\u6B62\u70B9\u7684\u8DDD\u79BB\n float lnglatLength = length(a_Instance.rg - a_Instance.ba)/50.0;\n // \u8BA1\u7B97\u98DE\u7EBF\u5404\u4E2A\u8282\u70B9\u76F8\u5E94\u7684\u9AD8\u5EA6\n float lineHeight = u_global_height * (-4.0*segmentRatio*segmentRatio + 4.0 * segmentRatio) * lnglatLength;\n // \u5730\u7403\u70B9\u4F4D\n vec3 globalPoint = normalize(mix(startLngLat, endLngLat, segmentRatio)) * (globalRadius + lineHeight) + lnglatOffset * a_Size;\n\n gl_Position = u_ViewProjectionMatrix * vec4(globalPoint, 1.0);\n }\n\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
14
13
|
const lineStyleObj = {
|
|
15
14
|
solid: 0.0,
|
|
16
15
|
dash: 1.0
|
|
@@ -41,6 +40,16 @@ export default class Arc3DModel extends BaseModel {
|
|
|
41
40
|
this.textures = [this.texture];
|
|
42
41
|
});
|
|
43
42
|
}
|
|
43
|
+
get attributeLocation() {
|
|
44
|
+
return Object.assign(super.attributeLocation, {
|
|
45
|
+
MAX: super.attributeLocation.MAX,
|
|
46
|
+
SIZE: 9,
|
|
47
|
+
INSTANCE: 10,
|
|
48
|
+
INSTANCE_64LOW: 11,
|
|
49
|
+
UV: 12,
|
|
50
|
+
THETA_OFFSET: 13
|
|
51
|
+
});
|
|
52
|
+
}
|
|
44
53
|
// public enableShaderEncodeStyles = ['opacity'];
|
|
45
54
|
getCommonUniformsInfo() {
|
|
46
55
|
const {
|
|
@@ -140,6 +149,7 @@ export default class Arc3DModel extends BaseModel {
|
|
|
140
149
|
moduleName: 'lineArc3d' + type,
|
|
141
150
|
vertexShader: vert,
|
|
142
151
|
fragmentShader: frag,
|
|
152
|
+
defines: _this2.getDefines(),
|
|
143
153
|
inject: _this2.getInject(),
|
|
144
154
|
triangulation: LineArcTriangulation,
|
|
145
155
|
styleOption: {
|
|
@@ -155,9 +165,8 @@ export default class Arc3DModel extends BaseModel {
|
|
|
155
165
|
type: AttributeType.Attribute,
|
|
156
166
|
descriptor: {
|
|
157
167
|
name: 'a_Size',
|
|
158
|
-
shaderLocation:
|
|
168
|
+
shaderLocation: this.attributeLocation.SIZE,
|
|
159
169
|
buffer: {
|
|
160
|
-
// give the WebGL driver a hint that this buffer may change
|
|
161
170
|
usage: gl.DYNAMIC_DRAW,
|
|
162
171
|
data: [],
|
|
163
172
|
type: gl.FLOAT
|
|
@@ -177,7 +186,7 @@ export default class Arc3DModel extends BaseModel {
|
|
|
177
186
|
type: AttributeType.Attribute,
|
|
178
187
|
descriptor: {
|
|
179
188
|
name: 'a_Instance',
|
|
180
|
-
shaderLocation:
|
|
189
|
+
shaderLocation: this.attributeLocation.INSTANCE,
|
|
181
190
|
buffer: {
|
|
182
191
|
usage: gl.STATIC_DRAW,
|
|
183
192
|
data: [],
|
|
@@ -189,12 +198,31 @@ export default class Arc3DModel extends BaseModel {
|
|
|
189
198
|
}
|
|
190
199
|
}
|
|
191
200
|
});
|
|
201
|
+
|
|
202
|
+
// save low part for enabled double precision INSTANCE attribute
|
|
203
|
+
this.styleAttributeService.registerStyleAttribute({
|
|
204
|
+
name: 'instance64Low',
|
|
205
|
+
type: AttributeType.Attribute,
|
|
206
|
+
descriptor: {
|
|
207
|
+
name: 'a_Instance64Low',
|
|
208
|
+
shaderLocation: this.attributeLocation.INSTANCE_64LOW,
|
|
209
|
+
buffer: {
|
|
210
|
+
usage: gl.STATIC_DRAW,
|
|
211
|
+
data: [],
|
|
212
|
+
type: gl.FLOAT
|
|
213
|
+
},
|
|
214
|
+
size: 4,
|
|
215
|
+
update: (feature, featureIdx, vertex) => {
|
|
216
|
+
return [fp64LowPart(vertex[3]), fp64LowPart(vertex[4]), fp64LowPart(vertex[5]), fp64LowPart(vertex[6])];
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
});
|
|
192
220
|
this.styleAttributeService.registerStyleAttribute({
|
|
193
221
|
name: 'uv',
|
|
194
222
|
type: AttributeType.Attribute,
|
|
195
223
|
descriptor: {
|
|
196
224
|
name: 'a_iconMapUV',
|
|
197
|
-
shaderLocation:
|
|
225
|
+
shaderLocation: this.attributeLocation.UV,
|
|
198
226
|
buffer: {
|
|
199
227
|
usage: gl.DYNAMIC_DRAW,
|
|
200
228
|
data: [],
|
|
@@ -217,5 +245,25 @@ export default class Arc3DModel extends BaseModel {
|
|
|
217
245
|
}
|
|
218
246
|
}
|
|
219
247
|
});
|
|
248
|
+
this.styleAttributeService.registerStyleAttribute({
|
|
249
|
+
name: 'thetaOffset',
|
|
250
|
+
type: AttributeType.Attribute,
|
|
251
|
+
descriptor: {
|
|
252
|
+
name: 'a_ThetaOffset',
|
|
253
|
+
shaderLocation: this.attributeLocation.THETA_OFFSET,
|
|
254
|
+
buffer: {
|
|
255
|
+
usage: gl.STATIC_DRAW,
|
|
256
|
+
data: [],
|
|
257
|
+
type: gl.FLOAT
|
|
258
|
+
},
|
|
259
|
+
size: 1,
|
|
260
|
+
update: feature => {
|
|
261
|
+
const {
|
|
262
|
+
thetaOffset: op = 1
|
|
263
|
+
} = feature;
|
|
264
|
+
return [op];
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
});
|
|
220
268
|
}
|
|
221
269
|
}
|
package/es/line/models/flow.d.ts
CHANGED
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
import type { IModel } from '@antv/l7-core';
|
|
2
2
|
import BaseModel from '../../core/BaseModel';
|
|
3
3
|
export default class FlowLineModel extends BaseModel {
|
|
4
|
+
protected get attributeLocation(): {
|
|
5
|
+
readonly POSITION: 0;
|
|
6
|
+
readonly POSITION_64LOW: 1;
|
|
7
|
+
readonly COLOR: 2;
|
|
8
|
+
readonly PICKING_COLOR: 3;
|
|
9
|
+
readonly STROKE: 4;
|
|
10
|
+
readonly OPACITY: 5;
|
|
11
|
+
readonly OFFSETS: 6;
|
|
12
|
+
readonly ROTATION: 7;
|
|
13
|
+
readonly MAX: 8;
|
|
14
|
+
} & Record<string, number> & {
|
|
15
|
+
MAX: 8;
|
|
16
|
+
SIZE: number;
|
|
17
|
+
INSTANCE: number;
|
|
18
|
+
INSTANCE_64LOW: number;
|
|
19
|
+
NORMAL: number;
|
|
20
|
+
};
|
|
4
21
|
protected getCommonUniformsInfo(): {
|
|
5
22
|
uniformsArray: number[];
|
|
6
23
|
uniformsLength: number;
|