Pass windowSize to Fragment Shader again
This commit is contained in:
parent
a05ad98896
commit
6569bb071f
2 changed files with 5 additions and 4 deletions
|
@ -3,8 +3,7 @@ uniform sampler2D startOffsetTexture;
|
|||
uniform sampler2D endOffsetTexture;
|
||||
uniform float factor;
|
||||
uniform float scale;
|
||||
uniform float textureWidth;
|
||||
uniform float textureHeight;
|
||||
uniform vec2 windowSize;
|
||||
|
||||
const float regionTexSize = 512.0;
|
||||
|
||||
|
@ -17,14 +16,14 @@ vec2 getOffset(sampler2D texture, vec2 pos)
|
|||
|
||||
vec2 pix2tex( vec2 pix )
|
||||
{
|
||||
return vec2( pix.s / textureWidth, pix.t / textureHeight );
|
||||
return pix/windowSize;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
// Original (unscaled) position in pixels
|
||||
// ### FIXME: Use a custom vertex shader that outputs the untransformed texcoords
|
||||
vec2 origpos = varyingTexCoords * vec2(textureWidth, textureHeight);
|
||||
vec2 origpos = varyingTexCoords * windowSize;
|
||||
// Position in pixels on the scaled window
|
||||
vec2 pos = origpos * scale;
|
||||
// Start/end position of current region
|
||||
|
|
|
@ -24,6 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include <kwinglplatform.h>
|
||||
|
||||
#include <QMatrix4x4>
|
||||
#include <QVector2D>
|
||||
|
||||
#include <KStandardDirs>
|
||||
#include <kdebug.h>
|
||||
|
@ -152,6 +153,7 @@ void ExplosionEffect::paintWindow(EffectWindow* w, int mask, QRegion region, Win
|
|||
mShader->setUniform("screenTransformation", screenTransformation);
|
||||
mShader->setUniform("factor", (float)mWindows[w]);
|
||||
mShader->setUniform("scale", (float)scale);
|
||||
mShader->setUniform("windowSize", QVector2D(w->width(), w->height()));
|
||||
glActiveTexture(GL_TEXTURE4);
|
||||
mStartOffsetTex->bind();
|
||||
glActiveTexture(GL_TEXTURE5);
|
||||
|
|
Loading…
Reference in a new issue