diff --git a/effects/cube.cpp b/effects/cube.cpp index 99c49e9389..79c53213f3 100644 --- a/effects/cube.cpp +++ b/effects/cube.cpp @@ -103,7 +103,24 @@ CubeEffect::CubeEffect() for( int y=0; ynumberOfDesktops(); i++ ) - { - glPushMatrix(); - glRotatef( i*angle, 0.0, 1.0, 0.0 ); - glBegin( GL_POLYGON ); - glVertex3f( -rect.width()/2, 0.0, z ); - glVertex3f( rect.width()/2, 0.0, z ); - glVertex3f( 0.0, 0.0, 0.0 ); - glEnd(); - glPopMatrix(); - } + glRotatef( (1-frontDesktop)*angle, 0.0, 1.0, 0.0 ); - // textured caps - // only works for more than three desktops + bool texture = false; if( texturedCaps && effects->numberOfDesktops() > 3 && capTexture ) { - glPushMatrix(); - glRotatef( (1-frontDesktop)*angle, 0.0, 1.0, 0.0 ); - capTexture->bind(); - glBegin( GL_QUADS ); - glTexCoord2f( 0.0, 0.0 ); - glVertex3f( -rect.width()/2, 0.0, zTexture ); - glTexCoord2f( 1.0, 0.0 ); - glVertex3f( rect.width()/2, 0.0, zTexture ); - glTexCoord2f( 1.0, 1.0 ); - glVertex3f( rect.width()/2, 0.0, -zTexture ); - glTexCoord2f( 0.0, 1.0 ); - glVertex3f( -rect.width()/2, 0.0, -zTexture ); - glEnd( ); - capTexture->unbind(); - glPopMatrix(); + texture = true; + paintCapStep( z, zTexture, true ); } + else + paintCapStep( z, zTexture, false ); glPopMatrix(); } +void CubeEffect::paintCapStep( float z, float zTexture, bool texture ) + { + QRect rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop()); + float angle = 360.0f/effects->numberOfDesktops(); + if( texture ) + capTexture->bind(); + for( int i=0; inumberOfDesktops(); i++ ) + { + int triangleRows = effects->numberOfDesktops()*5; + float zTriangleDistance = z/(float)triangleRows; + float widthTriangle = tan( angle*0.5 * M_PI/180.0 ) * zTriangleDistance; + float currentWidth = 0.0; + glBegin( GL_TRIANGLES ); + float cosValue = cos( i*angle * M_PI/180.0 ); + float sinValue = sin( i*angle * M_PI/180.0 ); + for( int j=0; junbind(); + } + } + void CubeEffect::postPaintScreen() { effects->postPaintScreen(); diff --git a/effects/cube.h b/effects/cube.h index 7323bda425..630c255afe 100644 --- a/effects/cube.h +++ b/effects/cube.h @@ -64,6 +64,7 @@ class CubeEffect }; virtual void paintScene( int mask, QRegion region, ScreenPaintData& data ); virtual void paintCap( float z, float zTexture ); + virtual void paintCapStep( float z, float zTexture, bool texture ); void rotateToDesktop( int desktop ); void setActive( bool active ); bool activated;