From dc188a6e5086ac33524264ab1561b0c92cb149bc Mon Sep 17 00:00:00 2001 From: Filippo Scognamiglio Date: Sun, 6 Apr 2014 17:05:00 +0200 Subject: [PATCH] Fixed some other warnings in shader. Little improvements in reflections. --- app/ShaderManager.qml | 8 ++++---- app/ShaderSettings.qml | 2 +- app/app.qmlproject.user | 2 +- app/frames/WhiteSimpleFrame.qml | 2 +- app/frames/utils/FrameShader.qml | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/ShaderManager.qml b/app/ShaderManager.qml index 9ae869d..d607c00 100644 --- a/app/ShaderManager.qml +++ b/app/ShaderManager.qml @@ -93,7 +93,7 @@ ShaderEffect { "qt_TexCoord0.y = -"+disp_top.toFixed(1)+"/txt_Size.y + qt_MultiTexCoord0.y / ((txt_Size.y -("+(disp_top+disp_bottom).toFixed(1)+")) / txt_Size.y);" + "vec2 coords = vec2(fract(time/(1024.0*2.0)), fract(time/(1024.0*1024.0*2.0)));" + (brightness_flickering !== 0.0 ? " - brightness = texture2D(randomFunctionSource, coords).g * "+brightness_flickering+";" + brightness = texture2D(randomFunctionSource, coords).g * "+brightness_flickering.toFixed(1)+";" : "") + (horizontal_sincronization !== 0.0 ? " @@ -193,11 +193,11 @@ ShaderEffect { color += randomPass(coords) * glowing_line_strength;" : "") + (rasterization !== shadersettings.no_rasterization ? " - color = mix(color, color * getScanlineIntensity(originalCoord), "+ rasterization_strength +");" + color = mix(color, color * getScanlineIntensity(originalCoord), "+ rasterization_strength.toFixed(1) +");" : "") + (bloom !== 0 ? " - color += texture2D(bloomSource, coords).r *" + 2.5 * bloom + ";" : "") + + color += texture2D(bloomSource, coords).r *" + (2.5 * bloom).toFixed(1) + ";" : "") + "vec3 finalColor = mix(background_color, font_color, color).rgb;" + "finalColor = mix(finalColor * 1.1, vec3(0.0), 1.2 * distance * distance);" + @@ -205,7 +205,7 @@ ShaderEffect { (brightness_flickering !== 0 ? " finalColor = mix(finalColor, vec3(0.0), brightness);" : "") + - "gl_FragColor = vec4(finalColor *"+brightness+", qt_Opacity); + "gl_FragColor = vec4(finalColor *"+brightness.toFixed(1)+", qt_Opacity); }" onStatusChanged: console.log(log) //Print warning messages diff --git a/app/ShaderSettings.qml b/app/ShaderSettings.qml index 5b00a5e..fff5a4f 100644 --- a/app/ShaderSettings.qml +++ b/app/ShaderSettings.qml @@ -82,7 +82,7 @@ Item{ property var fonts_list: fontlist property bool frame_reflections: true - property real frame_reflection_strength: ((frame_reflections && framelist.get(frames_index).reflections) ? 1.0 : 0.0) * 0.4 + property real frame_reflection_strength: ((frame_reflections && framelist.get(frames_index).reflections) ? 1.0 : 0.0) * 0.15 property var profiles_list: profileslist property int profiles_index: 0 diff --git a/app/app.qmlproject.user b/app/app.qmlproject.user index 7ae76bb..4e80251 100644 --- a/app/app.qmlproject.user +++ b/app/app.qmlproject.user @@ -1,6 +1,6 @@ - + ProjectExplorer.Project.ActiveTarget diff --git a/app/frames/WhiteSimpleFrame.qml b/app/frames/WhiteSimpleFrame.qml index f4e522a..e69b077 100644 --- a/app/frames/WhiteSimpleFrame.qml +++ b/app/frames/WhiteSimpleFrame.qml @@ -23,7 +23,7 @@ TerminalFrame{ displacementLeft: 43.0 displacementTop: 40.0 displacementRight: 35.0 - displacementBottom: 32.0 + displacementBottom: 30.0 shaderString: "FrameShader.qml" } diff --git a/app/frames/utils/FrameShader.qml b/app/frames/utils/FrameShader.qml index 45c2779..eeaa21a 100644 --- a/app/frames/utils/FrameShader.qml +++ b/app/frames/utils/FrameShader.qml @@ -32,9 +32,9 @@ ShaderEffect{ void main() { qt_TexCoord0 = qt_MultiTexCoord0; - brightness = "+brightness+";" + + brightness = "+brightness.toFixed(1)+";" + (brightness_flickering !== 0 ? - "brightness -= texture2D(randomFunctionSource, vec2(fract(time/(1024.0*2.0)), fract(time/(1024.0*1024.0*2.0)))).r * "+brightness_flickering+";" + "brightness -= texture2D(randomFunctionSource, vec2(fract(time/(1024.0*2.0)), fract(time/(1024.0*1024.0*2.0)))).r * "+brightness_flickering.toFixed(1)+";" : "") + " gl_Position = qt_Matrix * qt_Vertex; @@ -68,7 +68,7 @@ ShaderEffect{ float light = (reflection * 0.4 + 0.2) * brightness; vec3 final_color = reflection_color.rgb * light * 0.5; final_color += txt_color.rgb * ambient_light; - float reflection_alpha = (1.0 - reflection*0.4); + float reflection_alpha = (1.0 - reflection*"+frame_reflection_strength.toFixed(1)+"); gl_FragColor = vec4(final_color * txt_normal.a, txt_color.a * qt_Opacity * reflection_alpha); }"