Use opacity, brighness and saturation in shader for cylinder and sphere. That allows to have dimmed windows in these effects and correct window opacity.
svn path=/trunk/KDE/kdebase/workspace/; revision=956595icc-effect-5.14.5
parent
1b59bb1efc
commit
3e56e98281
|
@ -296,7 +296,6 @@ bool CubeEffect::loadShader()
|
|||
{
|
||||
cylinderShader->bind();
|
||||
cylinderShader->setUniform( "winTexture", 0 );
|
||||
cylinderShader->setUniform( "opacity", cubeOpacity );
|
||||
QRect rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop() );
|
||||
cylinderShader->setUniform( "width", (float)rect.width() );
|
||||
cylinderShader->unbind();
|
||||
|
@ -311,7 +310,6 @@ bool CubeEffect::loadShader()
|
|||
{
|
||||
sphereShader->bind();
|
||||
sphereShader->setUniform( "winTexture", 0 );
|
||||
sphereShader->setUniform( "opacity", cubeOpacity );
|
||||
QRect rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop() );
|
||||
sphereShader->setUniform( "width", (float)rect.width() );
|
||||
sphereShader->setUniform( "height", (float)rect.height() );
|
||||
|
|
|
@ -2,6 +2,8 @@ uniform sampler2D winTexture;
|
|||
uniform float windowWidth;
|
||||
uniform float windowHeight;
|
||||
uniform float opacity;
|
||||
uniform float brightness;
|
||||
uniform float saturation;
|
||||
uniform float front;
|
||||
uniform float useTexture;
|
||||
|
||||
|
@ -23,11 +25,19 @@ void main()
|
|||
if( gl_TexCoord[0].x < 0.0 || gl_TexCoord[0].x > windowWidth ||
|
||||
gl_TexCoord[0].y < 0.0 || gl_TexCoord[0].y > windowHeight )
|
||||
discard;
|
||||
gl_FragColor.rgba = texture2D(winTexture, pix2tex(gl_TexCoord[0].xy)).rgba;
|
||||
vec4 tex = texture2D(winTexture, pix2tex(gl_TexCoord[0].xy));
|
||||
tex = vec4( tex.rgb, tex.a * opacity );
|
||||
if( saturation != 1.0 )
|
||||
{
|
||||
vec3 desaturated = tex.rgb * vec3( 0.30, 0.59, 0.11 );
|
||||
desaturated = vec3( dot( desaturated, tex.rgb ));
|
||||
tex.rgb = tex.rgb * vec3( saturation ) + desaturated * vec3( 1.0 - saturation );
|
||||
}
|
||||
tex.rgb = tex.rgb * vec3( brightness );
|
||||
gl_FragColor = tex;
|
||||
}
|
||||
else
|
||||
{
|
||||
gl_FragColor = gl_Color;
|
||||
}
|
||||
gl_FragColor.a = gl_FragColor.a * opacity;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue