@antv/l7-layers 2.21.9-beta.0 → 2.21.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/citybuliding/models/build.d.ts +0 -16
- package/es/citybuliding/models/build.js +20 -18
- package/es/citybuliding/shaders/build_frag.glsl +6 -6
- package/es/citybuliding/shaders/build_vert.glsl +14 -8
- package/es/core/BaseLayer.js +8 -12
- package/es/core/BaseModel.d.ts +2 -15
- package/es/core/BaseModel.js +62 -94
- package/es/core/CommonStyleAttribute.d.ts +18 -14
- package/es/core/CommonStyleAttribute.js +67 -23
- package/es/core/triangulation.js +39 -13
- package/es/earth/models/atmosphere.d.ts +0 -15
- package/es/earth/models/atmosphere.js +24 -30
- package/es/earth/models/base.d.ts +0 -15
- package/es/earth/models/base.js +24 -30
- package/es/earth/models/bloomsphere.d.ts +0 -15
- package/es/earth/models/bloomsphere.js +24 -30
- package/es/earth/shaders/atmosphere/atmosphere_vert.glsl +5 -7
- package/es/earth/shaders/base/base_vert.glsl +3 -3
- package/es/earth/shaders/bloomshpere/bloomsphere_vert.glsl +4 -5
- package/es/geometry/models/billboard.d.ts +0 -15
- package/es/geometry/models/billboard.js +8 -14
- package/es/geometry/models/plane.d.ts +0 -14
- package/es/geometry/models/plane.js +10 -10
- package/es/geometry/models/sprite.js +9 -3
- package/es/geometry/shaders/billboard_vert.glsl +25 -28
- package/es/geometry/shaders/plane_vert.glsl +6 -6
- package/es/geometry/shaders/sprite_vert.glsl +9 -7
- package/es/heatmap/models/grid.d.ts +0 -14
- package/es/heatmap/models/grid.js +3 -10
- package/es/heatmap/models/grid3d.d.ts +0 -16
- package/es/heatmap/models/grid3d.js +6 -14
- package/es/heatmap/models/heatmap.d.ts +1 -20
- package/es/heatmap/models/heatmap.js +83 -96
- package/es/heatmap/models/hexagon.d.ts +0 -14
- package/es/heatmap/models/hexagon.js +3 -9
- package/es/heatmap/shaders/grid/grid_vert.glsl +42 -30
- package/es/heatmap/shaders/grid3d/grid_3d_vert.glsl +26 -14
- package/es/heatmap/shaders/heatmap/heatmap_3d_vert.glsl +16 -19
- package/es/heatmap/shaders/heatmap/heatmap_framebuffer_vert.glsl +22 -16
- package/es/heatmap/shaders/heatmap/heatmap_vert.glsl +4 -3
- package/es/heatmap/shaders/hexagon/hexagon_vert.glsl +23 -13
- package/es/image/models/image.d.ts +0 -14
- package/es/image/models/image.js +3 -11
- package/es/image/shaders/image_vert.glsl +6 -7
- package/es/line/models/arc.d.ts +0 -18
- package/es/line/models/arc.js +8 -57
- package/es/line/models/arc_3d.d.ts +0 -18
- package/es/line/models/arc_3d.js +7 -55
- package/es/line/models/flow.d.ts +0 -17
- package/es/line/models/flow.js +7 -35
- package/es/line/models/great_circle.d.ts +0 -17
- package/es/line/models/great_circle.js +6 -34
- package/es/line/models/line.d.ts +0 -17
- package/es/line/models/line.js +8 -17
- package/es/line/models/simple_line.d.ts +0 -14
- package/es/line/models/simple_line.js +47 -12
- package/es/line/models/wall.d.ts +0 -17
- package/es/line/models/wall.js +48 -22
- package/es/line/shaders/arc/line_arc_vert.glsl +48 -42
- package/es/line/shaders/arc3d/line_arc_3d_vert.glsl +20 -15
- package/es/line/shaders/flow/flow_line_vert.glsl +48 -30
- package/es/line/shaders/greatCircle/line_arc_great_circle_vert.glsl +72 -56
- package/es/line/shaders/line/line_vert.glsl +48 -31
- package/es/line/shaders/simple/simpleline_vert.glsl +23 -18
- package/es/line/shaders/wall/wall_vert.glsl +45 -36
- package/es/mask/models/fill.js +1 -2
- package/es/mask/shaders/mask_vert.glsl +7 -2
- package/es/plugins/DataMappingPlugin.d.ts +1 -0
- package/es/plugins/DataMappingPlugin.js +24 -1
- package/es/plugins/PixelPickingPlugin.js +2 -2
- package/es/plugins/RegisterStyleAttributePlugin.d.ts +1 -0
- package/es/plugins/RegisterStyleAttributePlugin.js +25 -3
- package/es/plugins/ShaderUniformPlugin.d.ts +5 -0
- package/es/plugins/ShaderUniformPlugin.js +34 -2
- package/es/point/models/billboard_point.d.ts +0 -14
- package/es/point/models/billboard_point.js +3 -11
- package/es/point/models/earthExtrude.d.ts +0 -16
- package/es/point/models/earthExtrude.js +8 -15
- package/es/point/models/earthFill.d.ts +0 -16
- package/es/point/models/earthFill.js +5 -13
- package/es/point/models/extrude.d.ts +0 -16
- package/es/point/models/extrude.js +12 -19
- package/es/point/models/fill.d.ts +0 -16
- package/es/point/models/fill.js +5 -16
- package/es/point/models/fillImage.d.ts +0 -16
- package/es/point/models/fillImage.js +16 -16
- package/es/point/models/image.d.ts +0 -15
- package/es/point/models/image.js +4 -14
- package/es/point/models/normal.d.ts +0 -14
- package/es/point/models/normal.js +3 -11
- package/es/point/models/radar.d.ts +0 -15
- package/es/point/models/radar.js +4 -13
- package/es/point/models/text.d.ts +0 -16
- package/es/point/models/text.js +11 -18
- package/es/point/shaders/billboard/billboard_point_vert.glsl +13 -10
- package/es/point/shaders/earthExtrude/earthExtrude_vert.glsl +25 -15
- package/es/point/shaders/earthFill/earthFill_vert.glsl +6 -6
- package/es/point/shaders/extrude/extrude_vert.glsl +39 -35
- package/es/point/shaders/fill/fill_vert.glsl +14 -12
- package/es/point/shaders/fillImage/fillImage_vert.glsl +28 -16
- package/es/point/shaders/image/image_vert.glsl +12 -15
- package/es/point/shaders/normal/normal_vert.glsl +10 -7
- package/es/point/shaders/radar/radar_vert.glsl +11 -11
- package/es/point/shaders/text/text_vert.glsl +9 -10
- package/es/polygon/models/extrude.d.ts +0 -16
- package/es/polygon/models/extrude.js +26 -26
- package/es/polygon/models/extrusion.d.ts +0 -16
- package/es/polygon/models/extrusion.js +4 -34
- package/es/polygon/models/fill.d.ts +0 -14
- package/es/polygon/models/fill.js +4 -12
- package/es/polygon/models/ocean.d.ts +0 -14
- package/es/polygon/models/ocean.js +6 -11
- package/es/polygon/models/water.d.ts +0 -14
- package/es/polygon/models/water.js +6 -11
- package/es/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +15 -17
- package/es/polygon/shaders/extrude/polygon_extrude_vert.glsl +20 -22
- package/es/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +17 -17
- package/es/polygon/shaders/extrusion/polygon_extrusion_vert.glsl +8 -8
- package/es/polygon/shaders/fill/fill_linear_vert.glsl +6 -7
- package/es/polygon/shaders/fill/fill_vert.glsl +12 -10
- package/es/polygon/shaders/ocean/ocean_vert.glsl +4 -3
- package/es/polygon/shaders/water/polygon_water_vert.glsl +5 -5
- package/es/raster/index.d.ts +1 -1
- package/es/raster/index.js +1 -1
- package/es/raster/models/raster.d.ts +0 -14
- package/es/raster/models/raster.js +3 -12
- package/es/raster/models/rasterRgb.d.ts +0 -14
- package/es/raster/models/rasterRgb.js +3 -12
- package/es/raster/models/rasterTerrainRgb.d.ts +0 -14
- package/es/raster/models/rasterTerrainRgb.js +3 -11
- package/es/raster/shaders/raster/raster_2d_vert.glsl +6 -6
- package/es/raster/shaders/rgb/raster_rgb_vert.glsl +11 -11
- package/es/raster/shaders/terrain/terrain_rgb_vert.glsl +11 -11
- package/es/tile/core/BaseLayer.js +16 -0
- package/es/tile/tile/Tile.d.ts +0 -2
- package/es/utils/extrude_polyline.d.ts +15 -0
- package/es/utils/extrude_polyline.js +217 -0
- package/es/utils/multiPassRender.js +2 -10
- package/es/wind/models/wind.d.ts +0 -14
- package/es/wind/models/wind.js +1 -9
- package/es/wind/shaders/wind_vert.glsl +5 -6
- package/lib/citybuliding/models/build.d.ts +0 -16
- package/lib/citybuliding/models/build.js +20 -18
- package/lib/citybuliding/shaders/build_frag.glsl +6 -6
- package/lib/citybuliding/shaders/build_vert.glsl +14 -8
- package/lib/core/BaseLayer.js +8 -12
- package/lib/core/BaseModel.d.ts +2 -15
- package/lib/core/BaseModel.js +60 -92
- package/lib/core/CommonStyleAttribute.d.ts +18 -14
- package/lib/core/CommonStyleAttribute.js +68 -23
- package/lib/core/triangulation.js +39 -13
- package/lib/earth/models/atmosphere.d.ts +0 -15
- package/lib/earth/models/atmosphere.js +24 -30
- package/lib/earth/models/base.d.ts +0 -15
- package/lib/earth/models/base.js +24 -30
- package/lib/earth/models/bloomsphere.d.ts +0 -15
- package/lib/earth/models/bloomsphere.js +24 -30
- package/lib/earth/shaders/atmosphere/atmosphere_vert.glsl +5 -7
- package/lib/earth/shaders/base/base_vert.glsl +3 -3
- package/lib/earth/shaders/bloomshpere/bloomsphere_vert.glsl +4 -5
- package/lib/geometry/models/billboard.d.ts +0 -15
- package/lib/geometry/models/billboard.js +8 -14
- package/lib/geometry/models/plane.d.ts +0 -14
- package/lib/geometry/models/plane.js +10 -10
- package/lib/geometry/models/sprite.js +9 -3
- package/lib/geometry/shaders/billboard_vert.glsl +25 -28
- package/lib/geometry/shaders/plane_vert.glsl +6 -6
- package/lib/geometry/shaders/sprite_vert.glsl +9 -7
- package/lib/heatmap/models/grid.d.ts +0 -14
- package/lib/heatmap/models/grid.js +3 -10
- package/lib/heatmap/models/grid3d.d.ts +0 -16
- package/lib/heatmap/models/grid3d.js +6 -14
- package/lib/heatmap/models/heatmap.d.ts +1 -20
- package/lib/heatmap/models/heatmap.js +82 -95
- package/lib/heatmap/models/hexagon.d.ts +0 -14
- package/lib/heatmap/models/hexagon.js +3 -9
- package/lib/heatmap/shaders/grid/grid_vert.glsl +42 -30
- package/lib/heatmap/shaders/grid3d/grid_3d_vert.glsl +26 -14
- package/lib/heatmap/shaders/heatmap/heatmap_3d_vert.glsl +16 -19
- package/lib/heatmap/shaders/heatmap/heatmap_framebuffer_vert.glsl +22 -16
- package/lib/heatmap/shaders/heatmap/heatmap_vert.glsl +4 -3
- package/lib/heatmap/shaders/hexagon/hexagon_vert.glsl +23 -13
- package/lib/image/models/image.d.ts +0 -14
- package/lib/image/models/image.js +3 -11
- package/lib/image/shaders/image_vert.glsl +6 -7
- package/lib/line/models/arc.d.ts +0 -18
- package/lib/line/models/arc.js +7 -56
- package/lib/line/models/arc_3d.d.ts +0 -18
- package/lib/line/models/arc_3d.js +7 -55
- package/lib/line/models/flow.d.ts +0 -17
- package/lib/line/models/flow.js +7 -35
- package/lib/line/models/great_circle.d.ts +0 -17
- package/lib/line/models/great_circle.js +5 -33
- package/lib/line/models/line.d.ts +0 -17
- package/lib/line/models/line.js +8 -17
- package/lib/line/models/simple_line.d.ts +0 -14
- package/lib/line/models/simple_line.js +47 -12
- package/lib/line/models/wall.d.ts +0 -17
- package/lib/line/models/wall.js +48 -22
- package/lib/line/shaders/arc/line_arc_vert.glsl +48 -42
- package/lib/line/shaders/arc3d/line_arc_3d_vert.glsl +20 -15
- package/lib/line/shaders/flow/flow_line_vert.glsl +48 -30
- package/lib/line/shaders/greatCircle/line_arc_great_circle_vert.glsl +72 -56
- package/lib/line/shaders/line/line_vert.glsl +48 -31
- package/lib/line/shaders/simple/simpleline_vert.glsl +23 -18
- package/lib/line/shaders/wall/wall_vert.glsl +45 -36
- package/lib/mask/models/fill.js +1 -2
- package/lib/mask/shaders/mask_vert.glsl +7 -2
- package/lib/plugins/DataMappingPlugin.d.ts +1 -0
- package/lib/plugins/DataMappingPlugin.js +23 -0
- package/lib/plugins/PixelPickingPlugin.js +1 -1
- package/lib/plugins/RegisterStyleAttributePlugin.d.ts +1 -0
- package/lib/plugins/RegisterStyleAttributePlugin.js +24 -2
- package/lib/plugins/ShaderUniformPlugin.d.ts +5 -0
- package/lib/plugins/ShaderUniformPlugin.js +34 -2
- package/lib/point/models/billboard_point.d.ts +0 -14
- package/lib/point/models/billboard_point.js +3 -11
- package/lib/point/models/earthExtrude.d.ts +0 -16
- package/lib/point/models/earthExtrude.js +7 -14
- package/lib/point/models/earthFill.d.ts +0 -16
- package/lib/point/models/earthFill.js +5 -13
- package/lib/point/models/extrude.d.ts +0 -16
- package/lib/point/models/extrude.js +11 -18
- package/lib/point/models/fill.d.ts +0 -16
- package/lib/point/models/fill.js +5 -16
- package/lib/point/models/fillImage.d.ts +0 -16
- package/lib/point/models/fillImage.js +16 -16
- package/lib/point/models/image.d.ts +0 -15
- package/lib/point/models/image.js +4 -14
- package/lib/point/models/normal.d.ts +0 -14
- package/lib/point/models/normal.js +3 -11
- package/lib/point/models/radar.d.ts +0 -15
- package/lib/point/models/radar.js +4 -13
- package/lib/point/models/text.d.ts +0 -16
- package/lib/point/models/text.js +11 -18
- package/lib/point/shaders/billboard/billboard_point_vert.glsl +13 -10
- package/lib/point/shaders/earthExtrude/earthExtrude_vert.glsl +25 -15
- package/lib/point/shaders/earthFill/earthFill_vert.glsl +6 -6
- package/lib/point/shaders/extrude/extrude_vert.glsl +39 -35
- package/lib/point/shaders/fill/fill_vert.glsl +14 -12
- package/lib/point/shaders/fillImage/fillImage_vert.glsl +28 -16
- package/lib/point/shaders/image/image_vert.glsl +12 -15
- package/lib/point/shaders/normal/normal_vert.glsl +10 -7
- package/lib/point/shaders/radar/radar_vert.glsl +11 -11
- package/lib/point/shaders/text/text_vert.glsl +9 -10
- package/lib/polygon/models/extrude.d.ts +0 -16
- package/lib/polygon/models/extrude.js +25 -25
- package/lib/polygon/models/extrusion.d.ts +0 -16
- package/lib/polygon/models/extrusion.js +4 -34
- package/lib/polygon/models/fill.d.ts +0 -14
- package/lib/polygon/models/fill.js +4 -12
- package/lib/polygon/models/ocean.d.ts +0 -14
- package/lib/polygon/models/ocean.js +6 -11
- package/lib/polygon/models/water.d.ts +0 -14
- package/lib/polygon/models/water.js +6 -11
- package/lib/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +15 -17
- package/lib/polygon/shaders/extrude/polygon_extrude_vert.glsl +20 -22
- package/lib/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +17 -17
- package/lib/polygon/shaders/extrusion/polygon_extrusion_vert.glsl +8 -8
- package/lib/polygon/shaders/fill/fill_linear_vert.glsl +6 -7
- package/lib/polygon/shaders/fill/fill_vert.glsl +12 -10
- package/lib/polygon/shaders/ocean/ocean_vert.glsl +4 -3
- package/lib/polygon/shaders/water/polygon_water_vert.glsl +5 -5
- package/lib/raster/index.d.ts +1 -1
- package/lib/raster/index.js +2 -2
- package/lib/raster/models/raster.d.ts +0 -14
- package/lib/raster/models/raster.js +3 -12
- package/lib/raster/models/rasterRgb.d.ts +0 -14
- package/lib/raster/models/rasterRgb.js +3 -12
- package/lib/raster/models/rasterTerrainRgb.d.ts +0 -14
- package/lib/raster/models/rasterTerrainRgb.js +3 -11
- package/lib/raster/shaders/raster/raster_2d_vert.glsl +6 -6
- package/lib/raster/shaders/rgb/raster_rgb_vert.glsl +11 -11
- package/lib/raster/shaders/terrain/terrain_rgb_vert.glsl +11 -11
- package/lib/tile/core/BaseLayer.js +16 -0
- package/lib/tile/tile/Tile.d.ts +0 -2
- package/lib/utils/extrude_polyline.d.ts +15 -0
- package/lib/utils/extrude_polyline.js +217 -0
- package/lib/utils/multiPassRender.js +2 -10
- package/lib/wind/models/wind.d.ts +0 -14
- package/lib/wind/models/wind.js +1 -9
- package/lib/wind/shaders/wind_vert.glsl +5 -6
- package/package.json +9 -9
|
@@ -10,12 +10,13 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
10
10
|
var _l7Core = require("@antv/l7-core");
|
|
11
11
|
var _l7Utils = require("@antv/l7-utils");
|
|
12
12
|
var _BaseModel = _interopRequireDefault(require("../../core/BaseModel"));
|
|
13
|
+
var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
|
|
13
14
|
var _triangulation = require("../../core/triangulation");
|
|
14
15
|
var _utils = require("../../earth/utils");
|
|
15
16
|
/* babel-plugin-inline-import '../shaders/earthExtrude/earthExtrude_frag.glsl' */
|
|
16
17
|
const pointExtrudeFrag = "precision highp float;\nin vec4 v_color;\n\n#pragma include \"picking\"\n\nlayout(std140) uniform commonUniform {\n vec4 u_sourceColor;\n vec4 u_targetColor;\n float u_linearColor: 0;\n float u_heightfixed: 0.0; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\n float u_globel;\n float u_r;\n float u_pickLight: 0.0;\n float u_opacitylinear: 0.0;\n float u_opacitylinear_dir: 1.0;\n float u_lightEnable: 1.0;\n};\nin float v_lightWeight;\nin float v_barLinearZ;\nout vec4 outputColor;\nvoid main() {\n\n outputColor = v_color;\n\n // \u5F00\u542F\u900F\u660E\u5EA6\u6E10\u53D8\n if(u_opacitylinear > 0.0) {\n outputColor.a *= u_opacitylinear_dir > 0.0 ? (1.0 - v_barLinearZ): v_barLinearZ;\n }\n\n // picking\n if(u_pickLight > 0.0) {\n outputColor = filterColorAlpha(outputColor, v_lightWeight);\n } else {\n outputColor = filterColor(outputColor);\n }\n}\n";
|
|
17
18
|
/* babel-plugin-inline-import '../shaders/earthExtrude/earthExtrude_vert.glsl' */
|
|
18
|
-
const pointExtrudeVert = "precision highp float;\n\n#define pi 3.1415926535\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\nlayout(location =
|
|
19
|
+
const pointExtrudeVert = "precision highp float;\n\n#define pi 3.1415926535\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\n\nlayout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 9) in vec3 a_Size;\nlayout(location = 11) in vec3 a_Pos;\nlayout(location = 13) in vec3 a_Normal;\n\n\nlayout(std140) uniform commonUniform {\n vec4 u_sourceColor;\n vec4 u_targetColor;\n float u_linearColor: 0;\n float u_heightfixed: 0.0; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\n float u_globel;\n float u_r;\n float u_pickLight: 0.0;\n float u_opacitylinear: 0.0;\n float u_opacitylinear_dir: 1.0;\n float u_lightEnable: 1.0;\n};\n\nout vec4 v_color;\nout float v_lightWeight;\nout float v_barLinearZ;\n// \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nfloat getYRadian(float x, float z) {\n if(x > 0.0 && z > 0.0) {\n return atan(x/z);\n } else if(x > 0.0 && z <= 0.0){\n return atan(-z/x) + pi/2.0;\n } else if(x <= 0.0 && z <= 0.0) {\n return pi + atan(x/z); //atan(x/z) + \n } else {\n return atan(z/-x) + pi*3.0/2.0;\n }\n}\n\nfloat getXRadian(float y, float r) {\n return atan(y/r);\n}\n\nvoid main() {\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n vec3 size = a_Size * a_Position;\n\n // a_Position.z \u662F\u5728\u6784\u5EFA\u7F51\u683C\u7684\u65F6\u5019\u4F20\u5165\u7684\u6807\u51C6\u503C 0 - 1\uFF0C\u5728\u63D2\u503C\u5668\u63D2\u503C\u53EF\u4EE5\u83B7\u53D6 0\uFF5E1 \u7EBF\u6027\u6E10\u53D8\u7684\u503C\n v_barLinearZ = a_Position.z;\n\n vec3 offset = size; // \u63A7\u5236\u5706\u67F1\u4F53\u7684\u5927\u5C0F - \u4ECE\u6807\u51C6\u5355\u4F4D\u5706\u67F1\u4F53\u8FDB\u884C\u504F\u79FB\n if(u_heightfixed < 1.0) { // \u5706\u67F1\u4F53\u4E0D\u56FA\u5B9A\u9AD8\u5EA6\n \n if (u_CoordinateSystem == COORDINATE_SYSTEM_P20 || u_CoordinateSystem == COORDINATE_SYSTEM_P20_OFFSET) {\n // P20 \u5750\u6807\u7CFB\u4E0B\uFF0C\u4E3A\u4E86\u548C Web \u58A8\u5361\u6258\u5750\u6807\u7CFB\u7EDF\u4E00\uFF0Czoom \u9ED8\u8BA4\u51CF1\n offset = offset * pow(2.0, (19.0 - u_Zoom));\n }\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {\n // P20_2 \u5750\u6807\u7CFB\u4E0B\uFF0C\u4E3A\u4E86\u548C Web \u58A8\u5361\u6258\u5750\u6807\u7CFB\u7EDF\u4E00\uFF0Czoom \u9ED8\u8BA4\u51CF3\n offset = offset * pow(2.0, (19.0 - 3.0 - u_Zoom));\n }\n } else {// \u5706\u67F1\u4F53\u56FA\u5B9A\u9AD8\u5EA6 \uFF08 \u5904\u7406 mapbox \uFF09\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n offset *= 4.0/pow(2.0, 21.0 - u_Zoom);\n }\n }\n\n\n vec4 project_pos = project_position(vec4(a_Pos.xy, 0., 1.0));\n\n // u_r \u63A7\u5236\u5706\u67F1\u7684\u751F\u957F\n vec4 pos = vec4(project_pos.xy + offset.xy, offset.z * u_r, 1.0);\n\n // \u5706\u67F1\u5149\u7167\u6548\u679C\n float lightWeight = 1.0;\n if(u_lightEnable > 0.0) { // \u53D6\u6D88\u4E09\u5143\u8868\u8FBE\u5F0F\uFF0C\u589E\u5F3A\u5065\u58EE\u6027\n lightWeight = calc_lighting(pos);\n }\n v_lightWeight = lightWeight;\n // \u8BBE\u7F6E\u5706\u67F1\u7684\u5E95\u8272\n if(u_linearColor == 1.0) { // \u4F7F\u7528\u6E10\u53D8\u989C\u8272\n v_color = mix(u_sourceColor, u_targetColor, v_barLinearZ);\n v_color.rgb *= lightWeight;\n } else { // \u4F7F\u7528 color \u65B9\u6CD5\u4F20\u5165\u7684\u989C\u8272\n v_color = a_Color;\n }\n v_color.a *= u_opacity;\n\n \n // \u5728\u5730\u7403\u6A21\u5F0F\u4E0B\uFF0C\u5C06\u539F\u672C\u5782\u76F4\u4E8E xy \u5E73\u9762\u7684\u5706\u67F1\u8C03\u6574\u59FF\u6001\u5230\u9002\u5E94\u5706\u7684\u89D2\u5EA6\n //\u65CB\u8F6C\u77E9\u9635mx\uFF0C\u521B\u5EFA\u7ED5x\u8F74\u65CB\u8F6C\u77E9\u9635\n float r = sqrt(a_Pos.z*a_Pos.z + a_Pos.x*a_Pos.x);\n float xRadian = getXRadian(a_Pos.y, r);\n float xcos = cos(xRadian);//\u6C42\u89E3\u65CB\u8F6C\u89D2\u5EA6\u4F59\u5F26\u503C\n float xsin = sin(xRadian);//\u6C42\u89E3\u65CB\u8F6C\u89D2\u5EA6\u6B63\u5F26\u503C\n mat4 mx = mat4(\n 1,0,0,0, \n 0,xcos,-xsin,0, \n 0,xsin,xcos,0, \n 0,0,0,1);\n\n //\u65CB\u8F6C\u77E9\u9635my\uFF0C\u521B\u5EFA\u7ED5y\u8F74\u65CB\u8F6C\u77E9\u9635\n float yRadian = getYRadian(a_Pos.x, a_Pos.z);\n float ycos = cos(yRadian);//\u6C42\u89E3\u65CB\u8F6C\u89D2\u5EA6\u4F59\u5F26\u503C\n float ysin = sin(yRadian);//\u6C42\u89E3\u65CB\u8F6C\u89D2\u5EA6\u6B63\u5F26\u503C\n mat4 my = mat4(\n ycos,0,-ysin,0, \n 0,1,0,0, \n ysin,0,ycos,0, \n 0,0,0,1);\n\n gl_Position = u_ViewProjectionMatrix * vec4(( my * mx * vec4(a_Position * a_Size, 1.0)).xyz + a_Pos, 1.0);\n \n\n setPickingColor(a_PickingColor);\n}\n";
|
|
19
20
|
const {
|
|
20
21
|
isNumber
|
|
21
22
|
} = _l7Utils.lodashUtil;
|
|
@@ -25,14 +26,6 @@ class ExtrudeModel extends _BaseModel.default {
|
|
|
25
26
|
(0, _defineProperty2.default)(this, "raiseCount", 0);
|
|
26
27
|
(0, _defineProperty2.default)(this, "raiseRepeat", 0);
|
|
27
28
|
}
|
|
28
|
-
get attributeLocation() {
|
|
29
|
-
return Object.assign(super.attributeLocation, {
|
|
30
|
-
MAX: super.attributeLocation.MAX,
|
|
31
|
-
SIZE: 9,
|
|
32
|
-
POS: 10,
|
|
33
|
-
NORMAL: 11
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
29
|
getCommonUniformsInfo() {
|
|
37
30
|
const {
|
|
38
31
|
animateOption = {
|
|
@@ -107,6 +100,7 @@ class ExtrudeModel extends _BaseModel.default {
|
|
|
107
100
|
buildModels() {
|
|
108
101
|
var _this2 = this;
|
|
109
102
|
return (0, _asyncToGenerator2.default)(function* () {
|
|
103
|
+
// GAODE1.x GAODE2.x MAPBOX
|
|
110
104
|
const {
|
|
111
105
|
animateOption: {
|
|
112
106
|
repeat = 1
|
|
@@ -121,11 +115,10 @@ class ExtrudeModel extends _BaseModel.default {
|
|
|
121
115
|
depth: {
|
|
122
116
|
enable: true
|
|
123
117
|
},
|
|
124
|
-
defines: _this2.getDefines(),
|
|
125
118
|
inject: _this2.getInject(),
|
|
126
119
|
cull: {
|
|
127
120
|
enable: true,
|
|
128
|
-
face:
|
|
121
|
+
face: (0, _l7Utils.getCullFace)(_this2.mapService.version)
|
|
129
122
|
},
|
|
130
123
|
blend: _this2.getBlend()
|
|
131
124
|
});
|
|
@@ -138,7 +131,7 @@ class ExtrudeModel extends _BaseModel.default {
|
|
|
138
131
|
type: _l7Core.AttributeType.Attribute,
|
|
139
132
|
descriptor: {
|
|
140
133
|
name: 'a_Size',
|
|
141
|
-
shaderLocation:
|
|
134
|
+
shaderLocation: _CommonStyleAttribute.ShaderLocation.SIZE,
|
|
142
135
|
buffer: {
|
|
143
136
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
144
137
|
data: [],
|
|
@@ -171,7 +164,7 @@ class ExtrudeModel extends _BaseModel.default {
|
|
|
171
164
|
type: _l7Core.AttributeType.Attribute,
|
|
172
165
|
descriptor: {
|
|
173
166
|
name: 'a_Normal',
|
|
174
|
-
shaderLocation:
|
|
167
|
+
shaderLocation: _CommonStyleAttribute.ShaderLocation.NORMAL,
|
|
175
168
|
buffer: {
|
|
176
169
|
// give the WebGL driver a hint that this buffer may change
|
|
177
170
|
usage: _l7Core.gl.STATIC_DRAW,
|
|
@@ -189,7 +182,7 @@ class ExtrudeModel extends _BaseModel.default {
|
|
|
189
182
|
type: _l7Core.AttributeType.Attribute,
|
|
190
183
|
descriptor: {
|
|
191
184
|
name: 'a_Pos',
|
|
192
|
-
shaderLocation:
|
|
185
|
+
shaderLocation: 15,
|
|
193
186
|
buffer: {
|
|
194
187
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
195
188
|
data: [],
|
|
@@ -1,22 +1,6 @@
|
|
|
1
1
|
import type { IAnimateOption, IModel } 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
|
-
};
|
|
20
4
|
protected getCommonUniformsInfo(): {
|
|
21
5
|
uniformsArray: number[];
|
|
22
6
|
uniformsLength: number;
|
|
@@ -10,19 +10,12 @@ var _l7Core = require("@antv/l7-core");
|
|
|
10
10
|
var _BaseModel = _interopRequireDefault(require("../../core/BaseModel"));
|
|
11
11
|
var _triangulation = require("../../core/triangulation");
|
|
12
12
|
var _glMatrix = require("gl-matrix");
|
|
13
|
+
var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
|
|
13
14
|
/* babel-plugin-inline-import '../shaders/earthFill/earthFill_frag.glsl' */
|
|
14
15
|
const pointFillFrag = "in vec4 v_data;\nin vec4 v_color;\nin float v_radius;\n\nlayout(std140) uniform commonUniform {\n float u_additive;\n float u_stroke_opacity : 1;\n float u_stroke_width : 2;\n float u_blur : 0.0;\n};\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\n vec4 strokeColor = u_stroke == vec4(0.0) ? v_color : u_stroke;\n\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 if(outer_df > antialiasblur + 0.018) discard;\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 if(u_stroke_width < 0.01) {\n outputColor = vec4(v_color.rgb, v_color.a * u_opacity);\n } else {\n outputColor = mix(vec4(v_color.rgb, v_color.a * u_opacity), strokeColor * u_stroke_opacity, color_t);\n }\n\n if(u_additive > 0.0) {\n outputColor *= opacity_t;\n outputColor = filterColorAlpha(outputColor, outputColor.a);\n } else {\n outputColor.a *= opacity_t;\n outputColor = filterColor(outputColor);\n }\n}\n";
|
|
15
16
|
/* babel-plugin-inline-import '../shaders/earthFill/earthFill_vert.glsl' */
|
|
16
|
-
const pointFillVert = "layout(location =
|
|
17
|
+
const pointFillVert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 9) in float a_Size;\nlayout(location = 10) in float a_Shape;\nlayout(location = 11) in vec3 a_Extrude;\n\nlayout(std140) uniform commonUniform {\n float u_additive;\n float u_stroke_opacity : 1;\n float u_stroke_width : 2;\n float u_blur : 0.0;\n};\nout vec4 v_data;\nout vec4 v_color;\nout float v_radius;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\n\nvoid main() {\n vec3 extrude = a_Extrude;\n float shape_type = a_Shape;\n /*\n * setPickingSize \u8BBE\u7F6E\u62FE\u53D6\u5927\u5C0F\n */\n float newSize = setPickingSize(a_Size);\n // float newSize = setPickingSize(a_Size) * 0.00001038445708445579;\n\n // unpack color(vec2)\n v_color = a_Color;\n\n // radius(16-bit)\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);\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 gl_Position = u_ViewProjectionMatrix * vec4(a_Position + extrude * newSize * 0.1 + vec3(u_offsets,0.0), 1.0);\n\n setPickingColor(a_PickingColor);\n}";
|
|
17
18
|
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
|
-
}
|
|
26
19
|
getCommonUniformsInfo() {
|
|
27
20
|
const {
|
|
28
21
|
strokeOpacity = 1,
|
|
@@ -57,7 +50,6 @@ class FillModel extends _BaseModel.default {
|
|
|
57
50
|
vertexShader: pointFillVert,
|
|
58
51
|
fragmentShader: pointFillFrag,
|
|
59
52
|
triangulation: _triangulation.GlobelPointFillTriangulation,
|
|
60
|
-
defines: _this2.getDefines(),
|
|
61
53
|
inject: _this2.getInject(),
|
|
62
54
|
depth: {
|
|
63
55
|
enable: true
|
|
@@ -78,7 +70,7 @@ class FillModel extends _BaseModel.default {
|
|
|
78
70
|
type: _l7Core.AttributeType.Attribute,
|
|
79
71
|
descriptor: {
|
|
80
72
|
name: 'a_Extrude',
|
|
81
|
-
shaderLocation:
|
|
73
|
+
shaderLocation: _CommonStyleAttribute.ShaderLocation.EXTRUDE,
|
|
82
74
|
buffer: {
|
|
83
75
|
// give the WebGL driver a hint that this buffer may change
|
|
84
76
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
@@ -120,7 +112,7 @@ class FillModel extends _BaseModel.default {
|
|
|
120
112
|
type: _l7Core.AttributeType.Attribute,
|
|
121
113
|
descriptor: {
|
|
122
114
|
name: 'a_Size',
|
|
123
|
-
shaderLocation:
|
|
115
|
+
shaderLocation: _CommonStyleAttribute.ShaderLocation.SIZE,
|
|
124
116
|
buffer: {
|
|
125
117
|
// give the WebGL driver a hint that this buffer may change
|
|
126
118
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
@@ -143,7 +135,7 @@ class FillModel extends _BaseModel.default {
|
|
|
143
135
|
type: _l7Core.AttributeType.Attribute,
|
|
144
136
|
descriptor: {
|
|
145
137
|
name: 'a_Shape',
|
|
146
|
-
shaderLocation:
|
|
138
|
+
shaderLocation: _CommonStyleAttribute.ShaderLocation.SHAPE,
|
|
147
139
|
buffer: {
|
|
148
140
|
// give the WebGL driver a hint that this buffer may change
|
|
149
141
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
@@ -1,22 +1,6 @@
|
|
|
1
1
|
import type { IModel } from '@antv/l7-core';
|
|
2
2
|
import BaseModel from '../../core/BaseModel';
|
|
3
3
|
export default class ExtrudeModel 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
|
-
NORMAL: number;
|
|
19
|
-
};
|
|
20
4
|
private raiseCount;
|
|
21
5
|
private raiseRepeat;
|
|
22
6
|
protected getCommonUniformsInfo(): {
|
|
@@ -10,25 +10,18 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
10
10
|
var _l7Core = require("@antv/l7-core");
|
|
11
11
|
var _l7Utils = require("@antv/l7-utils");
|
|
12
12
|
var _BaseModel = _interopRequireDefault(require("../../core/BaseModel"));
|
|
13
|
+
var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
|
|
13
14
|
var _triangulation = require("../../core/triangulation");
|
|
14
15
|
/* babel-plugin-inline-import '../shaders/extrude/extrude_frag.glsl' */
|
|
15
16
|
const pointExtrudeFrag = "\nin vec4 v_color;\nin float v_lightWeight;\nout vec4 outputColor;\n\nlayout(std140) uniform commonUniforms {\n float u_pickLight;\n float u_heightfixed;\n float u_r;\n float u_linearColor;\n vec4 u_sourceColor;\n vec4 u_targetColor;\n float u_opacitylinear;\n float u_opacitylinear_dir;\n float u_lightEnable;\n};\n\n#pragma include \"scene_uniforms\"\n#pragma include \"picking\"\n\nvoid main() {\n\n outputColor = v_color;\n // \u5F00\u542F\u900F\u660E\u5EA6\u6E10\u53D8\n // picking\n if(u_pickLight > 0.0) {\n outputColor = filterColorAlpha(outputColor, v_lightWeight);\n } else {\n outputColor = filterColor(outputColor);\n }\n}\n";
|
|
16
17
|
/* babel-plugin-inline-import '../shaders/extrude/extrude_vert.glsl' */
|
|
17
|
-
const pointExtrudeVert = "#define pi
|
|
18
|
+
const pointExtrudeVert = "#define pi 3.1415926535\n\nlayout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 9) in vec3 a_Size;\nlayout(location = 11) in vec3 a_Extrude;\nlayout(location = 13) in vec3 a_Normal;\n\nlayout(std140) uniform commonUniforms {\n float u_pickLight;\n float u_heightfixed;\n float u_r;\n float u_linearColor;\n vec4 u_sourceColor;\n vec4 u_targetColor;\n float u_opacitylinear;\n float u_opacitylinear_dir;\n float u_lightEnable;\n};\nout vec4 v_color;\nout float v_lightWeight;\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nfloat getYRadian(float x, float z) {\n if(x > 0.0 && z > 0.0) {\n return atan(x/z);\n } else if(x > 0.0 && z <= 0.0){\n return atan(-z/x) + pi/2.0;\n } else if(x <= 0.0 && z <= 0.0) {\n return pi + atan(x/z); //atan(x/z) + \n } else {\n return atan(z/-x) + pi*3.0/2.0;\n }\n}\n\nfloat getXRadian(float y, float r) {\n return atan(y/r);\n}\n\nvoid main() {\n\n\n vec3 size = a_Size * a_Position;\n\n vec3 offset = size; // \u63A7\u5236\u5706\u67F1\u4F53\u7684\u5927\u5C0F - \u4ECE\u6807\u51C6\u5355\u4F4D\u5706\u67F1\u4F53\u8FDB\u884C\u504F\u79FB\n\n if(u_heightfixed < 1.0) { // \u5706\u67F1\u4F53\u4E0D\u56FA\u5B9A\u9AD8\u5EA6\n \n if (u_CoordinateSystem == COORDINATE_SYSTEM_P20 || u_CoordinateSystem == COORDINATE_SYSTEM_P20_OFFSET) {\n // P20 \u5750\u6807\u7CFB\u4E0B\uFF0C\u4E3A\u4E86\u548C Web \u58A8\u5361\u6258\u5750\u6807\u7CFB\u7EDF\u4E00\uFF0Czoom \u9ED8\u8BA4\u51CF1\n offset = offset * pow(2.0, (19.0 - u_Zoom));\n }\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {\n // P20_2 \u5750\u6807\u7CFB\u4E0B\uFF0C\u4E3A\u4E86\u548C Web \u58A8\u5361\u6258\u5750\u6807\u7CFB\u7EDF\u4E00\uFF0Czoom \u9ED8\u8BA4\u51CF3\n offset = offset * pow(2.0, (19.0 - 3.0 - u_Zoom));\n }\n } else {// \u5706\u67F1\u4F53\u56FA\u5B9A\u9AD8\u5EA6 \uFF08 \u5904\u7406 mapbox \uFF09\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n offset *= 4.0/pow(2.0, 21.0 - u_Zoom);\n }\n }\n\n\n vec4 project_pos = project_position(vec4(a_Extrude.xy, 0., 1.0));\n\n // u_r \u63A7\u5236\u5706\u67F1\u7684\u751F\u957F\n vec4 pos = vec4(project_pos.xy + offset.xy, offset.z * u_r, 1.0);\n\n // // \u5706\u67F1\u5149\u7167\u6548\u679C\n float lightWeight = 1.0;\n\n if(u_lightEnable > 0.0) { // \u53D6\u6D88\u4E09\u5143\u8868\u8FBE\u5F0F\uFF0C\u589E\u5F3A\u5065\u58EE\u6027\n lightWeight = calc_lighting(pos);\n }\n\n v_lightWeight = lightWeight;\n\n v_color = a_Color;\n\n // \u8BBE\u7F6E\u5706\u67F1\u7684\u5E95\u8272\n if(u_linearColor == 1.0) { // \u4F7F\u7528\u6E10\u53D8\u989C\u8272\n v_color = mix(u_sourceColor, u_targetColor, a_Position.z);\n v_color.a = v_color.a * opacity;\n } else {\n v_color = vec4(a_Color.rgb * lightWeight, a_Color.w * opacity);\n }\n\n if(u_opacitylinear > 0.0) {\n v_color.a *= u_opacitylinear_dir > 0.0 ? (1.0 - a_Position.z): a_Position.z;\n }\n\n\n gl_Position = project_common_position_to_clipspace_v2(pos);\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
18
19
|
class ExtrudeModel extends _BaseModel.default {
|
|
19
20
|
constructor(...args) {
|
|
20
21
|
super(...args);
|
|
21
22
|
(0, _defineProperty2.default)(this, "raiseCount", 0);
|
|
22
23
|
(0, _defineProperty2.default)(this, "raiseRepeat", 0);
|
|
23
24
|
}
|
|
24
|
-
get attributeLocation() {
|
|
25
|
-
return Object.assign(super.attributeLocation, {
|
|
26
|
-
MAX: super.attributeLocation.MAX,
|
|
27
|
-
SIZE: 9,
|
|
28
|
-
EXTRUDE: 10,
|
|
29
|
-
NORMAL: 11
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
25
|
getCommonUniformsInfo() {
|
|
33
26
|
const {
|
|
34
27
|
animateOption = {
|
|
@@ -100,6 +93,7 @@ class ExtrudeModel extends _BaseModel.default {
|
|
|
100
93
|
buildModels() {
|
|
101
94
|
var _this2 = this;
|
|
102
95
|
return (0, _asyncToGenerator2.default)(function* () {
|
|
96
|
+
// GAODE1.x GAODE2.x MAPBOX
|
|
103
97
|
const {
|
|
104
98
|
depth = true,
|
|
105
99
|
animateOption: {
|
|
@@ -113,11 +107,10 @@ class ExtrudeModel extends _BaseModel.default {
|
|
|
113
107
|
vertexShader: pointExtrudeVert,
|
|
114
108
|
fragmentShader: pointExtrudeFrag,
|
|
115
109
|
triangulation: _triangulation.PointExtrudeTriangulation,
|
|
116
|
-
defines: _this2.getDefines(),
|
|
117
110
|
inject: _this2.getInject(),
|
|
118
111
|
cull: {
|
|
119
112
|
enable: true,
|
|
120
|
-
face:
|
|
113
|
+
face: (0, _l7Utils.getCullFace)(_this2.mapService.version)
|
|
121
114
|
},
|
|
122
115
|
depth: {
|
|
123
116
|
enable: depth
|
|
@@ -133,7 +126,7 @@ class ExtrudeModel extends _BaseModel.default {
|
|
|
133
126
|
type: _l7Core.AttributeType.Attribute,
|
|
134
127
|
descriptor: {
|
|
135
128
|
name: 'a_Size',
|
|
136
|
-
shaderLocation:
|
|
129
|
+
shaderLocation: _CommonStyleAttribute.ShaderLocation.SIZE,
|
|
137
130
|
buffer: {
|
|
138
131
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
139
132
|
data: [],
|
|
@@ -159,12 +152,14 @@ class ExtrudeModel extends _BaseModel.default {
|
|
|
159
152
|
}
|
|
160
153
|
}
|
|
161
154
|
});
|
|
155
|
+
|
|
156
|
+
// point layer size;
|
|
162
157
|
this.styleAttributeService.registerStyleAttribute({
|
|
163
158
|
name: 'normal',
|
|
164
159
|
type: _l7Core.AttributeType.Attribute,
|
|
165
160
|
descriptor: {
|
|
166
161
|
name: 'a_Normal',
|
|
167
|
-
shaderLocation:
|
|
162
|
+
shaderLocation: _CommonStyleAttribute.ShaderLocation.NORMAL,
|
|
168
163
|
buffer: {
|
|
169
164
|
// give the WebGL driver a hint that this buffer may change
|
|
170
165
|
usage: _l7Core.gl.STATIC_DRAW,
|
|
@@ -182,19 +177,17 @@ class ExtrudeModel extends _BaseModel.default {
|
|
|
182
177
|
type: _l7Core.AttributeType.Attribute,
|
|
183
178
|
descriptor: {
|
|
184
179
|
name: 'a_Extrude',
|
|
185
|
-
shaderLocation:
|
|
180
|
+
shaderLocation: _CommonStyleAttribute.ShaderLocation.EXTRUDE,
|
|
186
181
|
buffer: {
|
|
187
182
|
// give the WebGL driver a hint that this buffer may change
|
|
188
183
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
189
184
|
data: [],
|
|
190
185
|
type: _l7Core.gl.FLOAT
|
|
191
186
|
},
|
|
192
|
-
size:
|
|
187
|
+
size: 3,
|
|
193
188
|
update: feature => {
|
|
194
189
|
const coordinates = (0, _l7Utils.calculateCentroid)(feature.coordinates);
|
|
195
|
-
|
|
196
|
-
// low part for enabled double precision
|
|
197
|
-
return [coordinates[0], coordinates[1], (0, _l7Utils.fp64LowPart)(coordinates[0]), (0, _l7Utils.fp64LowPart)(coordinates[1])];
|
|
190
|
+
return [coordinates[0], coordinates[1], 0];
|
|
198
191
|
}
|
|
199
192
|
}
|
|
200
193
|
});
|
|
@@ -1,22 +1,6 @@
|
|
|
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
|
-
};
|
|
20
4
|
protected getCommonUniformsInfo(): {
|
|
21
5
|
uniformsArray: number[];
|
|
22
6
|
uniformsLength: number;
|
package/lib/point/models/fill.js
CHANGED
|
@@ -8,21 +8,14 @@ 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");
|
|
11
12
|
var _triangulation = require("../../core/triangulation");
|
|
12
13
|
var _interface = require("../../core/interface");
|
|
13
14
|
/* babel-plugin-inline-import '../shaders/fill/fill_frag.glsl' */
|
|
14
15
|
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";
|
|
15
16
|
/* babel-plugin-inline-import '../shaders/fill/fill_vert.glsl' */
|
|
16
|
-
const pointFillVert = "layout(location =
|
|
17
|
+
const pointFillVert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 9) in float a_Size;\nlayout(location = 10) in float a_Shape;\nlayout(location = 11) 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 vec3 aPosition = a_Position;\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\n // vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));\n vec4 project_pos = project_position(vec4(aPosition.xy, 0.0, 1.0));\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_v2(vec4(project_pos.xy + offset, raisingHeight, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
17
18
|
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
|
-
}
|
|
26
19
|
getCommonUniformsInfo() {
|
|
27
20
|
const {
|
|
28
21
|
strokeOpacity = 1,
|
|
@@ -83,7 +76,6 @@ class FillModel extends _BaseModel.default {
|
|
|
83
76
|
moduleName: type,
|
|
84
77
|
vertexShader: vert,
|
|
85
78
|
fragmentShader: frag,
|
|
86
|
-
defines: _this2.getDefines(),
|
|
87
79
|
inject: _this2.getInject(),
|
|
88
80
|
triangulation: _triangulation.PointFillTriangulation,
|
|
89
81
|
depth: {
|
|
@@ -113,15 +105,12 @@ class FillModel extends _BaseModel.default {
|
|
|
113
105
|
registerBuiltinAttributes() {
|
|
114
106
|
// 注册 Style 参与数据映射的内置属性
|
|
115
107
|
const shape2d = this.layer.getLayerConfig().shape2d;
|
|
116
|
-
|
|
117
|
-
// 注册 Position 属性 64 位地位部分,经纬度数据开启双精度,避免大于 20层级以上出现数据偏移
|
|
118
|
-
this.registerPosition64LowAttribute();
|
|
119
108
|
this.styleAttributeService.registerStyleAttribute({
|
|
120
109
|
name: 'extrude',
|
|
121
110
|
type: _l7Core.AttributeType.Attribute,
|
|
122
111
|
descriptor: {
|
|
123
112
|
name: 'a_Extrude',
|
|
124
|
-
shaderLocation:
|
|
113
|
+
shaderLocation: _CommonStyleAttribute.ShaderLocation.EXTRUDE,
|
|
125
114
|
buffer: {
|
|
126
115
|
// give the WebGL driver a hint that this buffer may change
|
|
127
116
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
@@ -143,7 +132,7 @@ class FillModel extends _BaseModel.default {
|
|
|
143
132
|
type: _l7Core.AttributeType.Attribute,
|
|
144
133
|
descriptor: {
|
|
145
134
|
name: 'a_Size',
|
|
146
|
-
shaderLocation:
|
|
135
|
+
shaderLocation: _CommonStyleAttribute.ShaderLocation.SIZE,
|
|
147
136
|
buffer: {
|
|
148
137
|
// give the WebGL driver a hint that this buffer may change
|
|
149
138
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
@@ -166,7 +155,7 @@ class FillModel extends _BaseModel.default {
|
|
|
166
155
|
type: _l7Core.AttributeType.Attribute,
|
|
167
156
|
descriptor: {
|
|
168
157
|
name: 'a_Shape',
|
|
169
|
-
shaderLocation:
|
|
158
|
+
shaderLocation: _CommonStyleAttribute.ShaderLocation.SHAPE,
|
|
170
159
|
buffer: {
|
|
171
160
|
// give the WebGL driver a hint that this buffer may change
|
|
172
161
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
@@ -1,22 +1,6 @@
|
|
|
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
|
-
};
|
|
20
4
|
private meter2coord;
|
|
21
5
|
private texture;
|
|
22
6
|
private isMeter;
|
|
@@ -8,13 +8,16 @@ 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");
|
|
11
12
|
var _BaseModel = _interopRequireDefault(require("../../core/BaseModel"));
|
|
12
13
|
var _interface = require("../../core/interface");
|
|
13
14
|
var _triangulation = require("../../core/triangulation");
|
|
15
|
+
var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
|
|
16
|
+
// static pointLayer shader - not support animate
|
|
14
17
|
/* babel-plugin-inline-import '../shaders/fillImage/fillImage_frag.glsl' */
|
|
15
18
|
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";
|
|
16
19
|
/* babel-plugin-inline-import '../shaders/fillImage/fillImage_vert.glsl' */
|
|
17
|
-
const pointFillVert = "layout(location =
|
|
20
|
+
const pointFillVert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 9) in float a_Size;\nlayout(location = 11) in vec3 a_Extrude;\nlayout(location = 14) in vec2 a_Uv;\n\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\nout vec2 v_uv;\nout vec2 v_Iconuv;\nout float v_opacity;\n\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 vec3 aPosition = a_Position;\n\n offset = project_pixel(offset);\n\n vec4 project_pos = project_position(vec4(aPosition.xy, 0.0, 1.0));\n float raisingHeight = u_raisingHeight;\n if(u_heightfixed < 1.0) { // height fixed\n raisingHeight = project_pixel(u_raisingHeight);\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_raisingHeight * mapboxZoomScale;\n }\n }\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy + offset, 0.0, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
18
21
|
class FillImageModel extends _BaseModel.default {
|
|
19
22
|
constructor(...args) {
|
|
20
23
|
super(...args);
|
|
@@ -49,14 +52,6 @@ class FillImageModel extends _BaseModel.default {
|
|
|
49
52
|
this.textures = [this.texture];
|
|
50
53
|
});
|
|
51
54
|
}
|
|
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
|
-
}
|
|
60
55
|
// 旋转的弧度
|
|
61
56
|
getCommonUniformsInfo() {
|
|
62
57
|
const {
|
|
@@ -68,6 +63,14 @@ class FillImageModel extends _BaseModel.default {
|
|
|
68
63
|
var _this$texture;
|
|
69
64
|
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.bind();
|
|
70
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* rotateFlag
|
|
68
|
+
* DEFAULT 1
|
|
69
|
+
* MAPBOX 1
|
|
70
|
+
* GAODE2.x -1
|
|
71
|
+
* GAODE1.x -1
|
|
72
|
+
*/
|
|
73
|
+
|
|
71
74
|
const commonOptions = {
|
|
72
75
|
u_textSize: [1024, this.iconService.canvasHeight || 128],
|
|
73
76
|
u_heightfixed: Number(heightfixed),
|
|
@@ -100,11 +103,10 @@ class FillImageModel extends _BaseModel.default {
|
|
|
100
103
|
depth: {
|
|
101
104
|
enable: false
|
|
102
105
|
},
|
|
103
|
-
defines: _this2.getDefines(),
|
|
104
106
|
inject: _this2.getInject(),
|
|
105
107
|
cull: {
|
|
106
108
|
enable: true,
|
|
107
|
-
face:
|
|
109
|
+
face: (0, _l7Utils.getCullFace)(_this2.mapService.version)
|
|
108
110
|
}
|
|
109
111
|
});
|
|
110
112
|
return [model];
|
|
@@ -118,14 +120,12 @@ class FillImageModel extends _BaseModel.default {
|
|
|
118
120
|
|
|
119
121
|
// overwrite baseModel func
|
|
120
122
|
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: _CommonStyleAttribute.ShaderLocation.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: _CommonStyleAttribute.ShaderLocation.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: _CommonStyleAttribute.ShaderLocation.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,21 +1,6 @@
|
|
|
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
|
-
};
|
|
19
4
|
private texture;
|
|
20
5
|
getUninforms(): IModelUniform;
|
|
21
6
|
protected getCommonUniformsInfo(): {
|
|
@@ -10,11 +10,12 @@ 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");
|
|
13
14
|
var _triangulation = require("../../core/triangulation");
|
|
14
15
|
/* babel-plugin-inline-import '../shaders/image/image_frag.glsl' */
|
|
15
16
|
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";
|
|
16
17
|
/* babel-plugin-inline-import '../shaders/image/image_vert.glsl' */
|
|
17
|
-
const pointImageVert = "layout(location =
|
|
18
|
+
const pointImageVert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 9) in float a_Size;\nlayout(location = 14) 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\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));\n \n vec2 offset = project_pixel(offsets);\n\n float raisingHeight = u_raisingHeight;\n if(u_heightfixed < 1.0) { // false\n raisingHeight = project_pixel(u_raisingHeight);\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_raisingHeight * mapboxZoomScale;\n }\n }\n\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy + offset, raisingHeight, 1.0));\n\n gl_PointSize = a_Size * 2.0 * u_DevicePixelRatio;\n setPickingColor(a_PickingColor);\n}\n";
|
|
18
19
|
class ImageModel extends _BaseModel.default {
|
|
19
20
|
constructor(...args) {
|
|
20
21
|
super(...args);
|
|
@@ -49,13 +50,6 @@ class ImageModel extends _BaseModel.default {
|
|
|
49
50
|
});
|
|
50
51
|
});
|
|
51
52
|
}
|
|
52
|
-
get attributeLocation() {
|
|
53
|
-
return Object.assign(super.attributeLocation, {
|
|
54
|
-
MAX: super.attributeLocation.MAX,
|
|
55
|
-
SIZE: 9,
|
|
56
|
-
UV: 10
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
53
|
getUninforms() {
|
|
60
54
|
// ThreeJS 图层兼容
|
|
61
55
|
if (this.rendererService.getDirty()) {
|
|
@@ -104,7 +98,6 @@ class ImageModel extends _BaseModel.default {
|
|
|
104
98
|
vertexShader: pointImageVert,
|
|
105
99
|
fragmentShader: pointImageFrag,
|
|
106
100
|
triangulation: _triangulation.PointImageTriangulation,
|
|
107
|
-
defines: _this2.getDefines(),
|
|
108
101
|
inject: _this2.getInject(),
|
|
109
102
|
depth: {
|
|
110
103
|
enable: false
|
|
@@ -115,16 +108,13 @@ class ImageModel extends _BaseModel.default {
|
|
|
115
108
|
})();
|
|
116
109
|
}
|
|
117
110
|
registerBuiltinAttributes() {
|
|
118
|
-
// 注册 Position 属性 64 位地位部分,经纬度数据开启双精度,避免大于 20层级以上出现数据偏移
|
|
119
|
-
this.registerPosition64LowAttribute();
|
|
120
|
-
|
|
121
111
|
// point layer size;
|
|
122
112
|
this.styleAttributeService.registerStyleAttribute({
|
|
123
113
|
name: 'size',
|
|
124
114
|
type: _l7Core.AttributeType.Attribute,
|
|
125
115
|
descriptor: {
|
|
126
116
|
name: 'a_Size',
|
|
127
|
-
shaderLocation:
|
|
117
|
+
shaderLocation: _CommonStyleAttribute.ShaderLocation.SIZE,
|
|
128
118
|
buffer: {
|
|
129
119
|
// give the WebGL driver a hint that this buffer may change
|
|
130
120
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
@@ -147,7 +137,7 @@ class ImageModel extends _BaseModel.default {
|
|
|
147
137
|
type: _l7Core.AttributeType.Attribute,
|
|
148
138
|
descriptor: {
|
|
149
139
|
name: 'a_Uv',
|
|
150
|
-
shaderLocation:
|
|
140
|
+
shaderLocation: _CommonStyleAttribute.ShaderLocation.UV,
|
|
151
141
|
buffer: {
|
|
152
142
|
// give the WebGL driver a hint that this buffer may change
|
|
153
143
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|