@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
|
@@ -3,27 +3,28 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.ShaderLocation = void 0;
|
|
7
7
|
exports.getCommonStyleAttributeOptions = getCommonStyleAttributeOptions;
|
|
8
8
|
var _l7Core = require("@antv/l7-core");
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
9
|
+
let ShaderLocation = exports.ShaderLocation = /*#__PURE__*/function (ShaderLocation) {
|
|
10
|
+
ShaderLocation[ShaderLocation["POSITION"] = 0] = "POSITION";
|
|
11
|
+
ShaderLocation[ShaderLocation["COLOR"] = 1] = "COLOR";
|
|
12
|
+
ShaderLocation[ShaderLocation["VERTEX_ID"] = 2] = "VERTEX_ID";
|
|
13
|
+
ShaderLocation[ShaderLocation["PICKING_COLOR"] = 3] = "PICKING_COLOR";
|
|
14
|
+
ShaderLocation[ShaderLocation["STROKE"] = 4] = "STROKE";
|
|
15
|
+
ShaderLocation[ShaderLocation["OPACITY"] = 5] = "OPACITY";
|
|
16
|
+
ShaderLocation[ShaderLocation["OFFSETS"] = 6] = "OFFSETS";
|
|
17
|
+
ShaderLocation[ShaderLocation["ROTATION"] = 7] = "ROTATION";
|
|
18
|
+
ShaderLocation[ShaderLocation["EXTRUSION_BASE"] = 8] = "EXTRUSION_BASE";
|
|
19
|
+
ShaderLocation[ShaderLocation["SIZE"] = 9] = "SIZE";
|
|
20
|
+
ShaderLocation[ShaderLocation["SHAPE"] = 10] = "SHAPE";
|
|
21
|
+
ShaderLocation[ShaderLocation["EXTRUDE"] = 11] = "EXTRUDE";
|
|
22
|
+
ShaderLocation[ShaderLocation["MAX"] = 12] = "MAX";
|
|
23
|
+
ShaderLocation[ShaderLocation["NORMAL"] = 13] = "NORMAL";
|
|
24
|
+
ShaderLocation[ShaderLocation["UV"] = 14] = "UV";
|
|
25
|
+
ShaderLocation[ShaderLocation["LINEAR"] = 15] = "LINEAR";
|
|
26
|
+
return ShaderLocation;
|
|
27
|
+
}({}); // Polygon Linear
|
|
27
28
|
function getCommonStyleAttributeOptions(name) {
|
|
28
29
|
switch (name) {
|
|
29
30
|
// // roate
|
|
@@ -33,7 +34,7 @@ function getCommonStyleAttributeOptions(name) {
|
|
|
33
34
|
type: _l7Core.AttributeType.Attribute,
|
|
34
35
|
descriptor: {
|
|
35
36
|
name: 'a_Rotation',
|
|
36
|
-
shaderLocation:
|
|
37
|
+
shaderLocation: ShaderLocation.ROTATION,
|
|
37
38
|
buffer: {
|
|
38
39
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
39
40
|
data: [],
|
|
@@ -54,7 +55,7 @@ function getCommonStyleAttributeOptions(name) {
|
|
|
54
55
|
type: _l7Core.AttributeType.Attribute,
|
|
55
56
|
descriptor: {
|
|
56
57
|
name: 'a_Stroke',
|
|
57
|
-
shaderLocation:
|
|
58
|
+
shaderLocation: ShaderLocation.STROKE,
|
|
58
59
|
buffer: {
|
|
59
60
|
// give the WebGL driver a hint that this buffer may change
|
|
60
61
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
@@ -76,7 +77,7 @@ function getCommonStyleAttributeOptions(name) {
|
|
|
76
77
|
type: _l7Core.AttributeType.Attribute,
|
|
77
78
|
descriptor: {
|
|
78
79
|
name: 'a_Opacity',
|
|
79
|
-
shaderLocation:
|
|
80
|
+
shaderLocation: ShaderLocation.OPACITY,
|
|
80
81
|
buffer: {
|
|
81
82
|
// give the WebGL driver a hint that this buffer may change
|
|
82
83
|
usage: _l7Core.gl.STATIC_DRAW,
|
|
@@ -92,13 +93,35 @@ function getCommonStyleAttributeOptions(name) {
|
|
|
92
93
|
}
|
|
93
94
|
}
|
|
94
95
|
};
|
|
96
|
+
case 'extrusionBase':
|
|
97
|
+
return {
|
|
98
|
+
name: 'extrusionBase',
|
|
99
|
+
type: _l7Core.AttributeType.Attribute,
|
|
100
|
+
descriptor: {
|
|
101
|
+
name: 'a_ExtrusionBase',
|
|
102
|
+
shaderLocation: ShaderLocation.EXTRUSION_BASE,
|
|
103
|
+
buffer: {
|
|
104
|
+
// give the WebGL driver a hint that this buffer may change
|
|
105
|
+
usage: _l7Core.gl.STATIC_DRAW,
|
|
106
|
+
data: [],
|
|
107
|
+
type: _l7Core.gl.FLOAT
|
|
108
|
+
},
|
|
109
|
+
size: 1,
|
|
110
|
+
update: feature => {
|
|
111
|
+
const {
|
|
112
|
+
extrusionBase: op = 0
|
|
113
|
+
} = feature;
|
|
114
|
+
return [op];
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
};
|
|
95
118
|
case 'offsets':
|
|
96
119
|
return {
|
|
97
120
|
name: 'offsets',
|
|
98
121
|
type: _l7Core.AttributeType.Attribute,
|
|
99
122
|
descriptor: {
|
|
100
123
|
name: 'a_Offsets',
|
|
101
|
-
shaderLocation:
|
|
124
|
+
shaderLocation: ShaderLocation.OFFSETS,
|
|
102
125
|
buffer: {
|
|
103
126
|
// give the WebGL driver a hint that this buffer may change
|
|
104
127
|
usage: _l7Core.gl.STATIC_DRAW,
|
|
@@ -114,6 +137,28 @@ function getCommonStyleAttributeOptions(name) {
|
|
|
114
137
|
}
|
|
115
138
|
}
|
|
116
139
|
};
|
|
140
|
+
case 'thetaOffset':
|
|
141
|
+
return {
|
|
142
|
+
name: 'thetaOffset',
|
|
143
|
+
type: _l7Core.AttributeType.Attribute,
|
|
144
|
+
descriptor: {
|
|
145
|
+
name: 'a_ThetaOffset',
|
|
146
|
+
shaderLocation: 15,
|
|
147
|
+
buffer: {
|
|
148
|
+
// give the WebGL driver a hint that this buffer may change
|
|
149
|
+
usage: _l7Core.gl.STATIC_DRAW,
|
|
150
|
+
data: [],
|
|
151
|
+
type: _l7Core.gl.FLOAT
|
|
152
|
+
},
|
|
153
|
+
size: 1,
|
|
154
|
+
update: feature => {
|
|
155
|
+
const {
|
|
156
|
+
thetaOffset: op = 1
|
|
157
|
+
} = feature;
|
|
158
|
+
return [op];
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
};
|
|
117
162
|
default:
|
|
118
163
|
return undefined;
|
|
119
164
|
}
|
|
@@ -103,7 +103,9 @@ function PointImageTriangulation(feature) {
|
|
|
103
103
|
*/
|
|
104
104
|
function LineTriangulation(feature) {
|
|
105
105
|
const {
|
|
106
|
-
coordinates
|
|
106
|
+
coordinates,
|
|
107
|
+
originCoordinates,
|
|
108
|
+
version
|
|
107
109
|
} = feature;
|
|
108
110
|
// let path = coordinates as number[][][] | number[][];
|
|
109
111
|
// if (!Array.isArray(path[0][0])) {
|
|
@@ -114,13 +116,32 @@ function LineTriangulation(feature) {
|
|
|
114
116
|
dash: true,
|
|
115
117
|
join: 'bevel'
|
|
116
118
|
});
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
119
|
+
if (version === 'GAODE2.x') {
|
|
120
|
+
// 处理高德2.0几何体构建
|
|
121
|
+
let path1 = coordinates; // 计算位置
|
|
122
|
+
if (!Array.isArray(path1[0][0])) {
|
|
123
|
+
path1 = [coordinates];
|
|
124
|
+
}
|
|
125
|
+
let path2 = originCoordinates; // 计算法线
|
|
126
|
+
if (!Array.isArray(path2[0][0])) {
|
|
127
|
+
path2 = [originCoordinates];
|
|
128
|
+
}
|
|
129
|
+
for (let i = 0; i < path1.length; i++) {
|
|
130
|
+
// 高德2.0在计算线时,需要使用经纬度计算发现,使用 customCoords.lnglatToCoords 计算的数据来计算顶点的位置
|
|
131
|
+
const item1 = path1[i];
|
|
132
|
+
const item2 = path2[i];
|
|
133
|
+
line.extrude_gaode2(item1, item2);
|
|
134
|
+
}
|
|
135
|
+
} else {
|
|
136
|
+
// 处理非高德2.0的几何体构建
|
|
137
|
+
let path = coordinates;
|
|
138
|
+
if (path[0] && !Array.isArray(path[0][0])) {
|
|
139
|
+
path = [coordinates];
|
|
140
|
+
}
|
|
141
|
+
path.forEach(item => {
|
|
142
|
+
line.extrude(item);
|
|
143
|
+
});
|
|
120
144
|
}
|
|
121
|
-
path.forEach(item => {
|
|
122
|
-
line.extrude(item);
|
|
123
|
-
});
|
|
124
145
|
const linebuffer = line.complex;
|
|
125
146
|
return {
|
|
126
147
|
vertices: linebuffer.positions,
|
|
@@ -182,7 +203,8 @@ function FlowLineFillTriangulation(feature) {
|
|
|
182
203
|
}
|
|
183
204
|
function SimpleLineTriangulation(feature) {
|
|
184
205
|
const {
|
|
185
|
-
coordinates
|
|
206
|
+
coordinates,
|
|
207
|
+
originCoordinates
|
|
186
208
|
} = feature;
|
|
187
209
|
const pos = [];
|
|
188
210
|
if (!Array.isArray(coordinates[0])) {
|
|
@@ -197,7 +219,7 @@ function SimpleLineTriangulation(feature) {
|
|
|
197
219
|
const {
|
|
198
220
|
results,
|
|
199
221
|
totalDistance
|
|
200
|
-
} = getSimpleLineVertices(coordinates);
|
|
222
|
+
} = getSimpleLineVertices(coordinates, originCoordinates);
|
|
201
223
|
results.map(point => {
|
|
202
224
|
pos.push(point[0], point[1], point[2], point[3], 0, totalDistance);
|
|
203
225
|
});
|
|
@@ -249,11 +271,15 @@ function pushDis(point, n) {
|
|
|
249
271
|
}
|
|
250
272
|
return point;
|
|
251
273
|
}
|
|
252
|
-
function getSimpleLineVertices(coordinates) {
|
|
274
|
+
function getSimpleLineVertices(coordinates, originCoordinates) {
|
|
253
275
|
let points = coordinates;
|
|
276
|
+
//除了amap2.0以外 coordinates就是经纬度数据
|
|
277
|
+
let originPoints = originCoordinates || coordinates;
|
|
254
278
|
if (Array.isArray(points) && Array.isArray(points[0]) && Array.isArray(points[0][0])) {
|
|
255
279
|
// @ts-ignore
|
|
256
|
-
points =
|
|
280
|
+
points = originCoordinates.flat();
|
|
281
|
+
// @ts-ignore
|
|
282
|
+
originPoints = originCoordinates.flat();
|
|
257
283
|
}
|
|
258
284
|
//修改计算距离的方式,与普通线的计算方式保持一致 edit by huyang 20231214
|
|
259
285
|
let distance = 0;
|
|
@@ -267,13 +293,13 @@ function getSimpleLineVertices(coordinates) {
|
|
|
267
293
|
const point = pushDis(points[0], distance);
|
|
268
294
|
results.push(point);
|
|
269
295
|
for (let i = 1; i < points.length - 1; i++) {
|
|
270
|
-
const subDistance = lineSegmentDistance((0, _l7Utils.aProjectFlat)(
|
|
296
|
+
const subDistance = lineSegmentDistance((0, _l7Utils.aProjectFlat)(originPoints[i - 1]), (0, _l7Utils.aProjectFlat)(originPoints[i]));
|
|
271
297
|
distance += subDistance;
|
|
272
298
|
const mulPoint = pushDis(points[i], distance);
|
|
273
299
|
results.push(mulPoint);
|
|
274
300
|
results.push(mulPoint);
|
|
275
301
|
}
|
|
276
|
-
const pointDistance = lineSegmentDistance((0, _l7Utils.aProjectFlat)(
|
|
302
|
+
const pointDistance = lineSegmentDistance((0, _l7Utils.aProjectFlat)(originPoints[originPoints.length - 2]), (0, _l7Utils.aProjectFlat)(originPoints[originPoints.length - 1]));
|
|
277
303
|
distance += pointDistance;
|
|
278
304
|
results.push(pushDis(points[points.length - 1], distance));
|
|
279
305
|
return {
|
|
@@ -1,21 +1,6 @@
|
|
|
1
1
|
import type { IModel } from '@antv/l7-core';
|
|
2
2
|
import BaseModel from '../../core/BaseModel';
|
|
3
3
|
export default class EarthAtomSphereModel 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
|
-
NORMAL: number;
|
|
17
|
-
UV: number;
|
|
18
|
-
};
|
|
19
4
|
protected getCommonUniformsInfo(): {
|
|
20
5
|
uniformsArray: number[];
|
|
21
6
|
uniformsLength: number;
|
|
@@ -9,22 +9,16 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
|
9
9
|
var _l7Core = require("@antv/l7-core");
|
|
10
10
|
var _l7Utils = require("@antv/l7-utils");
|
|
11
11
|
var _BaseModel = _interopRequireDefault(require("../../core/BaseModel"));
|
|
12
|
+
var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
|
|
12
13
|
var _triangulation = require("../../core/triangulation");
|
|
13
14
|
/* babel-plugin-inline-import '../shaders/atmosphere/atmosphere_frag.glsl' */
|
|
14
15
|
const atmoSphereFrag = "\nlayout(std140) uniform commonUniforms {\n float u_opacity;\n};\nin vec3 vVertexNormal;\nin float v_offset;\nin vec4 v_Color;\n\n#pragma include \"scene_uniforms\"\nout vec4 outputColor;\nvoid main() {\n \n \n // float intensity = pow(0.5 + dot(normalize(vVertexNormal), normalize(u_CameraPosition)), 3.0);\n float intensity = pow(v_offset + dot(normalize(vVertexNormal), normalize(u_CameraPosition)), 3.0);\n // \u53BB\u9664\u80CC\u9762\n if(intensity > 1.0) intensity = 0.0;\n\n outputColor = vec4(v_Color.rgb, v_Color.a * intensity * u_opacity);\n}\n";
|
|
15
16
|
/* babel-plugin-inline-import '../shaders/atmosphere/atmosphere_vert.glsl' */
|
|
16
|
-
const atmoSphereVert = "layout(location =
|
|
17
|
+
const atmoSphereVert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 1) vec4 a_Color;\nlayout(location = 13) in vec3 a_Normal;\nlayout(location = 14) in vec2 a_Uv;\nlayout(std140) uniform commonUniforms {\n float u_opacity;\n};\n#pragma include \"scene_uniforms\"\nout vec3 vVertexNormal;\nout vec4 v_Color;\nout float v_offset;\n\nvoid main() {\n float EARTH_RADIUS = 100.0;\n \n v_Color = a_Color;\n\n v_offset = min(((length(u_CameraPosition) - EARTH_RADIUS)/600.0) * 0.5 + 0.4, 1.0);\n vVertexNormal = a_Normal;\n\n gl_Position = u_ViewProjectionMatrix * u_ModelMatrix * vec4(a_Position, 1.0);\n}\n";
|
|
17
18
|
const {
|
|
18
19
|
isNumber
|
|
19
20
|
} = _l7Utils.lodashUtil;
|
|
20
21
|
class EarthAtomSphereModel extends _BaseModel.default {
|
|
21
|
-
get attributeLocation() {
|
|
22
|
-
return Object.assign(super.attributeLocation, {
|
|
23
|
-
MAX: super.attributeLocation.MAX,
|
|
24
|
-
NORMAL: 9,
|
|
25
|
-
UV: 10
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
22
|
getCommonUniformsInfo() {
|
|
29
23
|
const {
|
|
30
24
|
opacity = 1
|
|
@@ -54,7 +48,6 @@ class EarthAtomSphereModel extends _BaseModel.default {
|
|
|
54
48
|
moduleName: 'earthAtmoSphere',
|
|
55
49
|
vertexShader: atmoSphereVert,
|
|
56
50
|
fragmentShader: atmoSphereFrag,
|
|
57
|
-
defines: _this2.getDefines(),
|
|
58
51
|
triangulation: _triangulation.earthTriangulation,
|
|
59
52
|
depth: {
|
|
60
53
|
enable: false
|
|
@@ -66,31 +59,32 @@ class EarthAtomSphereModel extends _BaseModel.default {
|
|
|
66
59
|
}
|
|
67
60
|
registerBuiltinAttributes() {
|
|
68
61
|
// point layer size;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
62
|
+
this.styleAttributeService.registerStyleAttribute({
|
|
63
|
+
name: 'size',
|
|
64
|
+
type: _l7Core.AttributeType.Attribute,
|
|
65
|
+
descriptor: {
|
|
66
|
+
name: 'a_Size',
|
|
67
|
+
shaderLocation: _CommonStyleAttribute.ShaderLocation.SIZE,
|
|
68
|
+
buffer: {
|
|
69
|
+
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
70
|
+
data: [],
|
|
71
|
+
type: _l7Core.gl.FLOAT
|
|
72
|
+
},
|
|
73
|
+
size: 1,
|
|
74
|
+
update: feature => {
|
|
75
|
+
const {
|
|
76
|
+
size = 1
|
|
77
|
+
} = feature;
|
|
78
|
+
return Array.isArray(size) ? [size[0]] : [size];
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
});
|
|
88
82
|
this.styleAttributeService.registerStyleAttribute({
|
|
89
83
|
name: 'normal',
|
|
90
84
|
type: _l7Core.AttributeType.Attribute,
|
|
91
85
|
descriptor: {
|
|
92
86
|
name: 'a_Normal',
|
|
93
|
-
shaderLocation:
|
|
87
|
+
shaderLocation: _CommonStyleAttribute.ShaderLocation.NORMAL,
|
|
94
88
|
buffer: {
|
|
95
89
|
usage: _l7Core.gl.STATIC_DRAW,
|
|
96
90
|
data: [],
|
|
@@ -107,7 +101,7 @@ class EarthAtomSphereModel extends _BaseModel.default {
|
|
|
107
101
|
type: _l7Core.AttributeType.Attribute,
|
|
108
102
|
descriptor: {
|
|
109
103
|
name: 'a_Uv',
|
|
110
|
-
shaderLocation:
|
|
104
|
+
shaderLocation: _CommonStyleAttribute.ShaderLocation.UV,
|
|
111
105
|
buffer: {
|
|
112
106
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
113
107
|
data: [],
|
|
@@ -1,21 +1,6 @@
|
|
|
1
1
|
import type { IModel, ITexture2D } from '@antv/l7-core';
|
|
2
2
|
import BaseModel from '../../core/BaseModel';
|
|
3
3
|
export default class BaseEarthModel 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
|
-
NORMAL: number;
|
|
17
|
-
UV: number;
|
|
18
|
-
};
|
|
19
4
|
protected texture: ITexture2D;
|
|
20
5
|
private earthTime;
|
|
21
6
|
private sunX;
|
package/lib/earth/models/base.js
CHANGED
|
@@ -10,10 +10,11 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
10
10
|
var _l7Core = require("@antv/l7-core");
|
|
11
11
|
var _BaseModel = _interopRequireDefault(require("../../core/BaseModel"));
|
|
12
12
|
var _triangulation = require("../../core/triangulation");
|
|
13
|
+
var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
|
|
13
14
|
/* babel-plugin-inline-import '../shaders/base/base_frag.glsl' */
|
|
14
15
|
const baseFrag = "uniform sampler2D u_texture;\n\nin vec2 v_texCoord;\nin float v_lightWeight;\nout vec4 outputColor;\n\nvoid main() {\n vec4 color = texture(SAMPLER_2D(u_texture),vec2(v_texCoord.x,v_texCoord.y));\n color.xyz = color.xyz * v_lightWeight;\n outputColor = color;\n}\n";
|
|
15
16
|
/* babel-plugin-inline-import '../shaders/base/base_vert.glsl' */
|
|
16
|
-
const baseVert = "// attribute vec4 a_Color;\nlayout(location =
|
|
17
|
+
const baseVert = "// attribute vec4 a_Color;\nlayout(location = 0) in vec3 a_Position;\nlayout(location = 13) in vec3 a_Normal;\nlayout(location = 14) in vec2 a_Uv;\n\n// attribute vec2 a_Extrude;\n// attribute float a_Size;\n// attribute float a_Shape;\n\nlayout(std140) uniform commonUniforms {\n\tvec4 u_sunLight: [1.0, -10.5, 12.0,0.0];\n\tfloat u_ambientRatio : 0.5;\n\tfloat u_diffuseRatio : 0.3;\n\tfloat u_specularRatio : 0.2;\n};\n\n#pragma include \"scene_uniforms\"\n\nout vec2 v_texCoord;\nout float v_lightWeight;\n\nfloat calc_lighting(vec4 pos) {\n\n\tvec3 worldPos = vec3(pos * u_ModelMatrix);\n\n\tvec3 worldNormal = a_Normal;\n\n\t// cal light weight\n\tvec3 viewDir = normalize(u_CameraPosition - worldPos);\n\n\tvec3 lightDir = normalize(u_sunLight.xyz);\n\n\tvec3 halfDir = normalize(viewDir+lightDir);\n\t// lambert\n\tfloat lambert = dot(worldNormal, lightDir);\n\t// specular\n\tfloat specular = pow(max(0.0, dot(worldNormal, halfDir)), 32.0);\n\t//sum to light weight\n\tfloat lightWeight = u_ambientRatio + u_diffuseRatio * lambert + u_specularRatio * specular;\n\n\treturn lightWeight;\n}\n\nvoid main() {\n\n\tv_texCoord = a_Uv;\n\n\tfloat lightWeight = calc_lighting(vec4(a_Position, 1.0));\n\tv_lightWeight = lightWeight;\n\n\tgl_Position = u_ViewProjectionMatrix * u_ModelMatrix * vec4(a_Position, 1.0);\n}\n";
|
|
17
18
|
class BaseEarthModel extends _BaseModel.default {
|
|
18
19
|
constructor(...args) {
|
|
19
20
|
super(...args);
|
|
@@ -25,13 +26,6 @@ class BaseEarthModel extends _BaseModel.default {
|
|
|
25
26
|
(0, _defineProperty2.default)(this, "sunZ", 1000);
|
|
26
27
|
(0, _defineProperty2.default)(this, "sunRadius", Math.sqrt(this.sunX * this.sunX + this.sunY * this.sunY + this.sunZ * this.sunZ));
|
|
27
28
|
}
|
|
28
|
-
get attributeLocation() {
|
|
29
|
-
return Object.assign(super.attributeLocation, {
|
|
30
|
-
MAX: super.attributeLocation.MAX,
|
|
31
|
-
NORMAL: 9,
|
|
32
|
-
UV: 10
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
29
|
getCommonUniformsInfo() {
|
|
36
30
|
const {
|
|
37
31
|
animateOption,
|
|
@@ -110,7 +104,6 @@ class BaseEarthModel extends _BaseModel.default {
|
|
|
110
104
|
moduleName: 'earthBase',
|
|
111
105
|
vertexShader: baseVert,
|
|
112
106
|
fragmentShader: baseFrag,
|
|
113
|
-
defines: _this2.getDefines(),
|
|
114
107
|
triangulation: _triangulation.earthTriangulation,
|
|
115
108
|
depth: {
|
|
116
109
|
enable: true
|
|
@@ -121,31 +114,32 @@ class BaseEarthModel extends _BaseModel.default {
|
|
|
121
114
|
})();
|
|
122
115
|
}
|
|
123
116
|
registerBuiltinAttributes() {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
117
|
+
this.styleAttributeService.registerStyleAttribute({
|
|
118
|
+
name: 'size',
|
|
119
|
+
type: _l7Core.AttributeType.Attribute,
|
|
120
|
+
descriptor: {
|
|
121
|
+
name: 'a_Size',
|
|
122
|
+
shaderLocation: _CommonStyleAttribute.ShaderLocation.SIZE,
|
|
123
|
+
buffer: {
|
|
124
|
+
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
125
|
+
data: [],
|
|
126
|
+
type: _l7Core.gl.FLOAT
|
|
127
|
+
},
|
|
128
|
+
size: 1,
|
|
129
|
+
update: feature => {
|
|
130
|
+
const {
|
|
131
|
+
size = 1
|
|
132
|
+
} = feature;
|
|
133
|
+
return Array.isArray(size) ? [size[0]] : [size];
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
});
|
|
143
137
|
this.styleAttributeService.registerStyleAttribute({
|
|
144
138
|
name: 'normal',
|
|
145
139
|
type: _l7Core.AttributeType.Attribute,
|
|
146
140
|
descriptor: {
|
|
147
141
|
name: 'a_Normal',
|
|
148
|
-
shaderLocation:
|
|
142
|
+
shaderLocation: _CommonStyleAttribute.ShaderLocation.NORMAL,
|
|
149
143
|
buffer: {
|
|
150
144
|
usage: _l7Core.gl.STATIC_DRAW,
|
|
151
145
|
data: [],
|
|
@@ -162,7 +156,7 @@ class BaseEarthModel extends _BaseModel.default {
|
|
|
162
156
|
type: _l7Core.AttributeType.Attribute,
|
|
163
157
|
descriptor: {
|
|
164
158
|
name: 'a_Uv',
|
|
165
|
-
shaderLocation:
|
|
159
|
+
shaderLocation: _CommonStyleAttribute.ShaderLocation.UV,
|
|
166
160
|
buffer: {
|
|
167
161
|
// give the WebGL driver a hint that this buffer may change
|
|
168
162
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
@@ -1,21 +1,6 @@
|
|
|
1
1
|
import type { IModel } from '@antv/l7-core';
|
|
2
2
|
import BaseModel from '../../core/BaseModel';
|
|
3
3
|
export default class EarthBloomSphereModel 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
|
-
NORMAL: number;
|
|
17
|
-
UV: number;
|
|
18
|
-
};
|
|
19
4
|
protected getCommonUniformsInfo(): {
|
|
20
5
|
uniformsArray: number[];
|
|
21
6
|
uniformsLength: number;
|
|
@@ -9,22 +9,16 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
|
9
9
|
var _l7Core = require("@antv/l7-core");
|
|
10
10
|
var _l7Utils = require("@antv/l7-utils");
|
|
11
11
|
var _BaseModel = _interopRequireDefault(require("../../core/BaseModel"));
|
|
12
|
+
var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
|
|
12
13
|
var _triangulation = require("../../core/triangulation");
|
|
13
14
|
/* babel-plugin-inline-import '../shaders/bloomshpere/bloomsphere_frag.glsl' */
|
|
14
15
|
const bloomSphereFrag = "\nin vec3 vVertexNormal;\nin vec4 v_Color;\n\nlayout(std140) uniform commonUniforms {\n float u_opacity;\n};\nout vec4 outputColor;\n#pragma include \"scene_uniforms\"\nvoid main() {\n float intensity = - dot(normalize(vVertexNormal), normalize(u_CameraPosition));\n // \u53BB\u9664\u80CC\u9762\n if(intensity > 1.0) intensity = 0.0;\n\n outputColor = vec4(v_Color.rgb, v_Color.a * intensity * u_opacity);\n}\n";
|
|
15
16
|
/* babel-plugin-inline-import '../shaders/bloomshpere/bloomsphere_vert.glsl' */
|
|
16
|
-
const bloomSphereVert = "layout(location =
|
|
17
|
+
const bloomSphereVert = "layout(location = 0) in vec3 a_Position;\nlayout(location = 1) vec4 a_Color;\nlayout(location = 13) in vec3 a_Normal;\nlayout(location = 14) in vec2 a_Uv;\nlayout(std140) uniform commonUniforms {\n float u_opacity;\n};\n#pragma include \"scene_uniforms\"\n\nout vec3 vVertexNormal;\nout vec4 v_Color;\n\nvoid main() {\n v_Color = a_Color;\n\n vVertexNormal = a_Normal;\n\n gl_Position = u_ViewProjectionMatrix * u_ModelMatrix * vec4(a_Position, 1.0);\n}\n";
|
|
17
18
|
const {
|
|
18
19
|
isNumber
|
|
19
20
|
} = _l7Utils.lodashUtil;
|
|
20
21
|
class EarthBloomSphereModel extends _BaseModel.default {
|
|
21
|
-
get attributeLocation() {
|
|
22
|
-
return Object.assign(super.attributeLocation, {
|
|
23
|
-
MAX: super.attributeLocation.MAX,
|
|
24
|
-
NORMAL: 9,
|
|
25
|
-
UV: 10
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
22
|
getCommonUniformsInfo() {
|
|
29
23
|
const {
|
|
30
24
|
opacity = 1
|
|
@@ -54,7 +48,6 @@ class EarthBloomSphereModel extends _BaseModel.default {
|
|
|
54
48
|
moduleName: 'earthBloom',
|
|
55
49
|
vertexShader: bloomSphereVert,
|
|
56
50
|
fragmentShader: bloomSphereFrag,
|
|
57
|
-
defines: _this2.getDefines(),
|
|
58
51
|
triangulation: _triangulation.earthOuterTriangulation,
|
|
59
52
|
depth: {
|
|
60
53
|
enable: false
|
|
@@ -65,31 +58,32 @@ class EarthBloomSphereModel extends _BaseModel.default {
|
|
|
65
58
|
})();
|
|
66
59
|
}
|
|
67
60
|
registerBuiltinAttributes() {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
61
|
+
this.styleAttributeService.registerStyleAttribute({
|
|
62
|
+
name: 'size',
|
|
63
|
+
type: _l7Core.AttributeType.Attribute,
|
|
64
|
+
descriptor: {
|
|
65
|
+
name: 'a_Size',
|
|
66
|
+
shaderLocation: _CommonStyleAttribute.ShaderLocation.SIZE,
|
|
67
|
+
buffer: {
|
|
68
|
+
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
69
|
+
data: [],
|
|
70
|
+
type: _l7Core.gl.FLOAT
|
|
71
|
+
},
|
|
72
|
+
size: 1,
|
|
73
|
+
update: feature => {
|
|
74
|
+
const {
|
|
75
|
+
size = 1
|
|
76
|
+
} = feature;
|
|
77
|
+
return Array.isArray(size) ? [size[0]] : [size];
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
});
|
|
87
81
|
this.styleAttributeService.registerStyleAttribute({
|
|
88
82
|
name: 'normal',
|
|
89
83
|
type: _l7Core.AttributeType.Attribute,
|
|
90
84
|
descriptor: {
|
|
91
85
|
name: 'a_Normal',
|
|
92
|
-
shaderLocation:
|
|
86
|
+
shaderLocation: _CommonStyleAttribute.ShaderLocation.NORMAL,
|
|
93
87
|
buffer: {
|
|
94
88
|
usage: _l7Core.gl.STATIC_DRAW,
|
|
95
89
|
data: [],
|
|
@@ -106,7 +100,7 @@ class EarthBloomSphereModel extends _BaseModel.default {
|
|
|
106
100
|
type: _l7Core.AttributeType.Attribute,
|
|
107
101
|
descriptor: {
|
|
108
102
|
name: 'a_Uv',
|
|
109
|
-
shaderLocation:
|
|
103
|
+
shaderLocation: _CommonStyleAttribute.ShaderLocation.UV,
|
|
110
104
|
buffer: {
|
|
111
105
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
112
106
|
data: [],
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
layout(location =
|
|
2
|
-
layout(location =
|
|
3
|
-
layout(location =
|
|
4
|
-
layout(location =
|
|
5
|
-
|
|
1
|
+
layout(location = 0) in vec3 a_Position;
|
|
2
|
+
layout(location = 1) vec4 a_Color;
|
|
3
|
+
layout(location = 13) in vec3 a_Normal;
|
|
4
|
+
layout(location = 14) in vec2 a_Uv;
|
|
6
5
|
layout(std140) uniform commonUniforms {
|
|
7
6
|
float u_opacity;
|
|
8
7
|
};
|
|
9
|
-
|
|
10
8
|
#pragma include "scene_uniforms"
|
|
11
9
|
out vec3 vVertexNormal;
|
|
12
10
|
out vec4 v_Color;
|
|
@@ -14,7 +12,7 @@ out float v_offset;
|
|
|
14
12
|
|
|
15
13
|
void main() {
|
|
16
14
|
float EARTH_RADIUS = 100.0;
|
|
17
|
-
|
|
15
|
+
|
|
18
16
|
v_Color = a_Color;
|
|
19
17
|
|
|
20
18
|
v_offset = min(((length(u_CameraPosition) - EARTH_RADIUS)/600.0) * 0.5 + 0.4, 1.0);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// attribute vec4 a_Color;
|
|
2
|
-
layout(location =
|
|
3
|
-
layout(location =
|
|
4
|
-
layout(location =
|
|
2
|
+
layout(location = 0) in vec3 a_Position;
|
|
3
|
+
layout(location = 13) in vec3 a_Normal;
|
|
4
|
+
layout(location = 14) in vec2 a_Uv;
|
|
5
5
|
|
|
6
6
|
// attribute vec2 a_Extrude;
|
|
7
7
|
// attribute float a_Size;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
layout(location =
|
|
2
|
-
layout(location =
|
|
3
|
-
layout(location =
|
|
4
|
-
layout(location =
|
|
5
|
-
|
|
1
|
+
layout(location = 0) in vec3 a_Position;
|
|
2
|
+
layout(location = 1) vec4 a_Color;
|
|
3
|
+
layout(location = 13) in vec3 a_Normal;
|
|
4
|
+
layout(location = 14) in vec2 a_Uv;
|
|
6
5
|
layout(std140) uniform commonUniforms {
|
|
7
6
|
float u_opacity;
|
|
8
7
|
};
|