]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
fixed water rendering in shrunken views
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 30 Sep 2009 19:40:12 +0000 (19:40 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 30 Sep 2009 19:40:12 +0000 (19:40 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9265 d7cf8633-e32d-0410-b094-e92efae38249

gl_rmain.c

index 54159c25531e183819966e955defdb57b299597b..33b5ff2a519b9d6b5e9e3c791e28b6fd05547381 100644 (file)
@@ -3660,7 +3660,7 @@ static void R_Water_StartFrame(void)
        }
 
        // allocate textures as needed
-       if (r_waterstate.waterwidth != waterwidth || r_waterstate.waterheight != waterheight || r_waterstate.texturewidth != texturewidth || r_waterstate.textureheight != textureheight)
+       if (r_waterstate.texturewidth != texturewidth || r_waterstate.textureheight != textureheight)
        {
                r_waterstate.maxwaterplanes = MAX_WATERPLANES;
                for (i = 0, p = r_waterstate.waterplanes;i < r_waterstate.maxwaterplanes;i++, p++)
@@ -3673,25 +3673,23 @@ static void R_Water_StartFrame(void)
                        p->texture_reflection = NULL;
                }
                memset(&r_waterstate, 0, sizeof(r_waterstate));
-               r_waterstate.waterwidth = waterwidth;
-               r_waterstate.waterheight = waterheight;
                r_waterstate.texturewidth = texturewidth;
                r_waterstate.textureheight = textureheight;
        }
 
        // when doing a reduced render (HDR) we want to use a smaller area
-       waterwidth = (int)bound(1, r_refdef.view.width * r_water_resolutionmultiplier.value, r_refdef.view.width);
-       waterheight = (int)bound(1, r_refdef.view.height * r_water_resolutionmultiplier.value, r_refdef.view.height);
+       r_waterstate.waterwidth = (int)bound(1, r_refdef.view.width * r_water_resolutionmultiplier.value, r_refdef.view.width);
+       r_waterstate.waterheight = (int)bound(1, r_refdef.view.height * r_water_resolutionmultiplier.value, r_refdef.view.height);
 
        if (r_waterstate.waterwidth)
        {
                r_waterstate.enabled = true;
 
                // set up variables that will be used in shader setup
-               r_waterstate.screenscale[0] = 0.5f * (float)waterwidth / (float)texturewidth;
-               r_waterstate.screenscale[1] = 0.5f * (float)waterheight / (float)textureheight;
-               r_waterstate.screencenter[0] = 0.5f * (float)waterwidth / (float)texturewidth;
-               r_waterstate.screencenter[1] = 0.5f * (float)waterheight / (float)textureheight;
+               r_waterstate.screenscale[0] = 0.5f * (float)r_waterstate.waterwidth / (float)r_waterstate.texturewidth;
+               r_waterstate.screenscale[1] = 0.5f * (float)r_waterstate.waterheight / (float)r_waterstate.textureheight;
+               r_waterstate.screencenter[0] = 0.5f * (float)r_waterstate.waterwidth / (float)r_waterstate.texturewidth;
+               r_waterstate.screencenter[1] = 0.5f * (float)r_waterstate.waterheight / (float)r_waterstate.textureheight;
        }
 
        r_waterstate.maxwaterplanes = MAX_WATERPLANES;