From 1a1be4947285d3d78ad4fd462c2c4f6ed6c78327 Mon Sep 17 00:00:00 2001 From: divverent Date: Sat, 5 Apr 2014 10:07:15 +0000 Subject: [PATCH] Properly make the blur conditional on non empty uservecs 1 and 2. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12059 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=4322b75189b0a2b416dfc7a571c94d91337e2c14 --- shader_glsl.h | 2 ++ shader_hlsl.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/shader_glsl.h b/shader_glsl.h index 1c6cb906..cb839f10 100644 --- a/shader_glsl.h +++ b/shader_glsl.h @@ -304,6 +304,7 @@ "#ifdef USEPOSTPROCESSING\n", "// do r_glsl_dumpshader, edit glsl/default.glsl, and replace this by your own postprocessing if you want\n", "// this code does a blur with the radius specified in the first component of r_glsl_postprocess_uservec1 and blends it using the second component\n", +"#if defined(USERVEC1) || defined(USERVEC2)\n", " float sobel = 1.0;\n", " // vec2 ts = textureSize(Texture_First, 0);\n", " // vec2 px = vec2(1/ts.x, 1/ts.y);\n", @@ -341,6 +342,7 @@ " dp_FragColor /= (1.0 + 5.0 * UserVec1.y);\n", " dp_FragColor.rgb = dp_FragColor.rgb * (1.0 + UserVec2.x) + vec3(max(0.0, sobel - UserVec2.z))*UserVec2.y;\n", "#endif\n", +"#endif\n", "\n", "#ifdef USEBLOOM\n", " dp_FragColor += max(vec4(0,0,0,0), dp_texture2D(Texture_Second, TexCoord2) - BloomColorSubtract);\n", diff --git a/shader_hlsl.h b/shader_hlsl.h index e81e6039..4a63f1c4 100644 --- a/shader_hlsl.h +++ b/shader_hlsl.h @@ -208,6 +208,7 @@ "#ifdef USEPOSTPROCESSING\n", "// do r_glsl_dumpshader, edit glsl/default.glsl, and replace this by your own postprocessing if you want\n", "// this code does a blur with the radius specified in the first component of r_glsl_postprocess_uservec1 and blends it using the second component\n", +"#if defined(USERVEC1) || defined(USERVEC2)\n", " float sobel = 1.0;\n", " // float2 ts = textureSize(Texture_First, 0);\n", " // float2 px = float2(1/ts.x, 1/ts.y);\n", @@ -245,6 +246,7 @@ " dp_FragColor /= (1.0 + 5.0 * UserVec1.y);\n", " dp_FragColor.rgb = dp_FragColor.rgb * (1.0 + UserVec2.x) + float3(1,1,1)*max(0.0, sobel - UserVec2.z)*UserVec2.y;\n", "#endif\n", +"#endif\n", "\n", "#ifdef USEBLOOM\n", " dp_FragColor += max(float4(0,0,0,0), tex2D(Texture_Second, TexCoord2) - BloomColorSubtract);\n", -- 2.39.2