From: divverent Date: Sat, 7 May 2011 16:12:22 +0000 (+0000) Subject: fix water renders with r_viewscale X-Git-Tag: xonotic-v0.6.0~163^2~428 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=00a8efb624833e1aba894b6665c4fd7d8bd8fa84;p=xonotic%2Fdarkplaces.git fix water renders with r_viewscale git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11118 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/gl_rmain.c b/gl_rmain.c index dc00d05e..8f9b3ec5 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -5364,8 +5364,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 @@ -5411,17 +5410,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;