@antv/l7-layers 2.21.11-beta.5 → 2.21.11-beta.6
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/geometry/models/plane.d.ts +6 -5
- package/es/geometry/models/plane.js +42 -47
- package/es/geometry/models/sprite.js +3 -3
- package/es/geometry/shaders/plane_frag.glsl +1 -4
- package/es/geometry/shaders/plane_vert.glsl +8 -9
- package/lib/geometry/models/plane.d.ts +6 -5
- package/lib/geometry/models/plane.js +42 -47
- package/lib/geometry/models/sprite.js +3 -3
- package/lib/geometry/shaders/plane_frag.glsl +1 -4
- package/lib/geometry/shaders/plane_vert.glsl +8 -9
- package/package.json +6 -6
|
@@ -48,10 +48,11 @@ export default class PlaneModel extends BaseModel {
|
|
|
48
48
|
};
|
|
49
49
|
updateTexture(mapTexture: string | undefined): void;
|
|
50
50
|
protected getImageData(img: HTMLImageElement): ImageData;
|
|
51
|
-
protected translateVertex(positions: number[], indices: number[], image: HTMLImageElement, widthSegments: number, heightSegments: number, rgb2height: (r: number, g: number, b: number) => number):
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
protected translateVertex(positions: number[], indices: number[], image: HTMLImageElement, widthSegments: number, heightSegments: number, rgb2height: (r: number, g: number, b: number) => number): {
|
|
52
|
+
vertices: number[];
|
|
53
|
+
indices: number[];
|
|
54
|
+
size: number;
|
|
55
|
+
};
|
|
56
|
+
private loadTerrainImage;
|
|
56
57
|
protected registerBuiltinAttributes(): void;
|
|
57
58
|
}
|
|
@@ -2,12 +2,11 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
|
2
2
|
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
|
-
// import { mat4, vec3 } from 'gl-matrix';
|
|
6
5
|
import BaseModel from "../../core/BaseModel";
|
|
7
6
|
/* babel-plugin-inline-import '../shaders/plane_frag.glsl' */
|
|
8
|
-
const planeFrag = "
|
|
7
|
+
const planeFrag = "uniform 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 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 outputColor = vec4(v_Color, u_opacity);\n }\n outputColor.a *= v_clip;\n outputColor = filterColor(outputColor);\n}\n";
|
|
9
8
|
/* babel-plugin-inline-import '../shaders/plane_vert.glsl' */
|
|
10
|
-
const planeVert = "
|
|
9
|
+
const planeVert = "layout(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";
|
|
11
10
|
export default class PlaneModel extends BaseModel {
|
|
12
11
|
constructor(...args) {
|
|
13
12
|
super(...args);
|
|
@@ -22,7 +21,8 @@ export default class PlaneModel extends BaseModel {
|
|
|
22
21
|
widthSegments = 1,
|
|
23
22
|
heightSegments = 1,
|
|
24
23
|
center = [120, 30],
|
|
25
|
-
terrainTexture
|
|
24
|
+
terrainTexture,
|
|
25
|
+
rgb2height = (r, g, b) => r + g + b
|
|
26
26
|
} = this.layer.getLayerConfig();
|
|
27
27
|
const {
|
|
28
28
|
indices,
|
|
@@ -30,7 +30,7 @@ export default class PlaneModel extends BaseModel {
|
|
|
30
30
|
} = this.initPlane(width, height, widthSegments, heightSegments, ...center);
|
|
31
31
|
if (terrainTexture) {
|
|
32
32
|
// 存在地形贴图的时候会根据地形贴图对顶点进行偏移
|
|
33
|
-
this.
|
|
33
|
+
return this.translateVertex(positions, indices, this.terrainImage, widthSegments, heightSegments, rgb2height);
|
|
34
34
|
}
|
|
35
35
|
return {
|
|
36
36
|
vertices: positions,
|
|
@@ -121,7 +121,8 @@ export default class PlaneModel extends BaseModel {
|
|
|
121
121
|
var _this = this;
|
|
122
122
|
return _asyncToGenerator(function* () {
|
|
123
123
|
const {
|
|
124
|
-
mapTexture
|
|
124
|
+
mapTexture,
|
|
125
|
+
terrainTexture
|
|
125
126
|
} = _this.layer.getLayerConfig();
|
|
126
127
|
_this.mapTexture = mapTexture;
|
|
127
128
|
const {
|
|
@@ -133,6 +134,9 @@ export default class PlaneModel extends BaseModel {
|
|
|
133
134
|
});
|
|
134
135
|
_this.updateTexture(mapTexture);
|
|
135
136
|
_this.initUniformsBuffer();
|
|
137
|
+
if (terrainTexture) {
|
|
138
|
+
_this.terrainImage = yield _this.loadTerrainImage(terrainTexture);
|
|
139
|
+
}
|
|
136
140
|
const model = yield _this.layer.buildLayerModel({
|
|
137
141
|
moduleName: 'geometryPlane',
|
|
138
142
|
vertexShader: planeVert,
|
|
@@ -244,50 +248,41 @@ export default class PlaneModel extends BaseModel {
|
|
|
244
248
|
positions[z] = rgb2height(r, g, b);
|
|
245
249
|
}
|
|
246
250
|
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
size: 5
|
|
253
|
-
};
|
|
254
|
-
});
|
|
255
|
-
this.layer.updateModelData(modelData);
|
|
256
|
-
this.layerService.throttleRenderLayers();
|
|
251
|
+
return {
|
|
252
|
+
vertices: positions,
|
|
253
|
+
indices,
|
|
254
|
+
size: 5
|
|
255
|
+
};
|
|
257
256
|
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
this.translateVertex(positions, indices, this.terrainImage, widthSegments, heightSegments, rgb2height);
|
|
257
|
+
loadTerrainImage(terrainTexture) {
|
|
258
|
+
var _this3 = this;
|
|
259
|
+
return _asyncToGenerator(function* () {
|
|
260
|
+
if (_this3.terrainImage) {
|
|
261
|
+
// 若当前已经存在 image,直接进行偏移计算(LOD)
|
|
262
|
+
if (_this3.terrainImageLoaded) {
|
|
263
|
+
return _this3.terrainImage;
|
|
264
|
+
} else {
|
|
265
|
+
return new Promise(resolve => {
|
|
266
|
+
_this3.terrainImage.onload = () => {
|
|
267
|
+
resolve(_this3.terrainImage);
|
|
268
|
+
};
|
|
269
|
+
});
|
|
270
|
+
}
|
|
273
271
|
} else {
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
272
|
+
// 加载地形贴图、根据地形贴图对 planeGeometry 进行偏移
|
|
273
|
+
const terrainImage = new Image();
|
|
274
|
+
terrainImage.crossOrigin = 'anonymous';
|
|
275
|
+
return new Promise(resolve => {
|
|
276
|
+
terrainImage.onload = () => {
|
|
277
|
+
_this3.terrainImageLoaded = true;
|
|
278
|
+
resolve(terrainImage);
|
|
279
|
+
// 图片加载完,触发事件,可以进行地形图的顶点计算存储
|
|
280
|
+
setTimeout(() => _this3.layer.emit('terrainImageLoaded', null));
|
|
281
|
+
};
|
|
282
|
+
terrainImage.src = terrainTexture;
|
|
283
|
+
});
|
|
277
284
|
}
|
|
278
|
-
}
|
|
279
|
-
// 加载地形贴图、根据地形贴图对 planeGeometry 进行偏移
|
|
280
|
-
const terrainImage = new Image();
|
|
281
|
-
this.terrainImage = terrainImage;
|
|
282
|
-
terrainImage.crossOrigin = 'anonymous';
|
|
283
|
-
terrainImage.onload = () => {
|
|
284
|
-
this.terrainImageLoaded = true;
|
|
285
|
-
// 图片加载完,触发事件,可以进行地形图的顶点计算存储
|
|
286
|
-
setTimeout(() => this.layer.emit('terrainImageLoaded', null));
|
|
287
|
-
this.translateVertex(positions, indices, terrainImage, widthSegments, heightSegments, rgb2height);
|
|
288
|
-
};
|
|
289
|
-
terrainImage.src = terrainTexture;
|
|
290
|
-
}
|
|
285
|
+
})();
|
|
291
286
|
}
|
|
292
287
|
registerBuiltinAttributes() {
|
|
293
288
|
// point layer size;
|
|
@@ -25,7 +25,7 @@ export default class SpriteModel extends BaseModel {
|
|
|
25
25
|
_defineProperty(this, "spriteAnimate", void 0);
|
|
26
26
|
_defineProperty(this, "planeGeometryUpdateTriangulation", () => {
|
|
27
27
|
const {
|
|
28
|
-
spriteBottom = -
|
|
28
|
+
spriteBottom = -10
|
|
29
29
|
} = this.layer.getLayerConfig();
|
|
30
30
|
const updateZ = this.spriteUpdate;
|
|
31
31
|
const bottomZ = spriteBottom;
|
|
@@ -152,8 +152,8 @@ export default class SpriteModel extends BaseModel {
|
|
|
152
152
|
return _asyncToGenerator(function* () {
|
|
153
153
|
const {
|
|
154
154
|
mapTexture,
|
|
155
|
-
spriteTop =
|
|
156
|
-
spriteUpdate =
|
|
155
|
+
spriteTop = 300,
|
|
156
|
+
spriteUpdate = 10,
|
|
157
157
|
spriteAnimate = SPRITE_ANIMATE_DIR.DOWN
|
|
158
158
|
} = _this.layer.getLayerConfig();
|
|
159
159
|
_this.initUniformsBuffer();
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
uniform sampler2D u_texture;
|
|
3
2
|
layout(std140) uniform commonUniforms {
|
|
4
3
|
float u_opacity;
|
|
@@ -13,12 +12,10 @@ out vec4 outputColor;
|
|
|
13
12
|
|
|
14
13
|
#pragma include "picking"
|
|
15
14
|
void main() {
|
|
16
|
-
|
|
17
|
-
if(u_mapFlag > 0.0) {
|
|
15
|
+
if (u_mapFlag > 0.0) {
|
|
18
16
|
outputColor = texture(SAMPLER_2D(u_texture), vec2(v_uv.x, 1.0 - v_uv.y));
|
|
19
17
|
outputColor.a *= u_opacity;
|
|
20
18
|
} else {
|
|
21
|
-
// gl_FragColor = vec4(v_uv, 0.0, u_opacity);
|
|
22
19
|
outputColor = vec4(v_Color, u_opacity);
|
|
23
20
|
}
|
|
24
21
|
outputColor.a *= v_clip;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
|
|
3
2
|
layout(location = ATTRIBUTE_LOCATION_COLOR) in vec3 a_Color;
|
|
4
3
|
layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;
|
|
@@ -16,17 +15,17 @@ out float v_clip;
|
|
|
16
15
|
#pragma include "projection"
|
|
17
16
|
#pragma include "picking"
|
|
18
17
|
void main() {
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
v_Color = a_Color;
|
|
19
|
+
v_uv = a_Uv;
|
|
21
20
|
|
|
22
|
-
|
|
21
|
+
vec4 project_pos = project_position(vec4(a_Position, 1.0));
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
v_clip = 1.0;
|
|
24
|
+
if (a_Position.z < u_terrainClipHeight) {
|
|
25
|
+
v_clip = 0.0;
|
|
26
|
+
}
|
|
28
27
|
|
|
29
28
|
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, a_Position.z, 1.0));
|
|
30
29
|
|
|
31
|
-
|
|
30
|
+
setPickingColor(a_PickingColor);
|
|
32
31
|
}
|
|
@@ -48,10 +48,11 @@ export default class PlaneModel extends BaseModel {
|
|
|
48
48
|
};
|
|
49
49
|
updateTexture(mapTexture: string | undefined): void;
|
|
50
50
|
protected getImageData(img: HTMLImageElement): ImageData;
|
|
51
|
-
protected translateVertex(positions: number[], indices: number[], image: HTMLImageElement, widthSegments: number, heightSegments: number, rgb2height: (r: number, g: number, b: number) => number):
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
protected translateVertex(positions: number[], indices: number[], image: HTMLImageElement, widthSegments: number, heightSegments: number, rgb2height: (r: number, g: number, b: number) => number): {
|
|
52
|
+
vertices: number[];
|
|
53
|
+
indices: number[];
|
|
54
|
+
size: number;
|
|
55
|
+
};
|
|
56
|
+
private loadTerrainImage;
|
|
56
57
|
protected registerBuiltinAttributes(): void;
|
|
57
58
|
}
|
|
@@ -10,11 +10,10 @@ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/obje
|
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
var _l7Core = require("@antv/l7-core");
|
|
12
12
|
var _BaseModel = _interopRequireDefault(require("../../core/BaseModel"));
|
|
13
|
-
// import { mat4, vec3 } from 'gl-matrix';
|
|
14
13
|
/* babel-plugin-inline-import '../shaders/plane_frag.glsl' */
|
|
15
|
-
const planeFrag = "
|
|
14
|
+
const planeFrag = "uniform 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 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 outputColor = vec4(v_Color, u_opacity);\n }\n outputColor.a *= v_clip;\n outputColor = filterColor(outputColor);\n}\n";
|
|
16
15
|
/* babel-plugin-inline-import '../shaders/plane_vert.glsl' */
|
|
17
|
-
const planeVert = "
|
|
16
|
+
const planeVert = "layout(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";
|
|
18
17
|
class PlaneModel extends _BaseModel.default {
|
|
19
18
|
constructor(...args) {
|
|
20
19
|
super(...args);
|
|
@@ -29,7 +28,8 @@ class PlaneModel extends _BaseModel.default {
|
|
|
29
28
|
widthSegments = 1,
|
|
30
29
|
heightSegments = 1,
|
|
31
30
|
center = [120, 30],
|
|
32
|
-
terrainTexture
|
|
31
|
+
terrainTexture,
|
|
32
|
+
rgb2height = (r, g, b) => r + g + b
|
|
33
33
|
} = this.layer.getLayerConfig();
|
|
34
34
|
const {
|
|
35
35
|
indices,
|
|
@@ -37,7 +37,7 @@ class PlaneModel extends _BaseModel.default {
|
|
|
37
37
|
} = this.initPlane(width, height, widthSegments, heightSegments, ...center);
|
|
38
38
|
if (terrainTexture) {
|
|
39
39
|
// 存在地形贴图的时候会根据地形贴图对顶点进行偏移
|
|
40
|
-
this.
|
|
40
|
+
return this.translateVertex(positions, indices, this.terrainImage, widthSegments, heightSegments, rgb2height);
|
|
41
41
|
}
|
|
42
42
|
return {
|
|
43
43
|
vertices: positions,
|
|
@@ -128,7 +128,8 @@ class PlaneModel extends _BaseModel.default {
|
|
|
128
128
|
var _this = this;
|
|
129
129
|
return (0, _asyncToGenerator2.default)(function* () {
|
|
130
130
|
const {
|
|
131
|
-
mapTexture
|
|
131
|
+
mapTexture,
|
|
132
|
+
terrainTexture
|
|
132
133
|
} = _this.layer.getLayerConfig();
|
|
133
134
|
_this.mapTexture = mapTexture;
|
|
134
135
|
const {
|
|
@@ -140,6 +141,9 @@ class PlaneModel extends _BaseModel.default {
|
|
|
140
141
|
});
|
|
141
142
|
_this.updateTexture(mapTexture);
|
|
142
143
|
_this.initUniformsBuffer();
|
|
144
|
+
if (terrainTexture) {
|
|
145
|
+
_this.terrainImage = yield _this.loadTerrainImage(terrainTexture);
|
|
146
|
+
}
|
|
143
147
|
const model = yield _this.layer.buildLayerModel({
|
|
144
148
|
moduleName: 'geometryPlane',
|
|
145
149
|
vertexShader: planeVert,
|
|
@@ -251,50 +255,41 @@ class PlaneModel extends _BaseModel.default {
|
|
|
251
255
|
positions[z] = rgb2height(r, g, b);
|
|
252
256
|
}
|
|
253
257
|
}
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
size: 5
|
|
260
|
-
};
|
|
261
|
-
});
|
|
262
|
-
this.layer.updateModelData(modelData);
|
|
263
|
-
this.layerService.throttleRenderLayers();
|
|
258
|
+
return {
|
|
259
|
+
vertices: positions,
|
|
260
|
+
indices,
|
|
261
|
+
size: 5
|
|
262
|
+
};
|
|
264
263
|
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
this.translateVertex(positions, indices, this.terrainImage, widthSegments, heightSegments, rgb2height);
|
|
264
|
+
loadTerrainImage(terrainTexture) {
|
|
265
|
+
var _this3 = this;
|
|
266
|
+
return (0, _asyncToGenerator2.default)(function* () {
|
|
267
|
+
if (_this3.terrainImage) {
|
|
268
|
+
// 若当前已经存在 image,直接进行偏移计算(LOD)
|
|
269
|
+
if (_this3.terrainImageLoaded) {
|
|
270
|
+
return _this3.terrainImage;
|
|
271
|
+
} else {
|
|
272
|
+
return new Promise(resolve => {
|
|
273
|
+
_this3.terrainImage.onload = () => {
|
|
274
|
+
resolve(_this3.terrainImage);
|
|
275
|
+
};
|
|
276
|
+
});
|
|
277
|
+
}
|
|
280
278
|
} else {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
279
|
+
// 加载地形贴图、根据地形贴图对 planeGeometry 进行偏移
|
|
280
|
+
const terrainImage = new Image();
|
|
281
|
+
terrainImage.crossOrigin = 'anonymous';
|
|
282
|
+
return new Promise(resolve => {
|
|
283
|
+
terrainImage.onload = () => {
|
|
284
|
+
_this3.terrainImageLoaded = true;
|
|
285
|
+
resolve(terrainImage);
|
|
286
|
+
// 图片加载完,触发事件,可以进行地形图的顶点计算存储
|
|
287
|
+
setTimeout(() => _this3.layer.emit('terrainImageLoaded', null));
|
|
288
|
+
};
|
|
289
|
+
terrainImage.src = terrainTexture;
|
|
290
|
+
});
|
|
284
291
|
}
|
|
285
|
-
}
|
|
286
|
-
// 加载地形贴图、根据地形贴图对 planeGeometry 进行偏移
|
|
287
|
-
const terrainImage = new Image();
|
|
288
|
-
this.terrainImage = terrainImage;
|
|
289
|
-
terrainImage.crossOrigin = 'anonymous';
|
|
290
|
-
terrainImage.onload = () => {
|
|
291
|
-
this.terrainImageLoaded = true;
|
|
292
|
-
// 图片加载完,触发事件,可以进行地形图的顶点计算存储
|
|
293
|
-
setTimeout(() => this.layer.emit('terrainImageLoaded', null));
|
|
294
|
-
this.translateVertex(positions, indices, terrainImage, widthSegments, heightSegments, rgb2height);
|
|
295
|
-
};
|
|
296
|
-
terrainImage.src = terrainTexture;
|
|
297
|
-
}
|
|
292
|
+
})();
|
|
298
293
|
}
|
|
299
294
|
registerBuiltinAttributes() {
|
|
300
295
|
// point layer size;
|
|
@@ -32,7 +32,7 @@ class SpriteModel extends _BaseModel.default {
|
|
|
32
32
|
(0, _defineProperty2.default)(this, "spriteAnimate", void 0);
|
|
33
33
|
(0, _defineProperty2.default)(this, "planeGeometryUpdateTriangulation", () => {
|
|
34
34
|
const {
|
|
35
|
-
spriteBottom = -
|
|
35
|
+
spriteBottom = -10
|
|
36
36
|
} = this.layer.getLayerConfig();
|
|
37
37
|
const updateZ = this.spriteUpdate;
|
|
38
38
|
const bottomZ = spriteBottom;
|
|
@@ -159,8 +159,8 @@ class SpriteModel extends _BaseModel.default {
|
|
|
159
159
|
return (0, _asyncToGenerator2.default)(function* () {
|
|
160
160
|
const {
|
|
161
161
|
mapTexture,
|
|
162
|
-
spriteTop =
|
|
163
|
-
spriteUpdate =
|
|
162
|
+
spriteTop = 300,
|
|
163
|
+
spriteUpdate = 10,
|
|
164
164
|
spriteAnimate = SPRITE_ANIMATE_DIR.DOWN
|
|
165
165
|
} = _this.layer.getLayerConfig();
|
|
166
166
|
_this.initUniformsBuffer();
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
uniform sampler2D u_texture;
|
|
3
2
|
layout(std140) uniform commonUniforms {
|
|
4
3
|
float u_opacity;
|
|
@@ -13,12 +12,10 @@ out vec4 outputColor;
|
|
|
13
12
|
|
|
14
13
|
#pragma include "picking"
|
|
15
14
|
void main() {
|
|
16
|
-
|
|
17
|
-
if(u_mapFlag > 0.0) {
|
|
15
|
+
if (u_mapFlag > 0.0) {
|
|
18
16
|
outputColor = texture(SAMPLER_2D(u_texture), vec2(v_uv.x, 1.0 - v_uv.y));
|
|
19
17
|
outputColor.a *= u_opacity;
|
|
20
18
|
} else {
|
|
21
|
-
// gl_FragColor = vec4(v_uv, 0.0, u_opacity);
|
|
22
19
|
outputColor = vec4(v_Color, u_opacity);
|
|
23
20
|
}
|
|
24
21
|
outputColor.a *= v_clip;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
|
|
3
2
|
layout(location = ATTRIBUTE_LOCATION_COLOR) in vec3 a_Color;
|
|
4
3
|
layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;
|
|
@@ -16,17 +15,17 @@ out float v_clip;
|
|
|
16
15
|
#pragma include "projection"
|
|
17
16
|
#pragma include "picking"
|
|
18
17
|
void main() {
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
v_Color = a_Color;
|
|
19
|
+
v_uv = a_Uv;
|
|
21
20
|
|
|
22
|
-
|
|
21
|
+
vec4 project_pos = project_position(vec4(a_Position, 1.0));
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
v_clip = 1.0;
|
|
24
|
+
if (a_Position.z < u_terrainClipHeight) {
|
|
25
|
+
v_clip = 0.0;
|
|
26
|
+
}
|
|
28
27
|
|
|
29
28
|
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, a_Position.z, 1.0));
|
|
30
29
|
|
|
31
|
-
|
|
30
|
+
setPickingColor(a_PickingColor);
|
|
32
31
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/l7-layers",
|
|
3
|
-
"version": "2.21.11-beta.
|
|
3
|
+
"version": "2.21.11-beta.6",
|
|
4
4
|
"description": "L7's collection of built-in layers",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "https://github.com/orgs/antvis/people",
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"gl-matrix": "^3.1.0",
|
|
34
34
|
"gl-vec2": "^1.3.0",
|
|
35
35
|
"polyline-miter-util": "^1.0.1",
|
|
36
|
-
"@antv/l7-core": "2.21.11-beta.
|
|
37
|
-
"@antv/l7-maps": "2.21.11-beta.
|
|
38
|
-
"@antv/l7-source": "2.21.11-beta.
|
|
39
|
-
"@antv/l7-utils": "2.21.11-beta.
|
|
36
|
+
"@antv/l7-core": "2.21.11-beta.6",
|
|
37
|
+
"@antv/l7-maps": "2.21.11-beta.6",
|
|
38
|
+
"@antv/l7-source": "2.21.11-beta.6",
|
|
39
|
+
"@antv/l7-utils": "2.21.11-beta.6"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/d3-array": "^2",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@types/d3-scale": "^2.1.1",
|
|
46
46
|
"@types/earcut": "^2.1.0",
|
|
47
47
|
"@types/gl-matrix": "^2.4.5",
|
|
48
|
-
"@antv/l7-test-utils": "^2.21.11-beta.
|
|
48
|
+
"@antv/l7-test-utils": "^2.21.11-beta.6"
|
|
49
49
|
},
|
|
50
50
|
"publishConfig": {
|
|
51
51
|
"access": "public",
|