]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
fix v_flipped with near clip plane (water, warpzone)
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 25 Jul 2010 18:42:31 +0000 (18:42 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 25 Jul 2010 18:42:31 +0000 (18:42 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10363 d7cf8633-e32d-0410-b094-e92efae38249

gl_backend.c

index 710eb7445aaa15d0e585a31b56cc043e99bed07e..4e5700b88bee1aa75d65f1742861a59feeb67419 100644 (file)
@@ -561,9 +561,6 @@ void R_Viewport_InitPerspective(r_viewport_t *v, const matrix4x4_t *cameramatrix
        float m[16];
        memset(v, 0, sizeof(*v));
 
-       if(v_flipped.integer)
-               frustumx = -frustumx;
-
        v->type = R_VIEWPORTTYPE_PERSPECTIVE;
        v->cameramatrix = *cameramatrix;
        v->x = x;
@@ -589,6 +586,14 @@ void R_Viewport_InitPerspective(r_viewport_t *v, const matrix4x4_t *cameramatrix
        if (nearplane)
                R_Viewport_ApplyNearClipPlaneFloatGL(v, m, nearplane[0], nearplane[1], nearplane[2], nearplane[3]);
 
+       if(v_flipped.integer)
+       {
+               m[0] = -m[0];
+               m[4] = -m[4];
+               m[8] = -m[8];
+               m[12] = -m[12];
+       }
+
        Matrix4x4_FromArrayFloatGL(&v->projectmatrix, m);
 }
 
@@ -599,9 +604,6 @@ void R_Viewport_InitPerspectiveInfinite(r_viewport_t *v, const matrix4x4_t *came
        float m[16];
        memset(v, 0, sizeof(*v));
 
-       if(v_flipped.integer)
-               frustumx = -frustumx;
-
        v->type = R_VIEWPORTTYPE_PERSPECTIVE_INFINITEFARCLIP;
        v->cameramatrix = *cameramatrix;
        v->x = x;
@@ -627,6 +629,14 @@ void R_Viewport_InitPerspectiveInfinite(r_viewport_t *v, const matrix4x4_t *came
        if (nearplane)
                R_Viewport_ApplyNearClipPlaneFloatGL(v, m, nearplane[0], nearplane[1], nearplane[2], nearplane[3]);
 
+       if(v_flipped.integer)
+       {
+               m[0] = -m[0];
+               m[4] = -m[4];
+               m[8] = -m[8];
+               m[12] = -m[12];
+       }
+
        Matrix4x4_FromArrayFloatGL(&v->projectmatrix, m);
 }