From 1e1b0ef7c6334d7567d4ff7208fa695375467255 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Wed, 27 Aug 2008 19:02:14 +0000 Subject: [PATCH] Added sphere cap deformations. This is influenced by config parameter "CapDeformation" (no UI yet) which ranges from 0 (sphere) to 100 (flat). Default is sphere. CCMAIL: svn path=/trunk/KDE/kdebase/workspace/; revision=853464 --- effects/sphere.cpp | 3 +++ effects/sphere.h | 1 + 2 files changed, 4 insertions(+) diff --git a/effects/sphere.cpp b/effects/sphere.cpp index 31841a8a51..725f9445f9 100644 --- a/effects/sphere.cpp +++ b/effects/sphere.cpp @@ -47,6 +47,7 @@ SphereEffect::SphereEffect() animateDesktopChange = false; KConfigGroup conf = effects->effectConfig( "Sphere" ); zPosition = conf.readEntry( "ZPosition", 450.0 ); + capDeformationFactor = conf.readEntry( "CapDeformation", 0 )/100.0f; bigCube = true; } @@ -173,7 +174,9 @@ void SphereEffect::paintCapStep( float z, float zTexture, bool texture ) float topAngle = angle*i*M_PI/180.0; float bottomAngle = angle*(i+1)*M_PI/180.0; float yTop = rect.height() - radius * cos( topAngle ); + yTop -= (yTop-rect.height()*0.5)*capDeformationFactor; float yBottom = rect.height() -radius * cos( bottomAngle ); + yBottom -= (yBottom-rect.height()*0.5)*capDeformationFactor; for( int j=0; j<36; j++ ) { float x = radius * sin( topAngle ) * sin( (90.0+j*10.0)*M_PI/180.0 ); diff --git a/effects/sphere.h b/effects/sphere.h index d92cc8612c..a29b540adf 100644 --- a/effects/sphere.h +++ b/effects/sphere.h @@ -45,6 +45,7 @@ class SphereEffect bool mInited; bool mValid; GLShader* mShader; + float capDeformationFactor; }; } // namespace