@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
|
@@ -11,25 +11,20 @@ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/obje
|
|
|
11
11
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
12
|
var _l7Core = require("@antv/l7-core");
|
|
13
13
|
var _BaseModel = _interopRequireDefault(require("../../core/BaseModel"));
|
|
14
|
+
var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
|
|
14
15
|
var _triangulation = require("../../core/triangulation");
|
|
15
16
|
const _excluded = ["data"],
|
|
16
17
|
_excluded2 = ["rasterData"];
|
|
17
18
|
/* babel-plugin-inline-import '../shaders/rgb/raster_rgb_frag.glsl' */
|
|
18
19
|
const rasterFrag = "uniform sampler2D u_texture;\nlayout(std140) uniform commonUniforms {\n vec2 u_rminmax;\n vec2 u_gminmax;\n vec2 u_bminmax;\n float u_opacity;\n float u_noDataValue;\n};\n\nin vec2 v_texCoord;\n\nout vec4 outputColor;\n\nvoid main() {\n\n vec3 rgb = texture(SAMPLER_2D(u_texture),vec2(v_texCoord.x,v_texCoord.y)).rgb;\n\n if(rgb == vec3(u_noDataValue)) {\n outputColor = vec4(0.0, 0, 0, 0.0);\n } else {\n outputColor = vec4(rgb.r / (u_rminmax.y -u_rminmax.x), rgb.g /(u_gminmax.y -u_gminmax.x), rgb.b/ (u_bminmax.y - u_bminmax.x), u_opacity);\n }\n\n if(outputColor.a < 0.01)\n discard;\n \n}";
|
|
19
20
|
/* babel-plugin-inline-import '../shaders/rgb/raster_rgb_vert.glsl' */
|
|
20
|
-
const rasterVert = "
|
|
21
|
+
const rasterVert = "\nlayout(location = 0) in vec3 a_Position;\nlayout(location = 14) in vec2 a_Uv;\n\nlayout(std140) uniform commonUniforms {\n vec2 u_rminmax;\n vec2 u_gminmax;\n vec2 u_bminmax;\n float u_opacity;\n float u_noDataValue;\n};\n\nout vec2 v_texCoord;\n\n#pragma include \"projection\"\n\nvoid main() {\n v_texCoord = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy,0., 1.0));\n}\n";
|
|
21
22
|
class RasterModel extends _BaseModel.default {
|
|
22
23
|
constructor(...args) {
|
|
23
24
|
super(...args);
|
|
24
25
|
(0, _defineProperty2.default)(this, "texture", void 0);
|
|
25
26
|
(0, _defineProperty2.default)(this, "dataOption", {});
|
|
26
27
|
}
|
|
27
|
-
get attributeLocation() {
|
|
28
|
-
return Object.assign(super.attributeLocation, {
|
|
29
|
-
MAX: super.attributeLocation.MAX,
|
|
30
|
-
UV: 9
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
28
|
getUninforms() {
|
|
34
29
|
const commoninfo = this.getCommonUniformsInfo();
|
|
35
30
|
const attributeInfo = this.getUniformsBufferInfo(this.getStyleAttribute());
|
|
@@ -117,7 +112,6 @@ class RasterModel extends _BaseModel.default {
|
|
|
117
112
|
moduleName: 'rasterImageDataRGBA',
|
|
118
113
|
vertexShader: rasterVert,
|
|
119
114
|
fragmentShader: rasterFrag,
|
|
120
|
-
defines: _this2.getDefines(),
|
|
121
115
|
triangulation: _triangulation.RasterImageTriangulation,
|
|
122
116
|
primitive: _l7Core.gl.TRIANGLES,
|
|
123
117
|
depth: {
|
|
@@ -139,16 +133,13 @@ class RasterModel extends _BaseModel.default {
|
|
|
139
133
|
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
|
|
140
134
|
}
|
|
141
135
|
registerBuiltinAttributes() {
|
|
142
|
-
// 注册 Position 属性 64 位地位部分,经纬度数据开启双精度,避免大于 22 层级以上出现数据偏移
|
|
143
|
-
this.registerPosition64LowAttribute();
|
|
144
|
-
|
|
145
136
|
// point layer size;
|
|
146
137
|
this.styleAttributeService.registerStyleAttribute({
|
|
147
138
|
name: 'uv',
|
|
148
139
|
type: _l7Core.AttributeType.Attribute,
|
|
149
140
|
descriptor: {
|
|
150
141
|
name: 'a_Uv',
|
|
151
|
-
shaderLocation:
|
|
142
|
+
shaderLocation: _CommonStyleAttribute.ShaderLocation.UV,
|
|
152
143
|
buffer: {
|
|
153
144
|
// give the WebGL driver a hint that this buffer may change
|
|
154
145
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
@@ -1,20 +1,6 @@
|
|
|
1
1
|
import type { IModel, ITexture2D } from '@antv/l7-core';
|
|
2
2
|
import BaseModel from '../../core/BaseModel';
|
|
3
3
|
export default class RasterTerrainRGB extends BaseModel {
|
|
4
|
-
protected get attributeLocation(): {
|
|
5
|
-
readonly POSITION: 0;
|
|
6
|
-
readonly POSITION_64LOW: 1;
|
|
7
|
-
readonly COLOR: 2;
|
|
8
|
-
readonly PICKING_COLOR: 3;
|
|
9
|
-
readonly STROKE: 4;
|
|
10
|
-
readonly OPACITY: 5;
|
|
11
|
-
readonly OFFSETS: 6;
|
|
12
|
-
readonly ROTATION: 7;
|
|
13
|
-
readonly MAX: 8;
|
|
14
|
-
} & Record<string, number> & {
|
|
15
|
-
MAX: 8;
|
|
16
|
-
UV: number;
|
|
17
|
-
};
|
|
18
4
|
protected texture: ITexture2D;
|
|
19
5
|
protected getCommonUniformsInfo(): {
|
|
20
6
|
uniformsArray: number[];
|
|
@@ -10,22 +10,17 @@ 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/terrain/terrain_rgb_frag.glsl' */
|
|
15
16
|
const Raster_terrainFrag = "uniform sampler2D u_texture;\nuniform sampler2D u_colorTexture;\n\nlayout(std140) uniform commonUniforms {\n vec4 u_unpack;\n vec2 u_domain;\n float u_opacity;\n float u_noDataValue;\n float u_clampLow;\n float u_clampHigh;\n};\n\nin vec2 v_texCoord;\nout vec4 outputColor;\n\n\nfloat getElevation(vec2 coord, float bias) {\n // Convert encoded elevation value to meters\n vec4 data = texture(SAMPLER_2D(u_texture), coord,bias) * 255.0;\n data.a = -1.0;\n return dot(data, u_unpack);\n}\n\nvec4 getColor(float value) {\n float normalisedValue =(value- u_domain[0]) / (u_domain[1] - u_domain[0]);\n vec2 coord = vec2(normalisedValue, 0);\n return texture(SAMPLER_2D(u_colorTexture), coord);\n}\n\nvoid main() {\n float value = getElevation(v_texCoord,0.0);\n if (value == u_noDataValue) {\n outputColor = vec4(0.0, 0, 0, 0.0);\n } else if ((u_clampLow < 0.5 && value < u_domain[0]) || (u_clampHigh < 0.5 && value > u_domain[1])) {\n outputColor = vec4(0.0, 0, 0, 0.0);\n } else {\n \n outputColor = getColor(value);\n outputColor.a = outputColor.a * u_opacity ;\n if(outputColor.a < 0.01)\n discard;\n }\n}\n";
|
|
16
17
|
/* babel-plugin-inline-import '../shaders/terrain/terrain_rgb_vert.glsl' */
|
|
17
|
-
const Raster_terrainVert = "layout(location =
|
|
18
|
+
const Raster_terrainVert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 14) in vec2 a_Uv;\n\nlayout(std140) uniform commonUniforms {\n vec4 u_unpack;\n vec2 u_domain;\n float u_opacity;\n float u_noDataValue;\n float u_clampLow;\n float u_clampHigh;\n};\nout vec2 v_texCoord;\n#pragma include \"projection\"\n\nvoid main() {\n v_texCoord = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy,0., 1.0));\n}\n";
|
|
18
19
|
class RasterTerrainRGB extends _BaseModel.default {
|
|
19
20
|
constructor(...args) {
|
|
20
21
|
super(...args);
|
|
21
22
|
(0, _defineProperty2.default)(this, "texture", void 0);
|
|
22
23
|
}
|
|
23
|
-
get attributeLocation() {
|
|
24
|
-
return Object.assign(super.attributeLocation, {
|
|
25
|
-
MAX: super.attributeLocation.MAX,
|
|
26
|
-
UV: 9
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
24
|
getCommonUniformsInfo() {
|
|
30
25
|
const {
|
|
31
26
|
opacity,
|
|
@@ -81,7 +76,6 @@ class RasterTerrainRGB extends _BaseModel.default {
|
|
|
81
76
|
moduleName: 'RasterTileDataImage',
|
|
82
77
|
vertexShader: Raster_terrainVert,
|
|
83
78
|
fragmentShader: Raster_terrainFrag,
|
|
84
|
-
defines: _this.getDefines(),
|
|
85
79
|
triangulation: _triangulation.RasterImageTriangulation,
|
|
86
80
|
primitive: _l7Core.gl.TRIANGLES,
|
|
87
81
|
depth: {
|
|
@@ -102,14 +96,12 @@ class RasterTerrainRGB extends _BaseModel.default {
|
|
|
102
96
|
})();
|
|
103
97
|
}
|
|
104
98
|
registerBuiltinAttributes() {
|
|
105
|
-
// 注册 Position 属性 64 位地位部分,经纬度数据开启双精度,避免大于 22 层级以上出现数据偏移
|
|
106
|
-
this.registerPosition64LowAttribute();
|
|
107
99
|
this.styleAttributeService.registerStyleAttribute({
|
|
108
100
|
name: 'uv',
|
|
109
101
|
type: _l7Core.AttributeType.Attribute,
|
|
110
102
|
descriptor: {
|
|
111
103
|
name: 'a_Uv',
|
|
112
|
-
shaderLocation:
|
|
104
|
+
shaderLocation: _CommonStyleAttribute.ShaderLocation.UV,
|
|
113
105
|
buffer: {
|
|
114
106
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
115
107
|
data: [],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
layout(location =
|
|
3
|
-
layout(location =
|
|
1
|
+
|
|
2
|
+
layout(location = 0) in vec3 a_Position;
|
|
3
|
+
layout(location = 14) in vec2 a_Uv;
|
|
4
4
|
|
|
5
5
|
layout(std140) uniform commonUniforms {
|
|
6
6
|
vec2 u_domain;
|
|
@@ -15,7 +15,7 @@ out vec2 v_texCoord;
|
|
|
15
15
|
#pragma include "projection"
|
|
16
16
|
|
|
17
17
|
void main() {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
gl_Position =
|
|
18
|
+
v_texCoord = a_Uv;
|
|
19
|
+
vec4 project_pos = project_position(vec4(a_Position, 1.0));
|
|
20
|
+
gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy,0., 1.0));
|
|
21
21
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
layout(location =
|
|
3
|
-
layout(location =
|
|
1
|
+
|
|
2
|
+
layout(location = 0) in vec3 a_Position;
|
|
3
|
+
layout(location = 14) in vec2 a_Uv;
|
|
4
4
|
|
|
5
5
|
layout(std140) uniform commonUniforms {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
vec2 u_rminmax;
|
|
7
|
+
vec2 u_gminmax;
|
|
8
|
+
vec2 u_bminmax;
|
|
9
|
+
float u_opacity;
|
|
10
|
+
float u_noDataValue;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
out vec2 v_texCoord;
|
|
@@ -15,7 +15,7 @@ out vec2 v_texCoord;
|
|
|
15
15
|
#pragma include "projection"
|
|
16
16
|
|
|
17
17
|
void main() {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
v_texCoord = a_Uv;
|
|
19
|
+
vec4 project_pos = project_position(vec4(a_Position, 1.0));
|
|
20
|
+
gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy,0., 1.0));
|
|
21
21
|
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
layout(location =
|
|
2
|
-
layout(location =
|
|
1
|
+
layout(location = 0) in vec3 a_Position;
|
|
2
|
+
layout(location = 14) in vec2 a_Uv;
|
|
3
3
|
|
|
4
4
|
layout(std140) uniform commonUniforms {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
vec4 u_unpack;
|
|
6
|
+
vec2 u_domain;
|
|
7
|
+
float u_opacity;
|
|
8
|
+
float u_noDataValue;
|
|
9
|
+
float u_clampLow;
|
|
10
|
+
float u_clampHigh;
|
|
11
11
|
};
|
|
12
12
|
out vec2 v_texCoord;
|
|
13
13
|
#pragma include "projection"
|
|
14
14
|
|
|
15
15
|
void main() {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
v_texCoord = a_Uv;
|
|
17
|
+
vec4 project_pos = project_position(vec4(a_Position, 1.0));
|
|
18
|
+
gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy,0., 1.0));
|
|
19
19
|
}
|
|
@@ -39,6 +39,22 @@ class BaseTileLayer {
|
|
|
39
39
|
latLonBounds,
|
|
40
40
|
zoom
|
|
41
41
|
} = this.getCurrentView();
|
|
42
|
+
if (this.mapService.version === 'GAODE1.x') {
|
|
43
|
+
const {
|
|
44
|
+
visible
|
|
45
|
+
} = this.parent.getLayerConfig();
|
|
46
|
+
if (zoom < 2 && visible) {
|
|
47
|
+
this.parent.updateLayerConfig({
|
|
48
|
+
visible: false
|
|
49
|
+
});
|
|
50
|
+
this.layerService.reRender();
|
|
51
|
+
} else if (zoom >= 2 && !visible) {
|
|
52
|
+
this.parent.updateLayerConfig({
|
|
53
|
+
visible: true
|
|
54
|
+
});
|
|
55
|
+
this.layerService.reRender();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
42
58
|
if (this.lastViewStates && this.lastViewStates.zoom === zoom && this.lastViewStates.latLonBounds.toString() === latLonBounds.toString()) {
|
|
43
59
|
return;
|
|
44
60
|
}
|
package/lib/tile/tile/Tile.d.ts
CHANGED
|
@@ -68,8 +68,6 @@ export default abstract class Tile extends EventEmitter implements ITile {
|
|
|
68
68
|
activeColor?: string | number[] | undefined;
|
|
69
69
|
activeMix?: number | undefined;
|
|
70
70
|
selectMix?: number | undefined;
|
|
71
|
-
enableTAA?: boolean | undefined;
|
|
72
|
-
jitterScale?: number | undefined;
|
|
73
71
|
enableLighting?: boolean | undefined;
|
|
74
72
|
animateOption?: Partial<import("@antv/l7-core").IAnimateOption> | undefined;
|
|
75
73
|
globalOptions?: any;
|
|
@@ -39,6 +39,20 @@ export default class ExtrudePolyline {
|
|
|
39
39
|
startIndex: number;
|
|
40
40
|
indexes: number[];
|
|
41
41
|
};
|
|
42
|
+
simpleExtrude_gaode2(points: number[][], originPoints: number[][]): {
|
|
43
|
+
positions: number[];
|
|
44
|
+
indices: number[];
|
|
45
|
+
normals: number[];
|
|
46
|
+
startIndex: number;
|
|
47
|
+
indexes: number[];
|
|
48
|
+
};
|
|
49
|
+
extrude_gaode2(points: number[][], originPoints: number[][]): {
|
|
50
|
+
positions: number[];
|
|
51
|
+
indices: number[];
|
|
52
|
+
normals: number[];
|
|
53
|
+
startIndex: number;
|
|
54
|
+
indexes: number[];
|
|
55
|
+
};
|
|
42
56
|
extrude(points: number[][]): {
|
|
43
57
|
positions: number[];
|
|
44
58
|
indices: number[];
|
|
@@ -47,6 +61,7 @@ export default class ExtrudePolyline {
|
|
|
47
61
|
indexes: number[];
|
|
48
62
|
};
|
|
49
63
|
private simpleSegment;
|
|
64
|
+
private segment_gaode2;
|
|
50
65
|
private segment;
|
|
51
66
|
private extrusions;
|
|
52
67
|
private lineSegmentDistance;
|
|
@@ -102,6 +102,98 @@ class ExtrudePolyline {
|
|
|
102
102
|
complex.startIndex = complex.positions.length / 6;
|
|
103
103
|
return complex;
|
|
104
104
|
}
|
|
105
|
+
simpleExtrude_gaode2(points, originPoints) {
|
|
106
|
+
const complex = this.complex;
|
|
107
|
+
if (points.length <= 1) {
|
|
108
|
+
return complex;
|
|
109
|
+
}
|
|
110
|
+
this.lastFlip = -1;
|
|
111
|
+
this.started = false;
|
|
112
|
+
this.normal = null;
|
|
113
|
+
this.totalDistance = 0;
|
|
114
|
+
// 去除数组里重复的点
|
|
115
|
+
// points = getArrayUnique(points);
|
|
116
|
+
const total = points.length;
|
|
117
|
+
let count = complex.startIndex;
|
|
118
|
+
for (let i = 1; i < total; i++) {
|
|
119
|
+
var _originPoints$, _originPoints$i$, _originPoints$2;
|
|
120
|
+
const last = points[i - 1];
|
|
121
|
+
last.push((_originPoints$ = originPoints[i - 1][2]) !== null && _originPoints$ !== void 0 ? _originPoints$ : 0);
|
|
122
|
+
// @ts-ignore
|
|
123
|
+
const originLast = originPoints[i - 1];
|
|
124
|
+
const cur = points[i];
|
|
125
|
+
cur.push((_originPoints$i$ = originPoints[i][2]) !== null && _originPoints$i$ !== void 0 ? _originPoints$i$ : 0);
|
|
126
|
+
// @ts-ignore
|
|
127
|
+
const originCur = originPoints[i];
|
|
128
|
+
const next = i < points.length - 1 ? [...points[i + 1], (_originPoints$2 = originPoints[i + 1][2]) !== null && _originPoints$2 !== void 0 ? _originPoints$2 : 0] : null;
|
|
129
|
+
const originNext = i < originPoints.length - 1 ? originPoints[i + 1] : null;
|
|
130
|
+
const amt = this.simpleSegment(complex, count,
|
|
131
|
+
// @ts-ignore
|
|
132
|
+
last,
|
|
133
|
+
// @ts-ignore
|
|
134
|
+
cur,
|
|
135
|
+
// @ts-ignore
|
|
136
|
+
next,
|
|
137
|
+
// @ts-ignore
|
|
138
|
+
originLast, originCur,
|
|
139
|
+
// @ts-ignore
|
|
140
|
+
originNext);
|
|
141
|
+
count += amt;
|
|
142
|
+
}
|
|
143
|
+
if (this.dash) {
|
|
144
|
+
for (let i = 0; i < complex.positions.length / 6; i++) {
|
|
145
|
+
complex.positions[i * 6 + 5] = this.totalDistance;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
complex.startIndex = complex.positions.length / 6;
|
|
149
|
+
return complex;
|
|
150
|
+
}
|
|
151
|
+
extrude_gaode2(points, originPoints) {
|
|
152
|
+
const complex = this.complex;
|
|
153
|
+
if (points.length <= 1) {
|
|
154
|
+
return complex;
|
|
155
|
+
}
|
|
156
|
+
this.lastFlip = -1;
|
|
157
|
+
this.started = false;
|
|
158
|
+
this.normal = null;
|
|
159
|
+
this.totalDistance = 0;
|
|
160
|
+
// 去除数组里重复的点
|
|
161
|
+
// points = getArrayUnique(points);
|
|
162
|
+
const total = points.length;
|
|
163
|
+
let count = complex.startIndex;
|
|
164
|
+
for (let i = 1; i < total; i++) {
|
|
165
|
+
var _originPoints$3, _originPoints$i$2, _originPoints$4;
|
|
166
|
+
const last = points[i - 1];
|
|
167
|
+
last.push((_originPoints$3 = originPoints[i - 1][2]) !== null && _originPoints$3 !== void 0 ? _originPoints$3 : 0);
|
|
168
|
+
// @ts-ignore
|
|
169
|
+
const originLast = originPoints[i - 1];
|
|
170
|
+
const cur = points[i];
|
|
171
|
+
cur.push((_originPoints$i$2 = originPoints[i][2]) !== null && _originPoints$i$2 !== void 0 ? _originPoints$i$2 : 0);
|
|
172
|
+
// @ts-ignore
|
|
173
|
+
const originCur = originPoints[i];
|
|
174
|
+
const next = i < points.length - 1 ? [...points[i + 1], (_originPoints$4 = originPoints[i + 1][2]) !== null && _originPoints$4 !== void 0 ? _originPoints$4 : 0] : null;
|
|
175
|
+
const originNext = i < originPoints.length - 1 ? originPoints[i + 1] : null;
|
|
176
|
+
const amt = this.segment_gaode2(complex, count,
|
|
177
|
+
// @ts-ignore
|
|
178
|
+
last,
|
|
179
|
+
// @ts-ignore
|
|
180
|
+
cur,
|
|
181
|
+
// @ts-ignore
|
|
182
|
+
next,
|
|
183
|
+
// @ts-ignore
|
|
184
|
+
originLast, originCur,
|
|
185
|
+
// @ts-ignore
|
|
186
|
+
originNext);
|
|
187
|
+
count += amt;
|
|
188
|
+
}
|
|
189
|
+
if (this.dash) {
|
|
190
|
+
for (let i = 0; i < complex.positions.length / 6; i++) {
|
|
191
|
+
complex.positions[i * 6 + 5] = this.totalDistance;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
complex.startIndex = complex.positions.length / 6;
|
|
195
|
+
return complex;
|
|
196
|
+
}
|
|
105
197
|
extrude(points) {
|
|
106
198
|
const complex = this.complex;
|
|
107
199
|
if (points.length <= 1) {
|
|
@@ -184,6 +276,131 @@ class ExtrudePolyline {
|
|
|
184
276
|
}
|
|
185
277
|
return count;
|
|
186
278
|
}
|
|
279
|
+
segment_gaode2(complex, index, last, cur, next, originLast, originCur,
|
|
280
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
281
|
+
originNext) {
|
|
282
|
+
let count = 0;
|
|
283
|
+
const indices = complex.indices;
|
|
284
|
+
const positions = complex.positions;
|
|
285
|
+
const normals = complex.normals;
|
|
286
|
+
const capSquare = this.cap === 'square';
|
|
287
|
+
const joinBevel = this.join === 'bevel';
|
|
288
|
+
const flatCur = (0, _l7Utils.aProjectFlat)([originCur[0], originCur[1]]);
|
|
289
|
+
const flatLast = (0, _l7Utils.aProjectFlat)([originLast[0], originLast[1]]);
|
|
290
|
+
// @ts-ignore
|
|
291
|
+
direction(lineA, cur, last);
|
|
292
|
+
let segmentDistance = 0;
|
|
293
|
+
if (this.dash) {
|
|
294
|
+
// @ts-ignore
|
|
295
|
+
segmentDistance = this.lineSegmentDistance(flatCur, flatLast);
|
|
296
|
+
this.totalDistance += segmentDistance;
|
|
297
|
+
}
|
|
298
|
+
if (!this.normal) {
|
|
299
|
+
this.normal = _glMatrix.vec2.create();
|
|
300
|
+
computeNormal(this.normal, lineA);
|
|
301
|
+
}
|
|
302
|
+
if (!this.started) {
|
|
303
|
+
this.started = true;
|
|
304
|
+
|
|
305
|
+
// if the end cap is type square, we can just push the verts out a bit
|
|
306
|
+
if (capSquare) {
|
|
307
|
+
// vec2.scaleAndAdd(capEnd, last, lineA, -this.thickness);
|
|
308
|
+
const out1 = _glMatrix.vec2.create();
|
|
309
|
+
const out2 = _glMatrix.vec2.create();
|
|
310
|
+
_glMatrix.vec2.add(out1, this.normal, lineA);
|
|
311
|
+
_glMatrix.vec2.add(out2, this.normal, lineA);
|
|
312
|
+
normals.push(out2[0], out2[1], 0);
|
|
313
|
+
normals.push(out1[0], out1[1], 0);
|
|
314
|
+
positions.push(last[0], last[1], last[2] | 0, this.totalDistance - segmentDistance, -this.thickness, last[2] | 0);
|
|
315
|
+
this.complex.indexes.push(this.currentIndex);
|
|
316
|
+
positions.push(last[0], last[1], last[2] | 0, this.totalDistance - segmentDistance, this.thickness, last[2] | 0);
|
|
317
|
+
this.complex.indexes.push(this.currentIndex);
|
|
318
|
+
this.currentIndex++;
|
|
319
|
+
} else {
|
|
320
|
+
this.extrusions(positions, normals, last, this.normal, this.thickness, this.totalDistance - segmentDistance);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
indices.push(index + 0, index + 1, index + 2);
|
|
324
|
+
if (!next) {
|
|
325
|
+
computeNormal(this.normal, lineA);
|
|
326
|
+
if (capSquare) {
|
|
327
|
+
const out1 = _glMatrix.vec2.create();
|
|
328
|
+
const out2 = _glMatrix.vec2.create();
|
|
329
|
+
_glMatrix.vec2.sub(out2, lineA, this.normal);
|
|
330
|
+
_glMatrix.vec2.add(out1, lineA, this.normal);
|
|
331
|
+
normals.push(out2[0], out2[1], 0);
|
|
332
|
+
normals.push(out1[0], out1[1], 0);
|
|
333
|
+
positions.push(cur[0], cur[1], cur[2] | 0, this.totalDistance, this.thickness, cur[2] | 0);
|
|
334
|
+
this.complex.indexes.push(this.currentIndex);
|
|
335
|
+
positions.push(cur[0], cur[1], cur[2] | 0, this.totalDistance, this.thickness, cur[2] | 0);
|
|
336
|
+
this.complex.indexes.push(this.currentIndex);
|
|
337
|
+
this.currentIndex++;
|
|
338
|
+
} else {
|
|
339
|
+
this.extrusions(positions, normals, cur, this.normal, this.thickness, this.totalDistance);
|
|
340
|
+
}
|
|
341
|
+
indices.push(...(this.lastFlip === 1 ? [index, index + 2, index + 3] : [index + 2, index + 1, index + 3]));
|
|
342
|
+
count += 2;
|
|
343
|
+
} else {
|
|
344
|
+
// @ts-ignore
|
|
345
|
+
if (isPointEqual(cur, next)) {
|
|
346
|
+
_glMatrix.vec2.add(
|
|
347
|
+
// @ts-ignore
|
|
348
|
+
next,
|
|
349
|
+
// @ts-ignore
|
|
350
|
+
cur, _glMatrix.vec2.normalize(
|
|
351
|
+
// @ts-ignore
|
|
352
|
+
next,
|
|
353
|
+
// @ts-ignore
|
|
354
|
+
_glMatrix.vec2.subtract(next, cur, last)));
|
|
355
|
+
}
|
|
356
|
+
// @ts-ignore
|
|
357
|
+
direction(lineB, next, cur);
|
|
358
|
+
// stores tangent & miter
|
|
359
|
+
|
|
360
|
+
const [miterLen, miter] = computeMiter(tangent, _glMatrix.vec2.create(), lineA, lineB, this.thickness);
|
|
361
|
+
// normal(tmp, lineA)
|
|
362
|
+
|
|
363
|
+
// get orientation
|
|
364
|
+
let flip = _glMatrix.vec2.dot(tangent, this.normal) < 0 ? -1 : 1;
|
|
365
|
+
let bevel = joinBevel;
|
|
366
|
+
if (!bevel && this.join === 'miter') {
|
|
367
|
+
const limit = miterLen;
|
|
368
|
+
if (limit > this.miterLimit) {
|
|
369
|
+
bevel = true;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
if (bevel) {
|
|
373
|
+
normals.push(this.normal[0], this.normal[1], 0);
|
|
374
|
+
normals.push(miter[0], miter[1], 0);
|
|
375
|
+
positions.push(cur[0], cur[1], cur[2] | 0, this.totalDistance, -this.thickness * flip, cur[2] | 0);
|
|
376
|
+
this.complex.indexes.push(this.currentIndex);
|
|
377
|
+
positions.push(cur[0], cur[1], cur[2] | 0, this.totalDistance, this.thickness * flip, cur[2] | 0);
|
|
378
|
+
this.complex.indexes.push(this.currentIndex);
|
|
379
|
+
this.currentIndex++;
|
|
380
|
+
indices.push(...(this.lastFlip !== -flip ? [index, index + 2, index + 3] : [index + 2, index + 1, index + 3]));
|
|
381
|
+
|
|
382
|
+
// now add the bevel triangle
|
|
383
|
+
indices.push(index + 2, index + 3, index + 4);
|
|
384
|
+
computeNormal(tmp, lineB);
|
|
385
|
+
_glMatrix.vec2.copy(this.normal, tmp); // store normal for next round
|
|
386
|
+
normals.push(this.normal[0], this.normal[1], 0);
|
|
387
|
+
positions.push(cur[0], cur[1], cur[2] | 0, this.totalDistance, -this.thickness * flip, cur[2] | 0);
|
|
388
|
+
this.complex.indexes.push(this.currentIndex);
|
|
389
|
+
this.currentIndex++;
|
|
390
|
+
count += 3;
|
|
391
|
+
} else {
|
|
392
|
+
this.extrusions(positions, normals, cur, miter, miterLen, this.totalDistance);
|
|
393
|
+
indices.push(...(this.lastFlip === 1 ? [index, index + 2, index + 3] : [index + 2, index + 1, index + 3]));
|
|
394
|
+
flip = -1;
|
|
395
|
+
|
|
396
|
+
// the miter is now the normal for our next join
|
|
397
|
+
_glMatrix.vec2.copy(this.normal, miter);
|
|
398
|
+
count += 2;
|
|
399
|
+
}
|
|
400
|
+
this.lastFlip = flip;
|
|
401
|
+
}
|
|
402
|
+
return count;
|
|
403
|
+
}
|
|
187
404
|
segment(complex, index, last, cur, next) {
|
|
188
405
|
let count = 0;
|
|
189
406
|
const indices = complex.indices;
|
|
@@ -23,22 +23,14 @@ function normalizePasses(passes) {
|
|
|
23
23
|
*/
|
|
24
24
|
function createMultiPassRenderer(layer, passes, postProcessingPassFactory, normalPassFactory) {
|
|
25
25
|
const multiPassRenderer = layer.multiPassRenderer;
|
|
26
|
-
const {
|
|
27
|
-
enableTAA
|
|
28
|
-
} = layer.getLayerConfig();
|
|
29
26
|
|
|
30
27
|
// picking pass if enabled
|
|
31
28
|
// if (enablePicking) {
|
|
32
29
|
// multiPassRenderer.add(normalPassFactory('pixelPicking'));
|
|
33
30
|
// }
|
|
34
31
|
|
|
35
|
-
//
|
|
36
|
-
|
|
37
|
-
multiPassRenderer.add(normalPassFactory('taa'));
|
|
38
|
-
} else {
|
|
39
|
-
// render all layers in this pass
|
|
40
|
-
multiPassRenderer.add(normalPassFactory('render'));
|
|
41
|
-
}
|
|
32
|
+
// render all layers in this pass
|
|
33
|
+
multiPassRenderer.add(normalPassFactory('render'));
|
|
42
34
|
|
|
43
35
|
// post processing
|
|
44
36
|
normalizePasses(passes).forEach(pass => {
|
|
@@ -1,20 +1,6 @@
|
|
|
1
1
|
import type { IModel, IModelUniform, IRenderOptions, ITexture2D } from '@antv/l7-core';
|
|
2
2
|
import BaseModel from '../../core/BaseModel';
|
|
3
3
|
export default class WindModel extends BaseModel {
|
|
4
|
-
protected get attributeLocation(): {
|
|
5
|
-
readonly POSITION: 0;
|
|
6
|
-
readonly POSITION_64LOW: 1;
|
|
7
|
-
readonly COLOR: 2;
|
|
8
|
-
readonly PICKING_COLOR: 3;
|
|
9
|
-
readonly STROKE: 4;
|
|
10
|
-
readonly OPACITY: 5;
|
|
11
|
-
readonly OFFSETS: 6;
|
|
12
|
-
readonly ROTATION: 7;
|
|
13
|
-
readonly MAX: 8;
|
|
14
|
-
} & Record<string, number> & {
|
|
15
|
-
MAX: 8;
|
|
16
|
-
UV: number;
|
|
17
|
-
};
|
|
18
4
|
protected texture: ITexture2D;
|
|
19
5
|
private colorModel;
|
|
20
6
|
private wind;
|
package/lib/wind/models/wind.js
CHANGED
|
@@ -15,7 +15,7 @@ var _windRender = require("./windRender");
|
|
|
15
15
|
/* babel-plugin-inline-import '../shaders/wind_frag.glsl' */
|
|
16
16
|
const WindFrag = "precision mediump float;\nuniform float u_opacity: 1.0;\nuniform sampler2D u_texture;\nvarying vec2 v_texCoord;\nvoid main() {\n vec4 color = texture2D(u_texture,vec2(v_texCoord.x,v_texCoord.y));\n gl_FragColor = color;\n gl_FragColor.a *= u_opacity;\n}\n";
|
|
17
17
|
/* babel-plugin-inline-import '../shaders/wind_vert.glsl' */
|
|
18
|
-
const WindVert = "precision highp float;\nuniform mat4 u_ModelMatrix;\n\
|
|
18
|
+
const WindVert = "precision highp float;\nuniform mat4 u_ModelMatrix;\n\nattribute vec3 a_Position;\nattribute vec2 a_Uv;\nvarying vec2 v_texCoord;\n#pragma include \"projection\"\nvoid main() {\n v_texCoord = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy,0., 1.0));\n}\n";
|
|
19
19
|
const defaultRampColors = {
|
|
20
20
|
0.0: '#3288bd',
|
|
21
21
|
0.1: '#66c2a5',
|
|
@@ -39,12 +39,6 @@ class WindModel extends _BaseModel.default {
|
|
|
39
39
|
(0, _defineProperty2.default)(this, "frequency", new _l7Utils.FrequencyController(7.2));
|
|
40
40
|
(0, _defineProperty2.default)(this, "cacheZoom", void 0);
|
|
41
41
|
}
|
|
42
|
-
get attributeLocation() {
|
|
43
|
-
return Object.assign(super.attributeLocation, {
|
|
44
|
-
MAX: super.attributeLocation.MAX,
|
|
45
|
-
UV: 9
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
42
|
render(options) {
|
|
49
43
|
this.drawColorMode(options);
|
|
50
44
|
// Tip: 控制风场的平均更新频率
|
|
@@ -121,7 +115,6 @@ class WindModel extends _BaseModel.default {
|
|
|
121
115
|
moduleName: 'wind',
|
|
122
116
|
vertexShader: WindVert,
|
|
123
117
|
fragmentShader: WindFrag,
|
|
124
|
-
defines: _this.getDefines(),
|
|
125
118
|
triangulation: _triangulation.RasterImageTriangulation,
|
|
126
119
|
primitive: _l7Core.gl.TRIANGLES,
|
|
127
120
|
depth: {
|
|
@@ -160,7 +153,6 @@ class WindModel extends _BaseModel.default {
|
|
|
160
153
|
type: _l7Core.AttributeType.Attribute,
|
|
161
154
|
descriptor: {
|
|
162
155
|
name: 'a_Uv',
|
|
163
|
-
shaderLocation: this.attributeLocation.UV,
|
|
164
156
|
buffer: {
|
|
165
157
|
// give the WebGL driver a hint that this buffer may change
|
|
166
158
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
precision highp float;
|
|
2
2
|
uniform mat4 u_ModelMatrix;
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
attribute vec3 a_Position;
|
|
5
|
+
attribute vec2 a_Uv;
|
|
7
6
|
varying vec2 v_texCoord;
|
|
8
7
|
#pragma include "projection"
|
|
9
8
|
void main() {
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
v_texCoord = a_Uv;
|
|
10
|
+
vec4 project_pos = project_position(vec4(a_Position, 1.0));
|
|
12
11
|
|
|
13
|
-
|
|
12
|
+
gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy,0., 1.0));
|
|
14
13
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/l7-layers",
|
|
3
|
-
"version": "2.21.
|
|
3
|
+
"version": "2.21.10",
|
|
4
4
|
"description": "L7's collection of built-in layers",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "https://github.com/orgs/antvis/people",
|
|
@@ -23,29 +23,29 @@
|
|
|
23
23
|
"@turf/meta": "^6.0.2",
|
|
24
24
|
"@turf/polygon-to-line": "^6.5.0",
|
|
25
25
|
"@turf/union": "^6.5.0",
|
|
26
|
-
"d3-array": "
|
|
26
|
+
"d3-array": "^2",
|
|
27
27
|
"d3-color": "^1.4.0",
|
|
28
28
|
"d3-interpolate": "1.4.0",
|
|
29
|
-
"d3-scale": "2",
|
|
29
|
+
"d3-scale": "^2",
|
|
30
30
|
"earcut": "^2.2.1",
|
|
31
31
|
"eventemitter3": "^4.0.0",
|
|
32
32
|
"extrude-polyline": "^1.0.6",
|
|
33
33
|
"gl-matrix": "^3.1.0",
|
|
34
34
|
"gl-vec2": "^1.3.0",
|
|
35
35
|
"polyline-miter-util": "^1.0.1",
|
|
36
|
-
"@antv/l7-core": "2.21.
|
|
37
|
-
"@antv/l7-maps": "2.21.
|
|
38
|
-
"@antv/l7-source": "2.21.
|
|
39
|
-
"@antv/l7-utils": "2.21.
|
|
36
|
+
"@antv/l7-core": "2.21.10",
|
|
37
|
+
"@antv/l7-maps": "2.21.10",
|
|
38
|
+
"@antv/l7-source": "2.21.10",
|
|
39
|
+
"@antv/l7-utils": "2.21.10"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@types/d3-array": "^2
|
|
42
|
+
"@types/d3-array": "^2",
|
|
43
43
|
"@types/d3-color": "^1.2.2",
|
|
44
44
|
"@types/d3-interpolate": "1.1.6",
|
|
45
45
|
"@types/d3-scale": "^2.1.1",
|
|
46
46
|
"@types/earcut": "^2.1.0",
|
|
47
47
|
"@types/gl-matrix": "^2.4.5",
|
|
48
|
-
"@antv/l7-test-utils": "^2.21.
|
|
48
|
+
"@antv/l7-test-utils": "^2.21.10"
|
|
49
49
|
},
|
|
50
50
|
"publishConfig": {
|
|
51
51
|
"access": "public",
|