- fixed camerapos setup.

This commit is contained in:
Christoph Oelckers 2018-06-22 21:44:53 +02:00
parent d5af939119
commit e7531bb579
4 changed files with 12 additions and 13 deletions

View file

@ -114,7 +114,7 @@ struct FDrawInfo : public HWDrawInfo
// These should go into hwrenderer later.
void SetViewMatrix(const FRotator &angles, float vx, float vy, float vz, bool mirror, bool planemirror);
void SetupView(float vx, float vy, float vz, DAngle va, bool mirror, bool planemirror);
void SetupView(float vx, float vy, float vz, bool mirror, bool planemirror);
static FDrawInfo *StartDrawInfo(FRenderViewpoint &parentvp, HWViewpointUniforms *uniforms);

View file

@ -316,7 +316,7 @@ void GLPortal::End(FDrawInfo *di, bool usestencil)
// Restore the old view
if (vp.camera != nullptr) vp.camera->renderflags = (vp.camera->renderflags & ~RF_MAYBEINVISIBLE) | savedvisibility;
di->SetupView(vp.Pos.X, vp.Pos.Y, vp.Pos.Z, vp.Angles.Yaw, !!(MirrorFlag & 1), !!(PlaneMirrorFlag & 1));
di->SetupView(vp.Pos.X, vp.Pos.Y, vp.Pos.Z, !!(MirrorFlag & 1), !!(PlaneMirrorFlag & 1));
{
ScopedColorMask colorMask(0, 0, 0, 0); // glColorMask(0, 0, 0, 0); // no graphics
@ -370,7 +370,7 @@ void GLPortal::End(FDrawInfo *di, bool usestencil)
// Restore the old view
if (vp.camera != nullptr) vp.camera->renderflags = (vp.camera->renderflags & ~RF_MAYBEINVISIBLE) | savedvisibility;
di->SetupView(vp.Pos.X, vp.Pos.Y, vp.Pos.Z, vp.Angles.Yaw, !!(MirrorFlag & 1), !!(PlaneMirrorFlag & 1));
di->SetupView(vp.Pos.X, vp.Pos.Y, vp.Pos.Z, !!(MirrorFlag & 1), !!(PlaneMirrorFlag & 1));
// This draws a valid z-buffer into the stencil's contents to ensure it
// doesn't get overwritten by the level's geometry.
@ -577,7 +577,7 @@ void GLSkyboxPortal::DrawContents(FDrawInfo *di)
vp.ViewActor = origin;
inskybox = true;
di->SetupView(vp.Pos.X, vp.Pos.Y, vp.Pos.Z, vp.Angles.Yaw, !!(MirrorFlag & 1), !!(PlaneMirrorFlag & 1));
di->SetupView(vp.Pos.X, vp.Pos.Y, vp.Pos.Z, !!(MirrorFlag & 1), !!(PlaneMirrorFlag & 1));
di->SetViewArea();
ClearClipper(di);
@ -684,7 +684,7 @@ void GLSectorStackPortal::DrawContents(FDrawInfo *di)
// avoid recursions!
if (origin->plane != -1) screen->instack[origin->plane]++;
di->SetupView(vp.Pos.X, vp.Pos.Y, vp.Pos.Z, vp.Angles.Yaw, !!(MirrorFlag&1), !!(PlaneMirrorFlag&1));
di->SetupView(vp.Pos.X, vp.Pos.Y, vp.Pos.Z, !!(MirrorFlag&1), !!(PlaneMirrorFlag&1));
SetupCoverage(di);
ClearClipper(di);
@ -740,7 +740,7 @@ void GLPlaneMirrorPortal::DrawContents(FDrawInfo *di)
PlaneMirrorMode = origin->fC() < 0 ? -1 : 1;
PlaneMirrorFlag++;
di->SetupView(vp.Pos.X, vp.Pos.Y, vp.Pos.Z, vp.Angles.Yaw, !!(MirrorFlag & 1), !!(PlaneMirrorFlag & 1));
di->SetupView(vp.Pos.X, vp.Pos.Y, vp.Pos.Z, !!(MirrorFlag & 1), !!(PlaneMirrorFlag & 1));
ClearClipper(di);
di->UpdateCurrentMapSection();
@ -911,7 +911,7 @@ void GLMirrorPortal::DrawContents(FDrawInfo *di)
vp.ViewActor = nullptr;
MirrorFlag++;
di->SetupView(vp.Pos.X, vp.Pos.Y, vp.Pos.Z, vp.Angles.Yaw, !!(MirrorFlag&1), !!(PlaneMirrorFlag&1));
di->SetupView(vp.Pos.X, vp.Pos.Y, vp.Pos.Z, !!(MirrorFlag&1), !!(PlaneMirrorFlag&1));
di->mClipper->Clear();
@ -988,7 +988,7 @@ void GLLineToLinePortal::DrawContents(FDrawInfo *di)
}
vp.ViewActor = nullptr;
di->SetupView(vp.Pos.X, vp.Pos.Y, vp.Pos.Z, vp.Angles.Yaw, !!(MirrorFlag&1), !!(PlaneMirrorFlag&1));
di->SetupView(vp.Pos.X, vp.Pos.Y, vp.Pos.Z, !!(MirrorFlag&1), !!(PlaneMirrorFlag&1));
ClearClipper(di);
gl_RenderState.SetClipLine(glport->lines[0]->mDestination);

View file

@ -104,7 +104,7 @@ void FDrawInfo::SetViewMatrix(const FRotator &angles, float vx, float vy, float
// Setup the view rotation matrix for the given viewpoint
//
//-----------------------------------------------------------------------------
void FDrawInfo::SetupView(float vx, float vy, float vz, DAngle va, bool mirror, bool planemirror)
void FDrawInfo::SetupView(float vx, float vy, float vz, bool mirror, bool planemirror)
{
auto &vp = Viewpoint;
vp.SetViewAngle(r_viewwindow);
@ -506,12 +506,11 @@ sector_t * FGLRenderer::RenderViewpoint (FRenderViewpoint &mainvp, AActor * came
// Stereo mode specific perspective projection
di->VPUniforms.mProjectionMatrix = eye->GetProjection(fov, ratio, fovratio);
vp.SetViewAngle(r_viewwindow);
// Stereo mode specific viewpoint adjustment - temporarily shifts global ViewPos
eye->GetViewShift(vp.HWAngles.Yaw.Degrees, viewShift);
ScopedViewShifter viewShifter(vp.Pos, viewShift);
di->SetViewMatrix(vp.HWAngles, vp.Pos.X, vp.Pos.Y, vp.Pos.Z, false, false);
di->ApplyVPUniforms();
di->SetupView(vp.Pos.X, vp.Pos.Y, vp.Pos.Z, false, false);
di->ProcessScene(toscreen);

View file

@ -230,7 +230,7 @@ void GLSkyPortal::DrawContents(FDrawInfo *di)
gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
bool oldClamp = gl_RenderState.SetDepthClamp(true);
di->SetupView(0, 0, 0, vp.Angles.Yaw, !!(MirrorFlag & 1), !!(PlaneMirrorFlag & 1));
di->SetupView(0, 0, 0, !!(MirrorFlag & 1), !!(PlaneMirrorFlag & 1));
gl_RenderState.SetVertexBuffer(GLRenderer->mSkyVBO);
if (origin->texture[0] && origin->texture[0]->tex->bSkybox)