Render ImageWallpaper with OpenGL ES and apply visual effects. (Fix bug)
We have to render image wallpaper with OpenGL ES to apply some amazing visual effects. Bug: 122803209 Bug: 124073420 Bug: 123616712 Bug: 123615467 Test: Manually. Change-Id: I0123d4ba2acb5a84b709c0468910e006c8e49563
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
precision mediump float;
|
||||
|
||||
uniform sampler2D uTexture;
|
||||
uniform float uCenterReveal;
|
||||
uniform float uReveal;
|
||||
uniform float uAod2Opacity;
|
||||
varying vec2 vTextureCoordinates;
|
||||
|
||||
vec3 luminosity(vec3 color) {
|
||||
float lum = 0.2126 * color.r + 0.7152 * color.g + 0.0722 * color.b;
|
||||
return vec3(lum);
|
||||
}
|
||||
|
||||
vec4 transform(vec3 diffuse) {
|
||||
// TODO: Add well comments here, tracking on b/123615467.
|
||||
vec3 lum = luminosity(diffuse);
|
||||
diffuse = mix(diffuse, lum, smoothstep(0., uCenterReveal, uReveal));
|
||||
float val = mix(uReveal, uCenterReveal, step(uCenterReveal, uReveal));
|
||||
diffuse = smoothstep(val, 1.0, diffuse);
|
||||
diffuse *= uAod2Opacity * (1. - smoothstep(uCenterReveal, 1., uReveal));
|
||||
return vec4(diffuse.r, diffuse.g, diffuse.b, 1.);
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec4 fragColor = texture2D(uTexture, vTextureCoordinates);
|
||||
gl_FragColor = transform(fragColor.rgb);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
attribute vec4 aPosition;
|
||||
attribute vec2 aTextureCoordinates;
|
||||
varying vec2 vTextureCoordinates;
|
||||
|
||||
void main() {
|
||||
vTextureCoordinates = aTextureCoordinates;
|
||||
gl_Position = aPosition;
|
||||
}
|
||||
Reference in New Issue
Block a user