]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
fix water renders with r_viewscale
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 7 May 2011 16:12:22 +0000 (16:12 +0000)
committerRudolf Polzer <divVerent@xonotic.org>
Mon, 9 May 2011 08:39:14 +0000 (10:39 +0200)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11118 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=00a8efb624833e1aba894b6665c4fd7d8bd8fa84

gl_rmain.c

index 7dba7729e0ec18a63ac3628dab40c0c62f72f319..2998fd039d362a43c29d5b57052d65dd831bca87 100644 (file)
@@ -5379,8 +5379,7 @@ static void R_Water_StartFrame(void)
 
        // set waterwidth and waterheight to the water resolution that will be
        // used (often less than the screen resolution for faster rendering)
-       waterwidth = (int)bound(1, vid.width * r_water_resolutionmultiplier.value, vid.width);
-       waterheight = (int)bound(1, vid.height * r_water_resolutionmultiplier.value, vid.height);
+       R_GetScaledViewSize(bound(1, vid.width * r_water_resolutionmultiplier.value, vid.width), bound(1, vid.height * r_water_resolutionmultiplier.value, vid.height), &waterwidth, &waterheight);
 
        // calculate desired texture sizes
        // can't use water if the card does not support the texture size
@@ -5426,17 +5425,20 @@ static void R_Water_StartFrame(void)
 
        if (r_waterstate.texturewidth)
        {
+               int scaledwidth, scaledheight;
+
                r_waterstate.enabled = true;
 
                // when doing a reduced render (HDR) we want to use a smaller area
                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);
+               R_GetScaledViewSize(r_waterstate.waterwidth, r_waterstate.waterheight, &scaledwidth, &scaledheight);
 
                // set up variables that will be used in shader setup
-               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.screenscale[0] = 0.5f * (float)scaledwidth / (float)r_waterstate.texturewidth;
+               r_waterstate.screenscale[1] = 0.5f * (float)scaledheight / (float)r_waterstate.textureheight;
+               r_waterstate.screencenter[0] = 0.5f * (float)scaledwidth / (float)r_waterstate.texturewidth;
+               r_waterstate.screencenter[1] = 0.5f * (float)scaledheight / (float)r_waterstate.textureheight;
        }
 
        r_waterstate.maxwaterplanes = MAX_WATERPLANES;