- fixed calculation of projection matrix for weapon sprites.

- fixed color mask for green/magenta.
- fixed crash when initializing video, because it was accessing 'screen' before it was set from within the framebuffer's constructor.
This commit is contained in:
Christoph Oelckers 2018-06-24 17:15:27 +02:00
parent c3d5b960ee
commit 491898fe2c
4 changed files with 10 additions and 9 deletions

View file

@ -324,7 +324,7 @@ void FGLRenderer::PresentStereo()
return;
case VR_GREENMAGENTA:
PresentAnaglyph(false, true, true);
PresentAnaglyph(false, true, false);
break;
case VR_REDCYAN:

View file

@ -377,7 +377,7 @@ void OpenGLFrameBuffer::SetViewportRects(IntRect *bounds)
if (!bounds)
{
auto vrmode = VRMode::GetVRMode(true);
vrmode->AdjustViewport();
vrmode->AdjustViewport(this);
}
}

View file

@ -93,7 +93,7 @@ const VRMode *VRMode::GetVRMode(bool toscreen)
}
}
void VRMode::AdjustViewport() const
void VRMode::AdjustViewport(DFrameBuffer *screen) const
{
screen->mSceneViewport.height = (int)(screen->mSceneViewport.height * mVerticalViewportScale);
screen->mSceneViewport.top = (int)(screen->mSceneViewport.top * mVerticalViewportScale);
@ -109,11 +109,11 @@ void VRMode::AdjustViewport() const
VSMatrix VRMode::GetHUDSpriteProjection() const
{
VSMatrix mat;
int w = screen->mScreenViewport.width;
int h = screen->mScreenViewport.height;
float scaled_w = w * mWeaponProjectionScale;
float left_ofs = (scaled_w - w) / 2.f;
mat.ortho(left_ofs, left_ofs + w, (float)h, 0, -1.0f, 1.0f);
int w = screen->GetWidth();
int h = screen->GetHeight();
float scaled_w = w / mWeaponProjectionScale;
float left_ofs = (w - scaled_w) / 2.f;
mat.ortho(left_ofs, left_ofs + scaled_w, (float)h, 0, -1.0f, 1.0f);
return mat;
}

View file

@ -2,6 +2,7 @@
#include "r_data/matrix.h"
class DFrameBuffer;
enum
{
@ -41,6 +42,6 @@ struct VRMode
VREyeInfo mEyes[2];
static const VRMode *GetVRMode(bool toscreen = true);
void AdjustViewport() const;
void AdjustViewport(DFrameBuffer *fb) const;
VSMatrix GetHUDSpriteProjection() const;
};