@antv/l7-layers 2.21.8 → 2.21.9-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/citybuliding/models/build.d.ts +16 -0
- package/es/citybuliding/models/build.js +18 -20
- package/es/citybuliding/shaders/build_frag.glsl +6 -6
- package/es/citybuliding/shaders/build_vert.glsl +8 -14
- package/es/core/BaseLayer.js +9 -8
- package/es/core/BaseModel.d.ts +15 -2
- package/es/core/BaseModel.js +94 -62
- package/es/core/CommonStyleAttribute.d.ts +14 -18
- package/es/core/CommonStyleAttribute.js +23 -67
- package/es/core/triangulation.js +13 -39
- package/es/earth/models/atmosphere.d.ts +15 -0
- package/es/earth/models/atmosphere.js +30 -24
- package/es/earth/models/base.d.ts +15 -0
- package/es/earth/models/base.js +30 -24
- package/es/earth/models/bloomsphere.d.ts +15 -0
- package/es/earth/models/bloomsphere.js +30 -24
- package/es/earth/shaders/atmosphere/atmosphere_vert.glsl +7 -5
- package/es/earth/shaders/base/base_vert.glsl +3 -3
- package/es/earth/shaders/bloomshpere/bloomsphere_vert.glsl +5 -4
- package/es/geometry/models/billboard.d.ts +15 -0
- package/es/geometry/models/billboard.js +14 -8
- package/es/geometry/models/plane.d.ts +14 -0
- package/es/geometry/models/plane.js +10 -10
- package/es/geometry/models/sprite.js +3 -9
- package/es/geometry/shaders/billboard_vert.glsl +28 -25
- package/es/geometry/shaders/plane_vert.glsl +6 -6
- package/es/geometry/shaders/sprite_vert.glsl +7 -9
- package/es/heatmap/models/grid.d.ts +14 -0
- package/es/heatmap/models/grid.js +10 -3
- package/es/heatmap/models/grid3d.d.ts +16 -0
- package/es/heatmap/models/grid3d.js +14 -6
- package/es/heatmap/models/heatmap.d.ts +20 -1
- package/es/heatmap/models/heatmap.js +96 -83
- package/es/heatmap/models/hexagon.d.ts +14 -0
- package/es/heatmap/models/hexagon.js +9 -3
- package/es/heatmap/shaders/grid/grid_vert.glsl +30 -42
- package/es/heatmap/shaders/grid3d/grid_3d_vert.glsl +14 -26
- package/es/heatmap/shaders/heatmap/heatmap_3d_vert.glsl +19 -16
- package/es/heatmap/shaders/heatmap/heatmap_framebuffer_vert.glsl +16 -22
- package/es/heatmap/shaders/heatmap/heatmap_vert.glsl +3 -4
- package/es/heatmap/shaders/hexagon/hexagon_vert.glsl +13 -23
- package/es/image/models/image.d.ts +14 -0
- package/es/image/models/image.js +11 -3
- package/es/image/shaders/image_vert.glsl +7 -6
- package/es/line/models/arc.d.ts +18 -0
- package/es/line/models/arc.js +57 -8
- package/es/line/models/arc_3d.d.ts +18 -0
- package/es/line/models/arc_3d.js +55 -7
- package/es/line/models/flow.d.ts +17 -0
- package/es/line/models/flow.js +35 -7
- package/es/line/models/great_circle.d.ts +17 -0
- package/es/line/models/great_circle.js +34 -6
- package/es/line/models/line.d.ts +17 -0
- package/es/line/models/line.js +17 -8
- package/es/line/models/simple_line.d.ts +14 -0
- package/es/line/models/simple_line.js +12 -47
- package/es/line/models/wall.d.ts +17 -0
- package/es/line/models/wall.js +22 -48
- package/es/line/shaders/arc/line_arc_vert.glsl +42 -48
- package/es/line/shaders/arc3d/line_arc_3d_vert.glsl +15 -20
- package/es/line/shaders/flow/flow_line_vert.glsl +30 -48
- package/es/line/shaders/greatCircle/line_arc_great_circle_vert.glsl +56 -72
- package/es/line/shaders/line/line_vert.glsl +31 -48
- package/es/line/shaders/simple/simpleline_vert.glsl +18 -23
- package/es/line/shaders/wall/wall_vert.glsl +36 -45
- package/es/mask/models/fill.js +2 -1
- package/es/mask/shaders/mask_vert.glsl +2 -7
- package/es/plugins/DataMappingPlugin.d.ts +0 -1
- package/es/plugins/DataMappingPlugin.js +1 -24
- package/es/plugins/PixelPickingPlugin.js +2 -2
- package/es/plugins/RegisterStyleAttributePlugin.d.ts +0 -1
- package/es/plugins/RegisterStyleAttributePlugin.js +3 -25
- package/es/plugins/ShaderUniformPlugin.d.ts +0 -5
- package/es/plugins/ShaderUniformPlugin.js +2 -34
- package/es/point/models/billboard_point.d.ts +14 -0
- package/es/point/models/billboard_point.js +11 -3
- package/es/point/models/earthExtrude.d.ts +16 -0
- package/es/point/models/earthExtrude.js +15 -8
- package/es/point/models/earthFill.d.ts +16 -0
- package/es/point/models/earthFill.js +13 -5
- package/es/point/models/extrude.d.ts +16 -0
- package/es/point/models/extrude.js +19 -12
- package/es/point/models/fill.d.ts +16 -0
- package/es/point/models/fill.js +16 -5
- package/es/point/models/fillImage.d.ts +16 -0
- package/es/point/models/fillImage.js +16 -16
- package/es/point/models/image.d.ts +15 -0
- package/es/point/models/image.js +14 -4
- package/es/point/models/normal.d.ts +14 -0
- package/es/point/models/normal.js +11 -3
- package/es/point/models/radar.d.ts +15 -0
- package/es/point/models/radar.js +13 -4
- package/es/point/models/text.d.ts +16 -0
- package/es/point/models/text.js +18 -11
- package/es/point/shaders/billboard/billboard_point_vert.glsl +10 -13
- package/es/point/shaders/earthExtrude/earthExtrude_vert.glsl +15 -25
- package/es/point/shaders/earthFill/earthFill_vert.glsl +6 -6
- package/es/point/shaders/extrude/extrude_vert.glsl +35 -39
- package/es/point/shaders/fill/fill_vert.glsl +12 -14
- package/es/point/shaders/fillImage/fillImage_vert.glsl +16 -28
- package/es/point/shaders/image/image_vert.glsl +15 -12
- package/es/point/shaders/normal/normal_vert.glsl +7 -10
- package/es/point/shaders/radar/radar_vert.glsl +11 -11
- package/es/point/shaders/text/text_vert.glsl +10 -9
- package/es/polygon/models/extrude.d.ts +16 -0
- package/es/polygon/models/extrude.js +26 -26
- package/es/polygon/models/extrusion.d.ts +16 -0
- package/es/polygon/models/extrusion.js +34 -4
- package/es/polygon/models/fill.d.ts +14 -0
- package/es/polygon/models/fill.js +12 -4
- package/es/polygon/models/ocean.d.ts +14 -0
- package/es/polygon/models/ocean.js +11 -6
- package/es/polygon/models/water.d.ts +14 -0
- package/es/polygon/models/water.js +11 -6
- package/es/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +17 -15
- package/es/polygon/shaders/extrude/polygon_extrude_vert.glsl +22 -20
- package/es/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +17 -17
- package/es/polygon/shaders/extrusion/polygon_extrusion_vert.glsl +8 -8
- package/es/polygon/shaders/fill/fill_linear_vert.glsl +7 -6
- package/es/polygon/shaders/fill/fill_vert.glsl +10 -12
- package/es/polygon/shaders/ocean/ocean_vert.glsl +3 -4
- package/es/polygon/shaders/water/polygon_water_vert.glsl +5 -5
- package/es/raster/index.d.ts +1 -1
- package/es/raster/index.js +1 -1
- package/es/raster/models/raster.d.ts +14 -0
- package/es/raster/models/raster.js +12 -3
- package/es/raster/models/rasterRgb.d.ts +14 -0
- package/es/raster/models/rasterRgb.js +12 -3
- package/es/raster/models/rasterTerrainRgb.d.ts +14 -0
- package/es/raster/models/rasterTerrainRgb.js +11 -3
- package/es/raster/shaders/raster/raster_2d_vert.glsl +6 -6
- package/es/raster/shaders/rgb/raster_rgb_vert.glsl +11 -11
- package/es/raster/shaders/terrain/terrain_rgb_vert.glsl +11 -11
- package/es/tile/core/BaseLayer.js +0 -16
- package/es/utils/extrude_polyline.d.ts +0 -15
- package/es/utils/extrude_polyline.js +0 -217
- package/es/wind/models/wind.d.ts +14 -0
- package/es/wind/models/wind.js +9 -1
- package/es/wind/shaders/wind_vert.glsl +6 -5
- package/lib/citybuliding/models/build.d.ts +16 -0
- package/lib/citybuliding/models/build.js +18 -20
- package/lib/citybuliding/shaders/build_frag.glsl +6 -6
- package/lib/citybuliding/shaders/build_vert.glsl +8 -14
- package/lib/core/BaseLayer.js +9 -8
- package/lib/core/BaseModel.d.ts +15 -2
- package/lib/core/BaseModel.js +92 -60
- package/lib/core/CommonStyleAttribute.d.ts +14 -18
- package/lib/core/CommonStyleAttribute.js +23 -68
- package/lib/core/triangulation.js +13 -39
- package/lib/earth/models/atmosphere.d.ts +15 -0
- package/lib/earth/models/atmosphere.js +30 -24
- package/lib/earth/models/base.d.ts +15 -0
- package/lib/earth/models/base.js +30 -24
- package/lib/earth/models/bloomsphere.d.ts +15 -0
- package/lib/earth/models/bloomsphere.js +30 -24
- package/lib/earth/shaders/atmosphere/atmosphere_vert.glsl +7 -5
- package/lib/earth/shaders/base/base_vert.glsl +3 -3
- package/lib/earth/shaders/bloomshpere/bloomsphere_vert.glsl +5 -4
- package/lib/geometry/models/billboard.d.ts +15 -0
- package/lib/geometry/models/billboard.js +14 -8
- package/lib/geometry/models/plane.d.ts +14 -0
- package/lib/geometry/models/plane.js +10 -10
- package/lib/geometry/models/sprite.js +3 -9
- package/lib/geometry/shaders/billboard_vert.glsl +28 -25
- package/lib/geometry/shaders/plane_vert.glsl +6 -6
- package/lib/geometry/shaders/sprite_vert.glsl +7 -9
- package/lib/heatmap/models/grid.d.ts +14 -0
- package/lib/heatmap/models/grid.js +10 -3
- package/lib/heatmap/models/grid3d.d.ts +16 -0
- package/lib/heatmap/models/grid3d.js +14 -6
- package/lib/heatmap/models/heatmap.d.ts +20 -1
- package/lib/heatmap/models/heatmap.js +95 -82
- package/lib/heatmap/models/hexagon.d.ts +14 -0
- package/lib/heatmap/models/hexagon.js +9 -3
- package/lib/heatmap/shaders/grid/grid_vert.glsl +30 -42
- package/lib/heatmap/shaders/grid3d/grid_3d_vert.glsl +14 -26
- package/lib/heatmap/shaders/heatmap/heatmap_3d_vert.glsl +19 -16
- package/lib/heatmap/shaders/heatmap/heatmap_framebuffer_vert.glsl +16 -22
- package/lib/heatmap/shaders/heatmap/heatmap_vert.glsl +3 -4
- package/lib/heatmap/shaders/hexagon/hexagon_vert.glsl +13 -23
- package/lib/image/models/image.d.ts +14 -0
- package/lib/image/models/image.js +11 -3
- package/lib/image/shaders/image_vert.glsl +7 -6
- package/lib/line/models/arc.d.ts +18 -0
- package/lib/line/models/arc.js +56 -7
- package/lib/line/models/arc_3d.d.ts +18 -0
- package/lib/line/models/arc_3d.js +55 -7
- package/lib/line/models/flow.d.ts +17 -0
- package/lib/line/models/flow.js +35 -7
- package/lib/line/models/great_circle.d.ts +17 -0
- package/lib/line/models/great_circle.js +33 -5
- package/lib/line/models/line.d.ts +17 -0
- package/lib/line/models/line.js +17 -8
- package/lib/line/models/simple_line.d.ts +14 -0
- package/lib/line/models/simple_line.js +12 -47
- package/lib/line/models/wall.d.ts +17 -0
- package/lib/line/models/wall.js +22 -48
- package/lib/line/shaders/arc/line_arc_vert.glsl +42 -48
- package/lib/line/shaders/arc3d/line_arc_3d_vert.glsl +15 -20
- package/lib/line/shaders/flow/flow_line_vert.glsl +30 -48
- package/lib/line/shaders/greatCircle/line_arc_great_circle_vert.glsl +56 -72
- package/lib/line/shaders/line/line_vert.glsl +31 -48
- package/lib/line/shaders/simple/simpleline_vert.glsl +18 -23
- package/lib/line/shaders/wall/wall_vert.glsl +36 -45
- package/lib/mask/models/fill.js +2 -1
- package/lib/mask/shaders/mask_vert.glsl +2 -7
- package/lib/plugins/DataMappingPlugin.d.ts +0 -1
- package/lib/plugins/DataMappingPlugin.js +0 -23
- package/lib/plugins/PixelPickingPlugin.js +1 -1
- package/lib/plugins/RegisterStyleAttributePlugin.d.ts +0 -1
- package/lib/plugins/RegisterStyleAttributePlugin.js +2 -24
- package/lib/plugins/ShaderUniformPlugin.d.ts +0 -5
- package/lib/plugins/ShaderUniformPlugin.js +2 -34
- package/lib/point/models/billboard_point.d.ts +14 -0
- package/lib/point/models/billboard_point.js +11 -3
- package/lib/point/models/earthExtrude.d.ts +16 -0
- package/lib/point/models/earthExtrude.js +14 -7
- package/lib/point/models/earthFill.d.ts +16 -0
- package/lib/point/models/earthFill.js +13 -5
- package/lib/point/models/extrude.d.ts +16 -0
- package/lib/point/models/extrude.js +18 -11
- package/lib/point/models/fill.d.ts +16 -0
- package/lib/point/models/fill.js +16 -5
- package/lib/point/models/fillImage.d.ts +16 -0
- package/lib/point/models/fillImage.js +16 -16
- package/lib/point/models/image.d.ts +15 -0
- package/lib/point/models/image.js +14 -4
- package/lib/point/models/normal.d.ts +14 -0
- package/lib/point/models/normal.js +11 -3
- package/lib/point/models/radar.d.ts +15 -0
- package/lib/point/models/radar.js +13 -4
- package/lib/point/models/text.d.ts +16 -0
- package/lib/point/models/text.js +18 -11
- package/lib/point/shaders/billboard/billboard_point_vert.glsl +10 -13
- package/lib/point/shaders/earthExtrude/earthExtrude_vert.glsl +15 -25
- package/lib/point/shaders/earthFill/earthFill_vert.glsl +6 -6
- package/lib/point/shaders/extrude/extrude_vert.glsl +35 -39
- package/lib/point/shaders/fill/fill_vert.glsl +12 -14
- package/lib/point/shaders/fillImage/fillImage_vert.glsl +16 -28
- package/lib/point/shaders/image/image_vert.glsl +15 -12
- package/lib/point/shaders/normal/normal_vert.glsl +7 -10
- package/lib/point/shaders/radar/radar_vert.glsl +11 -11
- package/lib/point/shaders/text/text_vert.glsl +10 -9
- package/lib/polygon/models/extrude.d.ts +16 -0
- package/lib/polygon/models/extrude.js +25 -25
- package/lib/polygon/models/extrusion.d.ts +16 -0
- package/lib/polygon/models/extrusion.js +34 -4
- package/lib/polygon/models/fill.d.ts +14 -0
- package/lib/polygon/models/fill.js +12 -4
- package/lib/polygon/models/ocean.d.ts +14 -0
- package/lib/polygon/models/ocean.js +11 -6
- package/lib/polygon/models/water.d.ts +14 -0
- package/lib/polygon/models/water.js +11 -6
- package/lib/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +17 -15
- package/lib/polygon/shaders/extrude/polygon_extrude_vert.glsl +22 -20
- package/lib/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +17 -17
- package/lib/polygon/shaders/extrusion/polygon_extrusion_vert.glsl +8 -8
- package/lib/polygon/shaders/fill/fill_linear_vert.glsl +7 -6
- package/lib/polygon/shaders/fill/fill_vert.glsl +10 -12
- package/lib/polygon/shaders/ocean/ocean_vert.glsl +3 -4
- package/lib/polygon/shaders/water/polygon_water_vert.glsl +5 -5
- package/lib/raster/index.d.ts +1 -1
- package/lib/raster/index.js +2 -2
- package/lib/raster/models/raster.d.ts +14 -0
- package/lib/raster/models/raster.js +12 -3
- package/lib/raster/models/rasterRgb.d.ts +14 -0
- package/lib/raster/models/rasterRgb.js +12 -3
- package/lib/raster/models/rasterTerrainRgb.d.ts +14 -0
- package/lib/raster/models/rasterTerrainRgb.js +11 -3
- package/lib/raster/shaders/raster/raster_2d_vert.glsl +6 -6
- package/lib/raster/shaders/rgb/raster_rgb_vert.glsl +11 -11
- package/lib/raster/shaders/terrain/terrain_rgb_vert.glsl +11 -11
- package/lib/tile/core/BaseLayer.js +0 -16
- package/lib/utils/extrude_polyline.d.ts +0 -15
- package/lib/utils/extrude_polyline.js +0 -217
- package/lib/wind/models/wind.d.ts +14 -0
- package/lib/wind/models/wind.js +9 -1
- package/lib/wind/shaders/wind_vert.glsl +6 -5
- package/package.json +6 -6
|
@@ -3,28 +3,27 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.COMMON_ATTRIBUTE_LOCATION = 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
|
-
|
|
27
|
-
}({}); // Polygon Linear
|
|
9
|
+
/**
|
|
10
|
+
* Attribute Layout Location in Shader
|
|
11
|
+
*/
|
|
12
|
+
const COMMON_ATTRIBUTE_LOCATION = exports.COMMON_ATTRIBUTE_LOCATION = {
|
|
13
|
+
// common attribute in RegisterStyleAttributePlugin
|
|
14
|
+
POSITION: 0,
|
|
15
|
+
// low part for double precision POSITION attribute
|
|
16
|
+
POSITION_64LOW: 1,
|
|
17
|
+
COLOR: 2,
|
|
18
|
+
PICKING_COLOR: 3,
|
|
19
|
+
// common style attribute
|
|
20
|
+
STROKE: 4,
|
|
21
|
+
OPACITY: 5,
|
|
22
|
+
OFFSETS: 6,
|
|
23
|
+
ROTATION: 7,
|
|
24
|
+
// last index
|
|
25
|
+
MAX: 8
|
|
26
|
+
};
|
|
28
27
|
function getCommonStyleAttributeOptions(name) {
|
|
29
28
|
switch (name) {
|
|
30
29
|
// // roate
|
|
@@ -34,7 +33,7 @@ function getCommonStyleAttributeOptions(name) {
|
|
|
34
33
|
type: _l7Core.AttributeType.Attribute,
|
|
35
34
|
descriptor: {
|
|
36
35
|
name: 'a_Rotation',
|
|
37
|
-
shaderLocation:
|
|
36
|
+
shaderLocation: COMMON_ATTRIBUTE_LOCATION.ROTATION,
|
|
38
37
|
buffer: {
|
|
39
38
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
40
39
|
data: [],
|
|
@@ -55,7 +54,7 @@ function getCommonStyleAttributeOptions(name) {
|
|
|
55
54
|
type: _l7Core.AttributeType.Attribute,
|
|
56
55
|
descriptor: {
|
|
57
56
|
name: 'a_Stroke',
|
|
58
|
-
shaderLocation:
|
|
57
|
+
shaderLocation: COMMON_ATTRIBUTE_LOCATION.STROKE,
|
|
59
58
|
buffer: {
|
|
60
59
|
// give the WebGL driver a hint that this buffer may change
|
|
61
60
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
@@ -77,7 +76,7 @@ function getCommonStyleAttributeOptions(name) {
|
|
|
77
76
|
type: _l7Core.AttributeType.Attribute,
|
|
78
77
|
descriptor: {
|
|
79
78
|
name: 'a_Opacity',
|
|
80
|
-
shaderLocation:
|
|
79
|
+
shaderLocation: COMMON_ATTRIBUTE_LOCATION.OPACITY,
|
|
81
80
|
buffer: {
|
|
82
81
|
// give the WebGL driver a hint that this buffer may change
|
|
83
82
|
usage: _l7Core.gl.STATIC_DRAW,
|
|
@@ -93,35 +92,13 @@ function getCommonStyleAttributeOptions(name) {
|
|
|
93
92
|
}
|
|
94
93
|
}
|
|
95
94
|
};
|
|
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
|
-
};
|
|
118
95
|
case 'offsets':
|
|
119
96
|
return {
|
|
120
97
|
name: 'offsets',
|
|
121
98
|
type: _l7Core.AttributeType.Attribute,
|
|
122
99
|
descriptor: {
|
|
123
100
|
name: 'a_Offsets',
|
|
124
|
-
shaderLocation:
|
|
101
|
+
shaderLocation: COMMON_ATTRIBUTE_LOCATION.OFFSETS,
|
|
125
102
|
buffer: {
|
|
126
103
|
// give the WebGL driver a hint that this buffer may change
|
|
127
104
|
usage: _l7Core.gl.STATIC_DRAW,
|
|
@@ -137,28 +114,6 @@ function getCommonStyleAttributeOptions(name) {
|
|
|
137
114
|
}
|
|
138
115
|
}
|
|
139
116
|
};
|
|
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
|
-
};
|
|
162
117
|
default:
|
|
163
118
|
return undefined;
|
|
164
119
|
}
|
|
@@ -103,9 +103,7 @@ function PointImageTriangulation(feature) {
|
|
|
103
103
|
*/
|
|
104
104
|
function LineTriangulation(feature) {
|
|
105
105
|
const {
|
|
106
|
-
coordinates
|
|
107
|
-
originCoordinates,
|
|
108
|
-
version
|
|
106
|
+
coordinates
|
|
109
107
|
} = feature;
|
|
110
108
|
// let path = coordinates as number[][][] | number[][];
|
|
111
109
|
// if (!Array.isArray(path[0][0])) {
|
|
@@ -116,32 +114,13 @@ function LineTriangulation(feature) {
|
|
|
116
114
|
dash: true,
|
|
117
115
|
join: 'bevel'
|
|
118
116
|
});
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
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
|
-
});
|
|
117
|
+
let path = coordinates;
|
|
118
|
+
if (path[0] && !Array.isArray(path[0][0])) {
|
|
119
|
+
path = [coordinates];
|
|
144
120
|
}
|
|
121
|
+
path.forEach(item => {
|
|
122
|
+
line.extrude(item);
|
|
123
|
+
});
|
|
145
124
|
const linebuffer = line.complex;
|
|
146
125
|
return {
|
|
147
126
|
vertices: linebuffer.positions,
|
|
@@ -203,8 +182,7 @@ function FlowLineFillTriangulation(feature) {
|
|
|
203
182
|
}
|
|
204
183
|
function SimpleLineTriangulation(feature) {
|
|
205
184
|
const {
|
|
206
|
-
coordinates
|
|
207
|
-
originCoordinates
|
|
185
|
+
coordinates
|
|
208
186
|
} = feature;
|
|
209
187
|
const pos = [];
|
|
210
188
|
if (!Array.isArray(coordinates[0])) {
|
|
@@ -219,7 +197,7 @@ function SimpleLineTriangulation(feature) {
|
|
|
219
197
|
const {
|
|
220
198
|
results,
|
|
221
199
|
totalDistance
|
|
222
|
-
} = getSimpleLineVertices(coordinates
|
|
200
|
+
} = getSimpleLineVertices(coordinates);
|
|
223
201
|
results.map(point => {
|
|
224
202
|
pos.push(point[0], point[1], point[2], point[3], 0, totalDistance);
|
|
225
203
|
});
|
|
@@ -271,15 +249,11 @@ function pushDis(point, n) {
|
|
|
271
249
|
}
|
|
272
250
|
return point;
|
|
273
251
|
}
|
|
274
|
-
function getSimpleLineVertices(coordinates
|
|
252
|
+
function getSimpleLineVertices(coordinates) {
|
|
275
253
|
let points = coordinates;
|
|
276
|
-
//除了amap2.0以外 coordinates就是经纬度数据
|
|
277
|
-
let originPoints = originCoordinates || coordinates;
|
|
278
254
|
if (Array.isArray(points) && Array.isArray(points[0]) && Array.isArray(points[0][0])) {
|
|
279
255
|
// @ts-ignore
|
|
280
|
-
points =
|
|
281
|
-
// @ts-ignore
|
|
282
|
-
originPoints = originCoordinates.flat();
|
|
256
|
+
points = coordinates.flat();
|
|
283
257
|
}
|
|
284
258
|
//修改计算距离的方式,与普通线的计算方式保持一致 edit by huyang 20231214
|
|
285
259
|
let distance = 0;
|
|
@@ -293,13 +267,13 @@ function getSimpleLineVertices(coordinates, originCoordinates) {
|
|
|
293
267
|
const point = pushDis(points[0], distance);
|
|
294
268
|
results.push(point);
|
|
295
269
|
for (let i = 1; i < points.length - 1; i++) {
|
|
296
|
-
const subDistance = lineSegmentDistance((0, _l7Utils.aProjectFlat)(
|
|
270
|
+
const subDistance = lineSegmentDistance((0, _l7Utils.aProjectFlat)(points[i - 1]), (0, _l7Utils.aProjectFlat)(points[i]));
|
|
297
271
|
distance += subDistance;
|
|
298
272
|
const mulPoint = pushDis(points[i], distance);
|
|
299
273
|
results.push(mulPoint);
|
|
300
274
|
results.push(mulPoint);
|
|
301
275
|
}
|
|
302
|
-
const pointDistance = lineSegmentDistance((0, _l7Utils.aProjectFlat)(
|
|
276
|
+
const pointDistance = lineSegmentDistance((0, _l7Utils.aProjectFlat)(points[points.length - 2]), (0, _l7Utils.aProjectFlat)(points[points.length - 1]));
|
|
303
277
|
distance += pointDistance;
|
|
304
278
|
results.push(pushDis(points[points.length - 1], distance));
|
|
305
279
|
return {
|
|
@@ -1,6 +1,21 @@
|
|
|
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
|
+
};
|
|
4
19
|
protected getCommonUniformsInfo(): {
|
|
5
20
|
uniformsArray: number[];
|
|
6
21
|
uniformsLength: number;
|
|
@@ -9,16 +9,22 @@ 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");
|
|
13
12
|
var _triangulation = require("../../core/triangulation");
|
|
14
13
|
/* babel-plugin-inline-import '../shaders/atmosphere/atmosphere_frag.glsl' */
|
|
15
14
|
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";
|
|
16
15
|
/* babel-plugin-inline-import '../shaders/atmosphere/atmosphere_vert.glsl' */
|
|
17
|
-
const atmoSphereVert = "layout(location =
|
|
16
|
+
const atmoSphereVert = "layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\nlayout(location = ATTRIBUTE_LOCATION_COLOR) vec4 a_Color;\nlayout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal;\nlayout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;\n\nlayout(std140) uniform commonUniforms {\n float u_opacity;\n};\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";
|
|
18
17
|
const {
|
|
19
18
|
isNumber
|
|
20
19
|
} = _l7Utils.lodashUtil;
|
|
21
20
|
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
|
+
}
|
|
22
28
|
getCommonUniformsInfo() {
|
|
23
29
|
const {
|
|
24
30
|
opacity = 1
|
|
@@ -48,6 +54,7 @@ class EarthAtomSphereModel extends _BaseModel.default {
|
|
|
48
54
|
moduleName: 'earthAtmoSphere',
|
|
49
55
|
vertexShader: atmoSphereVert,
|
|
50
56
|
fragmentShader: atmoSphereFrag,
|
|
57
|
+
defines: _this2.getDefines(),
|
|
51
58
|
triangulation: _triangulation.earthTriangulation,
|
|
52
59
|
depth: {
|
|
53
60
|
enable: false
|
|
@@ -59,32 +66,31 @@ class EarthAtomSphereModel extends _BaseModel.default {
|
|
|
59
66
|
}
|
|
60
67
|
registerBuiltinAttributes() {
|
|
61
68
|
// point layer size;
|
|
62
|
-
this.styleAttributeService.registerStyleAttribute({
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
});
|
|
69
|
+
// this.styleAttributeService.registerStyleAttribute({
|
|
70
|
+
// name: 'size',
|
|
71
|
+
// type: AttributeType.Attribute,
|
|
72
|
+
// descriptor: {
|
|
73
|
+
// name: 'a_Size',
|
|
74
|
+
// shaderLocation: this.attributeLocation.SIZE,
|
|
75
|
+
// buffer: {
|
|
76
|
+
// usage: gl.DYNAMIC_DRAW,
|
|
77
|
+
// data: [],
|
|
78
|
+
// type: gl.FLOAT,
|
|
79
|
+
// },
|
|
80
|
+
// size: 1,
|
|
81
|
+
// update: (feature: IEncodeFeature) => {
|
|
82
|
+
// const { size = 1 } = feature;
|
|
83
|
+
// return Array.isArray(size) ? [size[0]] : [size as number];
|
|
84
|
+
// },
|
|
85
|
+
// },
|
|
86
|
+
// });
|
|
87
|
+
|
|
82
88
|
this.styleAttributeService.registerStyleAttribute({
|
|
83
89
|
name: 'normal',
|
|
84
90
|
type: _l7Core.AttributeType.Attribute,
|
|
85
91
|
descriptor: {
|
|
86
92
|
name: 'a_Normal',
|
|
87
|
-
shaderLocation:
|
|
93
|
+
shaderLocation: this.attributeLocation.NORMAL,
|
|
88
94
|
buffer: {
|
|
89
95
|
usage: _l7Core.gl.STATIC_DRAW,
|
|
90
96
|
data: [],
|
|
@@ -101,7 +107,7 @@ class EarthAtomSphereModel extends _BaseModel.default {
|
|
|
101
107
|
type: _l7Core.AttributeType.Attribute,
|
|
102
108
|
descriptor: {
|
|
103
109
|
name: 'a_Uv',
|
|
104
|
-
shaderLocation:
|
|
110
|
+
shaderLocation: this.attributeLocation.UV,
|
|
105
111
|
buffer: {
|
|
106
112
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
107
113
|
data: [],
|
|
@@ -1,6 +1,21 @@
|
|
|
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
|
+
};
|
|
4
19
|
protected texture: ITexture2D;
|
|
5
20
|
private earthTime;
|
|
6
21
|
private sunX;
|
package/lib/earth/models/base.js
CHANGED
|
@@ -10,11 +10,10 @@ 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");
|
|
14
13
|
/* babel-plugin-inline-import '../shaders/base/base_frag.glsl' */
|
|
15
14
|
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";
|
|
16
15
|
/* babel-plugin-inline-import '../shaders/base/base_vert.glsl' */
|
|
17
|
-
const baseVert = "// attribute vec4 a_Color;\nlayout(location =
|
|
16
|
+
const baseVert = "// attribute vec4 a_Color;\nlayout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\nlayout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal;\nlayout(location = ATTRIBUTE_LOCATION_UV) 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";
|
|
18
17
|
class BaseEarthModel extends _BaseModel.default {
|
|
19
18
|
constructor(...args) {
|
|
20
19
|
super(...args);
|
|
@@ -26,6 +25,13 @@ class BaseEarthModel extends _BaseModel.default {
|
|
|
26
25
|
(0, _defineProperty2.default)(this, "sunZ", 1000);
|
|
27
26
|
(0, _defineProperty2.default)(this, "sunRadius", Math.sqrt(this.sunX * this.sunX + this.sunY * this.sunY + this.sunZ * this.sunZ));
|
|
28
27
|
}
|
|
28
|
+
get attributeLocation() {
|
|
29
|
+
return Object.assign(super.attributeLocation, {
|
|
30
|
+
MAX: super.attributeLocation.MAX,
|
|
31
|
+
NORMAL: 9,
|
|
32
|
+
UV: 10
|
|
33
|
+
});
|
|
34
|
+
}
|
|
29
35
|
getCommonUniformsInfo() {
|
|
30
36
|
const {
|
|
31
37
|
animateOption,
|
|
@@ -104,6 +110,7 @@ class BaseEarthModel extends _BaseModel.default {
|
|
|
104
110
|
moduleName: 'earthBase',
|
|
105
111
|
vertexShader: baseVert,
|
|
106
112
|
fragmentShader: baseFrag,
|
|
113
|
+
defines: _this2.getDefines(),
|
|
107
114
|
triangulation: _triangulation.earthTriangulation,
|
|
108
115
|
depth: {
|
|
109
116
|
enable: true
|
|
@@ -114,32 +121,31 @@ class BaseEarthModel extends _BaseModel.default {
|
|
|
114
121
|
})();
|
|
115
122
|
}
|
|
116
123
|
registerBuiltinAttributes() {
|
|
117
|
-
this.styleAttributeService.registerStyleAttribute({
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
});
|
|
124
|
+
// this.styleAttributeService.registerStyleAttribute({
|
|
125
|
+
// name: 'size',
|
|
126
|
+
// type: AttributeType.Attribute,
|
|
127
|
+
// descriptor: {
|
|
128
|
+
// name: 'a_Size',
|
|
129
|
+
// shaderLocation: this.attributeLocation.SIZE,
|
|
130
|
+
// buffer: {
|
|
131
|
+
// usage: gl.DYNAMIC_DRAW,
|
|
132
|
+
// data: [],
|
|
133
|
+
// type: gl.FLOAT,
|
|
134
|
+
// },
|
|
135
|
+
// size: 1,
|
|
136
|
+
// update: (feature: IEncodeFeature) => {
|
|
137
|
+
// const { size = 1 } = feature;
|
|
138
|
+
// return Array.isArray(size) ? [size[0]] : [size as number];
|
|
139
|
+
// },
|
|
140
|
+
// },
|
|
141
|
+
// });
|
|
142
|
+
|
|
137
143
|
this.styleAttributeService.registerStyleAttribute({
|
|
138
144
|
name: 'normal',
|
|
139
145
|
type: _l7Core.AttributeType.Attribute,
|
|
140
146
|
descriptor: {
|
|
141
147
|
name: 'a_Normal',
|
|
142
|
-
shaderLocation:
|
|
148
|
+
shaderLocation: this.attributeLocation.NORMAL,
|
|
143
149
|
buffer: {
|
|
144
150
|
usage: _l7Core.gl.STATIC_DRAW,
|
|
145
151
|
data: [],
|
|
@@ -156,7 +162,7 @@ class BaseEarthModel extends _BaseModel.default {
|
|
|
156
162
|
type: _l7Core.AttributeType.Attribute,
|
|
157
163
|
descriptor: {
|
|
158
164
|
name: 'a_Uv',
|
|
159
|
-
shaderLocation:
|
|
165
|
+
shaderLocation: this.attributeLocation.UV,
|
|
160
166
|
buffer: {
|
|
161
167
|
// give the WebGL driver a hint that this buffer may change
|
|
162
168
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
@@ -1,6 +1,21 @@
|
|
|
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
|
+
};
|
|
4
19
|
protected getCommonUniformsInfo(): {
|
|
5
20
|
uniformsArray: number[];
|
|
6
21
|
uniformsLength: number;
|
|
@@ -9,16 +9,22 @@ 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");
|
|
13
12
|
var _triangulation = require("../../core/triangulation");
|
|
14
13
|
/* babel-plugin-inline-import '../shaders/bloomshpere/bloomsphere_frag.glsl' */
|
|
15
14
|
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";
|
|
16
15
|
/* babel-plugin-inline-import '../shaders/bloomshpere/bloomsphere_vert.glsl' */
|
|
17
|
-
const bloomSphereVert = "layout(location =
|
|
16
|
+
const bloomSphereVert = "layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\nlayout(location = ATTRIBUTE_LOCATION_COLOR) vec4 a_Color;\nlayout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal;\nlayout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;\n\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";
|
|
18
17
|
const {
|
|
19
18
|
isNumber
|
|
20
19
|
} = _l7Utils.lodashUtil;
|
|
21
20
|
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
|
+
}
|
|
22
28
|
getCommonUniformsInfo() {
|
|
23
29
|
const {
|
|
24
30
|
opacity = 1
|
|
@@ -48,6 +54,7 @@ class EarthBloomSphereModel extends _BaseModel.default {
|
|
|
48
54
|
moduleName: 'earthBloom',
|
|
49
55
|
vertexShader: bloomSphereVert,
|
|
50
56
|
fragmentShader: bloomSphereFrag,
|
|
57
|
+
defines: _this2.getDefines(),
|
|
51
58
|
triangulation: _triangulation.earthOuterTriangulation,
|
|
52
59
|
depth: {
|
|
53
60
|
enable: false
|
|
@@ -58,32 +65,31 @@ class EarthBloomSphereModel extends _BaseModel.default {
|
|
|
58
65
|
})();
|
|
59
66
|
}
|
|
60
67
|
registerBuiltinAttributes() {
|
|
61
|
-
this.styleAttributeService.registerStyleAttribute({
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
});
|
|
68
|
+
// this.styleAttributeService.registerStyleAttribute({
|
|
69
|
+
// name: 'size',
|
|
70
|
+
// type: AttributeType.Attribute,
|
|
71
|
+
// descriptor: {
|
|
72
|
+
// name: 'a_Size',
|
|
73
|
+
// shaderLocation: this.attributeLocation.SIZE,
|
|
74
|
+
// buffer: {
|
|
75
|
+
// usage: gl.DYNAMIC_DRAW,
|
|
76
|
+
// data: [],
|
|
77
|
+
// type: gl.FLOAT,
|
|
78
|
+
// },
|
|
79
|
+
// size: 1,
|
|
80
|
+
// update: (feature: IEncodeFeature) => {
|
|
81
|
+
// const { size = 1 } = feature;
|
|
82
|
+
// return Array.isArray(size) ? [size[0]] : [size as number];
|
|
83
|
+
// },
|
|
84
|
+
// },
|
|
85
|
+
// });
|
|
86
|
+
|
|
81
87
|
this.styleAttributeService.registerStyleAttribute({
|
|
82
88
|
name: 'normal',
|
|
83
89
|
type: _l7Core.AttributeType.Attribute,
|
|
84
90
|
descriptor: {
|
|
85
91
|
name: 'a_Normal',
|
|
86
|
-
shaderLocation:
|
|
92
|
+
shaderLocation: this.attributeLocation.NORMAL,
|
|
87
93
|
buffer: {
|
|
88
94
|
usage: _l7Core.gl.STATIC_DRAW,
|
|
89
95
|
data: [],
|
|
@@ -100,7 +106,7 @@ class EarthBloomSphereModel extends _BaseModel.default {
|
|
|
100
106
|
type: _l7Core.AttributeType.Attribute,
|
|
101
107
|
descriptor: {
|
|
102
108
|
name: 'a_Uv',
|
|
103
|
-
shaderLocation:
|
|
109
|
+
shaderLocation: this.attributeLocation.UV,
|
|
104
110
|
buffer: {
|
|
105
111
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
106
112
|
data: [],
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
layout(location =
|
|
2
|
-
layout(location =
|
|
3
|
-
layout(location =
|
|
4
|
-
layout(location =
|
|
1
|
+
layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
|
|
2
|
+
layout(location = ATTRIBUTE_LOCATION_COLOR) vec4 a_Color;
|
|
3
|
+
layout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal;
|
|
4
|
+
layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;
|
|
5
|
+
|
|
5
6
|
layout(std140) uniform commonUniforms {
|
|
6
7
|
float u_opacity;
|
|
7
8
|
};
|
|
9
|
+
|
|
8
10
|
#pragma include "scene_uniforms"
|
|
9
11
|
out vec3 vVertexNormal;
|
|
10
12
|
out vec4 v_Color;
|
|
@@ -12,7 +14,7 @@ out float v_offset;
|
|
|
12
14
|
|
|
13
15
|
void main() {
|
|
14
16
|
float EARTH_RADIUS = 100.0;
|
|
15
|
-
|
|
17
|
+
|
|
16
18
|
v_Color = a_Color;
|
|
17
19
|
|
|
18
20
|
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 = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
|
|
3
|
+
layout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal;
|
|
4
|
+
layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;
|
|
5
5
|
|
|
6
6
|
// attribute vec2 a_Extrude;
|
|
7
7
|
// attribute float a_Size;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
layout(location =
|
|
2
|
-
layout(location =
|
|
3
|
-
layout(location =
|
|
4
|
-
layout(location =
|
|
1
|
+
layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
|
|
2
|
+
layout(location = ATTRIBUTE_LOCATION_COLOR) vec4 a_Color;
|
|
3
|
+
layout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal;
|
|
4
|
+
layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;
|
|
5
|
+
|
|
5
6
|
layout(std140) uniform commonUniforms {
|
|
6
7
|
float u_opacity;
|
|
7
8
|
};
|