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: <lmurray@undefinedfire.com> svn path=/trunk/KDE/kdebase/workspace/; revision=853464
This commit is contained in:
parent
cc6e98cec9
commit
1e1b0ef7c6
2 changed files with 4 additions and 0 deletions
|
@ -47,6 +47,7 @@ SphereEffect::SphereEffect()
|
||||||
animateDesktopChange = false;
|
animateDesktopChange = false;
|
||||||
KConfigGroup conf = effects->effectConfig( "Sphere" );
|
KConfigGroup conf = effects->effectConfig( "Sphere" );
|
||||||
zPosition = conf.readEntry( "ZPosition", 450.0 );
|
zPosition = conf.readEntry( "ZPosition", 450.0 );
|
||||||
|
capDeformationFactor = conf.readEntry( "CapDeformation", 0 )/100.0f;
|
||||||
bigCube = true;
|
bigCube = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,7 +174,9 @@ void SphereEffect::paintCapStep( float z, float zTexture, bool texture )
|
||||||
float topAngle = angle*i*M_PI/180.0;
|
float topAngle = angle*i*M_PI/180.0;
|
||||||
float bottomAngle = angle*(i+1)*M_PI/180.0;
|
float bottomAngle = angle*(i+1)*M_PI/180.0;
|
||||||
float yTop = rect.height() - radius * cos( topAngle );
|
float yTop = rect.height() - radius * cos( topAngle );
|
||||||
|
yTop -= (yTop-rect.height()*0.5)*capDeformationFactor;
|
||||||
float yBottom = rect.height() -radius * cos( bottomAngle );
|
float yBottom = rect.height() -radius * cos( bottomAngle );
|
||||||
|
yBottom -= (yBottom-rect.height()*0.5)*capDeformationFactor;
|
||||||
for( int j=0; j<36; j++ )
|
for( int j=0; j<36; j++ )
|
||||||
{
|
{
|
||||||
float x = radius * sin( topAngle ) * sin( (90.0+j*10.0)*M_PI/180.0 );
|
float x = radius * sin( topAngle ) * sin( (90.0+j*10.0)*M_PI/180.0 );
|
||||||
|
|
|
@ -45,6 +45,7 @@ class SphereEffect
|
||||||
bool mInited;
|
bool mInited;
|
||||||
bool mValid;
|
bool mValid;
|
||||||
GLShader* mShader;
|
GLShader* mShader;
|
||||||
|
float capDeformationFactor;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
Loading…
Reference in a new issue