include layer opacity in shader

This commit is contained in:
mike-000
2021-12-21 17:07:57 +00:00
committed by GitHub
parent 5267e30d6d
commit 4acb45dc78

View File

@@ -285,12 +285,13 @@ class Heatmap extends BaseVector {
uniform sampler2D u_image;
uniform sampler2D u_gradientTexture;
uniform float u_opacity;
varying vec2 v_texCoord;
void main() {
vec4 color = texture2D(u_image, v_texCoord);
gl_FragColor.a = color.a;
gl_FragColor.a = color.a * u_opacity;
gl_FragColor.rgb = texture2D(u_gradientTexture, vec2(0.5, color.a)).rgb;
gl_FragColor.rgb *= gl_FragColor.a;
}`,
@@ -298,6 +299,9 @@ class Heatmap extends BaseVector {
u_gradientTexture: function () {
return this.gradient_;
}.bind(this),
u_opacity: function () {
return this.getOpacity();
}.bind(this),
},
},
],