Add crossview support (#7361)
authorotdav33 <odavies@dread.life>
Tue, 29 May 2018 16:38:58 +0000 (12:38 -0400)
committerSmallJoker <SmallJoker@users.noreply.github.com>
Tue, 29 May 2018 16:38:58 +0000 (18:38 +0200)
builtin/settingtypes.txt
src/client/render/factory.cpp
src/client/render/sidebyside.cpp
src/client/render/sidebyside.h
src/settings_translation_file.cpp

index 84059c25f82fbd9cfdda9e5ad0772c468d0f444f..51797f7deb9b0dbcc2688975b75e429081b86981 100644 (file)
@@ -621,9 +621,10 @@ fall_bobbing_amount (Fall bobbing factor) float 0.0
 #    -    interlaced: odd/even line based polarisation screen support.
 #    -    topbottom: split screen top/bottom.
 #    -    sidebyside: split screen side by side.
+#    -    crossview: Cross-eyed 3d
 #    -    pageflip: quadbuffer based 3d.
 #    Note that the interlaced mode requires shaders to be enabled.
-3d_mode (3D mode) enum none none,anaglyph,interlaced,topbottom,sidebyside,pageflip
+3d_mode (3D mode) enum none none,anaglyph,interlaced,topbottom,sidebyside,crossview,pageflip
 
 #    In-game chat console height, between 0.1 (10%) and 1.0 (100%).
 console_height (Console height) float 0.6 0.1 1.0
index 410ceaad7185dbe39571c4cf43ed4ce760252e61..3aabc5db917ec0aa36803de249f88c3945f4c8ff 100644 (file)
@@ -41,5 +41,7 @@ RenderingCore *createRenderingCore(const std::string &stereo_mode, IrrlichtDevic
                return new RenderingCoreSideBySide(device, client, hud);
        if (stereo_mode == "topbottom")
                return new RenderingCoreSideBySide(device, client, hud, true);
+       if (stereo_mode == "crossview")
+               return new RenderingCoreSideBySide(device, client, hud, false, true);
        throw std::invalid_argument("Invalid rendering mode: " + stereo_mode);
 }
index 9b1e06d4ada1b65b030b1985c3879220631f3bf0..ed08810db2627f968b9e9be6aa8051472597d296 100644 (file)
@@ -23,8 +23,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "client/hud.h"
 
 RenderingCoreSideBySide::RenderingCoreSideBySide(
-       IrrlichtDevice *_device, Client *_client, Hud *_hud, bool _horizontal)
-       : RenderingCoreStereo(_device, _client, _hud), horizontal(_horizontal)
+       IrrlichtDevice *_device, Client *_client, Hud *_hud, bool _horizontal, bool _flipped)
+       : RenderingCoreStereo(_device, _client, _hud), horizontal(_horizontal), flipped(_flipped)
 {
 }
 
@@ -62,7 +62,7 @@ void RenderingCoreSideBySide::drawAll()
 void RenderingCoreSideBySide::useEye(bool _right)
 {
        driver->setRenderTarget(_right ? right : left, true, true, skycolor);
-       RenderingCoreStereo::useEye(_right);
+       RenderingCoreStereo::useEye(_right ^ flipped);
 }
 
 void RenderingCoreSideBySide::resetEye()
index b5cf9d5db3c1a4b14ee73c7833579ca0cb441458..f8ed256b3aefd1a86e9c0187dad433e5285b7285 100644 (file)
@@ -27,6 +27,7 @@ protected:
        video::ITexture *left = nullptr;
        video::ITexture *right = nullptr;
        bool horizontal = false;
+       bool flipped = false;
        core::dimension2du image_size;
        v2s32 rpos;
 
@@ -37,6 +38,6 @@ protected:
 
 public:
        RenderingCoreSideBySide(IrrlichtDevice *_device, Client *_client, Hud *_hud,
-                       bool _horizontal = false);
+                       bool _horizontal = false, bool _flipped = false);
        void drawAll() override;
 };
index ec0c0db6ba01ca5697f53498142a742faee27fab..f94bfb3f2f76f881d97c0dbcd9c40567c6b046d5 100644 (file)
@@ -286,7 +286,7 @@ fake_function() {
        gettext("Fall bobbing factor");
        gettext("Multiplier for fall bobbing.\nFor example: 0 for no view bobbing; 1.0 for normal; 2.0 for double.");
        gettext("3D mode");
-       gettext("3D support.\nCurrently supported:\n-    none: no 3d output.\n-    anaglyph: cyan/magenta color 3d.\n-    interlaced: odd/even line based polarisation screen support.\n-    topbottom: split screen top/bottom.\n-    sidebyside: split screen side by side.\n-    pageflip: quadbuffer based 3d.\nNote that the interlaced mode requires shaders to be enabled.");
+       gettext("3D support.\nCurrently supported:\n-    none: no 3d output.\n-    anaglyph: cyan/magenta color 3d.\n-    interlaced: odd/even line based polarisation screen support.\n-    topbottom: split screen top/bottom.\n-    sidebyside: split screen side by side.\n-    crossview: cross-eyed 3d viewing.\n-    pageflip: quadbuffer based 3d.\nNote that the interlaced mode requires shaders to be enabled.");
        gettext("Console height");
        gettext("In-game chat console height, between 0.1 (10%) and 1.0 (100%).");
        gettext("Console color");