@antv/l7-layers 2.21.10 → 2.21.11-beta.1
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 +6 -6
|
@@ -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 { earthOuterTriangulation } from "../../core/triangulation";
|
|
7
6
|
/* babel-plugin-inline-import '../shaders/bloomshpere/bloomsphere_frag.glsl' */
|
|
8
7
|
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";
|
|
9
8
|
/* babel-plugin-inline-import '../shaders/bloomshpere/bloomsphere_vert.glsl' */
|
|
10
|
-
const bloomSphereVert = "layout(location =
|
|
9
|
+
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";
|
|
11
10
|
const {
|
|
12
11
|
isNumber
|
|
13
12
|
} = lodashUtil;
|
|
14
13
|
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
|
+
}
|
|
15
21
|
getCommonUniformsInfo() {
|
|
16
22
|
const {
|
|
17
23
|
opacity = 1
|
|
@@ -41,6 +47,7 @@ export default class EarthBloomSphereModel extends BaseModel {
|
|
|
41
47
|
moduleName: 'earthBloom',
|
|
42
48
|
vertexShader: bloomSphereVert,
|
|
43
49
|
fragmentShader: bloomSphereFrag,
|
|
50
|
+
defines: _this2.getDefines(),
|
|
44
51
|
triangulation: earthOuterTriangulation,
|
|
45
52
|
depth: {
|
|
46
53
|
enable: false
|
|
@@ -51,32 +58,31 @@ export default class EarthBloomSphereModel extends BaseModel {
|
|
|
51
58
|
})();
|
|
52
59
|
}
|
|
53
60
|
registerBuiltinAttributes() {
|
|
54
|
-
this.styleAttributeService.registerStyleAttribute({
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
});
|
|
61
|
+
// this.styleAttributeService.registerStyleAttribute({
|
|
62
|
+
// name: 'size',
|
|
63
|
+
// type: AttributeType.Attribute,
|
|
64
|
+
// descriptor: {
|
|
65
|
+
// name: 'a_Size',
|
|
66
|
+
// shaderLocation: this.attributeLocation.SIZE,
|
|
67
|
+
// buffer: {
|
|
68
|
+
// usage: gl.DYNAMIC_DRAW,
|
|
69
|
+
// data: [],
|
|
70
|
+
// type: gl.FLOAT,
|
|
71
|
+
// },
|
|
72
|
+
// size: 1,
|
|
73
|
+
// update: (feature: IEncodeFeature) => {
|
|
74
|
+
// const { size = 1 } = feature;
|
|
75
|
+
// return Array.isArray(size) ? [size[0]] : [size as number];
|
|
76
|
+
// },
|
|
77
|
+
// },
|
|
78
|
+
// });
|
|
79
|
+
|
|
74
80
|
this.styleAttributeService.registerStyleAttribute({
|
|
75
81
|
name: 'normal',
|
|
76
82
|
type: AttributeType.Attribute,
|
|
77
83
|
descriptor: {
|
|
78
84
|
name: 'a_Normal',
|
|
79
|
-
shaderLocation:
|
|
85
|
+
shaderLocation: this.attributeLocation.NORMAL,
|
|
80
86
|
buffer: {
|
|
81
87
|
usage: gl.STATIC_DRAW,
|
|
82
88
|
data: [],
|
|
@@ -93,7 +99,7 @@ export default class EarthBloomSphereModel extends BaseModel {
|
|
|
93
99
|
type: AttributeType.Attribute,
|
|
94
100
|
descriptor: {
|
|
95
101
|
name: 'a_Uv',
|
|
96
|
-
shaderLocation:
|
|
102
|
+
shaderLocation: this.attributeLocation.UV,
|
|
97
103
|
buffer: {
|
|
98
104
|
usage: gl.DYNAMIC_DRAW,
|
|
99
105
|
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
|
};
|
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
import type { IModel, IModelUniform, ITexture2D } from '@antv/l7-core';
|
|
2
2
|
import BaseModel from '../../core/BaseModel';
|
|
3
3
|
export default class BillBoardModel 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
|
+
EXTRUDE: number;
|
|
17
|
+
UV: number;
|
|
18
|
+
};
|
|
4
19
|
protected texture: ITexture2D;
|
|
5
20
|
private radian;
|
|
6
21
|
planeGeometryTriangulation: () => {
|
|
@@ -3,11 +3,10 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
4
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
5
5
|
import BaseModel from "../../core/BaseModel";
|
|
6
|
-
import { ShaderLocation } from "../../core/CommonStyleAttribute";
|
|
7
6
|
/* babel-plugin-inline-import '../shaders/billboard_frag.glsl' */
|
|
8
7
|
const planeFrag = "layout(std140) uniform commonUniforms {\n vec2 u_size;\n float u_raisingHeight;\n float u_rotation;\n float u_opacity;\n};\n\nuniform sampler2D u_texture;\n\nin vec2 v_uv;\nout vec4 outputColor;\n\n#pragma include \"picking\"\nvoid main() {\n outputColor = texture(SAMPLER_2D(u_texture), vec2(v_uv.x, 1.0 - v_uv.y));\n outputColor.a *= u_opacity;\n outputColor = filterColor(outputColor);\n}\n";
|
|
9
8
|
/* babel-plugin-inline-import '../shaders/billboard_vert.glsl' */
|
|
10
|
-
const planeVert = "layout(location =
|
|
9
|
+
const planeVert = "layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\nlayout(location = ATTRIBUTE_LOCATION_EXTRUDE) in vec3 a_Extrude;\nlayout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;\n\nlayout(std140) uniform commonUniforms {\n vec2 u_size;\n float u_raisingHeight;\n float u_rotation;\n float u_opacity;\n};\n\nout vec2 v_uv;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n#pragma include \"rotation_2d\"\nvoid main() {\n vec3 extrude = a_Extrude;\n v_uv = a_Uv;\n float raiseHeight = u_raisingHeight;\n if (\n u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||\n u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET\n ) {\n float mapboxZoomScale = 4.0 / pow(2.0, 21.0 - u_Zoom);\n raiseHeight = u_raisingHeight * mapboxZoomScale;\n }\n\n // \u8BA1\u7B97\u7ECF\u7EAC\u5EA6\u70B9\u4F4D\u5750\u6807\n vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));\n\n // \u8BA1\u7B97\u7ED5 z \u8F74\u65CB\u8F6C\u540E\u7684\u504F\u79FB\n vec2 offsetXY = project_pixel(rotate_matrix(vec2(extrude.x * u_size.x, 0.0), u_rotation));\n // \u7ED5 z \u8F74\u65CB\u8F6C\n float x = project_pos.x + offsetXY.x;\n float y = project_pos.y + offsetXY.y;\n // z \u8F74\u4E0D\u53C2\u4E0E\u65CB\u8F6C\n float z = project_pixel(extrude.y * u_size.y + raiseHeight);\n\n gl_Position = project_common_position_to_clipspace(vec4(x, y, z, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
11
10
|
export default class BillBoardModel extends BaseModel {
|
|
12
11
|
constructor(...args) {
|
|
13
12
|
super(...args);
|
|
@@ -25,6 +24,13 @@ export default class BillBoardModel extends BaseModel {
|
|
|
25
24
|
};
|
|
26
25
|
});
|
|
27
26
|
}
|
|
27
|
+
get attributeLocation() {
|
|
28
|
+
return Object.assign(super.attributeLocation, {
|
|
29
|
+
MAX: super.attributeLocation.MAX,
|
|
30
|
+
EXTRUDE: 9,
|
|
31
|
+
UV: 10
|
|
32
|
+
});
|
|
33
|
+
}
|
|
28
34
|
getUninforms() {
|
|
29
35
|
const commoninfo = this.getCommonUniformsInfo();
|
|
30
36
|
const attributeInfo = this.getUniformsBufferInfo(this.getStyleAttribute());
|
|
@@ -42,12 +48,11 @@ export default class BillBoardModel extends BaseModel {
|
|
|
42
48
|
/**
|
|
43
49
|
* rotateFlag
|
|
44
50
|
* DEFAULT 1
|
|
45
|
-
* MAPBOX
|
|
46
|
-
*
|
|
47
|
-
* GAODE1.x -1
|
|
51
|
+
* MAPBOX 1
|
|
52
|
+
* AMAP -1
|
|
48
53
|
*/
|
|
49
54
|
let rotateFlag = 1;
|
|
50
|
-
if (this.mapService.
|
|
55
|
+
if (this.mapService.getType() === 'amap') {
|
|
51
56
|
rotateFlag = -1;
|
|
52
57
|
}
|
|
53
58
|
// 控制图标的旋转角度(绕 Z 轴旋转)
|
|
@@ -89,6 +94,7 @@ export default class BillBoardModel extends BaseModel {
|
|
|
89
94
|
vertexShader: planeVert,
|
|
90
95
|
fragmentShader: planeFrag,
|
|
91
96
|
triangulation: _this.planeGeometryTriangulation,
|
|
97
|
+
defines: _this.getDefines(),
|
|
92
98
|
inject: _this.getInject(),
|
|
93
99
|
primitive: gl.TRIANGLES,
|
|
94
100
|
depth: {
|
|
@@ -134,7 +140,7 @@ export default class BillBoardModel extends BaseModel {
|
|
|
134
140
|
type: AttributeType.Attribute,
|
|
135
141
|
descriptor: {
|
|
136
142
|
name: 'a_Extrude',
|
|
137
|
-
shaderLocation:
|
|
143
|
+
shaderLocation: this.attributeLocation.EXTRUDE,
|
|
138
144
|
buffer: {
|
|
139
145
|
usage: gl.DYNAMIC_DRAW,
|
|
140
146
|
data: [],
|
|
@@ -153,7 +159,7 @@ export default class BillBoardModel extends BaseModel {
|
|
|
153
159
|
type: AttributeType.Attribute,
|
|
154
160
|
descriptor: {
|
|
155
161
|
name: 'a_Uv',
|
|
156
|
-
shaderLocation:
|
|
162
|
+
shaderLocation: this.attributeLocation.UV,
|
|
157
163
|
buffer: {
|
|
158
164
|
usage: gl.DYNAMIC_DRAW,
|
|
159
165
|
data: [],
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
import type { IModel, IModelUniform, ITexture2D } from '@antv/l7-core';
|
|
2
2
|
import BaseModel from '../../core/BaseModel';
|
|
3
3
|
export default class PlaneModel extends BaseModel {
|
|
4
|
+
protected get attributeLocation(): {
|
|
5
|
+
readonly POSITION: 0;
|
|
6
|
+
readonly POSITION_64LOW: 1;
|
|
7
|
+
readonly COLOR: 2;
|
|
8
|
+
readonly PICKING_COLOR: 3;
|
|
9
|
+
readonly STROKE: 4;
|
|
10
|
+
readonly OPACITY: 5;
|
|
11
|
+
readonly OFFSETS: 6;
|
|
12
|
+
readonly ROTATION: 7;
|
|
13
|
+
readonly MAX: 8;
|
|
14
|
+
} & Record<string, number> & {
|
|
15
|
+
MAX: 8;
|
|
16
|
+
UV: number;
|
|
17
|
+
};
|
|
4
18
|
protected texture: ITexture2D;
|
|
5
19
|
protected terrainImage: HTMLImageElement;
|
|
6
20
|
protected terrainImageLoaded: boolean;
|
|
@@ -4,11 +4,10 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
|
4
4
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
5
5
|
// import { mat4, vec3 } from 'gl-matrix';
|
|
6
6
|
import BaseModel from "../../core/BaseModel";
|
|
7
|
-
import { ShaderLocation } from "../../core/CommonStyleAttribute";
|
|
8
7
|
/* babel-plugin-inline-import '../shaders/plane_frag.glsl' */
|
|
9
8
|
const planeFrag = "\nuniform sampler2D u_texture;\nlayout(std140) uniform commonUniforms {\n float u_opacity;\n float u_mapFlag;\n float u_terrainClipHeight;\n};\n\nin vec3 v_Color;\nin vec2 v_uv;\nin float v_clip;\nout vec4 outputColor;\n\n#pragma include \"picking\"\nvoid main() {\n // gl_FragColor = vec4(v_Color, u_opacity);\n if(u_mapFlag > 0.0) {\n outputColor = texture(SAMPLER_2D(u_texture), vec2(v_uv.x, 1.0 - v_uv.y));\n outputColor.a *= u_opacity;\n } else {\n // gl_FragColor = vec4(v_uv, 0.0, u_opacity);\n outputColor = vec4(v_Color, u_opacity);\n }\n outputColor.a *= v_clip;\n outputColor = filterColor(outputColor);\n}\n";
|
|
10
9
|
/* babel-plugin-inline-import '../shaders/plane_vert.glsl' */
|
|
11
|
-
const planeVert = "\nlayout(location =
|
|
10
|
+
const planeVert = "\nlayout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\nlayout(location = ATTRIBUTE_LOCATION_COLOR) in vec3 a_Color;\nlayout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;\n\nlayout(std140) uniform commonUniforms {\n float u_opacity;\n float u_mapFlag;\n float u_terrainClipHeight;\n};\n\nout vec3 v_Color;\nout vec2 v_uv;\nout float v_clip;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\nvoid main() {\n v_Color = a_Color;\n v_uv = a_Uv;\n\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n\n v_clip = 1.0;\n if(a_Position.z < u_terrainClipHeight) {\n v_clip = 0.0;\n }\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, a_Position.z, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
12
11
|
export default class PlaneModel extends BaseModel {
|
|
13
12
|
constructor(...args) {
|
|
14
13
|
super(...args);
|
|
@@ -40,6 +39,12 @@ export default class PlaneModel extends BaseModel {
|
|
|
40
39
|
};
|
|
41
40
|
});
|
|
42
41
|
}
|
|
42
|
+
get attributeLocation() {
|
|
43
|
+
return Object.assign(super.attributeLocation, {
|
|
44
|
+
MAX: super.attributeLocation.MAX,
|
|
45
|
+
UV: 10
|
|
46
|
+
});
|
|
47
|
+
}
|
|
43
48
|
initPlane(width = 1, height = 1, widthSegments = 1, heightSegments = 1, lng = 120, lat = 30) {
|
|
44
49
|
// https://github.com/mrdoob/three.js/blob/dev/src/geometries/PlaneGeometry.js
|
|
45
50
|
const widthHalf = width / 2;
|
|
@@ -56,13 +61,7 @@ export default class PlaneModel extends BaseModel {
|
|
|
56
61
|
const y = iy * segmentHeight - heightHalf;
|
|
57
62
|
for (let ix = 0; ix < gridX1; ix++) {
|
|
58
63
|
const x = ix * segmentWidth - widthHalf;
|
|
59
|
-
|
|
60
|
-
// @ts-ignore
|
|
61
|
-
const [a, b] = this.mapService.lngLatToCoord([x + lng, -y + lat]);
|
|
62
|
-
positions.push(a, b, 0);
|
|
63
|
-
} else {
|
|
64
|
-
positions.push(x + lng, -y + lat, 0);
|
|
65
|
-
}
|
|
64
|
+
positions.push(x + lng, -y + lat, 0);
|
|
66
65
|
positions.push(ix / gridX);
|
|
67
66
|
positions.push(1 - iy / gridY);
|
|
68
67
|
}
|
|
@@ -139,6 +138,7 @@ export default class PlaneModel extends BaseModel {
|
|
|
139
138
|
vertexShader: planeVert,
|
|
140
139
|
fragmentShader: planeFrag,
|
|
141
140
|
triangulation: _this.planeGeometryTriangulation,
|
|
141
|
+
defines: _this.getDefines(),
|
|
142
142
|
inject: _this.getInject(),
|
|
143
143
|
primitive: gl.TRIANGLES,
|
|
144
144
|
depth: {
|
|
@@ -296,7 +296,7 @@ export default class PlaneModel extends BaseModel {
|
|
|
296
296
|
type: AttributeType.Attribute,
|
|
297
297
|
descriptor: {
|
|
298
298
|
name: 'a_Uv',
|
|
299
|
-
shaderLocation:
|
|
299
|
+
shaderLocation: this.attributeLocation.UV,
|
|
300
300
|
buffer: {
|
|
301
301
|
// give the WebGL driver a hint that this buffer may change
|
|
302
302
|
usage: gl.DYNAMIC_DRAW,
|
|
@@ -6,7 +6,7 @@ import BaseModel from "../../core/BaseModel";
|
|
|
6
6
|
/* babel-plugin-inline-import '../shaders/sprite_frag.glsl' */
|
|
7
7
|
const spriteFrag = "\nlayout(std140) uniform commonUniforms {\n float u_opacity;\n float u_mapFlag;\n float u_Scale;\n};\nuniform sampler2D u_texture;\n\nin vec3 v_Color;\nin float v_d;\nout vec4 outputColor;\n\nvoid main() {\n\n if(v_d < 0.0) {\n discard;\n }\n\n if(u_mapFlag > 0.0) {\n outputColor = texture(SAMPLER_2D(u_texture), gl_PointCoord);\n outputColor.a *= u_opacity;\n } else {\n outputColor = vec4(v_Color, u_opacity);\n }\n}\n";
|
|
8
8
|
/* babel-plugin-inline-import '../shaders/sprite_vert.glsl' */
|
|
9
|
-
const spriteVert = "layout(location =
|
|
9
|
+
const spriteVert = "layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\nlayout(location = ATTRIBUTE_LOCATION_COLOR) in vec3 a_Color;\n\nlayout(std140) uniform commonUniforms {\n float u_opacity;\n float u_mapFlag;\n float u_Scale;\n};\n\nout vec3 v_Color;\nout float v_d;\n\n#pragma include \"projection\"\nvoid main() {\n v_Color = a_Color.xyz;\n v_d = a_Position.z;\n\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, a_Position.z, 1.0));\n gl_PointSize = pow(u_Zoom - 1.0, 2.0) * u_Scale;\n}\n";
|
|
10
10
|
var SPRITE_ANIMATE_DIR = /*#__PURE__*/function (SPRITE_ANIMATE_DIR) {
|
|
11
11
|
SPRITE_ANIMATE_DIR["UP"] = "up";
|
|
12
12
|
SPRITE_ANIMATE_DIR["DOWN"] = "down";
|
|
@@ -92,7 +92,6 @@ export default class SpriteModel extends BaseModel {
|
|
|
92
92
|
initSprite(radius = 10, spriteCount = 100, lng = 120, lat = 30) {
|
|
93
93
|
const indices = [];
|
|
94
94
|
const positions = [];
|
|
95
|
-
const mapService = this.mapService;
|
|
96
95
|
const heightLimit = this.spriteAnimate === SPRITE_ANIMATE_DIR.UP ? -this.spriteTop : this.spriteTop;
|
|
97
96
|
for (let i = 0; i < spriteCount; i++) {
|
|
98
97
|
const height = Math.random() * heightLimit;
|
|
@@ -106,13 +105,7 @@ export default class SpriteModel extends BaseModel {
|
|
|
106
105
|
const randomY = radius * Math.random();
|
|
107
106
|
const x = -radius / 2 + randomX;
|
|
108
107
|
const y = -radius / 2 + randomY;
|
|
109
|
-
|
|
110
|
-
// @ts-ignore
|
|
111
|
-
const [a, b] = mapService.lngLatToCoord([x + lng, -y + lat]);
|
|
112
|
-
return [a, b, z, 0, 0];
|
|
113
|
-
} else {
|
|
114
|
-
return [x + lng, -y + lat, z, 0, 0];
|
|
115
|
-
}
|
|
108
|
+
return [x + lng, -y + lat, z, 0, 0];
|
|
116
109
|
}
|
|
117
110
|
return {
|
|
118
111
|
indices,
|
|
@@ -184,6 +177,7 @@ export default class SpriteModel extends BaseModel {
|
|
|
184
177
|
vertexShader: spriteVert,
|
|
185
178
|
fragmentShader: spriteFrag,
|
|
186
179
|
triangulation: _this.planeGeometryTriangulation,
|
|
180
|
+
defines: _this.getDefines(),
|
|
187
181
|
inject: _this.getInject(),
|
|
188
182
|
primitive: gl.POINTS,
|
|
189
183
|
depth: {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
layout(location =
|
|
2
|
-
layout(location =
|
|
3
|
-
layout(location =
|
|
1
|
+
layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
|
|
2
|
+
layout(location = ATTRIBUTE_LOCATION_EXTRUDE) in vec3 a_Extrude;
|
|
3
|
+
layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;
|
|
4
4
|
|
|
5
5
|
layout(std140) uniform commonUniforms {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
vec2 u_size;
|
|
7
|
+
float u_raisingHeight;
|
|
8
|
+
float u_rotation;
|
|
9
|
+
float u_opacity;
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
out vec2 v_uv;
|
|
@@ -15,26 +15,29 @@ out vec2 v_uv;
|
|
|
15
15
|
#pragma include "picking"
|
|
16
16
|
#pragma include "rotation_2d"
|
|
17
17
|
void main() {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
vec3 extrude = a_Extrude;
|
|
19
|
+
v_uv = a_Uv;
|
|
20
|
+
float raiseHeight = u_raisingHeight;
|
|
21
|
+
if (
|
|
22
|
+
u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
|
|
23
|
+
u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET
|
|
24
|
+
) {
|
|
25
|
+
float mapboxZoomScale = 4.0 / pow(2.0, 21.0 - u_Zoom);
|
|
26
|
+
raiseHeight = u_raisingHeight * mapboxZoomScale;
|
|
27
|
+
}
|
|
25
28
|
|
|
26
|
-
|
|
27
|
-
|
|
29
|
+
// 计算经纬度点位坐标
|
|
30
|
+
vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));
|
|
28
31
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
// 计算绕 z 轴旋转后的偏移
|
|
33
|
+
vec2 offsetXY = project_pixel(rotate_matrix(vec2(extrude.x * u_size.x, 0.0), u_rotation));
|
|
34
|
+
// 绕 z 轴旋转
|
|
35
|
+
float x = project_pos.x + offsetXY.x;
|
|
36
|
+
float y = project_pos.y + offsetXY.y;
|
|
37
|
+
// z 轴不参与旋转
|
|
38
|
+
float z = project_pixel(extrude.y * u_size.y + raiseHeight);
|
|
36
39
|
|
|
37
|
-
|
|
40
|
+
gl_Position = project_common_position_to_clipspace(vec4(x, y, z, 1.0));
|
|
38
41
|
|
|
39
|
-
|
|
42
|
+
setPickingColor(a_PickingColor);
|
|
40
43
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
|
-
layout(location =
|
|
3
|
-
layout(location =
|
|
4
|
-
layout(location =
|
|
2
|
+
layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
|
|
3
|
+
layout(location = ATTRIBUTE_LOCATION_COLOR) in vec3 a_Color;
|
|
4
|
+
layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;
|
|
5
5
|
|
|
6
6
|
layout(std140) uniform commonUniforms {
|
|
7
7
|
float u_opacity;
|
|
@@ -18,15 +18,15 @@ out float v_clip;
|
|
|
18
18
|
void main() {
|
|
19
19
|
v_Color = a_Color;
|
|
20
20
|
v_uv = a_Uv;
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
vec4 project_pos = project_position(vec4(a_Position, 1.0));
|
|
23
23
|
|
|
24
24
|
v_clip = 1.0;
|
|
25
25
|
if(a_Position.z < u_terrainClipHeight) {
|
|
26
26
|
v_clip = 0.0;
|
|
27
27
|
}
|
|
28
|
-
|
|
29
|
-
gl_Position =
|
|
28
|
+
|
|
29
|
+
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, a_Position.z, 1.0));
|
|
30
30
|
|
|
31
31
|
setPickingColor(a_PickingColor);
|
|
32
32
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
layout(location =
|
|
2
|
-
layout(location =
|
|
1
|
+
layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
|
|
2
|
+
layout(location = ATTRIBUTE_LOCATION_COLOR) in vec3 a_Color;
|
|
3
3
|
|
|
4
4
|
layout(std140) uniform commonUniforms {
|
|
5
5
|
float u_opacity;
|
|
@@ -12,12 +12,10 @@ out float v_d;
|
|
|
12
12
|
|
|
13
13
|
#pragma include "projection"
|
|
14
14
|
void main() {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
vec4 project_pos = project_position(vec4(a_Position, 1.0));
|
|
15
|
+
v_Color = a_Color.xyz;
|
|
16
|
+
v_d = a_Position.z;
|
|
18
17
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
gl_PointSize = pow((u_Zoom - 1.0), 2.0) * u_Scale;
|
|
18
|
+
vec4 project_pos = project_position(vec4(a_Position, 1.0));
|
|
19
|
+
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, a_Position.z, 1.0));
|
|
20
|
+
gl_PointSize = pow(u_Zoom - 1.0, 2.0) * u_Scale;
|
|
23
21
|
}
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
import type { IModel, IModelUniform } from '@antv/l7-core';
|
|
2
2
|
import BaseModel from '../../core/BaseModel';
|
|
3
3
|
export default class GridModel 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
|
+
POS: number;
|
|
17
|
+
};
|
|
4
18
|
getUninforms(): IModelUniform;
|
|
5
19
|
protected getCommonUniformsInfo(): {
|
|
6
20
|
uniformsArray: number[];
|
|
@@ -6,8 +6,14 @@ import { HeatmapGridTriangulation } from "../../core/triangulation";
|
|
|
6
6
|
/* babel-plugin-inline-import '../shaders/grid/grid_frag.glsl' */
|
|
7
7
|
const grid_frag = "in vec4 v_color;\n\n#pragma include \"scene_uniforms\"\n#pragma include \"picking\"\nout vec4 outputColor;\nvoid main() {\n outputColor = v_color;\n outputColor = filterColor(outputColor);\n}\n";
|
|
8
8
|
/* babel-plugin-inline-import '../shaders/grid/grid_vert.glsl' */
|
|
9
|
-
const grid_vert = "layout(location =
|
|
9
|
+
const grid_vert = "layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\nlayout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;\nlayout(location = ATTRIBUTE_LOCATION_POS) in vec3 a_Pos;\n\nlayout(std140) uniform commonUniforms {\n vec2 u_radius;\n float u_opacity;\n float u_coverage;\n float u_angle;\n};\n\nout vec4 v_color;\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"picking\"\n\nvoid main() {\n v_color = a_Color;\n v_color.a *= u_opacity;\n\n mat2 rotationMatrix = mat2(cos(u_angle), sin(u_angle), -sin(u_angle), cos(u_angle));\n vec2 offset = a_Position.xy * u_radius * rotationMatrix * u_coverage;\n\n vec2 lnglat = unProjectFlat(a_Pos.xy + offset);\n vec4 project_pos = project_position(vec4(lnglat, 0, 1.0));\n gl_Position = project_common_position_to_clipspace(project_pos);\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
10
10
|
export default class GridModel extends BaseModel {
|
|
11
|
+
get attributeLocation() {
|
|
12
|
+
return Object.assign(super.attributeLocation, {
|
|
13
|
+
MAX: super.attributeLocation.MAX,
|
|
14
|
+
POS: 9
|
|
15
|
+
});
|
|
16
|
+
}
|
|
11
17
|
getUninforms() {
|
|
12
18
|
const commoninfo = this.getCommonUniformsInfo();
|
|
13
19
|
const attributeInfo = this.getUniformsBufferInfo(this.getStyleAttribute());
|
|
@@ -43,6 +49,7 @@ export default class GridModel extends BaseModel {
|
|
|
43
49
|
moduleName: 'heatmapGrid',
|
|
44
50
|
vertexShader: grid_vert,
|
|
45
51
|
fragmentShader: grid_frag,
|
|
52
|
+
defines: _this2.getDefines(),
|
|
46
53
|
triangulation: HeatmapGridTriangulation,
|
|
47
54
|
primitive: gl.TRIANGLES,
|
|
48
55
|
depth: {
|
|
@@ -58,7 +65,7 @@ export default class GridModel extends BaseModel {
|
|
|
58
65
|
// 顶点经纬度位置
|
|
59
66
|
type: AttributeType.Attribute,
|
|
60
67
|
descriptor: {
|
|
61
|
-
shaderLocation:
|
|
68
|
+
shaderLocation: this.attributeLocation.POS,
|
|
62
69
|
name: 'a_Pos',
|
|
63
70
|
buffer: {
|
|
64
71
|
usage: gl.DYNAMIC_DRAW,
|
|
@@ -67,7 +74,7 @@ export default class GridModel extends BaseModel {
|
|
|
67
74
|
},
|
|
68
75
|
size: 3,
|
|
69
76
|
update: feature => {
|
|
70
|
-
const coordinates = feature.
|
|
77
|
+
const coordinates = feature.coordinates;
|
|
71
78
|
return [coordinates[0], coordinates[1], 0];
|
|
72
79
|
}
|
|
73
80
|
}
|
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
import type { IModel, IModelUniform } from '@antv/l7-core';
|
|
2
2
|
import BaseModel from '../../core/BaseModel';
|
|
3
3
|
export default class Grid3DModel 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
|
+
SIZE: number;
|
|
17
|
+
POS: number;
|
|
18
|
+
NORMAL: number;
|
|
19
|
+
};
|
|
4
20
|
getUninforms(): IModelUniform;
|
|
5
21
|
protected getCommonUniformsInfo(): {
|
|
6
22
|
uniformsArray: number[];
|