mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-28 06:32:29 +00:00
Call EndDrawScene for each eye.
Actually use stereoscopic projection matrix.
This commit is contained in:
parent
0874455faf
commit
b82d611936
4 changed files with 1740 additions and 1739 deletions
|
@ -1014,7 +1014,8 @@ void FDrawInfo::SetupFloodStencil(wallseg * ws)
|
||||||
glStencilOp(GL_KEEP, GL_KEEP, GL_INCR); // increment stencil of valid pixels
|
glStencilOp(GL_KEEP, GL_KEEP, GL_INCR); // increment stencil of valid pixels
|
||||||
{
|
{
|
||||||
// Use revertible color mask, to avoid stomping on anaglyph 3D state
|
// Use revertible color mask, to avoid stomping on anaglyph 3D state
|
||||||
ScopedColorMask colorMask(0, 0, 0, 0); // glColorMask(0, 0, 0, 0); // don't write to the graphics buffer
|
// ScopedColorMask colorMask(0, 0, 0, 0);
|
||||||
|
glColorMask(0, 0, 0, 0); // don't write to the graphics buffer
|
||||||
gl_RenderState.EnableTexture(false);
|
gl_RenderState.EnableTexture(false);
|
||||||
gl_RenderState.ResetColor();
|
gl_RenderState.ResetColor();
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
|
@ -1036,7 +1037,7 @@ void FDrawInfo::SetupFloodStencil(wallseg * ws)
|
||||||
glStencilFunc(GL_EQUAL, recursion + 1, ~0); // draw sky into stencil
|
glStencilFunc(GL_EQUAL, recursion + 1, ~0); // draw sky into stencil
|
||||||
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); // this stage doesn't modify the stencil
|
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); // this stage doesn't modify the stencil
|
||||||
|
|
||||||
} // glColorMask(1, 1, 1, 1); // don't write to the graphics buffer
|
} glColorMask(1, 1, 1, 1); // don't write to the graphics buffer
|
||||||
gl_RenderState.EnableTexture(true);
|
gl_RenderState.EnableTexture(true);
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
glDepthMask(false);
|
glDepthMask(false);
|
||||||
|
@ -1050,7 +1051,8 @@ void FDrawInfo::ClearFloodStencil(wallseg * ws)
|
||||||
gl_RenderState.EnableTexture(false);
|
gl_RenderState.EnableTexture(false);
|
||||||
{
|
{
|
||||||
// Use revertible color mask, to avoid stomping on anaglyph 3D state
|
// Use revertible color mask, to avoid stomping on anaglyph 3D state
|
||||||
ScopedColorMask colorMask(0, 0, 0, 0); // glColorMask(0,0,0,0); // don't write to the graphics buffer
|
// ScopedColorMask colorMask(0, 0, 0, 0);
|
||||||
|
glColorMask(0,0,0,0); // don't write to the graphics buffer
|
||||||
gl_RenderState.ResetColor();
|
gl_RenderState.ResetColor();
|
||||||
|
|
||||||
gl_RenderState.Apply();
|
gl_RenderState.Apply();
|
||||||
|
@ -1069,7 +1071,7 @@ void FDrawInfo::ClearFloodStencil(wallseg * ws)
|
||||||
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
|
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
|
||||||
glStencilFunc(GL_EQUAL, recursion, ~0);
|
glStencilFunc(GL_EQUAL, recursion, ~0);
|
||||||
gl_RenderState.EnableTexture(true);
|
gl_RenderState.EnableTexture(true);
|
||||||
} // glColorMask(1, 1, 1, 1);
|
} glColorMask(1, 1, 1, 1);
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
glDepthMask(true);
|
glDepthMask(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,7 +198,7 @@ bool GLPortal::Start(bool usestencil, bool doquery)
|
||||||
// Create stencil
|
// Create stencil
|
||||||
glStencilFunc(GL_EQUAL,recursion,~0); // create stencil
|
glStencilFunc(GL_EQUAL,recursion,~0); // create stencil
|
||||||
glStencilOp(GL_KEEP,GL_KEEP,GL_INCR); // increment stencil of valid pixels
|
glStencilOp(GL_KEEP,GL_KEEP,GL_INCR); // increment stencil of valid pixels
|
||||||
// glColorMask(0,0,0,0); // don't write to the graphics buffer
|
glColorMask(0,0,0,0); // don't write to the graphics buffer
|
||||||
gl_RenderState.SetEffect(EFF_STENCIL);
|
gl_RenderState.SetEffect(EFF_STENCIL);
|
||||||
gl_RenderState.EnableTexture(false);
|
gl_RenderState.EnableTexture(false);
|
||||||
gl_RenderState.ResetColor();
|
gl_RenderState.ResetColor();
|
||||||
|
@ -207,8 +207,6 @@ bool GLPortal::Start(bool usestencil, bool doquery)
|
||||||
|
|
||||||
if (NeedDepthBuffer())
|
if (NeedDepthBuffer())
|
||||||
{
|
{
|
||||||
{
|
|
||||||
ScopedColorMask colorMask(0, 0, 0, 0);
|
|
||||||
glDepthMask(false); // don't write to Z-buffer!
|
glDepthMask(false); // don't write to Z-buffer!
|
||||||
if (!NeedDepthBuffer()) doquery = false; // too much overhead and nothing to gain.
|
if (!NeedDepthBuffer()) doquery = false; // too much overhead and nothing to gain.
|
||||||
else if (gl_noquery) doquery = false;
|
else if (gl_noquery) doquery = false;
|
||||||
|
@ -236,7 +234,7 @@ bool GLPortal::Start(bool usestencil, bool doquery)
|
||||||
// set normal drawing mode
|
// set normal drawing mode
|
||||||
gl_RenderState.EnableTexture(true);
|
gl_RenderState.EnableTexture(true);
|
||||||
glDepthFunc(GL_LESS);
|
glDepthFunc(GL_LESS);
|
||||||
} // glColorMask(1, 1, 1, 1);
|
glColorMask(1, 1, 1, 1);
|
||||||
gl_RenderState.SetEffect(EFF_NONE);
|
gl_RenderState.SetEffect(EFF_NONE);
|
||||||
glDepthRange(0, 1);
|
glDepthRange(0, 1);
|
||||||
|
|
||||||
|
@ -261,13 +259,12 @@ bool GLPortal::Start(bool usestencil, bool doquery)
|
||||||
// than the benefit.
|
// than the benefit.
|
||||||
// Note: We must draw the stencil with z-write enabled here because there is no second pass!
|
// Note: We must draw the stencil with z-write enabled here because there is no second pass!
|
||||||
|
|
||||||
ScopedColorMask colorMask(0, 0, 0, 0);
|
|
||||||
glDepthMask(true);
|
glDepthMask(true);
|
||||||
DrawPortalStencil();
|
DrawPortalStencil();
|
||||||
glStencilFunc(GL_EQUAL,recursion+1,~0); // draw sky into stencil
|
glStencilFunc(GL_EQUAL,recursion+1,~0); // draw sky into stencil
|
||||||
glStencilOp(GL_KEEP,GL_KEEP,GL_KEEP); // this stage doesn't modify the stencil
|
glStencilOp(GL_KEEP,GL_KEEP,GL_KEEP); // this stage doesn't modify the stencil
|
||||||
gl_RenderState.EnableTexture(true);
|
gl_RenderState.EnableTexture(true);
|
||||||
// glColorMask(1,1,1,1);
|
glColorMask(1,1,1,1);
|
||||||
gl_RenderState.SetEffect(EFF_NONE);
|
gl_RenderState.SetEffect(EFF_NONE);
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
glDepthMask(false); // don't write to Z-buffer!
|
glDepthMask(false); // don't write to Z-buffer!
|
||||||
|
@ -376,7 +373,8 @@ void GLPortal::End(bool usestencil)
|
||||||
GLRenderer->SetupView(viewx, viewy, viewz, viewangle, !!(MirrorFlag & 1), !!(PlaneMirrorFlag & 1));
|
GLRenderer->SetupView(viewx, viewy, viewz, viewangle, !!(MirrorFlag & 1), !!(PlaneMirrorFlag & 1));
|
||||||
|
|
||||||
{
|
{
|
||||||
ScopedColorMask colorMask(0, 0, 0, 0); // glColorMask(0, 0, 0, 0); // no graphics
|
// ScopedColorMask colorMask(0, 0, 0, 0);
|
||||||
|
glColorMask(0, 0, 0, 0); // no graphics
|
||||||
gl_RenderState.SetEffect(EFF_NONE);
|
gl_RenderState.SetEffect(EFF_NONE);
|
||||||
gl_RenderState.ResetColor();
|
gl_RenderState.ResetColor();
|
||||||
gl_RenderState.EnableTexture(false);
|
gl_RenderState.EnableTexture(false);
|
||||||
|
@ -405,7 +403,7 @@ void GLPortal::End(bool usestencil)
|
||||||
|
|
||||||
gl_RenderState.EnableTexture(true);
|
gl_RenderState.EnableTexture(true);
|
||||||
gl_RenderState.SetEffect(EFF_NONE);
|
gl_RenderState.SetEffect(EFF_NONE);
|
||||||
} // glColorMask(1, 1, 1, 1);
|
} glColorMask(1, 1, 1, 1);
|
||||||
recursion--;
|
recursion--;
|
||||||
|
|
||||||
// restore old stencil op.
|
// restore old stencil op.
|
||||||
|
@ -440,7 +438,8 @@ void GLPortal::End(bool usestencil)
|
||||||
glDepthFunc(GL_LEQUAL);
|
glDepthFunc(GL_LEQUAL);
|
||||||
glDepthRange(0, 1);
|
glDepthRange(0, 1);
|
||||||
{
|
{
|
||||||
ScopedColorMask colorMask(0, 0, 0, 0); // glColorMask(0,0,0,0); // no graphics
|
ScopedColorMask colorMask(0, 0, 0, 0);
|
||||||
|
// glColorMask(0,0,0,0); // no graphics
|
||||||
gl_RenderState.SetEffect(EFF_STENCIL);
|
gl_RenderState.SetEffect(EFF_STENCIL);
|
||||||
gl_RenderState.EnableTexture(false);
|
gl_RenderState.EnableTexture(false);
|
||||||
DrawPortalStencil();
|
DrawPortalStencil();
|
||||||
|
|
|
@ -826,7 +826,7 @@ sector_t * FGLRenderer::RenderViewpoint (AActor * camera, GL_IRECT * bounds, flo
|
||||||
// Stereo mode specific perspective projection
|
// Stereo mode specific perspective projection
|
||||||
(*eye)->GetProjection(fov, ratio, fovratio, projectionMatrix);
|
(*eye)->GetProjection(fov, ratio, fovratio, projectionMatrix);
|
||||||
SetProjection(projectionMatrix);
|
SetProjection(projectionMatrix);
|
||||||
SetProjection(fov, ratio, fovratio); // switch to perspective mode and set up clipper
|
// SetProjection(fov, ratio, fovratio); // switch to perspective mode and set up clipper
|
||||||
SetViewAngle(viewangle);
|
SetViewAngle(viewangle);
|
||||||
// Stereo mode specific viewpoint adjustment - temporarily shifts global viewx, viewy, viewz
|
// Stereo mode specific viewpoint adjustment - temporarily shifts global viewx, viewy, viewz
|
||||||
(*eye)->GetViewShift(GLRenderer->mAngles.Yaw, viewShift);
|
(*eye)->GetViewShift(GLRenderer->mAngles.Yaw, viewShift);
|
||||||
|
@ -839,6 +839,7 @@ sector_t * FGLRenderer::RenderViewpoint (AActor * camera, GL_IRECT * bounds, flo
|
||||||
clipper.SafeAddClipRangeRealAngles(viewangle + a1, viewangle - a1);
|
clipper.SafeAddClipRangeRealAngles(viewangle + a1, viewangle - a1);
|
||||||
|
|
||||||
ProcessScene(toscreen);
|
ProcessScene(toscreen);
|
||||||
|
EndDrawScene(viewsector);
|
||||||
}
|
}
|
||||||
stereo3dMode.TearDown();
|
stereo3dMode.TearDown();
|
||||||
|
|
||||||
|
@ -910,7 +911,6 @@ void FGLRenderer::RenderView (player_t* player)
|
||||||
GLRenderer->mLightCount = ((it.Next()) != NULL);
|
GLRenderer->mLightCount = ((it.Next()) != NULL);
|
||||||
|
|
||||||
sector_t * viewsector = RenderViewpoint(player->camera, NULL, FieldOfView * 360.0f / FINEANGLES, ratio, fovratio, true, true);
|
sector_t * viewsector = RenderViewpoint(player->camera, NULL, FieldOfView * 360.0f / FINEANGLES, ratio, fovratio, true, true);
|
||||||
EndDrawScene(viewsector);
|
|
||||||
|
|
||||||
All.Unclock();
|
All.Unclock();
|
||||||
}
|
}
|
||||||
|
|
|
@ -291,7 +291,7 @@ static void I_SelectTimer()
|
||||||
|
|
||||||
unsigned int I_MSTime()
|
unsigned int I_MSTime()
|
||||||
{
|
{
|
||||||
assert(basetime != 0);
|
// assert(basetime != 0);
|
||||||
return timeGetTime() - basetime;
|
return timeGetTime() - basetime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue