- fix softpoly mirrors

This commit is contained in:
Magnus Norddahl 2018-04-22 23:29:39 +02:00
commit 6e77cb4906
7 changed files with 37 additions and 25 deletions

View file

@ -210,7 +210,7 @@ void PolyRenderer::SetSceneViewport()
}
}
PolyPortalViewpoint PolyRenderer::SetupPerspectiveMatrix()
PolyPortalViewpoint PolyRenderer::SetupPerspectiveMatrix(bool mirror)
{
// We have to scale the pitch to account for the pixel stretching, because the playsim doesn't know about this and treats it as 1:1.
double radPitch = Viewpoint.Angles.Pitch.Normalized180().Radians();
@ -235,6 +235,11 @@ PolyPortalViewpoint PolyRenderer::SetupPerspectiveMatrix()
Mat4f::SwapYZ() *
Mat4f::Translate((float)-Viewpoint.Pos.X, (float)-Viewpoint.Pos.Y, (float)-Viewpoint.Pos.Z);
portalViewpoint.Mirror = mirror;
if (mirror)
portalViewpoint.WorldToView = Mat4f::Scale(-1.0f, 1.0f, 1.0f) * portalViewpoint.WorldToView;
portalViewpoint.WorldToClip = Mat4f::Perspective(fovy, ratio, 5.0f, 65535.0f, Handedness::Right, ClipZRange::NegativePositiveW) * portalViewpoint.WorldToView;
return portalViewpoint;