]> 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)
committerRudolf Polzer <divverent@alientrap.org>
Tue, 27 Jul 2010 19:19:07 +0000 (21:19 +0200)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10363 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=2deb98cfc69b32025eceed117f9fd67d228e5c62

gl_backend.c

index 72f41165ad7a0ac83c3ce237490da39c7e21a1b6..bd2d422099059861b5d98052afe578e8b31954e3 100644 (file)
@@ -404,9 +404,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;
@@ -432,6 +429,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);
 }
 
@@ -442,9 +447,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;
@@ -470,6 +472,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);
 }