]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
move r_stereo adjustments into R_RenderView so that it executes AFTER CSQC may have...
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 24 Nov 2010 20:58:27 +0000 (20:58 +0000)
committerRudolf Polzer <divVerent@xonotic.org>
Fri, 26 Nov 2010 11:59:48 +0000 (12:59 +0100)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10626 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=d404f9aaa347ec6506ecff1de63ff55673e91881

cl_screen.c
gl_rmain.c
screen.h

index 70f4db8a3499c0cfab162fc852574c9f3b4f61ed..514f514bdf4596ad1784b4a0bcaf023632b987f6 100644 (file)
@@ -2238,11 +2238,6 @@ void CL_UpdateScreen(void)
 
        if (R_Stereo_Active())
        {
-               matrix4x4_t originalmatrix = r_refdef.view.matrix;
-               matrix4x4_t offsetmatrix;
-               Matrix4x4_CreateFromQuakeEntity(&offsetmatrix, 0, r_stereo_separation.value * 0.5f, 0, 0, r_stereo_angle.value * 0.5f, 0, 1);
-               Matrix4x4_Concat(&r_refdef.view.matrix, &originalmatrix, &offsetmatrix);
-
                r_stereo_side = 0;
 
                if (r_stereo_redblue.integer || r_stereo_redgreen.integer || r_stereo_redcyan.integer)
@@ -2257,9 +2252,6 @@ void CL_UpdateScreen(void)
 
                SCR_DrawScreen();
 
-               Matrix4x4_CreateFromQuakeEntity(&offsetmatrix, 0, r_stereo_separation.value * -0.5f, 0, 0, r_stereo_angle.value * -0.5f, 0, 1);
-               Matrix4x4_Concat(&r_refdef.view.matrix, &originalmatrix, &offsetmatrix);
-
                r_stereo_side = 1;
 
                if (r_stereo_redblue.integer || r_stereo_redgreen.integer || r_stereo_redcyan.integer)
@@ -2273,8 +2265,6 @@ void CL_UpdateScreen(void)
                        qglDrawBuffer(GL_BACK_LEFT);
 
                SCR_DrawScreen();
-
-               r_refdef.view.matrix = originalmatrix;
        }
        else
                SCR_DrawScreen();
index e9aa5060988f714b3415f0ea1234bf0f345c7e40..356dd378096a9cb794f316b284ebd64e8b0abc48 100644 (file)
@@ -9636,6 +9636,7 @@ R_RenderView
 */
 void R_RenderView(void)
 {
+       matrix4x4_t originalmatrix = r_refdef.view.matrix, offsetmatrix;
        if (r_timereport_active)
                R_TimeReport("start");
        r_textureframe++; // used only by R_GetCurrentTexture
@@ -9650,6 +9651,13 @@ void R_RenderView(void)
        R_AnimCache_ClearCache();
        R_FrameData_NewFrame();
 
+       /* adjust for stereo display */
+       if(R_Stereo_Active())
+       {
+               Matrix4x4_CreateFromQuakeEntity(&offsetmatrix, 0, r_stereo_separation.value * (0.5f - r_stereo_side), 0, 0, r_stereo_angle.value * (0.5f - r_stereo_side), 0, 1);
+               Matrix4x4_Concat(&r_refdef.view.matrix, &originalmatrix, &offsetmatrix);
+       }
+
        if (r_refdef.view.isoverlay)
        {
                // TODO: FIXME: move this into its own backend function maybe? [2/5/2008 Andreas]
@@ -9663,12 +9671,17 @@ void R_RenderView(void)
 
                R_RenderScene();
 
+               r_refdef.view.matrix = originalmatrix;
+
                CHECKGLERROR
                return;
        }
 
        if (!r_refdef.scene.entities || r_refdef.view.width * r_refdef.view.height == 0 || !r_renderview.integer || cl_videoplaying/* || !r_refdef.scene.worldmodel*/)
+       {
+               r_refdef.view.matrix = originalmatrix;
                return; //Host_Error ("R_RenderView: NULL worldmodel");
+       }
 
        r_refdef.view.colorscale = r_hdr_scenebrightness.value;
 
@@ -9721,6 +9734,8 @@ void R_RenderView(void)
        GL_Scissor(0, 0, vid.width, vid.height);
        GL_ScissorTest(false);
 
+       r_refdef.view.matrix = originalmatrix;
+
        CHECKGLERROR
 }
 
index 05befb2c65b101e7c42b00c956e9973aac74b4d5..7574d40d7cfb1d6da0312c95bf6b3467054a41ef 100644 (file)
--- a/screen.h
+++ b/screen.h
@@ -66,5 +66,10 @@ extern cvar_t r_letterbox;
 extern cvar_t scr_refresh;
 extern cvar_t scr_stipple;
 
+extern cvar_t r_stereo_separation;
+extern cvar_t r_stereo_angle;
+qboolean R_Stereo_Active(void);
+extern int r_stereo_side;
+
 #endif