Skip to content

Commit

Permalink
Added RENDER_STEREO_MODE_ANAGLYPH_YELLOW_BLUE implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Ferk committed Feb 21, 2015
1 parent b69ccc8 commit c5b8896
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 11 deletions.
8 changes: 7 additions & 1 deletion language/English/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -15747,7 +15747,13 @@ msgctxt "#36509"
msgid "Monoscopic (2D)"
msgstr ""

#empty strings from id 36510 to 36519
#. name of a stereoscopic mode
#: system/settings/settings.xml
msgctxt "#36510"
msgid "Anaglyph Yellow/Blue"
msgstr ""

#empty strings from id 36511 to 36519
#end of reserved strings for 3d modes

#. Name of a setting, asking the user for the default playback mode (2D, 3D, ask) of stereoscopic videos
Expand Down
4 changes: 2 additions & 2 deletions xbmc/cores/VideoRenderers/MMALRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ void CMMALRenderer::SetVideoRect(const CRect& InSrcRect, const CRect& InDestRect
video_stereo_mode = RENDER_STEREO_MODE_OFF;
display_stereo_mode = RENDER_STEREO_MODE_OFF;
}
else if (display_stereo_mode == RENDER_STEREO_MODE_ANAGLYPH_RED_CYAN || display_stereo_mode == RENDER_STEREO_MODE_ANAGLYPH_GREEN_MAGENTA)
else if (display_stereo_mode == RENDER_STEREO_MODE_ANAGLYPH_RED_CYAN || display_stereo_mode == RENDER_STEREO_MODE_ANAGLYPH_GREEN_MAGENTA || display_stereo_mode == RENDER_STEREO_MODE_ANAGLYPH_YELLOW_BLUE)
{
SrcRect.x2 *= 2.0f;
}
Expand All @@ -607,7 +607,7 @@ void CMMALRenderer::SetVideoRect(const CRect& InSrcRect, const CRect& InDestRect
video_stereo_mode = RENDER_STEREO_MODE_OFF;
display_stereo_mode = RENDER_STEREO_MODE_OFF;
}
else if (display_stereo_mode == RENDER_STEREO_MODE_ANAGLYPH_RED_CYAN || display_stereo_mode == RENDER_STEREO_MODE_ANAGLYPH_GREEN_MAGENTA)
else if (display_stereo_mode == RENDER_STEREO_MODE_ANAGLYPH_RED_CYAN || display_stereo_mode == RENDER_STEREO_MODE_ANAGLYPH_GREEN_MAGENTA || display_stereo_mode == RENDER_STEREO_MODE_ANAGLYPH_YELLOW_BLUE)
{
SrcRect.y2 *= 2.0f;
}
Expand Down
1 change: 1 addition & 0 deletions xbmc/cores/VideoRenderers/RenderFlags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ namespace RenderManager {
convert["anaglyph_cyan_red"] = 0u;
convert["right_left"] = CONF_FLAGS_STEREO_MODE_SBS | CONF_FLAGS_STEREO_CADANCE_RIGHT_LEFT;
convert["anaglyph_green_magenta"] = 0u;
convert["anaglyph_yellow_blue"] = 0u;
convert["block_lr"] = 0u;
convert["block_rl"] = 0u;
}
Expand Down
6 changes: 4 additions & 2 deletions xbmc/cores/VideoRenderers/WinRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,8 @@ void CWinRenderer::RenderProcessor(DWORD flags)
IDirect3DSurface9* target;
if ( m_bUseHQScaler
|| g_graphicsContext.GetStereoMode() == RENDER_STEREO_MODE_ANAGLYPH_RED_CYAN
|| g_graphicsContext.GetStereoMode() == RENDER_STEREO_MODE_ANAGLYPH_GREEN_MAGENTA)
|| g_graphicsContext.GetStereoMode() == RENDER_STEREO_MODE_ANAGLYPH_GREEN_MAGENTA
|| g_graphicsContext.GetStereoMode() == RENDER_STEREO_MODE_ANAGLYPH_YELLOW_BLUE)
{
m_IntermediateTarget.GetSurfaceLevel(0, &target);
}
Expand Down Expand Up @@ -1107,7 +1108,8 @@ void CWinRenderer::RenderProcessor(DWORD flags)
Stage2();
}
else if ( g_graphicsContext.GetStereoMode() == RENDER_STEREO_MODE_ANAGLYPH_RED_CYAN
|| g_graphicsContext.GetStereoMode() == RENDER_STEREO_MODE_ANAGLYPH_GREEN_MAGENTA)
|| g_graphicsContext.GetStereoMode() == RENDER_STEREO_MODE_ANAGLYPH_GREEN_MAGENTA
|| g_graphicsContext.GetStereoMode() == RENDER_STEREO_MODE_ANAGLYPH_YELLOW_BLUE)
{
IDirect3DDevice9 *pD3DDev = g_Windowing.Get3DDevice();

Expand Down
27 changes: 24 additions & 3 deletions xbmc/guilib/StereoscopicsManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ static const struct StereoModeMap VideoModeToGuiModeMap[] =
{ "col_interleaved_lr", RENDER_STEREO_MODE_OFF }, // unsupported
{ "anaglyph_cyan_red", RENDER_STEREO_MODE_ANAGLYPH_RED_CYAN },
{ "anaglyph_green_magenta", RENDER_STEREO_MODE_ANAGLYPH_GREEN_MAGENTA },
{ "anaglyph_yellow_blue", RENDER_STEREO_MODE_ANAGLYPH_YELLOW_BLUE },
{ "block_lr", RENDER_STEREO_MODE_OFF }, // unsupported
{ "block_rl", RENDER_STEREO_MODE_OFF }, // unsupported
{}
Expand All @@ -87,6 +88,7 @@ static const struct StereoModeMap StringToGuiModeMap[] =
{ "interlaced", RENDER_STEREO_MODE_INTERLACED }, // alias
{ "anaglyph_cyan_red", RENDER_STEREO_MODE_ANAGLYPH_RED_CYAN },
{ "anaglyph_green_magenta", RENDER_STEREO_MODE_ANAGLYPH_GREEN_MAGENTA },
{ "anaglyph_yellow_blue", RENDER_STEREO_MODE_ANAGLYPH_YELLOW_BLUE },
{ "hardware_based", RENDER_STEREO_MODE_HARDWAREBASED },
{ "monoscopic", RENDER_STEREO_MODE_MONO },
{}
Expand Down Expand Up @@ -266,9 +268,28 @@ RENDER_STEREO_MODE CStereoscopicsManager::GetStereoModeOfPlayingVideo(void)

const std::string &CStereoscopicsManager::GetLabelForStereoMode(const RENDER_STEREO_MODE &mode) const
{
if (mode == RENDER_STEREO_MODE_AUTO)
return g_localizeStrings.Get(36532);
return g_localizeStrings.Get(36502 + mode);
int msgId;
switch(mode) {
case RENDER_STEREO_MODE_AUTO:
msgId = 36532;
break;
case RENDER_STEREO_MODE_ANAGLYPH_YELLOW_BLUE:
msgId = 36510;
break;
case RENDER_STEREO_MODE_INTERLACED:
msgId = 36507;
break;
case RENDER_STEREO_MODE_HARDWAREBASED:
msgId = 36508;
break;
case RENDER_STEREO_MODE_MONO:
msgId = 36509;
break;
default:
msgId = 36502 + mode;
}

return g_localizeStrings.Get(msgId);
}

RENDER_STEREO_MODE CStereoscopicsManager::GetPreferredPlaybackMode(void)
Expand Down
2 changes: 1 addition & 1 deletion xbmc/interfaces/Builtins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ const BUILT_IN commands[] = {
#if defined(TARGET_ANDROID)
{ "StartAndroidActivity", true, "Launch an Android native app with the given package name. Optional parms (in order): intent, dataType, dataURI." },
#endif
{ "SetStereoMode", true, "Changes the stereo mode of the GUI. Params can be: toggle, next, previous, select, tomono or any of the supported stereomodes (off, split_vertical, split_horizontal, row_interleaved, hardware_based, anaglyph_cyan_red, anaglyph_green_magenta, monoscopic)" }
{ "SetStereoMode", true, "Changes the stereo mode of the GUI. Params can be: toggle, next, previous, select, tomono or any of the supported stereomodes (off, split_vertical, split_horizontal, row_interleaved, hardware_based, anaglyph_cyan_red, anaglyph_green_magenta, anaglyph_yellow_blue, monoscopic)" }
};

bool CBuiltins::HasCommand(const std::string& execString)
Expand Down
2 changes: 1 addition & 1 deletion xbmc/interfaces/json-rpc/schema/types.json
Original file line number Diff line number Diff line change
Expand Up @@ -1390,7 +1390,7 @@
"GUI.Stereoscopy.Mode": {
"type": "object",
"properties": {
"mode": { "type": "string", "required": true, "enum": [ "off", "split_vertical", "split_horizontal", "row_interleaved", "hardware_based", "anaglyph_cyan_red", "anaglyph_green_magenta", "monoscopic" ] },
"mode": { "type": "string", "required": true, "enum": [ "off", "split_vertical", "split_horizontal", "row_interleaved", "hardware_based", "anaglyph_cyan_red", "anaglyph_green_magenta", "anaglyph_yellow_blue", "monoscopic" ] },
"label": { "type": "string", "required": true }
}
},
Expand Down
1 change: 1 addition & 0 deletions xbmc/rendering/RenderSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ enum RENDER_STEREO_MODE
RENDER_STEREO_MODE_SPLIT_VERTICAL,
RENDER_STEREO_MODE_ANAGLYPH_RED_CYAN,
RENDER_STEREO_MODE_ANAGLYPH_GREEN_MAGENTA,
RENDER_STEREO_MODE_ANAGLYPH_YELLOW_BLUE,
RENDER_STEREO_MODE_INTERLACED,
RENDER_STEREO_MODE_HARDWAREBASED,
RENDER_STEREO_MODE_MONO,
Expand Down
11 changes: 10 additions & 1 deletion xbmc/rendering/dx/RenderSystemDX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,8 @@ bool CRenderSystemDX::ClearBuffers(color_t color)
return false;

if(m_stereoMode == RENDER_STEREO_MODE_ANAGLYPH_RED_CYAN
|| m_stereoMode == RENDER_STEREO_MODE_ANAGLYPH_GREEN_MAGENTA)
|| m_stereoMode == RENDER_STEREO_MODE_ANAGLYPH_GREEN_MAGENTA
|| m_stereoMode == RENDER_STEREO_MODE_ANAGLYPH_YELLOW_BLUE)
{
// if stereo anaglyph, data was cleared when left view was rendererd
if(m_stereoView == RENDER_STEREO_VIEW_RIGHT)
Expand Down Expand Up @@ -1031,6 +1032,13 @@ void CRenderSystemDX::SetStereoMode(RENDER_STEREO_MODE mode, RENDER_STEREO_VIEW
else if(m_stereoView == RENDER_STEREO_VIEW_RIGHT)
m_pD3DDevice->SetRenderState( D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_BLUE | D3DCOLORWRITEENABLE_RED );
}
if(m_stereoMode == RENDER_STEREO_MODE_ANAGLYPH_YELLOW_BLUE)
{
if(m_stereoView == RENDER_STEREO_VIEW_LEFT)
m_pD3DDevice->SetRenderState( D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_RED | D3DCOLORWRITEENABLE_GREEN);
else if(m_stereoView == RENDER_STEREO_VIEW_RIGHT)
m_pD3DDevice->SetRenderState( D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_BLUE);
}
}

