From 3d21701189d5db75274199c693ea5266bec11675 Mon Sep 17 00:00:00 2001 From: havoc Date: Fri, 4 Feb 2005 09:23:01 +0000 Subject: [PATCH] changed 3 clamp calls in the GLSL fragment shader to max calls instead, for a small speed gain (at least on ATI) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4996 d7cf8633-e32d-0410-b094-e92efae38249 --- r_shadow.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/r_shadow.c b/r_shadow.c index 258c3e33..fba2ad39 100644 --- a/r_shadow.c +++ b/r_shadow.c @@ -346,7 +346,7 @@ const char *builtinshader_light_frag = " //\n" " // pow(1-(x*x+y*y+z*z), 4) is far more realistic but needs large lights to\n" " // provide significant illumination, large = slow = pain.\n" -" float colorscale = clamp(1.0 - dot(CubeVector, CubeVector), 0.0, 1.0);\n" +" float colorscale = max(1.0 - dot(CubeVector, CubeVector), 0.0);\n" "\n" "#ifdef USEFOG\n" " // apply fog\n" @@ -371,9 +371,9 @@ const char *builtinshader_light_frag = "\n" " // calculate shading\n" " vec3 diffusenormal = normalize(LightVector);\n" -" vec3 color = colortexel * (AmbientScale + DiffuseScale * clamp(dot(surfacenormal, diffusenormal), 0.0, 1.0));\n" +" vec3 color = colortexel * (AmbientScale + DiffuseScale * max(dot(surfacenormal, diffusenormal), 0.0));\n" "#ifdef USESPECULAR\n" -" color += glosstexel * (SpecularScale * pow(clamp(dot(surfacenormal, normalize(diffusenormal + normalize(EyeVector))), 0.0, 1.0), SpecularPower));\n" +" color += glosstexel * (SpecularScale * pow(max(dot(surfacenormal, normalize(diffusenormal + normalize(EyeVector))), 0.0), SpecularPower));\n" "#endif\n" "\n" "#ifdef USECUBEFILTER\n" -- 2.39.2