From: divverent Date: Sun, 10 Oct 2010 16:36:44 +0000 (+0000) Subject: I have no idea why, but R_Viewport_TransformToScreen apparently should NOT invert... X-Git-Tag: xonotic-v0.1.0preview~56^2~99 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f485da47bd3a3737bb1db4e42b21e9e3b6c58dd9;p=xonotic%2Fdarkplaces.git I have no idea why, but R_Viewport_TransformToScreen apparently should NOT invert y, as doing so breaks dynamic light rendering in size-reduced views (HDR, water) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10518 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/gl_backend.c b/gl_backend.c index 3596dc4f..78e00828 100644 --- a/gl_backend.c +++ b/gl_backend.c @@ -516,7 +516,11 @@ void R_Viewport_TransformToScreen(const r_viewport_t *v, const vec4_t in, vec4_t Matrix4x4_Transform4 (&v->projectmatrix, temp, out); iw = 1.0f / out[3]; out[0] = v->x + (out[0] * iw + 1.0f) * v->width * 0.5f; - out[1] = v->y + v->height - (out[1] * iw + 1.0f) * v->height * 0.5f; + + // for an odd reason, inverting this is wrong for R_Shadow_ScissorForBBox (we then get badly scissored lights) + //out[1] = v->y + v->height - (out[1] * iw + 1.0f) * v->height * 0.5f; + out[1] = v->y + (out[1] * iw + 1.0f) * v->height * 0.5f; + out[2] = v->z + (out[2] * iw + 1.0f) * v->depth * 0.5f; } diff --git a/r_shadow.c b/r_shadow.c index 8e695852..bceb2359 100644 --- a/r_shadow.c +++ b/r_shadow.c @@ -2374,9 +2374,13 @@ qboolean R_Shadow_ScissorForBBox(const float *mins, const float *maxs) // now convert the scissor rectangle to integer screen coordinates ix1 = (int)(x1 - 1.0f); - iy1 = vid.height - (int)(y2 - 1.0f); + //iy1 = vid.height - (int)(y2 - 1.0f); + //iy1 = r_refdef.view.viewport.width + 2 * r_refdef.view.viewport.x - (int)(y2 - 1.0f); + iy1 = (int)(y1 - 1.0f); ix2 = (int)(x2 + 1.0f); - iy2 = vid.height - (int)(y1 + 1.0f); + //iy2 = vid.height - (int)(y1 + 1.0f); + //iy2 = r_refdef.view.viewport.height + 2 * r_refdef.view.viewport.y - (int)(y1 + 1.0f); + iy2 = (int)(y2 + 1.0f); //Con_Printf("%f %f %f %f\n", x1, y1, x2, y2); // clamp it to the screen