@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
|
@@ -4,23 +4,18 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
|
4
4
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
5
5
|
import { getDefaultDomain } from '@antv/l7-utils';
|
|
6
6
|
import BaseModel from "../../core/BaseModel";
|
|
7
|
+
import { ShaderLocation } from "../../core/CommonStyleAttribute";
|
|
7
8
|
import { RasterImageTriangulation } from "../../core/triangulation";
|
|
8
9
|
/* babel-plugin-inline-import '../shaders/raster/raster_2d_frag.glsl' */
|
|
9
10
|
const rasterFrag = "layout(std140) uniform commonUniforms {\n vec2 u_domain;\n float u_opacity;\n float u_noDataValue;\n float u_clampLow;\n float u_clampHigh;\n};\n\nuniform sampler2D u_rasterTexture;\nuniform sampler2D u_colorTexture;\n\nin vec2 v_texCoord;\n\nbool isnan_emu(float x) { return (x > 0.0 || x < 0.0) ? x != x : x != 0.0; }\n\nout vec4 outputColor;\n\nvoid main() {\n // Can use any component here since u_rasterTexture is under luminance format.\n float value = texture(SAMPLER_2D(u_rasterTexture), vec2(v_texCoord.x, v_texCoord.y)).r;\n if (value == u_noDataValue || isnan_emu(value)) {\n discard;\n } else if ((u_clampLow < 0.5 && value < u_domain[0]) || (u_clampHigh < 0.5 && value > u_domain[1])) {\n discard;\n } else {\n float normalisedValue =(value - u_domain[0]) / (u_domain[1] - u_domain[0]);\n vec4 color = texture(SAMPLER_2D(u_colorTexture), vec2(normalisedValue, 0));\n \n outputColor = color;\n outputColor.a = outputColor.a * u_opacity ;\n if (outputColor.a < 0.01)\n discard;\n }\n}\n";
|
|
10
11
|
/* babel-plugin-inline-import '../shaders/raster/raster_2d_vert.glsl' */
|
|
11
|
-
const rasterVert = "
|
|
12
|
+
const rasterVert = "\nlayout(location = 0) in vec3 a_Position;\nlayout(location = 14) in vec2 a_Uv;\n\nlayout(std140) uniform commonUniforms {\n vec2 u_domain;\n float u_opacity;\n float u_noDataValue;\n float u_clampLow;\n float u_clampHigh;\n};\n\nout vec2 v_texCoord;\n\n#pragma include \"projection\"\n\nvoid main() {\n v_texCoord = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy,0., 1.0));\n}\n";
|
|
12
13
|
export default class RasterModel extends BaseModel {
|
|
13
14
|
constructor(...args) {
|
|
14
15
|
super(...args);
|
|
15
16
|
_defineProperty(this, "texture", void 0);
|
|
16
17
|
_defineProperty(this, "colorTexture", void 0);
|
|
17
18
|
}
|
|
18
|
-
get attributeLocation() {
|
|
19
|
-
return Object.assign(super.attributeLocation, {
|
|
20
|
-
MAX: super.attributeLocation.MAX,
|
|
21
|
-
UV: 9
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
19
|
getUninforms() {
|
|
25
20
|
const commoninfo = this.getCommonUniformsInfo();
|
|
26
21
|
const attributeInfo = this.getUniformsBufferInfo(this.getStyleAttribute());
|
|
@@ -112,7 +107,6 @@ export default class RasterModel extends BaseModel {
|
|
|
112
107
|
moduleName: 'rasterImageData',
|
|
113
108
|
vertexShader: rasterVert,
|
|
114
109
|
fragmentShader: rasterFrag,
|
|
115
|
-
defines: _this2.getDefines(),
|
|
116
110
|
triangulation: RasterImageTriangulation,
|
|
117
111
|
primitive: gl.TRIANGLES,
|
|
118
112
|
depth: {
|
|
@@ -129,15 +123,12 @@ export default class RasterModel extends BaseModel {
|
|
|
129
123
|
(_this$colorTexture = this.colorTexture) === null || _this$colorTexture === void 0 || _this$colorTexture.destroy();
|
|
130
124
|
}
|
|
131
125
|
registerBuiltinAttributes() {
|
|
132
|
-
// 注册 Position 属性 64 位地位部分,经纬度数据开启双精度,避免大于 22 层级以上出现数据偏移
|
|
133
|
-
this.registerPosition64LowAttribute();
|
|
134
|
-
|
|
135
126
|
// point layer size;
|
|
136
127
|
this.styleAttributeService.registerStyleAttribute({
|
|
137
128
|
name: 'uv',
|
|
138
129
|
type: AttributeType.Attribute,
|
|
139
130
|
descriptor: {
|
|
140
|
-
shaderLocation:
|
|
131
|
+
shaderLocation: ShaderLocation.UV,
|
|
141
132
|
name: 'a_Uv',
|
|
142
133
|
buffer: {
|
|
143
134
|
// give the WebGL driver a hint that this buffer may change
|
|
@@ -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 RasterModel extends BaseModel {
|
|
4
|
-
protected get attributeLocation(): {
|
|
5
|
-
readonly POSITION: 0;
|
|
6
|
-
readonly POSITION_64LOW: 1;
|
|
7
|
-
readonly COLOR: 2;
|
|
8
|
-
readonly PICKING_COLOR: 3;
|
|
9
|
-
readonly STROKE: 4;
|
|
10
|
-
readonly OPACITY: 5;
|
|
11
|
-
readonly OFFSETS: 6;
|
|
12
|
-
readonly ROTATION: 7;
|
|
13
|
-
readonly MAX: 8;
|
|
14
|
-
} & Record<string, number> & {
|
|
15
|
-
MAX: 8;
|
|
16
|
-
UV: number;
|
|
17
|
-
};
|
|
18
4
|
protected texture: ITexture2D;
|
|
19
5
|
protected dataOption: any;
|
|
20
6
|
getUninforms(): {
|
|
@@ -6,23 +6,18 @@ const _excluded = ["data"],
|
|
|
6
6
|
_excluded2 = ["rasterData"];
|
|
7
7
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
8
8
|
import BaseModel from "../../core/BaseModel";
|
|
9
|
+
import { ShaderLocation } from "../../core/CommonStyleAttribute";
|
|
9
10
|
import { RasterImageTriangulation } from "../../core/triangulation";
|
|
10
11
|
/* babel-plugin-inline-import '../shaders/rgb/raster_rgb_frag.glsl' */
|
|
11
12
|
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}";
|
|
12
13
|
/* babel-plugin-inline-import '../shaders/rgb/raster_rgb_vert.glsl' */
|
|
13
|
-
const rasterVert = "
|
|
14
|
+
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";
|
|
14
15
|
export default class RasterModel extends BaseModel {
|
|
15
16
|
constructor(...args) {
|
|
16
17
|
super(...args);
|
|
17
18
|
_defineProperty(this, "texture", void 0);
|
|
18
19
|
_defineProperty(this, "dataOption", {});
|
|
19
20
|
}
|
|
20
|
-
get attributeLocation() {
|
|
21
|
-
return Object.assign(super.attributeLocation, {
|
|
22
|
-
MAX: super.attributeLocation.MAX,
|
|
23
|
-
UV: 9
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
21
|
getUninforms() {
|
|
27
22
|
const commoninfo = this.getCommonUniformsInfo();
|
|
28
23
|
const attributeInfo = this.getUniformsBufferInfo(this.getStyleAttribute());
|
|
@@ -110,7 +105,6 @@ export default class RasterModel extends BaseModel {
|
|
|
110
105
|
moduleName: 'rasterImageDataRGBA',
|
|
111
106
|
vertexShader: rasterVert,
|
|
112
107
|
fragmentShader: rasterFrag,
|
|
113
|
-
defines: _this2.getDefines(),
|
|
114
108
|
triangulation: RasterImageTriangulation,
|
|
115
109
|
primitive: gl.TRIANGLES,
|
|
116
110
|
depth: {
|
|
@@ -132,16 +126,13 @@ export default class RasterModel extends BaseModel {
|
|
|
132
126
|
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
|
|
133
127
|
}
|
|
134
128
|
registerBuiltinAttributes() {
|
|
135
|
-
// 注册 Position 属性 64 位地位部分,经纬度数据开启双精度,避免大于 22 层级以上出现数据偏移
|
|
136
|
-
this.registerPosition64LowAttribute();
|
|
137
|
-
|
|
138
129
|
// point layer size;
|
|
139
130
|
this.styleAttributeService.registerStyleAttribute({
|
|
140
131
|
name: 'uv',
|
|
141
132
|
type: AttributeType.Attribute,
|
|
142
133
|
descriptor: {
|
|
143
134
|
name: 'a_Uv',
|
|
144
|
-
shaderLocation:
|
|
135
|
+
shaderLocation: ShaderLocation.UV,
|
|
145
136
|
buffer: {
|
|
146
137
|
// give the WebGL driver a hint that this buffer may change
|
|
147
138
|
usage: 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[];
|
|
@@ -3,22 +3,17 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
|
3
3
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
4
4
|
import { getDefaultDomain } from '@antv/l7-utils';
|
|
5
5
|
import BaseModel from "../../core/BaseModel";
|
|
6
|
+
import { ShaderLocation } from "../../core/CommonStyleAttribute";
|
|
6
7
|
import { RasterImageTriangulation } from "../../core/triangulation";
|
|
7
8
|
/* babel-plugin-inline-import '../shaders/terrain/terrain_rgb_frag.glsl' */
|
|
8
9
|
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";
|
|
9
10
|
/* babel-plugin-inline-import '../shaders/terrain/terrain_rgb_vert.glsl' */
|
|
10
|
-
const Raster_terrainVert = "layout(location =
|
|
11
|
+
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";
|
|
11
12
|
export default class RasterTerrainRGB extends BaseModel {
|
|
12
13
|
constructor(...args) {
|
|
13
14
|
super(...args);
|
|
14
15
|
_defineProperty(this, "texture", void 0);
|
|
15
16
|
}
|
|
16
|
-
get attributeLocation() {
|
|
17
|
-
return Object.assign(super.attributeLocation, {
|
|
18
|
-
MAX: super.attributeLocation.MAX,
|
|
19
|
-
UV: 9
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
17
|
getCommonUniformsInfo() {
|
|
23
18
|
const {
|
|
24
19
|
opacity,
|
|
@@ -74,7 +69,6 @@ export default class RasterTerrainRGB extends BaseModel {
|
|
|
74
69
|
moduleName: 'RasterTileDataImage',
|
|
75
70
|
vertexShader: Raster_terrainVert,
|
|
76
71
|
fragmentShader: Raster_terrainFrag,
|
|
77
|
-
defines: _this.getDefines(),
|
|
78
72
|
triangulation: RasterImageTriangulation,
|
|
79
73
|
primitive: gl.TRIANGLES,
|
|
80
74
|
depth: {
|
|
@@ -95,14 +89,12 @@ export default class RasterTerrainRGB extends BaseModel {
|
|
|
95
89
|
})();
|
|
96
90
|
}
|
|
97
91
|
registerBuiltinAttributes() {
|
|
98
|
-
// 注册 Position 属性 64 位地位部分,经纬度数据开启双精度,避免大于 22 层级以上出现数据偏移
|
|
99
|
-
this.registerPosition64LowAttribute();
|
|
100
92
|
this.styleAttributeService.registerStyleAttribute({
|
|
101
93
|
name: 'uv',
|
|
102
94
|
type: AttributeType.Attribute,
|
|
103
95
|
descriptor: {
|
|
104
96
|
name: 'a_Uv',
|
|
105
|
-
shaderLocation:
|
|
97
|
+
shaderLocation: ShaderLocation.UV,
|
|
106
98
|
buffer: {
|
|
107
99
|
usage: gl.DYNAMIC_DRAW,
|
|
108
100
|
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
|
}
|
|
@@ -32,6 +32,22 @@ export default class BaseTileLayer {
|
|
|
32
32
|
latLonBounds,
|
|
33
33
|
zoom
|
|
34
34
|
} = this.getCurrentView();
|
|
35
|
+
if (this.mapService.version === 'GAODE1.x') {
|
|
36
|
+
const {
|
|
37
|
+
visible
|
|
38
|
+
} = this.parent.getLayerConfig();
|
|
39
|
+
if (zoom < 2 && visible) {
|
|
40
|
+
this.parent.updateLayerConfig({
|
|
41
|
+
visible: false
|
|
42
|
+
});
|
|
43
|
+
this.layerService.reRender();
|
|
44
|
+
} else if (zoom >= 2 && !visible) {
|
|
45
|
+
this.parent.updateLayerConfig({
|
|
46
|
+
visible: true
|
|
47
|
+
});
|
|
48
|
+
this.layerService.reRender();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
35
51
|
if (this.lastViewStates && this.lastViewStates.zoom === zoom && this.lastViewStates.latLonBounds.toString() === latLonBounds.toString()) {
|
|
36
52
|
return;
|
|
37
53
|
}
|
package/es/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;
|
|
@@ -91,6 +91,98 @@ export default class ExtrudePolyline {
|
|
|
91
91
|
complex.startIndex = complex.positions.length / 6;
|
|
92
92
|
return complex;
|
|
93
93
|
}
|
|
94
|
+
simpleExtrude_gaode2(points, originPoints) {
|
|
95
|
+
const complex = this.complex;
|
|
96
|
+
if (points.length <= 1) {
|
|
97
|
+
return complex;
|
|
98
|
+
}
|
|
99
|
+
this.lastFlip = -1;
|
|
100
|
+
this.started = false;
|
|
101
|
+
this.normal = null;
|
|
102
|
+
this.totalDistance = 0;
|
|
103
|
+
// 去除数组里重复的点
|
|
104
|
+
// points = getArrayUnique(points);
|
|
105
|
+
const total = points.length;
|
|
106
|
+
let count = complex.startIndex;
|
|
107
|
+
for (let i = 1; i < total; i++) {
|
|
108
|
+
var _originPoints$, _originPoints$i$, _originPoints$2;
|
|
109
|
+
const last = points[i - 1];
|
|
110
|
+
last.push((_originPoints$ = originPoints[i - 1][2]) !== null && _originPoints$ !== void 0 ? _originPoints$ : 0);
|
|
111
|
+
// @ts-ignore
|
|
112
|
+
const originLast = originPoints[i - 1];
|
|
113
|
+
const cur = points[i];
|
|
114
|
+
cur.push((_originPoints$i$ = originPoints[i][2]) !== null && _originPoints$i$ !== void 0 ? _originPoints$i$ : 0);
|
|
115
|
+
// @ts-ignore
|
|
116
|
+
const originCur = originPoints[i];
|
|
117
|
+
const next = i < points.length - 1 ? [...points[i + 1], (_originPoints$2 = originPoints[i + 1][2]) !== null && _originPoints$2 !== void 0 ? _originPoints$2 : 0] : null;
|
|
118
|
+
const originNext = i < originPoints.length - 1 ? originPoints[i + 1] : null;
|
|
119
|
+
const amt = this.simpleSegment(complex, count,
|
|
120
|
+
// @ts-ignore
|
|
121
|
+
last,
|
|
122
|
+
// @ts-ignore
|
|
123
|
+
cur,
|
|
124
|
+
// @ts-ignore
|
|
125
|
+
next,
|
|
126
|
+
// @ts-ignore
|
|
127
|
+
originLast, originCur,
|
|
128
|
+
// @ts-ignore
|
|
129
|
+
originNext);
|
|
130
|
+
count += amt;
|
|
131
|
+
}
|
|
132
|
+
if (this.dash) {
|
|
133
|
+
for (let i = 0; i < complex.positions.length / 6; i++) {
|
|
134
|
+
complex.positions[i * 6 + 5] = this.totalDistance;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
complex.startIndex = complex.positions.length / 6;
|
|
138
|
+
return complex;
|
|
139
|
+
}
|
|
140
|
+
extrude_gaode2(points, originPoints) {
|
|
141
|
+
const complex = this.complex;
|
|
142
|
+
if (points.length <= 1) {
|
|
143
|
+
return complex;
|
|
144
|
+
}
|
|
145
|
+
this.lastFlip = -1;
|
|
146
|
+
this.started = false;
|
|
147
|
+
this.normal = null;
|
|
148
|
+
this.totalDistance = 0;
|
|
149
|
+
// 去除数组里重复的点
|
|
150
|
+
// points = getArrayUnique(points);
|
|
151
|
+
const total = points.length;
|
|
152
|
+
let count = complex.startIndex;
|
|
153
|
+
for (let i = 1; i < total; i++) {
|
|
154
|
+
var _originPoints$3, _originPoints$i$2, _originPoints$4;
|
|
155
|
+
const last = points[i - 1];
|
|
156
|
+
last.push((_originPoints$3 = originPoints[i - 1][2]) !== null && _originPoints$3 !== void 0 ? _originPoints$3 : 0);
|
|
157
|
+
// @ts-ignore
|
|
158
|
+
const originLast = originPoints[i - 1];
|
|
159
|
+
const cur = points[i];
|
|
160
|
+
cur.push((_originPoints$i$2 = originPoints[i][2]) !== null && _originPoints$i$2 !== void 0 ? _originPoints$i$2 : 0);
|
|
161
|
+
// @ts-ignore
|
|
162
|
+
const originCur = originPoints[i];
|
|
163
|
+
const next = i < points.length - 1 ? [...points[i + 1], (_originPoints$4 = originPoints[i + 1][2]) !== null && _originPoints$4 !== void 0 ? _originPoints$4 : 0] : null;
|
|
164
|
+
const originNext = i < originPoints.length - 1 ? originPoints[i + 1] : null;
|
|
165
|
+
const amt = this.segment_gaode2(complex, count,
|
|
166
|
+
// @ts-ignore
|
|
167
|
+
last,
|
|
168
|
+
// @ts-ignore
|
|
169
|
+
cur,
|
|
170
|
+
// @ts-ignore
|
|
171
|
+
next,
|
|
172
|
+
// @ts-ignore
|
|
173
|
+
originLast, originCur,
|
|
174
|
+
// @ts-ignore
|
|
175
|
+
originNext);
|
|
176
|
+
count += amt;
|
|
177
|
+
}
|
|
178
|
+
if (this.dash) {
|
|
179
|
+
for (let i = 0; i < complex.positions.length / 6; i++) {
|
|
180
|
+
complex.positions[i * 6 + 5] = this.totalDistance;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
complex.startIndex = complex.positions.length / 6;
|
|
184
|
+
return complex;
|
|
185
|
+
}
|
|
94
186
|
extrude(points) {
|
|
95
187
|
const complex = this.complex;
|
|
96
188
|
if (points.length <= 1) {
|
|
@@ -173,6 +265,131 @@ export default class ExtrudePolyline {
|
|
|
173
265
|
}
|
|
174
266
|
return count;
|
|
175
267
|
}
|
|
268
|
+
segment_gaode2(complex, index, last, cur, next, originLast, originCur,
|
|
269
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
270
|
+
originNext) {
|
|
271
|
+
let count = 0;
|
|
272
|
+
const indices = complex.indices;
|
|
273
|
+
const positions = complex.positions;
|
|
274
|
+
const normals = complex.normals;
|
|
275
|
+
const capSquare = this.cap === 'square';
|
|
276
|
+
const joinBevel = this.join === 'bevel';
|
|
277
|
+
const flatCur = aProjectFlat([originCur[0], originCur[1]]);
|
|
278
|
+
const flatLast = aProjectFlat([originLast[0], originLast[1]]);
|
|
279
|
+
// @ts-ignore
|
|
280
|
+
direction(lineA, cur, last);
|
|
281
|
+
let segmentDistance = 0;
|
|
282
|
+
if (this.dash) {
|
|
283
|
+
// @ts-ignore
|
|
284
|
+
segmentDistance = this.lineSegmentDistance(flatCur, flatLast);
|
|
285
|
+
this.totalDistance += segmentDistance;
|
|
286
|
+
}
|
|
287
|
+
if (!this.normal) {
|
|
288
|
+
this.normal = vec2.create();
|
|
289
|
+
computeNormal(this.normal, lineA);
|
|
290
|
+
}
|
|
291
|
+
if (!this.started) {
|
|
292
|
+
this.started = true;
|
|
293
|
+
|
|
294
|
+
// if the end cap is type square, we can just push the verts out a bit
|
|
295
|
+
if (capSquare) {
|
|
296
|
+
// vec2.scaleAndAdd(capEnd, last, lineA, -this.thickness);
|
|
297
|
+
const out1 = vec2.create();
|
|
298
|
+
const out2 = vec2.create();
|
|
299
|
+
vec2.add(out1, this.normal, lineA);
|
|
300
|
+
vec2.add(out2, this.normal, lineA);
|
|
301
|
+
normals.push(out2[0], out2[1], 0);
|
|
302
|
+
normals.push(out1[0], out1[1], 0);
|
|
303
|
+
positions.push(last[0], last[1], last[2] | 0, this.totalDistance - segmentDistance, -this.thickness, last[2] | 0);
|
|
304
|
+
this.complex.indexes.push(this.currentIndex);
|
|
305
|
+
positions.push(last[0], last[1], last[2] | 0, this.totalDistance - segmentDistance, this.thickness, last[2] | 0);
|
|
306
|
+
this.complex.indexes.push(this.currentIndex);
|
|
307
|
+
this.currentIndex++;
|
|
308
|
+
} else {
|
|
309
|
+
this.extrusions(positions, normals, last, this.normal, this.thickness, this.totalDistance - segmentDistance);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
indices.push(index + 0, index + 1, index + 2);
|
|
313
|
+
if (!next) {
|
|
314
|
+
computeNormal(this.normal, lineA);
|
|
315
|
+
if (capSquare) {
|
|
316
|
+
const out1 = vec2.create();
|
|
317
|
+
const out2 = vec2.create();
|
|
318
|
+
vec2.sub(out2, lineA, this.normal);
|
|
319
|
+
vec2.add(out1, lineA, this.normal);
|
|
320
|
+
normals.push(out2[0], out2[1], 0);
|
|
321
|
+
normals.push(out1[0], out1[1], 0);
|
|
322
|
+
positions.push(cur[0], cur[1], cur[2] | 0, this.totalDistance, this.thickness, cur[2] | 0);
|
|
323
|
+
this.complex.indexes.push(this.currentIndex);
|
|
324
|
+
positions.push(cur[0], cur[1], cur[2] | 0, this.totalDistance, this.thickness, cur[2] | 0);
|
|
325
|
+
this.complex.indexes.push(this.currentIndex);
|
|
326
|
+
this.currentIndex++;
|
|
327
|
+
} else {
|
|
328
|
+
this.extrusions(positions, normals, cur, this.normal, this.thickness, this.totalDistance);
|
|
329
|
+
}
|
|
330
|
+
indices.push(...(this.lastFlip === 1 ? [index, index + 2, index + 3] : [index + 2, index + 1, index + 3]));
|
|
331
|
+
count += 2;
|
|
332
|
+
} else {
|
|
333
|
+
// @ts-ignore
|
|
334
|
+
if (isPointEqual(cur, next)) {
|
|
335
|
+
vec2.add(
|
|
336
|
+
// @ts-ignore
|
|
337
|
+
next,
|
|
338
|
+
// @ts-ignore
|
|
339
|
+
cur, vec2.normalize(
|
|
340
|
+
// @ts-ignore
|
|
341
|
+
next,
|
|
342
|
+
// @ts-ignore
|
|
343
|
+
vec2.subtract(next, cur, last)));
|
|
344
|
+
}
|
|
345
|
+
// @ts-ignore
|
|
346
|
+
direction(lineB, next, cur);
|
|
347
|
+
// stores tangent & miter
|
|
348
|
+
|
|
349
|
+
const [miterLen, miter] = computeMiter(tangent, vec2.create(), lineA, lineB, this.thickness);
|
|
350
|
+
// normal(tmp, lineA)
|
|
351
|
+
|
|
352
|
+
// get orientation
|
|
353
|
+
let flip = vec2.dot(tangent, this.normal) < 0 ? -1 : 1;
|
|
354
|
+
let bevel = joinBevel;
|
|
355
|
+
if (!bevel && this.join === 'miter') {
|
|
356
|
+
const limit = miterLen;
|
|
357
|
+
if (limit > this.miterLimit) {
|
|
358
|
+
bevel = true;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
if (bevel) {
|
|
362
|
+
normals.push(this.normal[0], this.normal[1], 0);
|
|
363
|
+
normals.push(miter[0], miter[1], 0);
|
|
364
|
+
positions.push(cur[0], cur[1], cur[2] | 0, this.totalDistance, -this.thickness * flip, cur[2] | 0);
|
|
365
|
+
this.complex.indexes.push(this.currentIndex);
|
|
366
|
+
positions.push(cur[0], cur[1], cur[2] | 0, this.totalDistance, this.thickness * flip, cur[2] | 0);
|
|
367
|
+
this.complex.indexes.push(this.currentIndex);
|
|
368
|
+
this.currentIndex++;
|
|
369
|
+
indices.push(...(this.lastFlip !== -flip ? [index, index + 2, index + 3] : [index + 2, index + 1, index + 3]));
|
|
370
|
+
|
|
371
|
+
// now add the bevel triangle
|
|
372
|
+
indices.push(index + 2, index + 3, index + 4);
|
|
373
|
+
computeNormal(tmp, lineB);
|
|
374
|
+
vec2.copy(this.normal, tmp); // store normal for next round
|
|
375
|
+
normals.push(this.normal[0], this.normal[1], 0);
|
|
376
|
+
positions.push(cur[0], cur[1], cur[2] | 0, this.totalDistance, -this.thickness * flip, cur[2] | 0);
|
|
377
|
+
this.complex.indexes.push(this.currentIndex);
|
|
378
|
+
this.currentIndex++;
|
|
379
|
+
count += 3;
|
|
380
|
+
} else {
|
|
381
|
+
this.extrusions(positions, normals, cur, miter, miterLen, this.totalDistance);
|
|
382
|
+
indices.push(...(this.lastFlip === 1 ? [index, index + 2, index + 3] : [index + 2, index + 1, index + 3]));
|
|
383
|
+
flip = -1;
|
|
384
|
+
|
|
385
|
+
// the miter is now the normal for our next join
|
|
386
|
+
vec2.copy(this.normal, miter);
|
|
387
|
+
count += 2;
|
|
388
|
+
}
|
|
389
|
+
this.lastFlip = flip;
|
|
390
|
+
}
|
|
391
|
+
return count;
|
|
392
|
+
}
|
|
176
393
|
segment(complex, index, last, cur, next) {
|
|
177
394
|
let count = 0;
|
|
178
395
|
const indices = complex.indices;
|
|
@@ -16,22 +16,14 @@ export function normalizePasses(passes) {
|
|
|
16
16
|
*/
|
|
17
17
|
export function createMultiPassRenderer(layer, passes, postProcessingPassFactory, normalPassFactory) {
|
|
18
18
|
const multiPassRenderer = layer.multiPassRenderer;
|
|
19
|
-
const {
|
|
20
|
-
enableTAA
|
|
21
|
-
} = layer.getLayerConfig();
|
|
22
19
|
|
|
23
20
|
// picking pass if enabled
|
|
24
21
|
// if (enablePicking) {
|
|
25
22
|
// multiPassRenderer.add(normalPassFactory('pixelPicking'));
|
|
26
23
|
// }
|
|
27
24
|
|
|
28
|
-
//
|
|
29
|
-
|
|
30
|
-
multiPassRenderer.add(normalPassFactory('taa'));
|
|
31
|
-
} else {
|
|
32
|
-
// render all layers in this pass
|
|
33
|
-
multiPassRenderer.add(normalPassFactory('render'));
|
|
34
|
-
}
|
|
25
|
+
// render all layers in this pass
|
|
26
|
+
multiPassRenderer.add(normalPassFactory('render'));
|
|
35
27
|
|
|
36
28
|
// post processing
|
|
37
29
|
normalizePasses(passes).forEach(pass => {
|
package/es/wind/models/wind.d.ts
CHANGED
|
@@ -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;
|