@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
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
2
|
+
export let ShaderLocation = /*#__PURE__*/function (ShaderLocation) {
|
|
3
|
+
ShaderLocation[ShaderLocation["POSITION"] = 0] = "POSITION";
|
|
4
|
+
ShaderLocation[ShaderLocation["COLOR"] = 1] = "COLOR";
|
|
5
|
+
ShaderLocation[ShaderLocation["VERTEX_ID"] = 2] = "VERTEX_ID";
|
|
6
|
+
ShaderLocation[ShaderLocation["PICKING_COLOR"] = 3] = "PICKING_COLOR";
|
|
7
|
+
ShaderLocation[ShaderLocation["STROKE"] = 4] = "STROKE";
|
|
8
|
+
ShaderLocation[ShaderLocation["OPACITY"] = 5] = "OPACITY";
|
|
9
|
+
ShaderLocation[ShaderLocation["OFFSETS"] = 6] = "OFFSETS";
|
|
10
|
+
ShaderLocation[ShaderLocation["ROTATION"] = 7] = "ROTATION";
|
|
11
|
+
ShaderLocation[ShaderLocation["EXTRUSION_BASE"] = 8] = "EXTRUSION_BASE";
|
|
12
|
+
ShaderLocation[ShaderLocation["SIZE"] = 9] = "SIZE";
|
|
13
|
+
ShaderLocation[ShaderLocation["SHAPE"] = 10] = "SHAPE";
|
|
14
|
+
ShaderLocation[ShaderLocation["EXTRUDE"] = 11] = "EXTRUDE";
|
|
15
|
+
ShaderLocation[ShaderLocation["MAX"] = 12] = "MAX";
|
|
16
|
+
ShaderLocation[ShaderLocation["NORMAL"] = 13] = "NORMAL";
|
|
17
|
+
ShaderLocation[ShaderLocation["UV"] = 14] = "UV";
|
|
18
|
+
ShaderLocation[ShaderLocation["LINEAR"] = 15] = "LINEAR";
|
|
19
|
+
return ShaderLocation;
|
|
20
|
+
}({}); // Polygon Linear
|
|
21
21
|
export function getCommonStyleAttributeOptions(name) {
|
|
22
22
|
switch (name) {
|
|
23
23
|
// // roate
|
|
@@ -27,7 +27,7 @@ export function getCommonStyleAttributeOptions(name) {
|
|
|
27
27
|
type: AttributeType.Attribute,
|
|
28
28
|
descriptor: {
|
|
29
29
|
name: 'a_Rotation',
|
|
30
|
-
shaderLocation:
|
|
30
|
+
shaderLocation: ShaderLocation.ROTATION,
|
|
31
31
|
buffer: {
|
|
32
32
|
usage: gl.DYNAMIC_DRAW,
|
|
33
33
|
data: [],
|
|
@@ -48,7 +48,7 @@ export function getCommonStyleAttributeOptions(name) {
|
|
|
48
48
|
type: AttributeType.Attribute,
|
|
49
49
|
descriptor: {
|
|
50
50
|
name: 'a_Stroke',
|
|
51
|
-
shaderLocation:
|
|
51
|
+
shaderLocation: ShaderLocation.STROKE,
|
|
52
52
|
buffer: {
|
|
53
53
|
// give the WebGL driver a hint that this buffer may change
|
|
54
54
|
usage: gl.DYNAMIC_DRAW,
|
|
@@ -70,7 +70,7 @@ export function getCommonStyleAttributeOptions(name) {
|
|
|
70
70
|
type: AttributeType.Attribute,
|
|
71
71
|
descriptor: {
|
|
72
72
|
name: 'a_Opacity',
|
|
73
|
-
shaderLocation:
|
|
73
|
+
shaderLocation: ShaderLocation.OPACITY,
|
|
74
74
|
buffer: {
|
|
75
75
|
// give the WebGL driver a hint that this buffer may change
|
|
76
76
|
usage: gl.STATIC_DRAW,
|
|
@@ -86,13 +86,35 @@ export function getCommonStyleAttributeOptions(name) {
|
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
};
|
|
89
|
+
case 'extrusionBase':
|
|
90
|
+
return {
|
|
91
|
+
name: 'extrusionBase',
|
|
92
|
+
type: AttributeType.Attribute,
|
|
93
|
+
descriptor: {
|
|
94
|
+
name: 'a_ExtrusionBase',
|
|
95
|
+
shaderLocation: ShaderLocation.EXTRUSION_BASE,
|
|
96
|
+
buffer: {
|
|
97
|
+
// give the WebGL driver a hint that this buffer may change
|
|
98
|
+
usage: gl.STATIC_DRAW,
|
|
99
|
+
data: [],
|
|
100
|
+
type: gl.FLOAT
|
|
101
|
+
},
|
|
102
|
+
size: 1,
|
|
103
|
+
update: feature => {
|
|
104
|
+
const {
|
|
105
|
+
extrusionBase: op = 0
|
|
106
|
+
} = feature;
|
|
107
|
+
return [op];
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
};
|
|
89
111
|
case 'offsets':
|
|
90
112
|
return {
|
|
91
113
|
name: 'offsets',
|
|
92
114
|
type: AttributeType.Attribute,
|
|
93
115
|
descriptor: {
|
|
94
116
|
name: 'a_Offsets',
|
|
95
|
-
shaderLocation:
|
|
117
|
+
shaderLocation: ShaderLocation.OFFSETS,
|
|
96
118
|
buffer: {
|
|
97
119
|
// give the WebGL driver a hint that this buffer may change
|
|
98
120
|
usage: gl.STATIC_DRAW,
|
|
@@ -108,6 +130,28 @@ export function getCommonStyleAttributeOptions(name) {
|
|
|
108
130
|
}
|
|
109
131
|
}
|
|
110
132
|
};
|
|
133
|
+
case 'thetaOffset':
|
|
134
|
+
return {
|
|
135
|
+
name: 'thetaOffset',
|
|
136
|
+
type: AttributeType.Attribute,
|
|
137
|
+
descriptor: {
|
|
138
|
+
name: 'a_ThetaOffset',
|
|
139
|
+
shaderLocation: 15,
|
|
140
|
+
buffer: {
|
|
141
|
+
// give the WebGL driver a hint that this buffer may change
|
|
142
|
+
usage: gl.STATIC_DRAW,
|
|
143
|
+
data: [],
|
|
144
|
+
type: gl.FLOAT
|
|
145
|
+
},
|
|
146
|
+
size: 1,
|
|
147
|
+
update: feature => {
|
|
148
|
+
const {
|
|
149
|
+
thetaOffset: op = 1
|
|
150
|
+
} = feature;
|
|
151
|
+
return [op];
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
};
|
|
111
155
|
default:
|
|
112
156
|
return undefined;
|
|
113
157
|
}
|
package/es/core/triangulation.js
CHANGED
|
@@ -75,7 +75,9 @@ export function PointImageTriangulation(feature) {
|
|
|
75
75
|
*/
|
|
76
76
|
export function LineTriangulation(feature) {
|
|
77
77
|
const {
|
|
78
|
-
coordinates
|
|
78
|
+
coordinates,
|
|
79
|
+
originCoordinates,
|
|
80
|
+
version
|
|
79
81
|
} = feature;
|
|
80
82
|
// let path = coordinates as number[][][] | number[][];
|
|
81
83
|
// if (!Array.isArray(path[0][0])) {
|
|
@@ -86,13 +88,32 @@ export function LineTriangulation(feature) {
|
|
|
86
88
|
dash: true,
|
|
87
89
|
join: 'bevel'
|
|
88
90
|
});
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
91
|
+
if (version === 'GAODE2.x') {
|
|
92
|
+
// 处理高德2.0几何体构建
|
|
93
|
+
let path1 = coordinates; // 计算位置
|
|
94
|
+
if (!Array.isArray(path1[0][0])) {
|
|
95
|
+
path1 = [coordinates];
|
|
96
|
+
}
|
|
97
|
+
let path2 = originCoordinates; // 计算法线
|
|
98
|
+
if (!Array.isArray(path2[0][0])) {
|
|
99
|
+
path2 = [originCoordinates];
|
|
100
|
+
}
|
|
101
|
+
for (let i = 0; i < path1.length; i++) {
|
|
102
|
+
// 高德2.0在计算线时,需要使用经纬度计算发现,使用 customCoords.lnglatToCoords 计算的数据来计算顶点的位置
|
|
103
|
+
const item1 = path1[i];
|
|
104
|
+
const item2 = path2[i];
|
|
105
|
+
line.extrude_gaode2(item1, item2);
|
|
106
|
+
}
|
|
107
|
+
} else {
|
|
108
|
+
// 处理非高德2.0的几何体构建
|
|
109
|
+
let path = coordinates;
|
|
110
|
+
if (path[0] && !Array.isArray(path[0][0])) {
|
|
111
|
+
path = [coordinates];
|
|
112
|
+
}
|
|
113
|
+
path.forEach(item => {
|
|
114
|
+
line.extrude(item);
|
|
115
|
+
});
|
|
92
116
|
}
|
|
93
|
-
path.forEach(item => {
|
|
94
|
-
line.extrude(item);
|
|
95
|
-
});
|
|
96
117
|
const linebuffer = line.complex;
|
|
97
118
|
return {
|
|
98
119
|
vertices: linebuffer.positions,
|
|
@@ -154,7 +175,8 @@ export function FlowLineFillTriangulation(feature) {
|
|
|
154
175
|
}
|
|
155
176
|
export function SimpleLineTriangulation(feature) {
|
|
156
177
|
const {
|
|
157
|
-
coordinates
|
|
178
|
+
coordinates,
|
|
179
|
+
originCoordinates
|
|
158
180
|
} = feature;
|
|
159
181
|
const pos = [];
|
|
160
182
|
if (!Array.isArray(coordinates[0])) {
|
|
@@ -169,7 +191,7 @@ export function SimpleLineTriangulation(feature) {
|
|
|
169
191
|
const {
|
|
170
192
|
results,
|
|
171
193
|
totalDistance
|
|
172
|
-
} = getSimpleLineVertices(coordinates);
|
|
194
|
+
} = getSimpleLineVertices(coordinates, originCoordinates);
|
|
173
195
|
results.map(point => {
|
|
174
196
|
pos.push(point[0], point[1], point[2], point[3], 0, totalDistance);
|
|
175
197
|
});
|
|
@@ -221,11 +243,15 @@ function pushDis(point, n) {
|
|
|
221
243
|
}
|
|
222
244
|
return point;
|
|
223
245
|
}
|
|
224
|
-
function getSimpleLineVertices(coordinates) {
|
|
246
|
+
function getSimpleLineVertices(coordinates, originCoordinates) {
|
|
225
247
|
let points = coordinates;
|
|
248
|
+
//除了amap2.0以外 coordinates就是经纬度数据
|
|
249
|
+
let originPoints = originCoordinates || coordinates;
|
|
226
250
|
if (Array.isArray(points) && Array.isArray(points[0]) && Array.isArray(points[0][0])) {
|
|
227
251
|
// @ts-ignore
|
|
228
|
-
points =
|
|
252
|
+
points = originCoordinates.flat();
|
|
253
|
+
// @ts-ignore
|
|
254
|
+
originPoints = originCoordinates.flat();
|
|
229
255
|
}
|
|
230
256
|
//修改计算距离的方式,与普通线的计算方式保持一致 edit by huyang 20231214
|
|
231
257
|
let distance = 0;
|
|
@@ -239,13 +265,13 @@ function getSimpleLineVertices(coordinates) {
|
|
|
239
265
|
const point = pushDis(points[0], distance);
|
|
240
266
|
results.push(point);
|
|
241
267
|
for (let i = 1; i < points.length - 1; i++) {
|
|
242
|
-
const subDistance = lineSegmentDistance(aProjectFlat(
|
|
268
|
+
const subDistance = lineSegmentDistance(aProjectFlat(originPoints[i - 1]), aProjectFlat(originPoints[i]));
|
|
243
269
|
distance += subDistance;
|
|
244
270
|
const mulPoint = pushDis(points[i], distance);
|
|
245
271
|
results.push(mulPoint);
|
|
246
272
|
results.push(mulPoint);
|
|
247
273
|
}
|
|
248
|
-
const pointDistance = lineSegmentDistance(aProjectFlat(
|
|
274
|
+
const pointDistance = lineSegmentDistance(aProjectFlat(originPoints[originPoints.length - 2]), aProjectFlat(originPoints[originPoints.length - 1]));
|
|
249
275
|
distance += pointDistance;
|
|
250
276
|
results.push(pushDis(points[points.length - 1], distance));
|
|
251
277
|
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;
|
|
@@ -2,22 +2,16 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
|
2
2
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
3
3
|
import { lodashUtil } from '@antv/l7-utils';
|
|
4
4
|
import BaseModel from "../../core/BaseModel";
|
|
5
|
+
import { ShaderLocation } from "../../core/CommonStyleAttribute";
|
|
5
6
|
import { earthTriangulation } from "../../core/triangulation";
|
|
6
7
|
/* babel-plugin-inline-import '../shaders/atmosphere/atmosphere_frag.glsl' */
|
|
7
8
|
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";
|
|
8
9
|
/* babel-plugin-inline-import '../shaders/atmosphere/atmosphere_vert.glsl' */
|
|
9
|
-
const atmoSphereVert = "layout(location =
|
|
10
|
+
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";
|
|
10
11
|
const {
|
|
11
12
|
isNumber
|
|
12
13
|
} = lodashUtil;
|
|
13
14
|
export default class EarthAtomSphereModel extends BaseModel {
|
|
14
|
-
get attributeLocation() {
|
|
15
|
-
return Object.assign(super.attributeLocation, {
|
|
16
|
-
MAX: super.attributeLocation.MAX,
|
|
17
|
-
NORMAL: 9,
|
|
18
|
-
UV: 10
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
15
|
getCommonUniformsInfo() {
|
|
22
16
|
const {
|
|
23
17
|
opacity = 1
|
|
@@ -47,7 +41,6 @@ export default class EarthAtomSphereModel extends BaseModel {
|
|
|
47
41
|
moduleName: 'earthAtmoSphere',
|
|
48
42
|
vertexShader: atmoSphereVert,
|
|
49
43
|
fragmentShader: atmoSphereFrag,
|
|
50
|
-
defines: _this2.getDefines(),
|
|
51
44
|
triangulation: earthTriangulation,
|
|
52
45
|
depth: {
|
|
53
46
|
enable: false
|
|
@@ -59,31 +52,32 @@ export default class EarthAtomSphereModel extends BaseModel {
|
|
|
59
52
|
}
|
|
60
53
|
registerBuiltinAttributes() {
|
|
61
54
|
// point layer size;
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
55
|
+
this.styleAttributeService.registerStyleAttribute({
|
|
56
|
+
name: 'size',
|
|
57
|
+
type: AttributeType.Attribute,
|
|
58
|
+
descriptor: {
|
|
59
|
+
name: 'a_Size',
|
|
60
|
+
shaderLocation: ShaderLocation.SIZE,
|
|
61
|
+
buffer: {
|
|
62
|
+
usage: gl.DYNAMIC_DRAW,
|
|
63
|
+
data: [],
|
|
64
|
+
type: gl.FLOAT
|
|
65
|
+
},
|
|
66
|
+
size: 1,
|
|
67
|
+
update: feature => {
|
|
68
|
+
const {
|
|
69
|
+
size = 1
|
|
70
|
+
} = feature;
|
|
71
|
+
return Array.isArray(size) ? [size[0]] : [size];
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
});
|
|
81
75
|
this.styleAttributeService.registerStyleAttribute({
|
|
82
76
|
name: 'normal',
|
|
83
77
|
type: AttributeType.Attribute,
|
|
84
78
|
descriptor: {
|
|
85
79
|
name: 'a_Normal',
|
|
86
|
-
shaderLocation:
|
|
80
|
+
shaderLocation: ShaderLocation.NORMAL,
|
|
87
81
|
buffer: {
|
|
88
82
|
usage: gl.STATIC_DRAW,
|
|
89
83
|
data: [],
|
|
@@ -100,7 +94,7 @@ export default class EarthAtomSphereModel extends BaseModel {
|
|
|
100
94
|
type: AttributeType.Attribute,
|
|
101
95
|
descriptor: {
|
|
102
96
|
name: 'a_Uv',
|
|
103
|
-
shaderLocation:
|
|
97
|
+
shaderLocation: ShaderLocation.UV,
|
|
104
98
|
buffer: {
|
|
105
99
|
usage: gl.DYNAMIC_DRAW,
|
|
106
100
|
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/es/earth/models/base.js
CHANGED
|
@@ -3,10 +3,11 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
|
3
3
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
4
4
|
import BaseModel from "../../core/BaseModel";
|
|
5
5
|
import { earthTriangulation } from "../../core/triangulation";
|
|
6
|
+
import { ShaderLocation } from "../../core/CommonStyleAttribute";
|
|
6
7
|
/* babel-plugin-inline-import '../shaders/base/base_frag.glsl' */
|
|
7
8
|
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";
|
|
8
9
|
/* babel-plugin-inline-import '../shaders/base/base_vert.glsl' */
|
|
9
|
-
const baseVert = "// attribute vec4 a_Color;\nlayout(location =
|
|
10
|
+
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";
|
|
10
11
|
export default class BaseEarthModel extends BaseModel {
|
|
11
12
|
constructor(...args) {
|
|
12
13
|
super(...args);
|
|
@@ -18,13 +19,6 @@ export default class BaseEarthModel extends BaseModel {
|
|
|
18
19
|
_defineProperty(this, "sunZ", 1000);
|
|
19
20
|
_defineProperty(this, "sunRadius", Math.sqrt(this.sunX * this.sunX + this.sunY * this.sunY + this.sunZ * this.sunZ));
|
|
20
21
|
}
|
|
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
|
animateOption,
|
|
@@ -103,7 +97,6 @@ export default class BaseEarthModel extends BaseModel {
|
|
|
103
97
|
moduleName: 'earthBase',
|
|
104
98
|
vertexShader: baseVert,
|
|
105
99
|
fragmentShader: baseFrag,
|
|
106
|
-
defines: _this2.getDefines(),
|
|
107
100
|
triangulation: earthTriangulation,
|
|
108
101
|
depth: {
|
|
109
102
|
enable: true
|
|
@@ -114,31 +107,32 @@ export default class BaseEarthModel extends BaseModel {
|
|
|
114
107
|
})();
|
|
115
108
|
}
|
|
116
109
|
registerBuiltinAttributes() {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
110
|
+
this.styleAttributeService.registerStyleAttribute({
|
|
111
|
+
name: 'size',
|
|
112
|
+
type: AttributeType.Attribute,
|
|
113
|
+
descriptor: {
|
|
114
|
+
name: 'a_Size',
|
|
115
|
+
shaderLocation: ShaderLocation.SIZE,
|
|
116
|
+
buffer: {
|
|
117
|
+
usage: gl.DYNAMIC_DRAW,
|
|
118
|
+
data: [],
|
|
119
|
+
type: gl.FLOAT
|
|
120
|
+
},
|
|
121
|
+
size: 1,
|
|
122
|
+
update: feature => {
|
|
123
|
+
const {
|
|
124
|
+
size = 1
|
|
125
|
+
} = feature;
|
|
126
|
+
return Array.isArray(size) ? [size[0]] : [size];
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
});
|
|
136
130
|
this.styleAttributeService.registerStyleAttribute({
|
|
137
131
|
name: 'normal',
|
|
138
132
|
type: AttributeType.Attribute,
|
|
139
133
|
descriptor: {
|
|
140
134
|
name: 'a_Normal',
|
|
141
|
-
shaderLocation:
|
|
135
|
+
shaderLocation: ShaderLocation.NORMAL,
|
|
142
136
|
buffer: {
|
|
143
137
|
usage: gl.STATIC_DRAW,
|
|
144
138
|
data: [],
|
|
@@ -155,7 +149,7 @@ export default class BaseEarthModel extends BaseModel {
|
|
|
155
149
|
type: AttributeType.Attribute,
|
|
156
150
|
descriptor: {
|
|
157
151
|
name: 'a_Uv',
|
|
158
|
-
shaderLocation:
|
|
152
|
+
shaderLocation: ShaderLocation.UV,
|
|
159
153
|
buffer: {
|
|
160
154
|
// give the WebGL driver a hint that this buffer may change
|
|
161
155
|
usage: 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;
|
|
@@ -2,22 +2,16 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
|
2
2
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
3
3
|
import { lodashUtil } from '@antv/l7-utils';
|
|
4
4
|
import BaseModel from "../../core/BaseModel";
|
|
5
|
+
import { ShaderLocation } from "../../core/CommonStyleAttribute";
|
|
5
6
|
import { earthOuterTriangulation } from "../../core/triangulation";
|
|
6
7
|
/* babel-plugin-inline-import '../shaders/bloomshpere/bloomsphere_frag.glsl' */
|
|
7
8
|
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";
|
|
8
9
|
/* babel-plugin-inline-import '../shaders/bloomshpere/bloomsphere_vert.glsl' */
|
|
9
|
-
const bloomSphereVert = "layout(location =
|
|
10
|
+
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";
|
|
10
11
|
const {
|
|
11
12
|
isNumber
|
|
12
13
|
} = lodashUtil;
|
|
13
14
|
export default class EarthBloomSphereModel extends BaseModel {
|
|
14
|
-
get attributeLocation() {
|
|
15
|
-
return Object.assign(super.attributeLocation, {
|
|
16
|
-
MAX: super.attributeLocation.MAX,
|
|
17
|
-
NORMAL: 9,
|
|
18
|
-
UV: 10
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
15
|
getCommonUniformsInfo() {
|
|
22
16
|
const {
|
|
23
17
|
opacity = 1
|
|
@@ -47,7 +41,6 @@ export default class EarthBloomSphereModel extends BaseModel {
|
|
|
47
41
|
moduleName: 'earthBloom',
|
|
48
42
|
vertexShader: bloomSphereVert,
|
|
49
43
|
fragmentShader: bloomSphereFrag,
|
|
50
|
-
defines: _this2.getDefines(),
|
|
51
44
|
triangulation: earthOuterTriangulation,
|
|
52
45
|
depth: {
|
|
53
46
|
enable: false
|
|
@@ -58,31 +51,32 @@ export default class EarthBloomSphereModel extends BaseModel {
|
|
|
58
51
|
})();
|
|
59
52
|
}
|
|
60
53
|
registerBuiltinAttributes() {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
54
|
+
this.styleAttributeService.registerStyleAttribute({
|
|
55
|
+
name: 'size',
|
|
56
|
+
type: AttributeType.Attribute,
|
|
57
|
+
descriptor: {
|
|
58
|
+
name: 'a_Size',
|
|
59
|
+
shaderLocation: ShaderLocation.SIZE,
|
|
60
|
+
buffer: {
|
|
61
|
+
usage: gl.DYNAMIC_DRAW,
|
|
62
|
+
data: [],
|
|
63
|
+
type: gl.FLOAT
|
|
64
|
+
},
|
|
65
|
+
size: 1,
|
|
66
|
+
update: feature => {
|
|
67
|
+
const {
|
|
68
|
+
size = 1
|
|
69
|
+
} = feature;
|
|
70
|
+
return Array.isArray(size) ? [size[0]] : [size];
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
});
|
|
80
74
|
this.styleAttributeService.registerStyleAttribute({
|
|
81
75
|
name: 'normal',
|
|
82
76
|
type: AttributeType.Attribute,
|
|
83
77
|
descriptor: {
|
|
84
78
|
name: 'a_Normal',
|
|
85
|
-
shaderLocation:
|
|
79
|
+
shaderLocation: ShaderLocation.NORMAL,
|
|
86
80
|
buffer: {
|
|
87
81
|
usage: gl.STATIC_DRAW,
|
|
88
82
|
data: [],
|
|
@@ -99,7 +93,7 @@ export default class EarthBloomSphereModel extends BaseModel {
|
|
|
99
93
|
type: AttributeType.Attribute,
|
|
100
94
|
descriptor: {
|
|
101
95
|
name: 'a_Uv',
|
|
102
|
-
shaderLocation:
|
|
96
|
+
shaderLocation: ShaderLocation.UV,
|
|
103
97
|
buffer: {
|
|
104
98
|
usage: gl.DYNAMIC_DRAW,
|
|
105
99
|
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
|
};
|