]> 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)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 10 Oct 2010 16:36:44 +0000 (16:36 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10518 d7cf8633-e32d-0410-b094-e92efae38249

gl_backend.c
r_shadow.c

index 3596dc4f73d07215621a874efe92b60c93aea408..78e0082806549a8a4078ecd0d6a4516df408ad2b 100644 (file)
@@ -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;
 }
 
index 8e6958522cdb9fcc4763ea084bcdd7e512f7a973..bceb2359922fa3963e28934f81b0679dd1c3c11f 100644 (file)
@@ -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