bool CRenderSystemDX::SupportsStereo(RENDER_STEREO_MODE mode) const
Expand All @@ -1039,6 +1047,7 @@ bool CRenderSystemDX::SupportsStereo(RENDER_STEREO_MODE mode) const
{
case RENDER_STEREO_MODE_ANAGLYPH_RED_CYAN:
case RENDER_STEREO_MODE_ANAGLYPH_GREEN_MAGENTA:
case RENDER_STEREO_MODE_ANAGLYPH_YELLOW_BLUE:
return true;
default:
return CRenderSystemBase::SupportsStereo(mode);
Expand Down
8 changes: 8 additions & 0 deletions xbmc/rendering/gl/RenderSystemGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,13 @@ void CRenderSystemGL::SetStereoMode(RENDER_STEREO_MODE mode, RENDER_STEREO_VIEW
else if(m_stereoView == RENDER_STEREO_VIEW_RIGHT)
glColorMask(GL_TRUE, GL_FALSE, GL_TRUE, GL_TRUE);
}
if(m_stereoMode == RENDER_STEREO_MODE_ANAGLYPH_YELLOW_BLUE)
{
if(m_stereoView == RENDER_STEREO_VIEW_LEFT)
glColorMask(GL_TRUE, GL_TRUE, GL_FALSE, GL_TRUE);
else if(m_stereoView == RENDER_STEREO_VIEW_RIGHT)
glColorMask(GL_FALSE, GL_FALSE, GL_TRUE, GL_TRUE);
}

if(m_stereoMode == RENDER_STEREO_MODE_INTERLACED)
{
Expand All @@ -698,6 +705,7 @@ bool CRenderSystemGL::SupportsStereo(RENDER_STEREO_MODE mode)
{
case RENDER_STEREO_MODE_ANAGLYPH_RED_CYAN:
case RENDER_STEREO_MODE_ANAGLYPH_GREEN_MAGENTA:
case RENDER_STEREO_MODE_ANAGLYPH_YELLOW_BLUE:
case RENDER_STEREO_MODE_INTERLACED:
return true;
case RENDER_STEREO_MODE_HARDWAREBASED: {
Expand Down

0 comments on commit c5b8896

Please sign in to comment.