@antv/l7-layers 2.21.9 → 2.21.11-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.d.ts +0 -1
- package/es/core/BaseLayer.js +9 -19
- package/es/core/BaseModel.d.ts +15 -2
- package/es/core/BaseModel.js +98 -64
- package/es/core/CommonStyleAttribute.d.ts +14 -18
- package/es/core/CommonStyleAttribute.js +23 -67
- package/es/core/shape/extrude.js +6 -3
- package/es/core/triangulation.js +22 -50
- package/es/core/utils.d.ts +4 -0
- package/es/core/utils.js +33 -0
- 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 -7
- 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 +44 -52
- 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 +53 -74
- 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 +4 -35
- 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 +13 -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.d.ts +0 -1
- package/lib/core/BaseLayer.js +9 -19
- package/lib/core/BaseModel.d.ts +15 -2
- package/lib/core/BaseModel.js +96 -62
- package/lib/core/CommonStyleAttribute.d.ts +14 -18
- package/lib/core/CommonStyleAttribute.js +23 -68
- package/lib/core/shape/extrude.js +6 -3
- package/lib/core/triangulation.js +22 -50
- package/lib/core/utils.d.ts +4 -0
- package/lib/core/utils.js +35 -0
- 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 -7
- 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 +44 -52
- 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 +53 -74
- 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 +4 -35
- 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 +13 -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 +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
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Attribute Layout Location in Shader
|
|
5
|
+
*/
|
|
6
|
+
export const COMMON_ATTRIBUTE_LOCATION = {
|
|
7
|
+
// common attribute in RegisterStyleAttributePlugin
|
|
8
|
+
POSITION: 0,
|
|
9
|
+
// low part for double precision POSITION attribute
|
|
10
|
+
POSITION_64LOW: 1,
|
|
11
|
+
COLOR: 2,
|
|
12
|
+
PICKING_COLOR: 3,
|
|
13
|
+
// common style attribute
|
|
14
|
+
STROKE: 4,
|
|
15
|
+
OPACITY: 5,
|
|
16
|
+
OFFSETS: 6,
|
|
17
|
+
ROTATION: 7,
|
|
18
|
+
// last index
|
|
19
|
+
MAX: 8
|
|
20
|
+
};
|
|
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: COMMON_ATTRIBUTE_LOCATION.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: COMMON_ATTRIBUTE_LOCATION.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: COMMON_ATTRIBUTE_LOCATION.OPACITY,
|
|
74
74
|
buffer: {
|
|
75
75
|
// give the WebGL driver a hint that this buffer may change
|
|
76
76
|
usage: gl.STATIC_DRAW,
|
|
@@ -86,35 +86,13 @@ 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
|
-
};
|
|
111
89
|
case 'offsets':
|
|
112
90
|
return {
|
|
113
91
|
name: 'offsets',
|
|
114
92
|
type: AttributeType.Attribute,
|
|
115
93
|
descriptor: {
|
|
116
94
|
name: 'a_Offsets',
|
|
117
|
-
shaderLocation:
|
|
95
|
+
shaderLocation: COMMON_ATTRIBUTE_LOCATION.OFFSETS,
|
|
118
96
|
buffer: {
|
|
119
97
|
// give the WebGL driver a hint that this buffer may change
|
|
120
98
|
usage: gl.STATIC_DRAW,
|
|
@@ -130,28 +108,6 @@ export function getCommonStyleAttributeOptions(name) {
|
|
|
130
108
|
}
|
|
131
109
|
}
|
|
132
110
|
};
|
|
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
|
-
};
|
|
155
111
|
default:
|
|
156
112
|
return undefined;
|
|
157
113
|
}
|
package/es/core/shape/extrude.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { lngLatToMeters } from '@antv/l7-utils';
|
|
2
2
|
import earcut from 'earcut';
|
|
3
3
|
import { vec3 } from 'gl-matrix';
|
|
4
|
+
import { getPolygonSurfaceIndices } from "../utils";
|
|
4
5
|
/**
|
|
5
6
|
* 拉伸多边形顶点,返回拉伸后的顶点信息
|
|
6
7
|
* @param paths 路径数据组
|
|
@@ -64,7 +65,8 @@ export function extrude_PolygonNormal(path, needFlat = false // 是否需要转
|
|
|
64
65
|
const flattengeo = earcut.flatten(path);
|
|
65
66
|
const {
|
|
66
67
|
vertices,
|
|
67
|
-
dimensions
|
|
68
|
+
dimensions,
|
|
69
|
+
holes
|
|
68
70
|
} = flattengeo;
|
|
69
71
|
const positions = [];
|
|
70
72
|
const indexArray = [];
|
|
@@ -83,8 +85,9 @@ export function extrude_PolygonNormal(path, needFlat = false // 是否需要转
|
|
|
83
85
|
);
|
|
84
86
|
normals.push(0, 0, 1);
|
|
85
87
|
}
|
|
86
|
-
const
|
|
87
|
-
indexArray.push(...
|
|
88
|
+
const indices = getPolygonSurfaceIndices(vertices, holes, dimensions, needFlat);
|
|
89
|
+
indexArray.push(...indices);
|
|
90
|
+
|
|
88
91
|
// 设置侧面
|
|
89
92
|
for (let i = 0; i < n; i++) {
|
|
90
93
|
const prePoint = flattengeo.vertices.slice(i * dimensions, (i + 1) * dimensions);
|
package/es/core/triangulation.js
CHANGED
|
@@ -4,8 +4,9 @@ import earcut from 'earcut';
|
|
|
4
4
|
import { vec3 } from 'gl-matrix';
|
|
5
5
|
import { EARTH_RADIUS, EARTH_RADIUS_OUTER, EARTH_SEGMENTS, lglt2xyz, primitiveSphere } from "../earth/utils";
|
|
6
6
|
import ExtrudePolyline from "../utils/extrude_polyline";
|
|
7
|
-
import extrudePolygon, { extrude_PolygonNormal, fillPolygon } from "./shape/extrude";
|
|
8
7
|
import { geometryShape } from "./shape/Path";
|
|
8
|
+
import extrudePolygon, { extrude_PolygonNormal, fillPolygon } from "./shape/extrude";
|
|
9
|
+
import { getPolygonSurfaceIndices } from "./utils";
|
|
9
10
|
const GeometryCache = {};
|
|
10
11
|
|
|
11
12
|
/**
|
|
@@ -75,9 +76,7 @@ export function PointImageTriangulation(feature) {
|
|
|
75
76
|
*/
|
|
76
77
|
export function LineTriangulation(feature) {
|
|
77
78
|
const {
|
|
78
|
-
coordinates
|
|
79
|
-
originCoordinates,
|
|
80
|
-
version
|
|
79
|
+
coordinates
|
|
81
80
|
} = feature;
|
|
82
81
|
// let path = coordinates as number[][][] | number[][];
|
|
83
82
|
// if (!Array.isArray(path[0][0])) {
|
|
@@ -88,32 +87,13 @@ export function LineTriangulation(feature) {
|
|
|
88
87
|
dash: true,
|
|
89
88
|
join: 'bevel'
|
|
90
89
|
});
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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
|
-
});
|
|
90
|
+
let path = coordinates;
|
|
91
|
+
if (path[0] && !Array.isArray(path[0][0])) {
|
|
92
|
+
path = [coordinates];
|
|
116
93
|
}
|
|
94
|
+
path.forEach(item => {
|
|
95
|
+
line.extrude(item);
|
|
96
|
+
});
|
|
117
97
|
const linebuffer = line.complex;
|
|
118
98
|
return {
|
|
119
99
|
vertices: linebuffer.positions,
|
|
@@ -175,8 +155,7 @@ export function FlowLineFillTriangulation(feature) {
|
|
|
175
155
|
}
|
|
176
156
|
export function SimpleLineTriangulation(feature) {
|
|
177
157
|
const {
|
|
178
|
-
coordinates
|
|
179
|
-
originCoordinates
|
|
158
|
+
coordinates
|
|
180
159
|
} = feature;
|
|
181
160
|
const pos = [];
|
|
182
161
|
if (!Array.isArray(coordinates[0])) {
|
|
@@ -191,7 +170,7 @@ export function SimpleLineTriangulation(feature) {
|
|
|
191
170
|
const {
|
|
192
171
|
results,
|
|
193
172
|
totalDistance
|
|
194
|
-
} = getSimpleLineVertices(coordinates
|
|
173
|
+
} = getSimpleLineVertices(coordinates);
|
|
195
174
|
results.map(point => {
|
|
196
175
|
pos.push(point[0], point[1], point[2], point[3], 0, totalDistance);
|
|
197
176
|
});
|
|
@@ -243,15 +222,11 @@ function pushDis(point, n) {
|
|
|
243
222
|
}
|
|
244
223
|
return point;
|
|
245
224
|
}
|
|
246
|
-
function getSimpleLineVertices(coordinates
|
|
225
|
+
function getSimpleLineVertices(coordinates) {
|
|
247
226
|
let points = coordinates;
|
|
248
|
-
//除了amap2.0以外 coordinates就是经纬度数据
|
|
249
|
-
let originPoints = originCoordinates || coordinates;
|
|
250
227
|
if (Array.isArray(points) && Array.isArray(points[0]) && Array.isArray(points[0][0])) {
|
|
251
228
|
// @ts-ignore
|
|
252
|
-
points =
|
|
253
|
-
// @ts-ignore
|
|
254
|
-
originPoints = originCoordinates.flat();
|
|
229
|
+
points = coordinates.flat();
|
|
255
230
|
}
|
|
256
231
|
//修改计算距离的方式,与普通线的计算方式保持一致 edit by huyang 20231214
|
|
257
232
|
let distance = 0;
|
|
@@ -265,13 +240,13 @@ function getSimpleLineVertices(coordinates, originCoordinates) {
|
|
|
265
240
|
const point = pushDis(points[0], distance);
|
|
266
241
|
results.push(point);
|
|
267
242
|
for (let i = 1; i < points.length - 1; i++) {
|
|
268
|
-
const subDistance = lineSegmentDistance(aProjectFlat(
|
|
243
|
+
const subDistance = lineSegmentDistance(aProjectFlat(points[i - 1]), aProjectFlat(points[i]));
|
|
269
244
|
distance += subDistance;
|
|
270
245
|
const mulPoint = pushDis(points[i], distance);
|
|
271
246
|
results.push(mulPoint);
|
|
272
247
|
results.push(mulPoint);
|
|
273
248
|
}
|
|
274
|
-
const pointDistance = lineSegmentDistance(aProjectFlat(
|
|
249
|
+
const pointDistance = lineSegmentDistance(aProjectFlat(points[points.length - 2]), aProjectFlat(points[points.length - 1]));
|
|
275
250
|
distance += pointDistance;
|
|
276
251
|
results.push(pushDis(points[points.length - 1], distance));
|
|
277
252
|
return {
|
|
@@ -310,8 +285,9 @@ export function polygonTriangulation(feature) {
|
|
|
310
285
|
dimensions,
|
|
311
286
|
holes
|
|
312
287
|
} = flattengeo;
|
|
288
|
+
const indices = getPolygonSurfaceIndices(vertices, holes, dimensions);
|
|
313
289
|
return {
|
|
314
|
-
indices
|
|
290
|
+
indices,
|
|
315
291
|
vertices,
|
|
316
292
|
size: dimensions
|
|
317
293
|
};
|
|
@@ -320,18 +296,14 @@ export function polygonTriangulation(feature) {
|
|
|
320
296
|
// 构建几何图形(带有中心点和大小)
|
|
321
297
|
export function polygonTriangulationWithCenter(feature) {
|
|
322
298
|
const {
|
|
323
|
-
|
|
324
|
-
} = feature;
|
|
325
|
-
const flattengeo = earcut.flatten(coordinates);
|
|
326
|
-
const {
|
|
299
|
+
indices,
|
|
327
300
|
vertices,
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
} = flattengeo;
|
|
301
|
+
size
|
|
302
|
+
} = polygonTriangulation(feature);
|
|
331
303
|
return {
|
|
332
|
-
indices:
|
|
304
|
+
indices: indices,
|
|
333
305
|
vertices: getVerticesWithCenter(vertices),
|
|
334
|
-
size:
|
|
306
|
+
size: size + 4
|
|
335
307
|
};
|
|
336
308
|
}
|
|
337
309
|
function getVerticesWithCenter(vertices) {
|
package/es/core/utils.d.ts
CHANGED
|
@@ -1 +1,5 @@
|
|
|
1
1
|
export declare function MultipleOfFourNumber(num: number): number;
|
|
2
|
+
/**
|
|
3
|
+
* Get vertex indices for drawing polygon mesh (triangulation)
|
|
4
|
+
*/
|
|
5
|
+
export declare function getPolygonSurfaceIndices(positions: number[], holeIndices: number[], positionSize: number, preproject?: boolean): number[];
|
package/es/core/utils.js
CHANGED
|
@@ -1,3 +1,36 @@
|
|
|
1
|
+
import { lngLatToMeters } from '@antv/l7-utils';
|
|
2
|
+
import earcut from 'earcut';
|
|
1
3
|
export function MultipleOfFourNumber(num) {
|
|
2
4
|
return Math.max(Math.ceil(num / 4) * 4, 4);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Get vertex indices for drawing polygon mesh (triangulation)
|
|
9
|
+
*/
|
|
10
|
+
export function getPolygonSurfaceIndices(positions, holeIndices, positionSize, preproject = true) {
|
|
11
|
+
const is3d = positionSize === 3;
|
|
12
|
+
if (preproject) {
|
|
13
|
+
positions = positions.slice();
|
|
14
|
+
const p = [];
|
|
15
|
+
for (let i = 0; i < positions.length; i += positionSize) {
|
|
16
|
+
p[0] = positions[i];
|
|
17
|
+
p[1] = positions[i + 1];
|
|
18
|
+
if (is3d) {
|
|
19
|
+
p[2] = positions[i + 2];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// earcut is a 2D triangulation algorithm, and handles 3D data as if it was projected onto the XY plane
|
|
23
|
+
const xy = lngLatToMeters(p, true, {
|
|
24
|
+
enable: false,
|
|
25
|
+
decimal: 1
|
|
26
|
+
});
|
|
27
|
+
positions[i] = xy[0];
|
|
28
|
+
positions[i + 1] = xy[1];
|
|
29
|
+
if (is3d) {
|
|
30
|
+
positions[i + 2] = xy[2];
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const indices = earcut(positions, holeIndices, positionSize);
|
|
35
|
+
return indices;
|
|
3
36
|
}
|
|
@@ -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;
|
|
@@ -2,16 +2,22 @@ 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";
|
|
6
5
|
import { earthTriangulation } from "../../core/triangulation";
|
|
7
6
|
/* babel-plugin-inline-import '../shaders/atmosphere/atmosphere_frag.glsl' */
|
|
8
7
|
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";
|
|
9
8
|
/* babel-plugin-inline-import '../shaders/atmosphere/atmosphere_vert.glsl' */
|
|
10
|
-
const atmoSphereVert = "layout(location =
|
|
9
|
+
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";
|
|
11
10
|
const {
|
|
12
11
|
isNumber
|
|
13
12
|
} = lodashUtil;
|
|
14
13
|
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
|
+
}
|
|
15
21
|
getCommonUniformsInfo() {
|
|
16
22
|
const {
|
|
17
23
|
opacity = 1
|
|
@@ -41,6 +47,7 @@ export default class EarthAtomSphereModel extends BaseModel {
|
|
|
41
47
|
moduleName: 'earthAtmoSphere',
|
|
42
48
|
vertexShader: atmoSphereVert,
|
|
43
49
|
fragmentShader: atmoSphereFrag,
|
|
50
|
+
defines: _this2.getDefines(),
|
|
44
51
|
triangulation: earthTriangulation,
|
|
45
52
|
depth: {
|
|
46
53
|
enable: false
|
|
@@ -52,32 +59,31 @@ export default class EarthAtomSphereModel extends BaseModel {
|
|
|
52
59
|
}
|
|
53
60
|
registerBuiltinAttributes() {
|
|
54
61
|
// point layer size;
|
|
55
|
-
this.styleAttributeService.registerStyleAttribute({
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
});
|
|
62
|
+
// this.styleAttributeService.registerStyleAttribute({
|
|
63
|
+
// name: 'size',
|
|
64
|
+
// type: AttributeType.Attribute,
|
|
65
|
+
// descriptor: {
|
|
66
|
+
// name: 'a_Size',
|
|
67
|
+
// shaderLocation: this.attributeLocation.SIZE,
|
|
68
|
+
// buffer: {
|
|
69
|
+
// usage: gl.DYNAMIC_DRAW,
|
|
70
|
+
// data: [],
|
|
71
|
+
// type: gl.FLOAT,
|
|
72
|
+
// },
|
|
73
|
+
// size: 1,
|
|
74
|
+
// update: (feature: IEncodeFeature) => {
|
|
75
|
+
// const { size = 1 } = feature;
|
|
76
|
+
// return Array.isArray(size) ? [size[0]] : [size as number];
|
|
77
|
+
// },
|
|
78
|
+
// },
|
|
79
|
+
// });
|
|
80
|
+
|
|
75
81
|
this.styleAttributeService.registerStyleAttribute({
|
|
76
82
|
name: 'normal',
|
|
77
83
|
type: AttributeType.Attribute,
|
|
78
84
|
descriptor: {
|
|
79
85
|
name: 'a_Normal',
|
|
80
|
-
shaderLocation:
|
|
86
|
+
shaderLocation: this.attributeLocation.NORMAL,
|
|
81
87
|
buffer: {
|
|
82
88
|
usage: gl.STATIC_DRAW,
|
|
83
89
|
data: [],
|
|
@@ -94,7 +100,7 @@ export default class EarthAtomSphereModel extends BaseModel {
|
|
|
94
100
|
type: AttributeType.Attribute,
|
|
95
101
|
descriptor: {
|
|
96
102
|
name: 'a_Uv',
|
|
97
|
-
shaderLocation:
|
|
103
|
+
shaderLocation: this.attributeLocation.UV,
|
|
98
104
|
buffer: {
|
|
99
105
|
usage: gl.DYNAMIC_DRAW,
|
|
100
106
|
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/es/earth/models/base.js
CHANGED
|
@@ -3,11 +3,10 @@ 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";
|
|
7
6
|
/* babel-plugin-inline-import '../shaders/base/base_frag.glsl' */
|
|
8
7
|
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";
|
|
9
8
|
/* babel-plugin-inline-import '../shaders/base/base_vert.glsl' */
|
|
10
|
-
const baseVert = "// attribute vec4 a_Color;\nlayout(location =
|
|
9
|
+
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";
|
|
11
10
|
export default class BaseEarthModel extends BaseModel {
|
|
12
11
|
constructor(...args) {
|
|
13
12
|
super(...args);
|
|
@@ -19,6 +18,13 @@ export default class BaseEarthModel extends BaseModel {
|
|
|
19
18
|
_defineProperty(this, "sunZ", 1000);
|
|
20
19
|
_defineProperty(this, "sunRadius", Math.sqrt(this.sunX * this.sunX + this.sunY * this.sunY + this.sunZ * this.sunZ));
|
|
21
20
|
}
|
|
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
|
animateOption,
|
|
@@ -97,6 +103,7 @@ export default class BaseEarthModel extends BaseModel {
|
|
|
97
103
|
moduleName: 'earthBase',
|
|
98
104
|
vertexShader: baseVert,
|
|
99
105
|
fragmentShader: baseFrag,
|
|
106
|
+
defines: _this2.getDefines(),
|
|
100
107
|
triangulation: earthTriangulation,
|
|
101
108
|
depth: {
|
|
102
109
|
enable: true
|
|
@@ -107,32 +114,31 @@ export default class BaseEarthModel extends BaseModel {
|
|
|
107
114
|
})();
|
|
108
115
|
}
|
|
109
116
|
registerBuiltinAttributes() {
|
|
110
|
-
this.styleAttributeService.registerStyleAttribute({
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
});
|
|
117
|
+
// this.styleAttributeService.registerStyleAttribute({
|
|
118
|
+
// name: 'size',
|
|
119
|
+
// type: AttributeType.Attribute,
|
|
120
|
+
// descriptor: {
|
|
121
|
+
// name: 'a_Size',
|
|
122
|
+
// shaderLocation: this.attributeLocation.SIZE,
|
|
123
|
+
// buffer: {
|
|
124
|
+
// usage: gl.DYNAMIC_DRAW,
|
|
125
|
+
// data: [],
|
|
126
|
+
// type: gl.FLOAT,
|
|
127
|
+
// },
|
|
128
|
+
// size: 1,
|
|
129
|
+
// update: (feature: IEncodeFeature) => {
|
|
130
|
+
// const { size = 1 } = feature;
|
|
131
|
+
// return Array.isArray(size) ? [size[0]] : [size as number];
|
|
132
|
+
// },
|
|
133
|
+
// },
|
|
134
|
+
// });
|
|
135
|
+
|
|
130
136
|
this.styleAttributeService.registerStyleAttribute({
|
|
131
137
|
name: 'normal',
|
|
132
138
|
type: AttributeType.Attribute,
|
|
133
139
|
descriptor: {
|
|
134
140
|
name: 'a_Normal',
|
|
135
|
-
shaderLocation:
|
|
141
|
+
shaderLocation: this.attributeLocation.NORMAL,
|
|
136
142
|
buffer: {
|
|
137
143
|
usage: gl.STATIC_DRAW,
|
|
138
144
|
data: [],
|
|
@@ -149,7 +155,7 @@ export default class BaseEarthModel extends BaseModel {
|
|
|
149
155
|
type: AttributeType.Attribute,
|
|
150
156
|
descriptor: {
|
|
151
157
|
name: 'a_Uv',
|
|
152
|
-
shaderLocation:
|
|
158
|
+
shaderLocation: this.attributeLocation.UV,
|
|
153
159
|
buffer: {
|
|
154
160
|
// give the WebGL driver a hint that this buffer may change
|
|
155
161
|
usage: 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;
|