From: eihrul Date: Mon, 12 Sep 2011 11:59:37 +0000 (+0000) Subject: slightly faster non-VSDCT GetShadowMapTC2D variant X-Git-Tag: xonotic-v0.6.0~163^2~209 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=989ca4a9f1569dff8d782772d43fa8754073ad53;p=xonotic%2Fdarkplaces.git slightly faster non-VSDCT GetShadowMapTC2D variant git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11343 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/shader_glsl.h b/shader_glsl.h index e54f7c43..d59744a4 100644 --- a/shader_glsl.h +++ b/shader_glsl.h @@ -753,13 +753,11 @@ "# else\n" "vec3 GetShadowMapTC2D(vec3 dir)\n" "{\n" -" vec3 adir = abs(dir);\n" -" float ma = adir.z;\n" -" vec4 proj = vec4(dir, 2.5);\n" -" if (adir.x > ma) { ma = adir.x; proj = vec4(dir.zyx, 0.5); }\n" -" if (adir.y > ma) { ma = adir.y; proj = vec4(dir.xzy, 1.5); }\n" -" vec2 aparams = ShadowMap_Parameters.xy / ma;\n" -" return vec3(proj.xy * aparams.x + vec2(proj.z < 0.0 ? 1.5 : 0.5, proj.w) * ShadowMap_Parameters.z, aparams.y + ShadowMap_Parameters.w);\n" +" vec3 adir = abs(dir);\n" +" vec2 aparams = ShadowMap_Parameters.xy / max(max(adir.x, adir.y), adir.z);\n" +" vec4 proj = adir.x > adir.y ? (adir.x > adir.z ? vec4(dir.zy, dir.x < 0.0 ? 1.5 : 0.5, 0.5) : vec4(dir.xy, dir.z < 0.0 ? 1.5 : 0.5, 2.5)) :\n" +" (adir.y > adir.z ? vec4(dir.xz, dir.y < 0.0 ? 1.5 : 0.5, 1.5) : vec4(dir.xy, dir.z < 0.0 ? 1.5 : 0.5, 2.5));\n" +" return vec3(proj.xy * aparams.x + proj.zw * ShadowMap_Parameters.z, aparams.y + ShadowMap_Parameters.w);\n" "}\n" "# endif\n" "# endif\n"