Smoothly transform to cube and sphere during start animation and vice versa during stop animation.

Caps have to be deformed during start/stop as well.

svn path=/trunk/KDE/kdebase/workspace/; revision=928308
icc-effect-5.14.5
Martin Gräßlin 2009-02-19 11:50:00 +00:00
parent 5025509e3a
commit bdef1d7c5b
3 changed files with 19 additions and 0 deletions

View File

@ -1376,6 +1376,12 @@ void CubeEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowP
cylinderShader->setUniform( "windowHeight", (float)w->height() );
cylinderShader->setUniform( "xCoord", (float)w->x() );
cylinderShader->setUniform( "cubeAngle", (effects->numberOfDesktops() - 2 )/(float)effects->numberOfDesktops() * 180.0f );
float factor = 0.0f;
if( start )
factor = 1.0f - timeLine.value();
if( stop )
factor = timeLine.value();
cylinderShader->setUniform( "timeLine", factor );
data.shader = cylinderShader;
}
if( mode == Sphere )
@ -1386,6 +1392,12 @@ void CubeEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowP
sphereShader->setUniform( "xCoord", (float)w->x() );
sphereShader->setUniform( "yCoord", (float)w->y() );
sphereShader->setUniform( "cubeAngle", (effects->numberOfDesktops() - 2 )/(float)effects->numberOfDesktops() * 180.0f );
float factor = 0.0f;
if( start )
factor = 1.0f - timeLine.value();
if( stop )
factor = timeLine.value();
sphereShader->setUniform( "timeLine", factor );
data.shader = sphereShader;
}
//kDebug(1212) << w->caption();

View File

@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
uniform float width;
uniform float cubeAngle;
uniform float xCoord;
uniform float timeLine;
void main()
{
@ -52,5 +53,7 @@ void main()
if( distance != 0.0 )
h = tan( angle ) * distance;
vertex.z = h - midpoint;
vec3 diff = (gl_Vertex.xyz - vertex.xyz)*timeLine;
vertex.xyz += diff;
gl_Position = gl_ModelViewProjectionMatrix * vertex;
}

View File

@ -22,6 +22,7 @@ uniform float height;
uniform float cubeAngle;
uniform float xCoord;
uniform float yCoord;
uniform float timeLine;
void main()
{
@ -36,5 +37,8 @@ void main()
vertex.xy += vec2( width*0.5 - xCoord, height*0.5 - yCoord );
vec3 diff = (gl_Vertex.xyz - vertex.xyz)*timeLine;
vertex.xyz += diff;
gl_Position = gl_ModelViewProjectionMatrix * vec4( vertex, 1.0 );
}