From 27e30ee258f7e38fca14c2575cab7131068c484d Mon Sep 17 00:00:00 2001 From: Filippo Scognamiglio Date: Thu, 3 Apr 2014 15:22:39 +0200 Subject: [PATCH] Fixes #6 writing to uniform value --- app/ShaderManager.qml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/ShaderManager.qml b/app/ShaderManager.qml index 7441fa8..6742434 100644 --- a/app/ShaderManager.qml +++ b/app/ShaderManager.qml @@ -153,6 +153,9 @@ ShaderEffect { "vec2 cc = vec2(0.5) - qt_TexCoord0;" + "float distance = length(cc);" + + (noise_strength ? " + float noise = noise_strength;" : "") + + (screen_distorsion !== 0 ? " float distortion = dot(cc, cc) * screen_distorsion; vec2 coords = (qt_TexCoord0 - cc * (1.0 + distortion) * distortion);" @@ -164,14 +167,14 @@ ShaderEffect { h_distortion += 0.5 * cos(time*0.04 + 0.03 + coords.y*50.0*fract(time/10.0 + 0.4)); coords.x = coords.x + h_distortion * horizontal_distortion;" + (noise_strength ? " - noise_strength += horizontal_distortion * 0.5;" : "") + noise += horizontal_distortion * 0.5;" : "") : "") + "float color = texture2D(source, coords).r;" + (noise_strength !== 0 ? " - color += stepNoise(coords) * noise_strength * (1.0 - distance * distance * 2.0);" : "") + + color += stepNoise(coords) * noise * (1.0 - distance * distance * 2.0);" : "") + (glowing_line_strength !== 0 ? " color += randomPass(coords) * glowing_line_strength;" : "") +