@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
|
@@ -91,98 +91,6 @@ export default class ExtrudePolyline {
|
|
|
91
91
|
complex.startIndex = complex.positions.length / 6;
|
|
92
92
|
return complex;
|
|
93
93
|
}
|
|
94
|
-
simpleExtrude_gaode2(points, originPoints) {
|
|
95
|
-
const complex = this.complex;
|
|
96
|
-
if (points.length <= 1) {
|
|
97
|
-
return complex;
|
|
98
|
-
}
|
|
99
|
-
this.lastFlip = -1;
|
|
100
|
-
this.started = false;
|
|
101
|
-
this.normal = null;
|
|
102
|
-
this.totalDistance = 0;
|
|
103
|
-
// 去除数组里重复的点
|
|
104
|
-
// points = getArrayUnique(points);
|
|
105
|
-
const total = points.length;
|
|
106
|
-
let count = complex.startIndex;
|
|
107
|
-
for (let i = 1; i < total; i++) {
|
|
108
|
-
var _originPoints$, _originPoints$i$, _originPoints$2;
|
|
109
|
-
const last = points[i - 1];
|
|
110
|
-
last.push((_originPoints$ = originPoints[i - 1][2]) !== null && _originPoints$ !== void 0 ? _originPoints$ : 0);
|
|
111
|
-
// @ts-ignore
|
|
112
|
-
const originLast = originPoints[i - 1];
|
|
113
|
-
const cur = points[i];
|
|
114
|
-
cur.push((_originPoints$i$ = originPoints[i][2]) !== null && _originPoints$i$ !== void 0 ? _originPoints$i$ : 0);
|
|
115
|
-
// @ts-ignore
|
|
116
|
-
const originCur = originPoints[i];
|
|
117
|
-
const next = i < points.length - 1 ? [...points[i + 1], (_originPoints$2 = originPoints[i + 1][2]) !== null && _originPoints$2 !== void 0 ? _originPoints$2 : 0] : null;
|
|
118
|
-
const originNext = i < originPoints.length - 1 ? originPoints[i + 1] : null;
|
|
119
|
-
const amt = this.simpleSegment(complex, count,
|
|
120
|
-
// @ts-ignore
|
|
121
|
-
last,
|
|
122
|
-
// @ts-ignore
|
|
123
|
-
cur,
|
|
124
|
-
// @ts-ignore
|
|
125
|
-
next,
|
|
126
|
-
// @ts-ignore
|
|
127
|
-
originLast, originCur,
|
|
128
|
-
// @ts-ignore
|
|
129
|
-
originNext);
|
|
130
|
-
count += amt;
|
|
131
|
-
}
|
|
132
|
-
if (this.dash) {
|
|
133
|
-
for (let i = 0; i < complex.positions.length / 6; i++) {
|
|
134
|
-
complex.positions[i * 6 + 5] = this.totalDistance;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
complex.startIndex = complex.positions.length / 6;
|
|
138
|
-
return complex;
|
|
139
|
-
}
|
|
140
|
-
extrude_gaode2(points, originPoints) {
|
|
141
|
-
const complex = this.complex;
|
|
142
|
-
if (points.length <= 1) {
|
|
143
|
-
return complex;
|
|
144
|
-
}
|
|
145
|
-
this.lastFlip = -1;
|
|
146
|
-
this.started = false;
|
|
147
|
-
this.normal = null;
|
|
148
|
-
this.totalDistance = 0;
|
|
149
|
-
// 去除数组里重复的点
|
|
150
|
-
// points = getArrayUnique(points);
|
|
151
|
-
const total = points.length;
|
|
152
|
-
let count = complex.startIndex;
|
|
153
|
-
for (let i = 1; i < total; i++) {
|
|
154
|
-
var _originPoints$3, _originPoints$i$2, _originPoints$4;
|
|
155
|
-
const last = points[i - 1];
|
|
156
|
-
last.push((_originPoints$3 = originPoints[i - 1][2]) !== null && _originPoints$3 !== void 0 ? _originPoints$3 : 0);
|
|
157
|
-
// @ts-ignore
|
|
158
|
-
const originLast = originPoints[i - 1];
|
|
159
|
-
const cur = points[i];
|
|
160
|
-
cur.push((_originPoints$i$2 = originPoints[i][2]) !== null && _originPoints$i$2 !== void 0 ? _originPoints$i$2 : 0);
|
|
161
|
-
// @ts-ignore
|
|
162
|
-
const originCur = originPoints[i];
|
|
163
|
-
const next = i < points.length - 1 ? [...points[i + 1], (_originPoints$4 = originPoints[i + 1][2]) !== null && _originPoints$4 !== void 0 ? _originPoints$4 : 0] : null;
|
|
164
|
-
const originNext = i < originPoints.length - 1 ? originPoints[i + 1] : null;
|
|
165
|
-
const amt = this.segment_gaode2(complex, count,
|
|
166
|
-
// @ts-ignore
|
|
167
|
-
last,
|
|
168
|
-
// @ts-ignore
|
|
169
|
-
cur,
|
|
170
|
-
// @ts-ignore
|
|
171
|
-
next,
|
|
172
|
-
// @ts-ignore
|
|
173
|
-
originLast, originCur,
|
|
174
|
-
// @ts-ignore
|
|
175
|
-
originNext);
|
|
176
|
-
count += amt;
|
|
177
|
-
}
|
|
178
|
-
if (this.dash) {
|
|
179
|
-
for (let i = 0; i < complex.positions.length / 6; i++) {
|
|
180
|
-
complex.positions[i * 6 + 5] = this.totalDistance;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
complex.startIndex = complex.positions.length / 6;
|
|
184
|
-
return complex;
|
|
185
|
-
}
|
|
186
94
|
extrude(points) {
|
|
187
95
|
const complex = this.complex;
|
|
188
96
|
if (points.length <= 1) {
|
|
@@ -265,131 +173,6 @@ export default class ExtrudePolyline {
|
|
|
265
173
|
}
|
|
266
174
|
return count;
|
|
267
175
|
}
|
|
268
|
-
segment_gaode2(complex, index, last, cur, next, originLast, originCur,
|
|
269
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
270
|
-
originNext) {
|
|
271
|
-
let count = 0;
|
|
272
|
-
const indices = complex.indices;
|
|
273
|
-
const positions = complex.positions;
|
|
274
|
-
const normals = complex.normals;
|
|
275
|
-
const capSquare = this.cap === 'square';
|
|
276
|
-
const joinBevel = this.join === 'bevel';
|
|
277
|
-
const flatCur = aProjectFlat([originCur[0], originCur[1]]);
|
|
278
|
-
const flatLast = aProjectFlat([originLast[0], originLast[1]]);
|
|
279
|
-
// @ts-ignore
|
|
280
|
-
direction(lineA, cur, last);
|
|
281
|
-
let segmentDistance = 0;
|
|
282
|
-
if (this.dash) {
|
|
283
|
-
// @ts-ignore
|
|
284
|
-
segmentDistance = this.lineSegmentDistance(flatCur, flatLast);
|
|
285
|
-
this.totalDistance += segmentDistance;
|
|
286
|
-
}
|
|
287
|
-
if (!this.normal) {
|
|
288
|
-
this.normal = vec2.create();
|
|
289
|
-
computeNormal(this.normal, lineA);
|
|
290
|
-
}
|
|
291
|
-
if (!this.started) {
|
|
292
|
-
this.started = true;
|
|
293
|
-
|
|
294
|
-
// if the end cap is type square, we can just push the verts out a bit
|
|
295
|
-
if (capSquare) {
|
|
296
|
-
// vec2.scaleAndAdd(capEnd, last, lineA, -this.thickness);
|
|
297
|
-
const out1 = vec2.create();
|
|
298
|
-
const out2 = vec2.create();
|
|
299
|
-
vec2.add(out1, this.normal, lineA);
|
|
300
|
-
vec2.add(out2, this.normal, lineA);
|
|
301
|
-
normals.push(out2[0], out2[1], 0);
|
|
302
|
-
normals.push(out1[0], out1[1], 0);
|
|
303
|
-
positions.push(last[0], last[1], last[2] | 0, this.totalDistance - segmentDistance, -this.thickness, last[2] | 0);
|
|
304
|
-
this.complex.indexes.push(this.currentIndex);
|
|
305
|
-
positions.push(last[0], last[1], last[2] | 0, this.totalDistance - segmentDistance, this.thickness, last[2] | 0);
|
|
306
|
-
this.complex.indexes.push(this.currentIndex);
|
|
307
|
-
this.currentIndex++;
|
|
308
|
-
} else {
|
|
309
|
-
this.extrusions(positions, normals, last, this.normal, this.thickness, this.totalDistance - segmentDistance);
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
indices.push(index + 0, index + 1, index + 2);
|
|
313
|
-
if (!next) {
|
|
314
|
-
computeNormal(this.normal, lineA);
|
|
315
|
-
if (capSquare) {
|
|
316
|
-
const out1 = vec2.create();
|
|
317
|
-
const out2 = vec2.create();
|
|
318
|
-
vec2.sub(out2, lineA, this.normal);
|
|
319
|
-
vec2.add(out1, lineA, this.normal);
|
|
320
|
-
normals.push(out2[0], out2[1], 0);
|
|
321
|
-
normals.push(out1[0], out1[1], 0);
|
|
322
|
-
positions.push(cur[0], cur[1], cur[2] | 0, this.totalDistance, this.thickness, cur[2] | 0);
|
|
323
|
-
this.complex.indexes.push(this.currentIndex);
|
|
324
|
-
positions.push(cur[0], cur[1], cur[2] | 0, this.totalDistance, this.thickness, cur[2] | 0);
|
|
325
|
-
this.complex.indexes.push(this.currentIndex);
|
|
326
|
-
this.currentIndex++;
|
|
327
|
-
} else {
|
|
328
|
-
this.extrusions(positions, normals, cur, this.normal, this.thickness, this.totalDistance);
|
|
329
|
-
}
|
|
330
|
-
indices.push(...(this.lastFlip === 1 ? [index, index + 2, index + 3] : [index + 2, index + 1, index + 3]));
|
|
331
|
-
count += 2;
|
|
332
|
-
} else {
|
|
333
|
-
// @ts-ignore
|
|
334
|
-
if (isPointEqual(cur, next)) {
|
|
335
|
-
vec2.add(
|
|
336
|
-
// @ts-ignore
|
|
337
|
-
next,
|
|
338
|
-
// @ts-ignore
|
|
339
|
-
cur, vec2.normalize(
|
|
340
|
-
// @ts-ignore
|
|
341
|
-
next,
|
|
342
|
-
// @ts-ignore
|
|
343
|
-
vec2.subtract(next, cur, last)));
|
|
344
|
-
}
|
|
345
|
-
// @ts-ignore
|
|
346
|
-
direction(lineB, next, cur);
|
|
347
|
-
// stores tangent & miter
|
|
348
|
-
|
|
349
|
-
const [miterLen, miter] = computeMiter(tangent, vec2.create(), lineA, lineB, this.thickness);
|
|
350
|
-
// normal(tmp, lineA)
|
|
351
|
-
|
|
352
|
-
// get orientation
|
|
353
|
-
let flip = vec2.dot(tangent, this.normal) < 0 ? -1 : 1;
|
|
354
|
-
let bevel = joinBevel;
|
|
355
|
-
if (!bevel && this.join === 'miter') {
|
|
356
|
-
const limit = miterLen;
|
|
357
|
-
if (limit > this.miterLimit) {
|
|
358
|
-
bevel = true;
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
if (bevel) {
|
|
362
|
-
normals.push(this.normal[0], this.normal[1], 0);
|
|
363
|
-
normals.push(miter[0], miter[1], 0);
|
|
364
|
-
positions.push(cur[0], cur[1], cur[2] | 0, this.totalDistance, -this.thickness * flip, cur[2] | 0);
|
|
365
|
-
this.complex.indexes.push(this.currentIndex);
|
|
366
|
-
positions.push(cur[0], cur[1], cur[2] | 0, this.totalDistance, this.thickness * flip, cur[2] | 0);
|
|
367
|
-
this.complex.indexes.push(this.currentIndex);
|
|
368
|
-
this.currentIndex++;
|
|
369
|
-
indices.push(...(this.lastFlip !== -flip ? [index, index + 2, index + 3] : [index + 2, index + 1, index + 3]));
|
|
370
|
-
|
|
371
|
-
// now add the bevel triangle
|
|
372
|
-
indices.push(index + 2, index + 3, index + 4);
|
|
373
|
-
computeNormal(tmp, lineB);
|
|
374
|
-
vec2.copy(this.normal, tmp); // store normal for next round
|
|
375
|
-
normals.push(this.normal[0], this.normal[1], 0);
|
|
376
|
-
positions.push(cur[0], cur[1], cur[2] | 0, this.totalDistance, -this.thickness * flip, cur[2] | 0);
|
|
377
|
-
this.complex.indexes.push(this.currentIndex);
|
|
378
|
-
this.currentIndex++;
|
|
379
|
-
count += 3;
|
|
380
|
-
} else {
|
|
381
|
-
this.extrusions(positions, normals, cur, miter, miterLen, this.totalDistance);
|
|
382
|
-
indices.push(...(this.lastFlip === 1 ? [index, index + 2, index + 3] : [index + 2, index + 1, index + 3]));
|
|
383
|
-
flip = -1;
|
|
384
|
-
|
|
385
|
-
// the miter is now the normal for our next join
|
|
386
|
-
vec2.copy(this.normal, miter);
|
|
387
|
-
count += 2;
|
|
388
|
-
}
|
|
389
|
-
this.lastFlip = flip;
|
|
390
|
-
}
|
|
391
|
-
return count;
|
|
392
|
-
}
|
|
393
176
|
segment(complex, index, last, cur, next) {
|
|
394
177
|
let count = 0;
|
|
395
178
|
const indices = complex.indices;
|
package/es/wind/models/wind.d.ts
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
import type { IModel, IModelUniform, IRenderOptions, ITexture2D } from '@antv/l7-core';
|
|
2
2
|
import BaseModel from '../../core/BaseModel';
|
|
3
3
|
export default class WindModel 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
|
private colorModel;
|
|
6
20
|
private wind;
|
package/es/wind/models/wind.js
CHANGED
|
@@ -7,7 +7,7 @@ import { RasterImageTriangulation } from "../../core/triangulation";
|
|
|
7
7
|
/* babel-plugin-inline-import '../shaders/wind_frag.glsl' */
|
|
8
8
|
const WindFrag = "precision mediump float;\nuniform float u_opacity: 1.0;\nuniform sampler2D u_texture;\nvarying vec2 v_texCoord;\nvoid main() {\n vec4 color = texture2D(u_texture,vec2(v_texCoord.x,v_texCoord.y));\n gl_FragColor = color;\n gl_FragColor.a *= u_opacity;\n}\n";
|
|
9
9
|
/* babel-plugin-inline-import '../shaders/wind_vert.glsl' */
|
|
10
|
-
const WindVert = "precision highp float;\nuniform mat4 u_ModelMatrix;\n\
|
|
10
|
+
const WindVert = "precision highp float;\nuniform mat4 u_ModelMatrix;\n\nlayout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\nlayout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;\n\nvarying vec2 v_texCoord;\n#pragma include \"projection\"\nvoid main() {\n v_texCoord = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0.0, 1.0));\n}\n";
|
|
11
11
|
import { Wind } from "./windRender";
|
|
12
12
|
const defaultRampColors = {
|
|
13
13
|
0.0: '#3288bd',
|
|
@@ -32,6 +32,12 @@ export default class WindModel extends BaseModel {
|
|
|
32
32
|
_defineProperty(this, "frequency", new FrequencyController(7.2));
|
|
33
33
|
_defineProperty(this, "cacheZoom", void 0);
|
|
34
34
|
}
|
|
35
|
+
get attributeLocation() {
|
|
36
|
+
return Object.assign(super.attributeLocation, {
|
|
37
|
+
MAX: super.attributeLocation.MAX,
|
|
38
|
+
UV: 9
|
|
39
|
+
});
|
|
40
|
+
}
|
|
35
41
|
render(options) {
|
|
36
42
|
this.drawColorMode(options);
|
|
37
43
|
// Tip: 控制风场的平均更新频率
|
|
@@ -108,6 +114,7 @@ export default class WindModel extends BaseModel {
|
|
|
108
114
|
moduleName: 'wind',
|
|
109
115
|
vertexShader: WindVert,
|
|
110
116
|
fragmentShader: WindFrag,
|
|
117
|
+
defines: _this.getDefines(),
|
|
111
118
|
triangulation: RasterImageTriangulation,
|
|
112
119
|
primitive: gl.TRIANGLES,
|
|
113
120
|
depth: {
|
|
@@ -146,6 +153,7 @@ export default class WindModel extends BaseModel {
|
|
|
146
153
|
type: AttributeType.Attribute,
|
|
147
154
|
descriptor: {
|
|
148
155
|
name: 'a_Uv',
|
|
156
|
+
shaderLocation: this.attributeLocation.UV,
|
|
149
157
|
buffer: {
|
|
150
158
|
// give the WebGL driver a hint that this buffer may change
|
|
151
159
|
usage: gl.DYNAMIC_DRAW,
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
precision highp float;
|
|
2
2
|
uniform mat4 u_ModelMatrix;
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
|
|
5
|
+
layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;
|
|
6
|
+
|
|
6
7
|
varying vec2 v_texCoord;
|
|
7
8
|
#pragma include "projection"
|
|
8
9
|
void main() {
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
v_texCoord = a_Uv;
|
|
11
|
+
vec4 project_pos = project_position(vec4(a_Position, 1.0));
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0.0, 1.0));
|
|
13
14
|
}
|
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
import type { IModel } from '@antv/l7-core';
|
|
2
2
|
import BaseModel from '../../core/BaseModel';
|
|
3
3
|
export default class CityBuildModel 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
|
+
NORMAL: number;
|
|
18
|
+
UV: number;
|
|
19
|
+
};
|
|
4
20
|
private cityCenter;
|
|
5
21
|
private cityMinSize;
|
|
6
22
|
protected getCommonUniformsInfo(): {
|
|
@@ -10,18 +10,25 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
10
10
|
var _l7Core = require("@antv/l7-core");
|
|
11
11
|
var _l7Utils = require("@antv/l7-utils");
|
|
12
12
|
var _BaseModel = _interopRequireDefault(require("../../core/BaseModel"));
|
|
13
|
-
var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
|
|
14
13
|
var _triangulation = require("../../core/triangulation");
|
|
15
14
|
/* babel-plugin-inline-import '../shaders/build_frag.glsl' */
|
|
16
|
-
const buildFrag = "precision highp float;\nlayout(std140) uniform commonUniforms {\n vec4 u_baseColor
|
|
15
|
+
const buildFrag = "precision highp float;\nlayout(std140) uniform commonUniforms {\n vec4 u_baseColor: [ 1.0, 0, 0, 1.0 ];\n vec4 u_brightColor: [ 1.0, 0, 0, 1.0 ];\n vec4 u_windowColor: [ 1.0, 0, 0, 1.0 ];\n vec4 u_circleSweepColor;\n vec2 u_cityCenter;\n float u_circleSweep;\n float u_cityMinSize;\n float u_circleSweepSpeed;\n float u_opacity: 1.0;\n float u_near: 0;\n float u_far: 1;\n float u_time;\n};\nin vec4 v_Color;\nin vec2 v_texCoord;\nin float v_worldDis;\nout vec4 outputColor;\n\n#pragma include \"picking\"\n#pragma include \"scene_uniforms\"\n\nvec3 getWindowColor(float n, float hot, vec3 brightColor, vec3 darkColor) {\n float s = step(hot, n);\n vec3 color = mix(brightColor,vec3(0.9,0.9,1.0),n);\n\n return mix(darkColor, color, s);\n}\nfloat random (vec2 st) {\n return fract(sin(dot(st.xy, vec2(12.9898,78.233)))* 43758.5453123);\n}\n\nfloat LinearizeDepth()\n{\n float z = gl_FragCoord.z * 2.0 - 1.0;\n return (2.0 * u_near * u_far) / (u_far + u_near - z * (u_far - u_near));\n}\n\nvec3 fog(vec3 color, vec3 fogColor, float depth){\n float fogFactor=clamp(depth,0.0,1.0);\n vec3 output_color=mix(fogColor,color,fogFactor);\n return output_color;\n}\n\nfloat sdRect(vec2 p, vec2 sz) {\n vec2 d = abs(p) - sz;\n float outside = length(max(d, 0.));\n float inside = min(max(d.x, d.y), 0.);\n return outside + inside;\n}\n\nvoid main() {\n outputColor = v_Color;\n vec3 baseColor = u_baseColor.xyz;\n vec3 brightColor = u_brightColor.xyz;\n vec3 windowColor = u_windowColor.xyz;\n float targetColId = 5.;\n float depth = 1.0 - LinearizeDepth() / u_far * u_Zoom;\n vec3 fogColor = vec3(23.0/255.0,31.0/255.0,51.0/255.0);\n if(v_texCoord.x < 0.) { //\u9876\u90E8\u989C\u8272\n vec3 foggedColor = fog(baseColor.xyz + vec3(0.12*0.9,0.2*0.9,0.3*0.9),fogColor,depth);\n outputColor = vec4( foggedColor, v_Color.w);\n }else { // \u4FA7\u9762\u989C\u8272\n vec2 st = v_texCoord;\n vec2 UvScale = v_texCoord;\n float tStep = min(0.08,max(0.05* (18.0-u_Zoom),0.02));\n float tStart = 0.25 * tStep;\n float tEnd = 0.75 * tStep;\n float u = mod(UvScale.x, tStep);\n float v = mod(UvScale.y, tStep);\n float ux = floor(UvScale.x/tStep);\n float uy = floor(UvScale.y/tStep);\n float n = random(vec2(ux,uy));\n float lightP = u_time;\n float head = 1.0- step(0.005,st.y);\n /*step3*/\n // \u5C06\u7A97\u6237\u989C\u8272\u548C\u5899\u9762\u989C\u8272\u533A\u522B\u5F00\u6765\n float sU = step(tStart, u) - step(tEnd, u);\n float sV = step(tStart, v) - step(tEnd, v);\n vec2 windowSize = vec2(abs(tEnd-tStart),abs(tEnd-tStart));\n float dist = sdRect(vec2(u,v), windowSize);\n float s = sU * sV;\n\n float curColId = floor(UvScale.x / tStep);\n float sCol = step(targetColId - 0.2, curColId) - step(targetColId + 0.2, curColId);\n\n float mLightP = mod(lightP, 2.);\n float sRow = step(mLightP - 0.2, st.y) - step(mLightP, st.y);\n if(ux == targetColId){\n n =0.;\n }\n float timeP = min(0.75, abs ( sin(u_time/3.0) ) );\n float hot = smoothstep(1.0,0.0,timeP);\n vec3 color = mix(baseColor, getWindowColor(n,hot,brightColor,windowColor), s);\n //vec3 color = mix(baseColor, getWindowColor(n,hot,brightColor,windowColor), 1.0);\n float sFinal = s * sCol * sRow;\n color += mix(baseColor, brightColor, sFinal*n);\n if (st.y<0.01){\n color = baseColor;\n }\n if(head ==1.0) { // \u9876\u90E8\u4EAE\u7EBF\n color = brightColor;\n }\n color = color * v_Color.rgb;\n\n vec3 foggedColor = fog(color,fogColor,depth);\n\n outputColor = vec4(foggedColor,1.0);\n }\n\n\n if(u_circleSweep > 0.0 && v_worldDis < u_cityMinSize) {\n float r = fract(((v_worldDis/u_cityMinSize) - u_time * u_circleSweepSpeed) * 2.0);\n outputColor.rgb += r * r * u_circleSweepColor.rgb;\n }\n\n outputColor.a *= u_opacity;\n outputColor = filterColor(outputColor);\n}\n";
|
|
17
16
|
/* babel-plugin-inline-import '../shaders/build_vert.glsl' */
|
|
18
|
-
const buildVert = "precision highp float;\n\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\nlayout(location =
|
|
17
|
+
const buildVert = "precision highp float;\n\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\nlayout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;\nlayout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;\nlayout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;\nlayout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal;\nlayout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;\n\nout vec2 v_texCoord;\nout vec4 v_Color;\nout float v_worldDis;\n\nlayout(std140) uniform commonUniforms {\n vec4 u_baseColor : [ 1.0, 0, 0, 1.0 ];\n vec4 u_brightColor : [ 1.0, 0, 0, 1.0 ];\n vec4 u_windowColor : [ 1.0, 0, 0, 1.0 ];\n vec4 u_circleSweepColor;\n vec2 u_cityCenter;\n float u_circleSweep;\n float u_cityMinSize;\n float u_circleSweepSpeed;\n float u_opacity: 1.0;\n float u_near : 0;\n float u_far : 1;\n float u_time;\n};\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\n\nvoid main() {\n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);\n vec4 project_pos = project_position(pos);\n\n v_texCoord = a_Uv;\n\n if(u_circleSweep > 0.0) {\n vec2 lnglatscale = vec2(0.0);\n lnglatscale = (a_Position.xy - u_cityCenter) * vec2(0.0, 0.135);\n v_worldDis = length(a_Position.xy + lnglatscale - u_cityCenter);\n }\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n\n float lightWeight = calc_lighting(pos);\n // v_Color = a_Color;\n v_Color = vec4(a_Color.rgb * lightWeight, a_Color.w);\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
19
18
|
class CityBuildModel extends _BaseModel.default {
|
|
20
19
|
constructor(...args) {
|
|
21
20
|
super(...args);
|
|
22
21
|
(0, _defineProperty2.default)(this, "cityCenter", void 0);
|
|
23
22
|
(0, _defineProperty2.default)(this, "cityMinSize", void 0);
|
|
24
23
|
}
|
|
24
|
+
get attributeLocation() {
|
|
25
|
+
return Object.assign(super.attributeLocation, {
|
|
26
|
+
MAX: super.attributeLocation.MAX,
|
|
27
|
+
SIZE: 9,
|
|
28
|
+
NORMAL: 10,
|
|
29
|
+
UV: 11
|
|
30
|
+
});
|
|
31
|
+
}
|
|
25
32
|
getCommonUniformsInfo() {
|
|
26
33
|
const {
|
|
27
34
|
opacity = 1,
|
|
@@ -57,20 +64,10 @@ class CityBuildModel extends _BaseModel.default {
|
|
|
57
64
|
calCityGeo() {
|
|
58
65
|
// @ts-ignore
|
|
59
66
|
const [minLng, minLat, maxLng, maxLat] = this.layer.getSource().extent;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const l1 = this.mapService.lngLatToCoord([maxLng, maxLat]);
|
|
65
|
-
// @ts-ignore
|
|
66
|
-
const l2 = this.mapService.lngLatToCoord([minLng, minLat]);
|
|
67
|
-
this.cityMinSize = Math.sqrt(Math.pow(l1[0] - l2[0], 2) + Math.pow(l1[1] - l2[1], 2)) / 4;
|
|
68
|
-
} else {
|
|
69
|
-
const w = maxLng - minLng;
|
|
70
|
-
const h = maxLat - minLat;
|
|
71
|
-
this.cityCenter = [(maxLng + minLng) / 2, (maxLat + minLat) / 2];
|
|
72
|
-
this.cityMinSize = Math.sqrt(Math.pow(w, 2) + Math.pow(h, 2)) / 4;
|
|
73
|
-
}
|
|
67
|
+
const w = maxLng - minLng;
|
|
68
|
+
const h = maxLat - minLat;
|
|
69
|
+
this.cityCenter = [(maxLng + minLng) / 2, (maxLat + minLat) / 2];
|
|
70
|
+
this.cityMinSize = Math.sqrt(Math.pow(w, 2) + Math.pow(h, 2)) / 4;
|
|
74
71
|
}
|
|
75
72
|
initModels() {
|
|
76
73
|
var _this = this;
|
|
@@ -92,6 +89,7 @@ class CityBuildModel extends _BaseModel.default {
|
|
|
92
89
|
depth: {
|
|
93
90
|
enable: true
|
|
94
91
|
},
|
|
92
|
+
defines: _this2.getDefines(),
|
|
95
93
|
inject: _this2.getInject(),
|
|
96
94
|
cull: {
|
|
97
95
|
enable: true,
|
|
@@ -108,7 +106,7 @@ class CityBuildModel extends _BaseModel.default {
|
|
|
108
106
|
type: _l7Core.AttributeType.Attribute,
|
|
109
107
|
descriptor: {
|
|
110
108
|
name: 'a_Normal',
|
|
111
|
-
shaderLocation:
|
|
109
|
+
shaderLocation: this.attributeLocation.NORMAL,
|
|
112
110
|
buffer: {
|
|
113
111
|
// give the WebGL driver a hint that this buffer may change
|
|
114
112
|
usage: _l7Core.gl.STATIC_DRAW,
|
|
@@ -126,7 +124,7 @@ class CityBuildModel extends _BaseModel.default {
|
|
|
126
124
|
type: _l7Core.AttributeType.Attribute,
|
|
127
125
|
descriptor: {
|
|
128
126
|
name: 'a_Size',
|
|
129
|
-
shaderLocation:
|
|
127
|
+
shaderLocation: this.attributeLocation.SIZE,
|
|
130
128
|
buffer: {
|
|
131
129
|
// give the WebGL driver a hint that this buffer may change
|
|
132
130
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
@@ -147,7 +145,7 @@ class CityBuildModel extends _BaseModel.default {
|
|
|
147
145
|
type: _l7Core.AttributeType.Attribute,
|
|
148
146
|
descriptor: {
|
|
149
147
|
name: 'a_Uv',
|
|
150
|
-
shaderLocation:
|
|
148
|
+
shaderLocation: this.attributeLocation.UV,
|
|
151
149
|
buffer: {
|
|
152
150
|
// give the WebGL driver a hint that this buffer may change
|
|
153
151
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
precision highp float;
|
|
2
2
|
layout(std140) uniform commonUniforms {
|
|
3
|
-
vec4 u_baseColor
|
|
4
|
-
vec4 u_brightColor
|
|
5
|
-
vec4 u_windowColor
|
|
3
|
+
vec4 u_baseColor: [ 1.0, 0, 0, 1.0 ];
|
|
4
|
+
vec4 u_brightColor: [ 1.0, 0, 0, 1.0 ];
|
|
5
|
+
vec4 u_windowColor: [ 1.0, 0, 0, 1.0 ];
|
|
6
6
|
vec4 u_circleSweepColor;
|
|
7
7
|
vec2 u_cityCenter;
|
|
8
8
|
float u_circleSweep;
|
|
9
9
|
float u_cityMinSize;
|
|
10
10
|
float u_circleSweepSpeed;
|
|
11
11
|
float u_opacity: 1.0;
|
|
12
|
-
float u_near
|
|
13
|
-
float u_far
|
|
12
|
+
float u_near: 0;
|
|
13
|
+
float u_far: 1;
|
|
14
14
|
float u_time;
|
|
15
15
|
};
|
|
16
16
|
in vec4 v_Color;
|
|
@@ -114,7 +114,7 @@ void main() {
|
|
|
114
114
|
float r = fract(((v_worldDis/u_cityMinSize) - u_time * u_circleSweepSpeed) * 2.0);
|
|
115
115
|
outputColor.rgb += r * r * u_circleSweepColor.rgb;
|
|
116
116
|
}
|
|
117
|
-
|
|
117
|
+
|
|
118
118
|
outputColor.a *= u_opacity;
|
|
119
119
|
outputColor = filterColor(outputColor);
|
|
120
120
|
}
|
|
@@ -4,11 +4,11 @@ precision highp float;
|
|
|
4
4
|
#define diffuseRatio 0.3
|
|
5
5
|
#define specularRatio 0.2
|
|
6
6
|
|
|
7
|
-
layout(location =
|
|
8
|
-
layout(location =
|
|
9
|
-
layout(location =
|
|
10
|
-
layout(location =
|
|
11
|
-
layout(location =
|
|
7
|
+
layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
|
|
8
|
+
layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
|
|
9
|
+
layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;
|
|
10
|
+
layout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal;
|
|
11
|
+
layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;
|
|
12
12
|
|
|
13
13
|
out vec2 v_texCoord;
|
|
14
14
|
out vec4 v_Color;
|
|
@@ -41,17 +41,11 @@ void main() {
|
|
|
41
41
|
|
|
42
42
|
if(u_circleSweep > 0.0) {
|
|
43
43
|
vec2 lnglatscale = vec2(0.0);
|
|
44
|
-
|
|
45
|
-
lnglatscale = (a_Position.xy - u_cityCenter) * vec2(0.0, 0.135);
|
|
46
|
-
}
|
|
44
|
+
lnglatscale = (a_Position.xy - u_cityCenter) * vec2(0.0, 0.135);
|
|
47
45
|
v_worldDis = length(a_Position.xy + lnglatscale - u_cityCenter);
|
|
48
46
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));
|
|
52
|
-
} else {
|
|
53
|
-
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
|
|
54
|
-
}
|
|
47
|
+
|
|
48
|
+
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
|
|
55
49
|
|
|
56
50
|
float lightWeight = calc_lighting(pos);
|
|
57
51
|
// v_Color = a_Color;
|
package/lib/core/BaseLayer.d.ts
CHANGED
|
@@ -237,7 +237,6 @@ export default class BaseLayer<ChildLayerStyleOptions = {}> extends EventEmitter
|
|
|
237
237
|
protected getDefaultConfig(): {};
|
|
238
238
|
protected sourceEvent: () => void;
|
|
239
239
|
protected initLayerModels(): Promise<void>;
|
|
240
|
-
getLayerUniformBuffer(): IBuffer;
|
|
241
240
|
getPickingUniformBuffer(): IBuffer;
|
|
242
241
|
protected reRender(): void;
|
|
243
242
|
protected splitValuesAndCallbackInAttribute(valuesOrCallback?: unknown[]): {
|
package/lib/core/BaseLayer.js
CHANGED
|
@@ -19,7 +19,7 @@ var _multiPassRender = require("../utils/multiPassRender");
|
|
|
19
19
|
var _LayerPickService = _interopRequireDefault(require("./LayerPickService"));
|
|
20
20
|
var _TextureService = _interopRequireDefault(require("./TextureService"));
|
|
21
21
|
const _excluded = ["passes"],
|
|
22
|
-
_excluded2 = ["moduleName", "vertexShader", "fragmentShader", "inject", "triangulation", "styleOption", "pickingEnabled"]; // @ts-ignore
|
|
22
|
+
_excluded2 = ["moduleName", "vertexShader", "fragmentShader", "defines", "inject", "triangulation", "styleOption", "pickingEnabled"]; // @ts-ignore
|
|
23
23
|
const {
|
|
24
24
|
isEqual,
|
|
25
25
|
isFunction,
|
|
@@ -64,7 +64,8 @@ class BaseLayer extends _eventemitter.EventEmitter {
|
|
|
64
64
|
return this.container.interactionService;
|
|
65
65
|
}
|
|
66
66
|
get mapService() {
|
|
67
|
-
|
|
67
|
+
var _this$container;
|
|
68
|
+
return (_this$container = this.container) === null || _this$container === void 0 ? void 0 : _this$container.mapService;
|
|
68
69
|
}
|
|
69
70
|
get normalPassFactory() {
|
|
70
71
|
return this.container.normalPassFactory;
|
|
@@ -924,12 +925,8 @@ class BaseLayer extends _eventemitter.EventEmitter {
|
|
|
924
925
|
type
|
|
925
926
|
}) => {
|
|
926
927
|
if (this.coordCenter === undefined) {
|
|
927
|
-
var _this$mapService;
|
|
928
928
|
const layerCenter = this.layerSource.center;
|
|
929
929
|
this.coordCenter = layerCenter;
|
|
930
|
-
if ((_this$mapService = this.mapService) !== null && _this$mapService !== void 0 && _this$mapService.setCoordCenter) {
|
|
931
|
-
this.mapService.setCoordCenter(layerCenter);
|
|
932
|
-
}
|
|
933
930
|
}
|
|
934
931
|
if (type === 'update') {
|
|
935
932
|
if (this.tileLayer) {
|
|
@@ -1023,6 +1020,7 @@ class BaseLayer extends _eventemitter.EventEmitter {
|
|
|
1023
1020
|
moduleName,
|
|
1024
1021
|
vertexShader,
|
|
1025
1022
|
fragmentShader,
|
|
1023
|
+
defines,
|
|
1026
1024
|
inject,
|
|
1027
1025
|
triangulation,
|
|
1028
1026
|
styleOption,
|
|
@@ -1032,6 +1030,7 @@ class BaseLayer extends _eventemitter.EventEmitter {
|
|
|
1032
1030
|
_this3.shaderModuleService.registerModule(moduleName, {
|
|
1033
1031
|
vs: vertexShader,
|
|
1034
1032
|
fs: fragmentShader,
|
|
1033
|
+
defines,
|
|
1035
1034
|
inject
|
|
1036
1035
|
});
|
|
1037
1036
|
const {
|
|
@@ -1048,7 +1047,7 @@ class BaseLayer extends _eventemitter.EventEmitter {
|
|
|
1048
1047
|
elements,
|
|
1049
1048
|
count
|
|
1050
1049
|
} = _this3.styleAttributeService.createAttributesAndIndices(_this3.encodedData, triangulation, styleOption, _this3);
|
|
1051
|
-
const uniformBuffers = [..._this3.layerModel.uniformBuffers, ..._this3.rendererService.uniformBuffers
|
|
1050
|
+
const uniformBuffers = [..._this3.layerModel.uniformBuffers, ..._this3.rendererService.uniformBuffers];
|
|
1052
1051
|
if (pickingEnabled) {
|
|
1053
1052
|
uniformBuffers.push(_this3.getPickingUniformBuffer());
|
|
1054
1053
|
}
|
|
@@ -1231,28 +1230,19 @@ class BaseLayer extends _eventemitter.EventEmitter {
|
|
|
1231
1230
|
buffer.destroy();
|
|
1232
1231
|
});
|
|
1233
1232
|
_this5.uniformBuffers = [];
|
|
1234
|
-
// Layer Uniform
|
|
1235
|
-
const layerUniforms = _this5.rendererService.createBuffer({
|
|
1236
|
-
data: new Float32Array(16 + 4).fill(0),
|
|
1237
|
-
// u_Mvp
|
|
1238
|
-
isUBO: true
|
|
1239
|
-
});
|
|
1240
|
-
_this5.uniformBuffers.push(layerUniforms);
|
|
1241
1233
|
|
|
1242
1234
|
// Picking Uniform
|
|
1243
1235
|
const pickingUniforms = _this5.rendererService.createBuffer({
|
|
1244
1236
|
data: new Float32Array(20).fill(0),
|
|
1245
|
-
isUBO: true
|
|
1237
|
+
isUBO: true,
|
|
1238
|
+
label: 'pickingUniforms'
|
|
1246
1239
|
});
|
|
1247
1240
|
_this5.uniformBuffers.push(pickingUniforms);
|
|
1248
1241
|
_this5.models = yield _this5.layerModel.initModels();
|
|
1249
1242
|
})();
|
|
1250
1243
|
}
|
|
1251
|
-
getLayerUniformBuffer() {
|
|
1252
|
-
return this.uniformBuffers[0];
|
|
1253
|
-
}
|
|
1254
1244
|
getPickingUniformBuffer() {
|
|
1255
|
-
return this.uniformBuffers[
|
|
1245
|
+
return this.uniformBuffers[0];
|
|
1256
1246
|
}
|
|
1257
1247
|
reRender() {
|
|
1258
1248
|
if (this.inited) {
|
package/lib/core/BaseModel.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { IAnimateOption, IAttribute, IBlendOptions, IBuffer, ICameraService, IElements, IFontService, IGlobalConfigService, IIconService,
|
|
1
|
+
import type { IAnimateOption, IAttribute, IBlendOptions, IBuffer, ICameraService, IElements, IFontService, IGlobalConfigService, IIconService, ILayer, ILayerModel, ILayerService, IMapService, IModel, IModelUniform, IPickingService, IRenderOptions, IRendererService, IShaderModuleService, IStencilOptions, IStyleAttributeService, ITexture2D, ITexture2DInitializationOptions, ShaderDefine, ShaderInject, Triangulation } from '@antv/l7-core';
|
|
2
|
+
import { COMMON_ATTRIBUTE_LOCATION } from './CommonStyleAttribute';
|
|
2
3
|
export type styleSingle = number | string | [string, (single: any) => number] | [string, [number, number]];
|
|
3
4
|
export type styleOffset = string | [number, number] | [string, (single: any) => number];
|
|
4
5
|
export type styleColor = string | [string, (single: any) => string] | [string, [string, string]];
|
|
@@ -11,10 +12,15 @@ export interface ICellProperty {
|
|
|
11
12
|
attr: string;
|
|
12
13
|
count: number;
|
|
13
14
|
}
|
|
15
|
+
type AttributeLayoutLocationType = typeof COMMON_ATTRIBUTE_LOCATION & Record<string, number>;
|
|
14
16
|
export default class BaseModel<ChildLayerStyleOptions = {}> implements ILayerModel {
|
|
15
17
|
triangulation: Triangulation;
|
|
16
18
|
uniformBuffers: IBuffer[];
|
|
17
19
|
textures: ITexture2D[];
|
|
20
|
+
/**
|
|
21
|
+
* Attribute Layout Location in Shader
|
|
22
|
+
*/
|
|
23
|
+
protected get attributeLocation(): AttributeLayoutLocationType;
|
|
18
24
|
createTexture2D: (options: ITexture2DInitializationOptions) => ITexture2D;
|
|
19
25
|
preStyleAttribute: Record<string, any>;
|
|
20
26
|
protected encodeStyleAttribute: Record<string, boolean>;
|
|
@@ -55,11 +61,17 @@ export default class BaseModel<ChildLayerStyleOptions = {}> implements ILayerMod
|
|
|
55
61
|
protected registerBuiltinAttributes(): void;
|
|
56
62
|
protected animateOption2Array(option: IAnimateOption): number[];
|
|
57
63
|
protected startModelAnimate(): void;
|
|
58
|
-
protected getInject():
|
|
64
|
+
protected getInject(): ShaderInject;
|
|
65
|
+
protected getDefines(): Record<string, ShaderDefine>;
|
|
59
66
|
protected getStyleAttribute(): {
|
|
60
67
|
[key: string]: any;
|
|
61
68
|
};
|
|
62
69
|
protected registerStyleAttribute(): void;
|
|
70
|
+
/**
|
|
71
|
+
* 注册 Position 属性 64 位地位部分,当经纬度数据开启双精度浮点数使用,
|
|
72
|
+
* 避免大于 20层级以上出现数据偏移
|
|
73
|
+
*/
|
|
74
|
+
protected registerPosition64LowAttribute(enable64bitPosition?: boolean): void;
|
|
63
75
|
updateEncodeAttribute(type: string, flag: boolean): void;
|
|
64
76
|
initUniformsBuffer(): void;
|
|
65
77
|
protected getUniformsBufferInfo(uniformsOption: {
|
|
@@ -80,3 +92,4 @@ export default class BaseModel<ChildLayerStyleOptions = {}> implements ILayerMod
|
|
|
80
92
|
};
|
|
81
93
|
updateStyleUnifoms(): void;
|
|
82
94
|
}
|
|
95
|
+
export {};
|