Skip to content

Commit

Permalink
Add crossview support (#7361)
Browse files Browse the repository at this point in the history
  • Loading branch information
otdav33 authored and SmallJoker committed May 29, 2018
1 parent 7f7678e commit 3f0720e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
3 changes: 2 additions & 1 deletion builtin/settingtypes.txt
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/client/render/factory.cpp
Expand Up @@ -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);
}
6 changes: 3 additions & 3 deletions src/client/render/sidebyside.cpp
Expand Up @@ -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)
{
}

Expand Down Expand Up @@ -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()
Expand Down
3 changes: 2 additions & 1 deletion src/client/render/sidebyside.h
Expand Up @@ -27,6 +27,7 @@ class RenderingCoreSideBySide : public RenderingCoreStereo
video::ITexture *left = nullptr;
video::ITexture *right = nullptr;
bool horizontal = false;
bool flipped = false;
core::dimension2du image_size;
v2s32 rpos;

Expand All @@ -37,6 +38,6 @@ class RenderingCoreSideBySide : public RenderingCoreStereo

public:
RenderingCoreSideBySide(IrrlichtDevice *_device, Client *_client, Hud *_hud,
bool _horizontal = false);
bool _horizontal = false, bool _flipped = false);
void drawAll() override;
};
2 changes: 1 addition & 1 deletion src/settings_translation_file.cpp
Expand Up @@ -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");
Expand Down

0 comments on commit 3f0720e

Please sign in to comment.