@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,6 +1,22 @@
|
|
|
1
1
|
import type { IAnimateOption, IAttribute, IElements, IModel, IModelUniform } from '@antv/l7-core';
|
|
2
2
|
import BaseModel from '../../core/BaseModel';
|
|
3
3
|
export default class FillModel 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
|
+
SHAPE: number;
|
|
18
|
+
EXTRUDE: number;
|
|
19
|
+
};
|
|
4
20
|
protected getCommonUniformsInfo(): {
|
|
5
21
|
uniformsArray: number[];
|
|
6
22
|
uniformsLength: number;
|
package/lib/point/models/fill.js
CHANGED
|
@@ -8,14 +8,21 @@ exports.default = void 0;
|
|
|
8
8
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
9
9
|
var _l7Core = require("@antv/l7-core");
|
|
10
10
|
var _BaseModel = _interopRequireDefault(require("../../core/BaseModel"));
|
|
11
|
-
var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
|
|
12
11
|
var _triangulation = require("../../core/triangulation");
|
|
13
12
|
var _interface = require("../../core/interface");
|
|
14
13
|
/* babel-plugin-inline-import '../shaders/fill/fill_frag.glsl' */
|
|
15
14
|
const pointFillFrag = "\nlayout(std140) uniform commonUniforms {\n vec3 u_blur_height_fixed;\n float u_stroke_width;\n float u_additive;\n float u_stroke_opacity;\n float u_size_unit;\n float u_time;\n vec4 u_animate;\n};\n\nin vec4 v_color;\nin vec4 v_stroke;\nin vec4 v_data;\nin float v_radius;\n\n#pragma include \"scene_uniforms\"\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\n\nout vec4 outputColor;\n\nvoid main() {\n int shape = int(floor(v_data.w + 0.5));\n lowp float antialiasblur = v_data.z;\n float r = v_radius / (v_radius + u_stroke_width);\n\n float outer_df;\n float inner_df;\n // 'circle', 'triangle', 'square', 'pentagon', 'hexagon', 'octogon', 'hexagram', 'rhombus', 'vesica'\n if (shape == 0) {\n outer_df = sdCircle(v_data.xy, 1.0);\n inner_df = sdCircle(v_data.xy, r);\n } else if (shape == 1) {\n outer_df = sdEquilateralTriangle(1.1 * v_data.xy);\n inner_df = sdEquilateralTriangle(1.1 / r * v_data.xy);\n } else if (shape == 2) {\n outer_df = sdBox(v_data.xy, vec2(1.));\n inner_df = sdBox(v_data.xy, vec2(r));\n } else if (shape == 3) {\n outer_df = sdPentagon(v_data.xy, 0.8);\n inner_df = sdPentagon(v_data.xy, r * 0.8);\n } else if (shape == 4) {\n outer_df = sdHexagon(v_data.xy, 0.8);\n inner_df = sdHexagon(v_data.xy, r * 0.8);\n } else if (shape == 5) {\n outer_df = sdOctogon(v_data.xy, 1.0);\n inner_df = sdOctogon(v_data.xy, r);\n } else if (shape == 6) {\n outer_df = sdHexagram(v_data.xy, 0.52);\n inner_df = sdHexagram(v_data.xy, r * 0.52);\n } else if (shape == 7) {\n outer_df = sdRhombus(v_data.xy, vec2(1.0));\n inner_df = sdRhombus(v_data.xy, vec2(r));\n } else if (shape == 8) {\n outer_df = sdVesica(v_data.xy, 1.1, 0.8);\n inner_df = sdVesica(v_data.xy, r * 1.1, r * 0.8);\n }\n\n float opacity_t = smoothstep(0.0, antialiasblur, outer_df);\n\n float color_t = u_stroke_width < 0.01 ? 0.0 : smoothstep(\n antialiasblur,\n 0.0,\n inner_df\n );\n\n float PI = 3.14159;\n float N_RINGS = 3.0;\n float FREQ = 1.0;\n\n if(u_stroke_width < 0.01) {\n outputColor = v_color;\n } else {\n outputColor = mix(v_color, v_stroke * u_stroke_opacity, color_t);\n }\n float intensity = 1.0;\n if(u_time!=-1.0){\n //wave\u76F8\u5173\u903B\u8F91\n float d = length(v_data.xy);\n if(d > 0.5) {\n discard;\n }\n intensity = clamp(cos(d * PI), 0.0, 1.0) * clamp(cos(2.0 * PI * (d * 2.0 * u_animate.z - u_animate.y * u_time)), 0.0, 1.0);\n }\n\n if(u_additive > 0.0) {\n outputColor *= opacity_t;\n outputColor *= intensity;//wave\n outputColor = filterColorAlpha(outputColor, outputColor.a);\n } else {\n outputColor.a *= opacity_t;\n outputColor.a *= intensity;//wave \n outputColor = filterColor(outputColor);\n }\n // \u4F5C\u4E3A mask \u6A21\u677F\u65F6\u9700\u8981\u4E22\u5F03\u900F\u660E\u7684\u50CF\u7D20\n if(outputColor.a < 0.01) {\n discard;\n } \n}\n";
|
|
16
15
|
/* babel-plugin-inline-import '../shaders/fill/fill_vert.glsl' */
|
|
17
|
-
const pointFillVert = "layout(location =
|
|
16
|
+
const pointFillVert = "layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\nlayout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;\nlayout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;\nlayout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;\nlayout(location = ATTRIBUTE_LOCATION_SHAPE) in float a_Shape;\nlayout(location = ATTRIBUTE_LOCATION_EXTRUDE) in vec3 a_Extrude;\n\nlayout(std140) uniform commonUniforms {\n vec3 u_blur_height_fixed;\n float u_stroke_width;\n float u_additive;\n float u_stroke_opacity;\n float u_size_unit;\n float u_time;\n vec4 u_animate;\n};\n\nout vec4 v_color;\nout vec4 v_stroke;\nout vec4 v_data;\nout float v_radius;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n#pragma include \"rotation_2d\"\n\nvoid main() {\n // \u900F\u660E\u5EA6\u8BA1\u7B97\n v_stroke = stroke;\n vec3 extrude = a_Extrude;\n float shape_type = a_Shape;\n /*\n * setPickingSize \u8BBE\u7F6E\u62FE\u53D6\u5927\u5C0F\n * u_meter2coord \u5728\u7B49\u9762\u79EF\u5927\u5C0F\u7684\u65F6\u5019\u8BBE\u7F6E\u5355\u4F4D\n */\n float newSize = setPickingSize(a_Size);\n // float newSize = setPickingSize(a_Size) * 0.00001038445708445579;\n\n\n\n // unpack color(vec2)\n v_color = vec4(a_Color.xyz, a_Color.w * opacity);\n\n if(u_size_unit == 1.0) {\n newSize = newSize * u_PixelsPerMeter.z;\n }\n\n v_radius = newSize;\n\n // anti-alias\n // float antialiased_blur = -max(u_blur, antialiasblur);\n float antialiasblur = -max(2.0 / u_DevicePixelRatio / newSize, u_blur_height_fixed.x);\n\n vec2 offset = (extrude.xy * (newSize + u_stroke_width) + u_offsets);\n\n offset = project_pixel(offset);\n offset = rotate_matrix(offset,rotation);\n\n // TODP: /abs(extrude.x) \u662F\u4E3A\u4E86\u517C\u5BB9\u5730\u7403\u6A21\u5F0F\n v_data = vec4(extrude.x/abs(extrude.x), extrude.y/abs(extrude.y), antialiasblur,shape_type);\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0), a_Position64Low);\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));\n\n float raisingHeight = u_blur_height_fixed.y;\n\n if(u_blur_height_fixed.z < 1.0) { // false\n raisingHeight = project_pixel(u_blur_height_fixed.y);\n } else {\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n raisingHeight = u_blur_height_fixed.y * mapboxZoomScale;\n }\n }\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, raisingHeight, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
18
17
|
class FillModel extends _BaseModel.default {
|
|
18
|
+
get attributeLocation() {
|
|
19
|
+
return Object.assign(super.attributeLocation, {
|
|
20
|
+
MAX: super.attributeLocation.MAX,
|
|
21
|
+
SIZE: 9,
|
|
22
|
+
SHAPE: 10,
|
|
23
|
+
EXTRUDE: 11
|
|
24
|
+
});
|
|
25
|
+
}
|
|
19
26
|
getCommonUniformsInfo() {
|
|
20
27
|
const {
|
|
21
28
|
strokeOpacity = 1,
|
|
@@ -76,6 +83,7 @@ class FillModel extends _BaseModel.default {
|
|
|
76
83
|
moduleName: type,
|
|
77
84
|
vertexShader: vert,
|
|
78
85
|
fragmentShader: frag,
|
|
86
|
+
defines: _this2.getDefines(),
|
|
79
87
|
inject: _this2.getInject(),
|
|
80
88
|
triangulation: _triangulation.PointFillTriangulation,
|
|
81
89
|
depth: {
|
|
@@ -105,12 +113,15 @@ class FillModel extends _BaseModel.default {
|
|
|
105
113
|
registerBuiltinAttributes() {
|
|
106
114
|
// 注册 Style 参与数据映射的内置属性
|
|
107
115
|
const shape2d = this.layer.getLayerConfig().shape2d;
|
|
116
|
+
|
|
117
|
+
// 注册 Position 属性 64 位地位部分,经纬度数据开启双精度,避免大于 20层级以上出现数据偏移
|
|
118
|
+
this.registerPosition64LowAttribute();
|
|
108
119
|
this.styleAttributeService.registerStyleAttribute({
|
|
109
120
|
name: 'extrude',
|
|
110
121
|
type: _l7Core.AttributeType.Attribute,
|
|
111
122
|
descriptor: {
|
|
112
123
|
name: 'a_Extrude',
|
|
113
|
-
shaderLocation:
|
|
124
|
+
shaderLocation: this.attributeLocation.EXTRUDE,
|
|
114
125
|
buffer: {
|
|
115
126
|
// give the WebGL driver a hint that this buffer may change
|
|
116
127
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
@@ -132,7 +143,7 @@ class FillModel extends _BaseModel.default {
|
|
|
132
143
|
type: _l7Core.AttributeType.Attribute,
|
|
133
144
|
descriptor: {
|
|
134
145
|
name: 'a_Size',
|
|
135
|
-
shaderLocation:
|
|
146
|
+
shaderLocation: this.attributeLocation.SIZE,
|
|
136
147
|
buffer: {
|
|
137
148
|
// give the WebGL driver a hint that this buffer may change
|
|
138
149
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
@@ -155,7 +166,7 @@ class FillModel extends _BaseModel.default {
|
|
|
155
166
|
type: _l7Core.AttributeType.Attribute,
|
|
156
167
|
descriptor: {
|
|
157
168
|
name: 'a_Shape',
|
|
158
|
-
shaderLocation:
|
|
169
|
+
shaderLocation: this.attributeLocation.SHAPE,
|
|
159
170
|
buffer: {
|
|
160
171
|
// give the WebGL driver a hint that this buffer may change
|
|
161
172
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
import type { IAttribute, IElements, IModel } from '@antv/l7-core';
|
|
2
2
|
import BaseModel from '../../core/BaseModel';
|
|
3
3
|
export default class FillImageModel 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
|
+
EXTRUDE: number;
|
|
18
|
+
UV: number;
|
|
19
|
+
};
|
|
4
20
|
private meter2coord;
|
|
5
21
|
private texture;
|
|
6
22
|
private isMeter;
|
|
@@ -8,16 +8,13 @@ exports.default = void 0;
|
|
|
8
8
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _l7Core = require("@antv/l7-core");
|
|
11
|
-
var _l7Utils = require("@antv/l7-utils");
|
|
12
11
|
var _BaseModel = _interopRequireDefault(require("../../core/BaseModel"));
|
|
13
12
|
var _interface = require("../../core/interface");
|
|
14
13
|
var _triangulation = require("../../core/triangulation");
|
|
15
|
-
var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
|
|
16
|
-
// static pointLayer shader - not support animate
|
|
17
14
|
/* babel-plugin-inline-import '../shaders/fillImage/fillImage_frag.glsl' */
|
|
18
15
|
const pointFillFrag = "in vec2 v_uv;// \u672C\u8EAB\u7684 uv \u5750\u6807\nin vec2 v_Iconuv;\nin float v_opacity;\nout vec4 outputColor;\n\nuniform sampler2D u_texture;\nlayout(std140) uniform commonUniform {\n vec2 u_textSize;\n float u_heightfixed: 0.0;\n float u_raisingHeight: 0.0;\n float u_size_unit;\n};\n\n#pragma include \"scene_uniforms\"\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\n\nvoid main() {\n vec2 pos = v_Iconuv / u_textSize + v_uv / u_textSize * 64.;\n outputColor = texture(SAMPLER_2D(u_texture), pos);\n outputColor.a *= v_opacity;\n outputColor = filterColor(outputColor);\n}\n";
|
|
19
16
|
/* babel-plugin-inline-import '../shaders/fillImage/fillImage_vert.glsl' */
|
|
20
|
-
const pointFillVert = "layout(location =
|
|
17
|
+
const pointFillVert = "layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\nlayout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;\nlayout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;\nlayout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;\nlayout(location = ATTRIBUTE_LOCATION_EXTRUDE) in vec3 a_Extrude;\nlayout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;\n\nlayout(std140) uniform commonUniform {\n vec2 u_textSize;\n float u_heightfixed;\n float u_raisingHeight;\n float u_size_unit;\n};\n\nout vec2 v_uv;\nout vec2 v_Iconuv;\nout float v_opacity;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n#pragma include \"rotation_2d\"\n\nvoid main() {\n vec3 extrude = a_Extrude;\n v_uv = (a_Extrude.xy + 1.0) / 2.0;\n v_uv.y = 1.0 - v_uv.y;\n v_Iconuv = a_Uv;\n v_opacity = opacity;\n float newSize = a_Size;\n if (u_size_unit == 1.0) {\n newSize = newSize * u_PixelsPerMeter.z;\n }\n\n // vec2 offset = (u_RotateMatrix * extrude.xy * (a_Size) + textrueOffsets);\n vec2 offset = extrude.xy * newSize + offsets;\n\n offset = rotate_matrix(offset, rotation);\n\n offset = project_pixel(offset);\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0), a_Position64Low);\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
21
18
|
class FillImageModel extends _BaseModel.default {
|
|
22
19
|
constructor(...args) {
|
|
23
20
|
super(...args);
|
|
@@ -52,6 +49,14 @@ class FillImageModel extends _BaseModel.default {
|
|
|
52
49
|
this.textures = [this.texture];
|
|
53
50
|
});
|
|
54
51
|
}
|
|
52
|
+
get attributeLocation() {
|
|
53
|
+
return Object.assign(super.attributeLocation, {
|
|
54
|
+
MAX: super.attributeLocation.MAX,
|
|
55
|
+
SIZE: 9,
|
|
56
|
+
EXTRUDE: 10,
|
|
57
|
+
UV: 11
|
|
58
|
+
});
|
|
59
|
+
}
|
|
55
60
|
// 旋转的弧度
|
|
56
61
|
getCommonUniformsInfo() {
|
|
57
62
|
const {
|
|
@@ -63,14 +68,6 @@ class FillImageModel extends _BaseModel.default {
|
|
|
63
68
|
var _this$texture;
|
|
64
69
|
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.bind();
|
|
65
70
|
}
|
|
66
|
-
/**
|
|
67
|
-
* rotateFlag
|
|
68
|
-
* DEFAULT 1
|
|
69
|
-
* MAPBOX 1
|
|
70
|
-
* GAODE2.x -1
|
|
71
|
-
* GAODE1.x -1
|
|
72
|
-
*/
|
|
73
|
-
|
|
74
71
|
const commonOptions = {
|
|
75
72
|
u_textSize: [1024, this.iconService.canvasHeight || 128],
|
|
76
73
|
u_heightfixed: Number(heightfixed),
|
|
@@ -103,10 +100,11 @@ class FillImageModel extends _BaseModel.default {
|
|
|
103
100
|
depth: {
|
|
104
101
|
enable: false
|
|
105
102
|
},
|
|
103
|
+
defines: _this2.getDefines(),
|
|
106
104
|
inject: _this2.getInject(),
|
|
107
105
|
cull: {
|
|
108
106
|
enable: true,
|
|
109
|
-
face:
|
|
107
|
+
face: _l7Core.gl.FRONT
|
|
110
108
|
}
|
|
111
109
|
});
|
|
112
110
|
return [model];
|
|
@@ -120,12 +118,14 @@ class FillImageModel extends _BaseModel.default {
|
|
|
120
118
|
|
|
121
119
|
// overwrite baseModel func
|
|
122
120
|
registerBuiltinAttributes() {
|
|
121
|
+
// 注册 Position 属性 64 位地位部分,经纬度数据开启双精度,避免大于 20层级以上出现数据偏移
|
|
122
|
+
this.registerPosition64LowAttribute();
|
|
123
123
|
this.styleAttributeService.registerStyleAttribute({
|
|
124
124
|
name: 'uv',
|
|
125
125
|
type: _l7Core.AttributeType.Attribute,
|
|
126
126
|
descriptor: {
|
|
127
127
|
name: 'a_Uv',
|
|
128
|
-
shaderLocation:
|
|
128
|
+
shaderLocation: this.attributeLocation.UV,
|
|
129
129
|
buffer: {
|
|
130
130
|
// give the WebGL driver a hint that this buffer may change
|
|
131
131
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
@@ -154,7 +154,7 @@ class FillImageModel extends _BaseModel.default {
|
|
|
154
154
|
type: _l7Core.AttributeType.Attribute,
|
|
155
155
|
descriptor: {
|
|
156
156
|
name: 'a_Extrude',
|
|
157
|
-
shaderLocation:
|
|
157
|
+
shaderLocation: this.attributeLocation.EXTRUDE,
|
|
158
158
|
buffer: {
|
|
159
159
|
// give the WebGL driver a hint that this buffer may change
|
|
160
160
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
@@ -176,7 +176,7 @@ class FillImageModel extends _BaseModel.default {
|
|
|
176
176
|
type: _l7Core.AttributeType.Attribute,
|
|
177
177
|
descriptor: {
|
|
178
178
|
name: 'a_Size',
|
|
179
|
-
shaderLocation:
|
|
179
|
+
shaderLocation: this.attributeLocation.SIZE,
|
|
180
180
|
buffer: {
|
|
181
181
|
// give the WebGL driver a hint that this buffer may change
|
|
182
182
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
import type { IModel, IModelUniform } from '@antv/l7-core';
|
|
2
2
|
import BaseModel from '../../core/BaseModel';
|
|
3
3
|
export default class ImageModel 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
|
+
UV: number;
|
|
18
|
+
};
|
|
4
19
|
private texture;
|
|
5
20
|
getUninforms(): IModelUniform;
|
|
6
21
|
protected getCommonUniformsInfo(): {
|
|
@@ -10,12 +10,11 @@ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/obje
|
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
var _l7Core = require("@antv/l7-core");
|
|
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/image/image_frag.glsl' */
|
|
16
15
|
const pointImageFrag = "layout(std140) uniform commonUniforms {\n vec2 u_textSize;\n float u_raisingHeight;\n float u_heightfixed;\n};\n\nuniform sampler2D u_texture;\n\nin vec4 v_color;\nin vec2 v_uv;\nin float v_opacity;\n\n#pragma include \"picking\"\n\nout vec4 outputColor;\n\nvoid main(){\n vec2 pos = v_uv / u_textSize + gl_PointCoord / u_textSize * 64.;\n vec4 textureColor;\n\n // Y = 0.299R + 0.587G + 0.114B // \u4EAE\u5EA6\u63D0\u53D6\n \n textureColor = texture(SAMPLER_2D(u_texture), pos);\n\n // Tip: \u53BB\u9664\u8FB9\u7F18\u90E8\u5206 mipmap \u5BFC\u81F4\u7684\u6DF7\u5408\u53D8\u6697\n float fragmengTocenter = distance(vec2(0.5), gl_PointCoord);\n if(fragmengTocenter >= 0.5) {\n float luma = 0.299 * textureColor.r + 0.587 * textureColor.g + 0.114 * textureColor.b;\n textureColor.a *= luma;\n }\n \n if(all(lessThan(v_color, vec4(1.0+0.00001))) && all(greaterThan(v_color, vec4(1.0-0.00001))) || v_color==vec4(1.0)){\n outputColor= textureColor;\n }else {\n outputColor= step(0.01, textureColor.z) * v_color;\n }\n outputColor.a *= v_opacity;\n if (outputColor.a < 0.01) {\n discard;\n }\n outputColor = filterColor(outputColor);\n}\n";
|
|
17
16
|
/* babel-plugin-inline-import '../shaders/image/image_vert.glsl' */
|
|
18
|
-
const pointImageVert = "layout(location =
|
|
17
|
+
const pointImageVert = "layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\nlayout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;\nlayout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;\nlayout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;\nlayout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;\n\nlayout(std140) uniform commonUniforms {\n vec2 u_textSize;\n float u_raisingHeight;\n float u_heightfixed;\n};\n\nout vec4 v_color;\nout vec2 v_uv;\nout float v_opacity;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n v_color = a_Color;\n v_opacity = opacity;\n v_uv = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low);\n\n vec2 offset = project_pixel(offsets);\n\n float raisingHeight = u_raisingHeight;\n if (u_heightfixed < 1.0) {\n // false\n raisingHeight = project_pixel(u_raisingHeight);\n } else {\n if (\n u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||\n u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET\n ) {\n float mapboxZoomScale = 4.0 / pow(2.0, 21.0 - u_Zoom);\n raisingHeight = u_raisingHeight * mapboxZoomScale;\n }\n }\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, raisingHeight, 1.0));\n\n gl_PointSize = a_Size * 2.0 * u_DevicePixelRatio;\n setPickingColor(a_PickingColor);\n}\n";
|
|
19
18
|
class ImageModel extends _BaseModel.default {
|
|
20
19
|
constructor(...args) {
|
|
21
20
|
super(...args);
|
|
@@ -50,6 +49,13 @@ class ImageModel extends _BaseModel.default {
|
|
|
50
49
|
});
|
|
51
50
|
});
|
|
52
51
|
}
|
|
52
|
+
get attributeLocation() {
|
|
53
|
+
return Object.assign(super.attributeLocation, {
|
|
54
|
+
MAX: super.attributeLocation.MAX,
|
|
55
|
+
SIZE: 9,
|
|
56
|
+
UV: 10
|
|
57
|
+
});
|
|
58
|
+
}
|
|
53
59
|
getUninforms() {
|
|
54
60
|
// ThreeJS 图层兼容
|
|
55
61
|
if (this.rendererService.getDirty()) {
|
|
@@ -98,6 +104,7 @@ class ImageModel extends _BaseModel.default {
|
|
|
98
104
|
vertexShader: pointImageVert,
|
|
99
105
|
fragmentShader: pointImageFrag,
|
|
100
106
|
triangulation: _triangulation.PointImageTriangulation,
|
|
107
|
+
defines: _this2.getDefines(),
|
|
101
108
|
inject: _this2.getInject(),
|
|
102
109
|
depth: {
|
|
103
110
|
enable: false
|
|
@@ -108,13 +115,16 @@ class ImageModel extends _BaseModel.default {
|
|
|
108
115
|
})();
|
|
109
116
|
}
|
|
110
117
|
registerBuiltinAttributes() {
|
|
118
|
+
// 注册 Position 属性 64 位地位部分,经纬度数据开启双精度,避免大于 20层级以上出现数据偏移
|
|
119
|
+
this.registerPosition64LowAttribute();
|
|
120
|
+
|
|
111
121
|
// point layer size;
|
|
112
122
|
this.styleAttributeService.registerStyleAttribute({
|
|
113
123
|
name: 'size',
|
|
114
124
|
type: _l7Core.AttributeType.Attribute,
|
|
115
125
|
descriptor: {
|
|
116
126
|
name: 'a_Size',
|
|
117
|
-
shaderLocation:
|
|
127
|
+
shaderLocation: this.attributeLocation.SIZE,
|
|
118
128
|
buffer: {
|
|
119
129
|
// give the WebGL driver a hint that this buffer may change
|
|
120
130
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
@@ -137,7 +147,7 @@ class ImageModel extends _BaseModel.default {
|
|
|
137
147
|
type: _l7Core.AttributeType.Attribute,
|
|
138
148
|
descriptor: {
|
|
139
149
|
name: 'a_Uv',
|
|
140
|
-
shaderLocation:
|
|
150
|
+
shaderLocation: this.attributeLocation.UV,
|
|
141
151
|
buffer: {
|
|
142
152
|
// give the WebGL driver a hint that this buffer may change
|
|
143
153
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
@@ -7,6 +7,20 @@ export declare function PointTriangulation(feature: IEncodeFeature): {
|
|
|
7
7
|
size: number;
|
|
8
8
|
};
|
|
9
9
|
export default class NormalModel extends BaseModel {
|
|
10
|
+
protected get attributeLocation(): {
|
|
11
|
+
readonly POSITION: 0;
|
|
12
|
+
readonly POSITION_64LOW: 1;
|
|
13
|
+
readonly COLOR: 2;
|
|
14
|
+
readonly PICKING_COLOR: 3;
|
|
15
|
+
readonly STROKE: 4;
|
|
16
|
+
readonly OPACITY: 5;
|
|
17
|
+
readonly OFFSETS: 6;
|
|
18
|
+
readonly ROTATION: 7;
|
|
19
|
+
readonly MAX: 8;
|
|
20
|
+
} & Record<string, number> & {
|
|
21
|
+
MAX: 8;
|
|
22
|
+
SIZE: number;
|
|
23
|
+
};
|
|
10
24
|
getDefaultStyle(): Partial<IPointLayerStyleOptions>;
|
|
11
25
|
protected getCommonUniformsInfo(): {
|
|
12
26
|
uniformsArray: number[];
|
|
@@ -9,11 +9,10 @@ exports.default = void 0;
|
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
10
|
var _l7Core = require("@antv/l7-core");
|
|
11
11
|
var _BaseModel = _interopRequireDefault(require("../../core/BaseModel"));
|
|
12
|
-
var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
|
|
13
12
|
/* babel-plugin-inline-import '../shaders/normal/normal_frag.glsl' */
|
|
14
13
|
const normalFrag = "in vec4 v_color;\nout vec4 outputColor;\nvoid main() {\n outputColor = v_color;\n}";
|
|
15
14
|
/* babel-plugin-inline-import '../shaders/normal/normal_vert.glsl' */
|
|
16
|
-
const normalVert = "layout(location =
|
|
15
|
+
const normalVert = "layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\nlayout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;\nlayout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;\nlayout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;\n\nlayout(std140) uniform u_Common {\n float u_size_scale;\n};\n\nout vec4 v_color;\n\n#pragma include \"projection\"\n#pragma include \"project\"\n\nvoid main() {\n v_color = vec4(a_Color.xyz, a_Color.w * opacity);\n\n vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low);\n gl_Position = project_common_position_to_clipspace(project_pos);\n\n gl_PointSize = a_Size * u_size_scale * 2.0 * u_DevicePixelRatio;\n}\n";
|
|
17
16
|
function PointTriangulation(feature) {
|
|
18
17
|
const coordinates = feature.coordinates;
|
|
19
18
|
return {
|
|
@@ -23,6 +22,12 @@ function PointTriangulation(feature) {
|
|
|
23
22
|
};
|
|
24
23
|
}
|
|
25
24
|
class NormalModel extends _BaseModel.default {
|
|
25
|
+
get attributeLocation() {
|
|
26
|
+
return Object.assign(super.attributeLocation, {
|
|
27
|
+
MAX: super.attributeLocation.MAX,
|
|
28
|
+
SIZE: 9
|
|
29
|
+
});
|
|
30
|
+
}
|
|
26
31
|
getDefaultStyle() {
|
|
27
32
|
return {
|
|
28
33
|
blend: 'additive'
|
|
@@ -51,6 +56,7 @@ class NormalModel extends _BaseModel.default {
|
|
|
51
56
|
vertexShader: normalVert,
|
|
52
57
|
fragmentShader: normalFrag,
|
|
53
58
|
triangulation: PointTriangulation,
|
|
59
|
+
defines: _this2.getDefines(),
|
|
54
60
|
inject: _this2.getInject(),
|
|
55
61
|
depth: {
|
|
56
62
|
enable: false
|
|
@@ -65,12 +71,14 @@ class NormalModel extends _BaseModel.default {
|
|
|
65
71
|
return;
|
|
66
72
|
}
|
|
67
73
|
registerBuiltinAttributes() {
|
|
74
|
+
// 注册 Position 属性 64 位地位部分,经纬度数据开启双精度,避免大于 20层级以上出现数据偏移
|
|
75
|
+
this.registerPosition64LowAttribute();
|
|
68
76
|
this.styleAttributeService.registerStyleAttribute({
|
|
69
77
|
name: 'size',
|
|
70
78
|
type: _l7Core.AttributeType.Attribute,
|
|
71
79
|
descriptor: {
|
|
72
80
|
name: 'a_Size',
|
|
73
|
-
shaderLocation:
|
|
81
|
+
shaderLocation: this.attributeLocation.SIZE,
|
|
74
82
|
buffer: {
|
|
75
83
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
76
84
|
data: [],
|
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
import type { IAnimateOption, IAttribute, IElements, IModel, IModelUniform } from '@antv/l7-core';
|
|
2
2
|
import BaseModel from '../../core/BaseModel';
|
|
3
3
|
export default class RadarModel 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
|
+
EXTRUDE: number;
|
|
18
|
+
};
|
|
4
19
|
protected getCommonUniformsInfo(): {
|
|
5
20
|
uniformsArray: number[];
|
|
6
21
|
uniformsLength: number;
|
|
@@ -10,12 +10,18 @@ var _l7Core = require("@antv/l7-core");
|
|
|
10
10
|
var _BaseModel = _interopRequireDefault(require("../../core/BaseModel"));
|
|
11
11
|
var _interface = require("../../core/interface");
|
|
12
12
|
var _triangulation = require("../../core/triangulation");
|
|
13
|
-
var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
|
|
14
13
|
/* babel-plugin-inline-import '../shaders/radar/radar_frag.glsl' */
|
|
15
14
|
const pointFillFrag = "\nlayout(std140) uniform commonUniorm{\n float u_additive;\n float u_size_unit;\n float u_speed: 1.0;\n float u_time;\n};\nin vec4 v_data;\nin vec4 v_color;\nin float v_radius;\nin vec2 v_extrude;\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\n\nout vec4 outputColor;\n\nvoid main() {\n\n lowp float antialiasblur = v_data.z;\n float r = v_radius / (v_radius);\n\n float outer_df = sdCircle(v_data.xy, 1.0);\n float inner_df = sdCircle(v_data.xy, r);\n\n float opacity_t = smoothstep(0.0, antialiasblur, outer_df);\n\n outputColor = vec4(v_color.rgb, v_color.a);\n\n if(u_additive > 0.0) {\n outputColor *= opacity_t;\n } else {\n outputColor.a *= opacity_t;\n }\n\n if(outputColor.a > 0.0) {\n outputColor = filterColor(outputColor);\n }\n\n vec2 extrude = v_extrude;\n vec2 dir = normalize(extrude);\n vec2 baseDir = vec2(1.0, 0.0);\n float pi = 3.14159265359;\n float flag = sign(dir.y);\n float rades = dot(dir, baseDir);\n float radar_v = (flag - 1.0) * -0.5 * acos(rades)/pi;\n // simple AA\n if(radar_v > 0.99) {\n radar_v = 1.0 - (radar_v - 0.99)/0.01;\n }\n\n outputColor.a *= radar_v;\n}\n";
|
|
16
15
|
/* babel-plugin-inline-import '../shaders/radar/radar_vert.glsl' */
|
|
17
|
-
const pointFillVert = "layout(location =
|
|
16
|
+
const pointFillVert = "layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\nlayout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;\nlayout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;\nlayout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;\nlayout(location = ATTRIBUTE_LOCATION_EXTRUDE) in vec3 a_Extrude;\n\nlayout(std140) uniform commonUniorm {\n float u_additive;\n float u_size_unit;\n float u_speed: 1.0;\n float u_time;\n};\n\nout vec4 v_data;\nout vec4 v_color;\nout float v_radius;\nout vec2 v_extrude;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n float newSize = setPickingSize(a_Size);\n\n float time = u_time * u_speed;\n mat2 rotateMatrix = mat2(\n cos(time), sin(time),\n -sin(time), cos(time)\n );\n v_extrude = rotateMatrix * a_Extrude.xy;\n\n v_color = a_Color;\n v_color.a *= opacity;\n\n float blur = 0.0;\n float antialiasblur = -max(2.0 / u_DevicePixelRatio / a_Size, blur);\n\n if(u_size_unit == 1.) {\n newSize = newSize * u_PixelsPerMeter.z;\n }\n v_radius = newSize;\n\n vec2 offset = (a_Extrude.xy * (newSize));\n\n offset = project_pixel(offset);\n\n v_data = vec4(a_Extrude.x, a_Extrude.y, antialiasblur, -1.0);\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0), a_Position64Low);\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
18
17
|
class RadarModel extends _BaseModel.default {
|
|
18
|
+
get attributeLocation() {
|
|
19
|
+
return Object.assign(super.attributeLocation, {
|
|
20
|
+
MAX: super.attributeLocation.MAX,
|
|
21
|
+
SIZE: 9,
|
|
22
|
+
EXTRUDE: 10
|
|
23
|
+
});
|
|
24
|
+
}
|
|
19
25
|
getCommonUniformsInfo() {
|
|
20
26
|
const {
|
|
21
27
|
blend,
|
|
@@ -52,6 +58,7 @@ class RadarModel extends _BaseModel.default {
|
|
|
52
58
|
vertexShader: pointFillVert,
|
|
53
59
|
fragmentShader: pointFillFrag,
|
|
54
60
|
triangulation: _triangulation.PointFillTriangulation,
|
|
61
|
+
defines: _this2.getDefines(),
|
|
55
62
|
inject: _this2.getInject(),
|
|
56
63
|
depth: {
|
|
57
64
|
enable: false
|
|
@@ -66,12 +73,14 @@ class RadarModel extends _BaseModel.default {
|
|
|
66
73
|
return [option.enable ? 0 : 1.0, option.speed || 1, option.rings || 3, 0];
|
|
67
74
|
}
|
|
68
75
|
registerBuiltinAttributes() {
|
|
76
|
+
// 注册 Position 属性 64 位地位部分,经纬度数据开启双精度,避免大于 20层级以上出现数据偏移
|
|
77
|
+
this.registerPosition64LowAttribute();
|
|
69
78
|
this.styleAttributeService.registerStyleAttribute({
|
|
70
79
|
name: 'extrude',
|
|
71
80
|
type: _l7Core.AttributeType.Attribute,
|
|
72
81
|
descriptor: {
|
|
73
82
|
name: 'a_Extrude',
|
|
74
|
-
shaderLocation:
|
|
83
|
+
shaderLocation: this.attributeLocation.EXTRUDE,
|
|
75
84
|
buffer: {
|
|
76
85
|
// give the WebGL driver a hint that this buffer may change
|
|
77
86
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
@@ -92,7 +101,7 @@ class RadarModel extends _BaseModel.default {
|
|
|
92
101
|
name: 'size',
|
|
93
102
|
type: _l7Core.AttributeType.Attribute,
|
|
94
103
|
descriptor: {
|
|
95
|
-
shaderLocation:
|
|
104
|
+
shaderLocation: this.attributeLocation.SIZE,
|
|
96
105
|
name: 'a_Size',
|
|
97
106
|
buffer: {
|
|
98
107
|
// give the WebGL driver a hint that this buffer may change
|
|
@@ -7,6 +7,22 @@ export declare function TextTrianglation(feature: IEncodeFeature): {
|
|
|
7
7
|
size: number;
|
|
8
8
|
};
|
|
9
9
|
export default class TextModel extends BaseModel {
|
|
10
|
+
protected get attributeLocation(): {
|
|
11
|
+
readonly POSITION: 0;
|
|
12
|
+
readonly POSITION_64LOW: 1;
|
|
13
|
+
readonly COLOR: 2;
|
|
14
|
+
readonly PICKING_COLOR: 3;
|
|
15
|
+
readonly STROKE: 4;
|
|
16
|
+
readonly OPACITY: 5;
|
|
17
|
+
readonly OFFSETS: 6;
|
|
18
|
+
readonly ROTATION: 7;
|
|
19
|
+
readonly MAX: 8;
|
|
20
|
+
} & Record<string, number> & {
|
|
21
|
+
MAX: 8;
|
|
22
|
+
SIZE: number;
|
|
23
|
+
TEXT_OFFSETS: number;
|
|
24
|
+
UV: number;
|
|
25
|
+
};
|
|
10
26
|
glyphInfo: IEncodeFeature[];
|
|
11
27
|
glyphInfoMap: {
|
|
12
28
|
[key: string]: {
|
package/lib/point/models/text.js
CHANGED
|
@@ -12,13 +12,12 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
12
12
|
var _l7Core = require("@antv/l7-core");
|
|
13
13
|
var _l7Utils = require("@antv/l7-utils");
|
|
14
14
|
var _BaseModel = _interopRequireDefault(require("../../core/BaseModel"));
|
|
15
|
-
var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
|
|
16
15
|
var _collisionIndex = _interopRequireDefault(require("../../utils/collision-index"));
|
|
17
16
|
var _symbolLayout = require("../../utils/symbol-layout");
|
|
18
17
|
/* babel-plugin-inline-import '../shaders/text/text_frag.glsl' */
|
|
19
18
|
const textFrag = "#define SDF_PX 8.0\n#define EDGE_GAMMA 0.105\n#define FONT_SIZE 48.0\n\nuniform sampler2D u_sdf_map;\nlayout(std140) uniform commonUniforms {\n vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];\n vec2 u_sdf_map_size;\n float u_raisingHeight: 0.0;\n float u_stroke_width : 2;\n float u_gamma_scale : 0.5;\n float u_halo_blur : 0.5;\n};\n\nin vec2 v_uv;\nin float v_gamma_scale;\nin vec4 v_color;\nin vec4 v_stroke_color;\nin float v_fontScale;\n\nout vec4 outputColor;\n\n#pragma include \"picking\"\nvoid main() {\n // get style data mapping\n\n // get sdf from atlas\n float dist = texture(SAMPLER_2D(u_sdf_map), v_uv).a;\n\n lowp float buff = (6.0 - u_stroke_width / v_fontScale) / SDF_PX;\n highp float gamma = (u_halo_blur * 1.19 / SDF_PX + EDGE_GAMMA) / (v_fontScale * u_gamma_scale) / 1.0;\n\n highp float gamma_scaled = gamma * v_gamma_scale;\n\n highp float alpha = smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist);\n\n outputColor = mix(v_color, v_stroke_color, smoothstep(0., 0.5, 1.- dist));\n\n outputColor.a *= alpha;\n // \u4F5C\u4E3A mask \u6A21\u677F\u65F6\u9700\u8981\u4E22\u5F03\u900F\u660E\u7684\u50CF\u7D20\n if (outputColor.a < 0.01) {\n discard;\n }\n outputColor = filterColor(outputColor);\n}\n";
|
|
20
19
|
/* babel-plugin-inline-import '../shaders/text/text_vert.glsl' */
|
|
21
|
-
const textVert = "#define SDF_PX 8.0\n#define EDGE_GAMMA 0.105\n#define FONT_SIZE 24.0\n\nlayout(location =
|
|
20
|
+
const textVert = "#define SDF_PX 8.0\n#define EDGE_GAMMA 0.105\n#define FONT_SIZE 24.0\n\nlayout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\nlayout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;\nlayout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;\nlayout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;\nlayout(location = ATTRIBUTE_LOCATION_TEXT_OFFSETS) in vec2 a_textOffsets;\nlayout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_tex;\n\nlayout(std140) uniform commonUniforms {\n vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];\n vec2 u_sdf_map_size;\n float u_raisingHeight: 0.0;\n float u_stroke_width : 2;\n float u_gamma_scale : 0.5;\n float u_halo_blur : 0.5;\n};\n\nout vec2 v_uv;\nout float v_gamma_scale;\nout vec4 v_color;\nout vec4 v_stroke_color;\nout float v_fontScale;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n#pragma include \"rotation_2d\"\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n v_uv = a_tex / u_sdf_map_size;\n\n\n\n v_color = vec4(a_Color.xyz, a_Color.w * opacity);\n v_stroke_color = vec4(u_stroke_color.xyz, u_stroke_color.w * opacity);\n\n // \u6587\u672C\u7F29\u653E\u6BD4\u4F8B\n float fontScale = a_Size / FONT_SIZE;\n v_fontScale = fontScale;\n\n vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low);\n // vec4 projected_position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n\n vec2 offset = rotate_matrix(a_textOffsets,rotation);\n\n // gl_Position = vec4(projected_position.xy / projected_position.w + rotation_matrix * a_textOffsets * fontScale / u_ViewportSize * 2.0 * u_DevicePixelRatio, 0.0, 1.0);\n\n float raiseHeight = u_raisingHeight;\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n raiseHeight = u_raisingHeight * mapboxZoomScale;\n }\n\n vec4 projected_position = project_common_position_to_clipspace(vec4(project_pos.xyz + vec3(0.0, 0.0, raiseHeight), 1.0));\n\n gl_Position = vec4(\n projected_position.xy / projected_position.w + offset * fontScale / u_ViewportSize * 2.0 * u_DevicePixelRatio, 0.0, 1.0);\n v_gamma_scale = gl_Position.w;\n setPickingColor(a_PickingColor);\n\n}\n";
|
|
22
21
|
const {
|
|
23
22
|
isEqual
|
|
24
23
|
} = _l7Utils.lodashUtil;
|
|
@@ -69,6 +68,14 @@ class TextModel extends _BaseModel.default {
|
|
|
69
68
|
yield _this.reBuildModel();
|
|
70
69
|
}));
|
|
71
70
|
}
|
|
71
|
+
get attributeLocation() {
|
|
72
|
+
return Object.assign(super.attributeLocation, {
|
|
73
|
+
MAX: super.attributeLocation.MAX,
|
|
74
|
+
SIZE: 9,
|
|
75
|
+
TEXT_OFFSETS: 10,
|
|
76
|
+
UV: 11
|
|
77
|
+
});
|
|
78
|
+
}
|
|
72
79
|
getUninforms() {
|
|
73
80
|
const commoninfo = this.getCommonUniformsInfo();
|
|
74
81
|
const attributeInfo = this.getUniformsBufferInfo(this.getStyleAttribute());
|
|
@@ -132,6 +139,7 @@ class TextModel extends _BaseModel.default {
|
|
|
132
139
|
moduleName: 'pointText',
|
|
133
140
|
vertexShader: textVert,
|
|
134
141
|
fragmentShader: textFrag,
|
|
142
|
+
defines: _this3.getDefines(),
|
|
135
143
|
inject: _this3.getInject(),
|
|
136
144
|
triangulation: TextTrianglation.bind(_this3),
|
|
137
145
|
depth: {
|
|
@@ -187,11 +195,13 @@ class TextModel extends _BaseModel.default {
|
|
|
187
195
|
this.layer.off('remapping', this.mapping);
|
|
188
196
|
}
|
|
189
197
|
registerBuiltinAttributes() {
|
|
198
|
+
// 注册 Position 属性 64 位地位部分,经纬度数据开启双精度,避免大于 20层级以上出现数据偏移
|
|
199
|
+
this.registerPosition64LowAttribute();
|
|
190
200
|
this.styleAttributeService.registerStyleAttribute({
|
|
191
201
|
name: 'textOffsets',
|
|
192
202
|
type: _l7Core.AttributeType.Attribute,
|
|
193
203
|
descriptor: {
|
|
194
|
-
shaderLocation:
|
|
204
|
+
shaderLocation: this.attributeLocation.TEXT_OFFSETS,
|
|
195
205
|
name: 'a_textOffsets',
|
|
196
206
|
// 文字偏移量
|
|
197
207
|
buffer: {
|
|
@@ -211,7 +221,7 @@ class TextModel extends _BaseModel.default {
|
|
|
211
221
|
type: _l7Core.AttributeType.Attribute,
|
|
212
222
|
descriptor: {
|
|
213
223
|
name: 'a_tex',
|
|
214
|
-
shaderLocation:
|
|
224
|
+
shaderLocation: this.attributeLocation.UV,
|
|
215
225
|
buffer: {
|
|
216
226
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
217
227
|
data: [],
|
|
@@ -223,13 +233,14 @@ class TextModel extends _BaseModel.default {
|
|
|
223
233
|
}
|
|
224
234
|
}
|
|
225
235
|
});
|
|
236
|
+
|
|
226
237
|
// point layer size;
|
|
227
238
|
this.styleAttributeService.registerStyleAttribute({
|
|
228
239
|
name: 'size',
|
|
229
240
|
type: _l7Core.AttributeType.Attribute,
|
|
230
241
|
descriptor: {
|
|
231
242
|
name: 'a_Size',
|
|
232
|
-
shaderLocation:
|
|
243
|
+
shaderLocation: this.attributeLocation.SIZE,
|
|
233
244
|
buffer: {
|
|
234
245
|
// give the WebGL driver a hint that this buffer may change
|
|
235
246
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
@@ -369,9 +380,6 @@ class TextModel extends _BaseModel.default {
|
|
|
369
380
|
// feature.centroid = calculteCentroid(coordinates);
|
|
370
381
|
|
|
371
382
|
feature.centroid = (0, _l7Utils.calculateCentroid)(feature.coordinates);
|
|
372
|
-
|
|
373
|
-
// 此时地图高德2.0 originCentroid == centroid
|
|
374
|
-
feature.originCentroid = feature.version === 'GAODE2.x' ? (0, _l7Utils.calculateCentroid)(feature.originCoordinates) : feature.originCentroid = feature.centroid;
|
|
375
383
|
this.glyphInfoMap[id] = {
|
|
376
384
|
shaping,
|
|
377
385
|
glyphQuads,
|
|
@@ -421,9 +429,7 @@ class TextModel extends _BaseModel.default {
|
|
|
421
429
|
shaping,
|
|
422
430
|
id = 0
|
|
423
431
|
} = feature;
|
|
424
|
-
|
|
425
|
-
// const centroid = feature.originCentroid as [number, number];
|
|
426
|
-
const centroid = feature.version === 'GAODE2.x' ? feature.originCentroid : feature.centroid;
|
|
432
|
+
const centroid = feature.centroid;
|
|
427
433
|
const size = feature.size;
|
|
428
434
|
const fontScale = size / 16;
|
|
429
435
|
const pixels = this.mapService.lngLatToContainer(centroid);
|
|
@@ -492,6 +498,7 @@ class TextModel extends _BaseModel.default {
|
|
|
492
498
|
vertexShader: textVert,
|
|
493
499
|
fragmentShader: textFrag,
|
|
494
500
|
triangulation: TextTrianglation.bind(_this5),
|
|
501
|
+
defines: _this5.getDefines(),
|
|
495
502
|
inject: _this5.getInject(),
|
|
496
503
|
depth: {
|
|
497
504
|
enable: false
|