]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
I have no idea why, but R_Viewport_TransformToScreen apparently should NOT invert...
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 10 Oct 2010 16:36:44 +0000 (16:36 +0000)
committerRudolf Polzer <divVerent@xonotic.org>
Wed, 13 Oct 2010 10:06:23 +0000 (12:06 +0200)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10518 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=f485da47bd3a3737bb1db4e42b21e9e3b6c58dd9

gl_backend.c
r_shadow.c

index bd2d422099059861b5d98052afe578e8b31954e3..ee2643642420d8aa6252797edecf3ee7314038ee 100644 (file)
@@ -304,7 +304,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;
 }
 
index 2aed02fce0ed513eac26c33da2883abd1422d8bc..7481de8791b7832a0ce097af9d378a883ca5c770 100644 (file)
@@ -2536,9 +2536,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