From a5c27af59bd902b53fb8d560b17738ecfe674ae1 Mon Sep 17 00:00:00 2001 From: Christopher Bruns Date: Mon, 19 Sep 2016 20:06:52 -0400 Subject: [PATCH] Show weapon at full width in SideBySideFull 3D mode. (cherry picked from commit c42e98c0042937adc05c1f1569d909d58a5b8ffb) --- src/gl/scene/gl_scene.cpp | 5 ++++- src/gl/stereo3d/gl_sidebyside3d.cpp | 10 ++++++++++ src/gl/stereo3d/gl_sidebyside3d.h | 1 + src/gl/stereo3d/gl_stereo3d.h | 2 ++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/gl/scene/gl_scene.cpp b/src/gl/scene/gl_scene.cpp index 6ddd12a1f..425841333 100644 --- a/src/gl/scene/gl_scene.cpp +++ b/src/gl/scene/gl_scene.cpp @@ -660,6 +660,9 @@ void FGLRenderer::EndDrawScene(sector_t * viewsector) framebuffer->Begin2D(false); Reset3DViewport(); + + s3d::Stereo3DMode::getCurrentMode().AdjustPlayerSprites(); + // [BB] Only draw the sprites if we didn't render a HUD model before. if ( renderHUDModel == false ) { @@ -820,7 +823,7 @@ sector_t * FGLRenderer::RenderViewpoint (AActor * camera, GL_IRECT * bounds, flo clipper.SafeAddClipRangeRealAngles(ViewAngle.BAMs() + a1, ViewAngle.BAMs() - a1); ProcessScene(toscreen); - if (mainview && toscreen) EndDrawScene(lviewsector); // do not call this for camera textures. + if (mainview && toscreen) EndDrawScene(lviewsector); // do not call this for camera textures. if (mainview && FGLRenderBuffers::IsEnabled()) { mBuffers->BlitSceneToTexture(); diff --git a/src/gl/stereo3d/gl_sidebyside3d.cpp b/src/gl/stereo3d/gl_sidebyside3d.cpp index 57fc8aac9..c6463d2c8 100644 --- a/src/gl/stereo3d/gl_sidebyside3d.cpp +++ b/src/gl/stereo3d/gl_sidebyside3d.cpp @@ -98,4 +98,14 @@ SideBySideFull::SideBySideFull(double ipdMeters) eye_ptrs.Push(&rightEye); } +/* virtual */ +void SideBySideFull::AdjustPlayerSprites() const /* override */ +{ + // Show weapon at double width, so it would appear normal width after rescaling + int w = GLRenderer->mScreenViewport.width; + int h = GLRenderer->mScreenViewport.height; + gl_RenderState.mProjectionMatrix.ortho(w/2, w + w/2, h, 0, -1.0f, 1.0f); + gl_RenderState.ApplyMatrices(); +} + } /* namespace s3d */ diff --git a/src/gl/stereo3d/gl_sidebyside3d.h b/src/gl/stereo3d/gl_sidebyside3d.h index 68ce88f6a..374f255c5 100644 --- a/src/gl/stereo3d/gl_sidebyside3d.h +++ b/src/gl/stereo3d/gl_sidebyside3d.h @@ -82,6 +82,7 @@ class SideBySideFull : public SideBySideBase public: static const SideBySideFull& getInstance(float ipd); SideBySideFull(double ipdMeters); + virtual void AdjustPlayerSprites() const override; private: SBSFLeftEyePose leftEye; SBSFRightEyePose rightEye; diff --git a/src/gl/stereo3d/gl_stereo3d.h b/src/gl/stereo3d/gl_stereo3d.h index 747bcd0c0..c55154e51 100644 --- a/src/gl/stereo3d/gl_stereo3d.h +++ b/src/gl/stereo3d/gl_stereo3d.h @@ -58,6 +58,7 @@ public: virtual void GetViewShift(float yaw, float outViewShift[3]) const; virtual void SetUp() const {}; virtual void TearDown() const {}; + // virtual void EndDrawScene(sector_t * viewsector) const {GLRenderer->EndDrawScene(viewsector);}; }; @@ -80,6 +81,7 @@ public: virtual bool IsMono() const { return false; } virtual void AdjustViewports() const {}; + virtual void AdjustPlayerSprites() const {}; virtual void Present() const = 0; protected: