Cache the matrix for cube cap mirroring
This commit is contained in:
parent
fe614119e5
commit
802dd6b5fe
2 changed files with 4 additions and 4 deletions
|
@ -99,6 +99,8 @@ CubeEffect::CubeEffect()
|
||||||
m_reflectionShader = ShaderManager::instance()->loadFragmentShader(ShaderManager::GenericShader, fragmentshader);
|
m_reflectionShader = ShaderManager::instance()->loadFragmentShader(ShaderManager::GenericShader, fragmentshader);
|
||||||
const QString capshader = KGlobal::dirs()->findResource("data", "kwin/cube-cap.glsl");
|
const QString capshader = KGlobal::dirs()->findResource("data", "kwin/cube-cap.glsl");
|
||||||
m_capShader = ShaderManager::instance()->loadFragmentShader(ShaderManager::GenericShader, capshader);
|
m_capShader = ShaderManager::instance()->loadFragmentShader(ShaderManager::GenericShader, capshader);
|
||||||
|
m_textureMirrorMatrix.scale(1.0, -1.0, 1.0);
|
||||||
|
m_textureMirrorMatrix.translate(0.0, -1.0, 0.0);
|
||||||
|
|
||||||
reconfigure( ReconfigureAll );
|
reconfigure( ReconfigureAll );
|
||||||
}
|
}
|
||||||
|
@ -819,11 +821,8 @@ void CubeEffect::paintCap(bool frontFirst, float zOffset)
|
||||||
#ifndef KWIN_HAVE_OPENGLES
|
#ifndef KWIN_HAVE_OPENGLES
|
||||||
glMatrixMode( GL_TEXTURE );
|
glMatrixMode( GL_TEXTURE );
|
||||||
#endif
|
#endif
|
||||||
QMatrix4x4 textureMirrorMatrix;
|
|
||||||
textureMirrorMatrix.scale(1.0, -1.0, 1.0);
|
|
||||||
textureMirrorMatrix.translate(0.0, -1.0, 0.0);
|
|
||||||
pushMatrix();
|
pushMatrix();
|
||||||
loadMatrix(textureMirrorMatrix);
|
loadMatrix(m_textureMirrorMatrix);
|
||||||
#ifndef KWIN_HAVE_OPENGLES
|
#ifndef KWIN_HAVE_OPENGLES
|
||||||
glMatrixMode( GL_MODELVIEW );
|
glMatrixMode( GL_MODELVIEW );
|
||||||
|
|
||||||
|
|
|
@ -167,6 +167,7 @@ class CubeEffect
|
||||||
|
|
||||||
QMatrix4x4 m_rotationMatrix;
|
QMatrix4x4 m_rotationMatrix;
|
||||||
QMatrix4x4 m_reflectionMatrix;
|
QMatrix4x4 m_reflectionMatrix;
|
||||||
|
QMatrix4x4 m_textureMirrorMatrix;
|
||||||
GLVertexBuffer *m_cubeCapBuffer;
|
GLVertexBuffer *m_cubeCapBuffer;
|
||||||
|
|
||||||
// Shortcuts - needed to toggle the effect
|
// Shortcuts - needed to toggle the effect
|
||||||
|
|
Loading…
Reference in a new issue