/// <summary> /// Set the ME's or SSME's shader effect and chooses a scaling factor. /// </summary> private void SetShaderEffect() { if (activeMediaPlugin != null && activeMediaPlugin.VisualElement != null && validPropertiesForAnaglyph && pluginIsEnabled) { switch (ActiveDisplayMechanism) { case AnaglyphDisplayMechanism.None: activeMediaPlugin.VisualElement.Effect = null; XFactor = 1.0; YFactor = 1.0; break; case AnaglyphDisplayMechanism.AnaglyphLeftOnly: if (smfPlayer.CurrentPlaylistItem.S3DProperties.S3DFormat == S3D_Formats.TopAndBottom) { activeMediaPlugin.VisualElement.Effect = null; //Scale vertically by the Pixel Aspect Ratio (PAR) XFactor = 1.0; YFactor = smfPlayer.CurrentPlaylistItem.S3DProperties.S3DLeftEyePAR; } else { activeMediaPlugin.VisualElement.Effect = null; //Scale horizontally by the Pixel Aspect Ratio (PAR) XFactor = smfPlayer.CurrentPlaylistItem.S3DProperties.S3DLeftEyePAR; YFactor = 1.0; } break; case AnaglyphDisplayMechanism.AnaglyphGrayRedCyan: GrayAnaglyphRedCyan grayAnaglyphRedCyan = new GrayAnaglyphRedCyan(); //Passing in the eye priority as a double. It's formatted as a double rather //than a bool as that's the parameter format the pixel shader supports grayAnaglyphRedCyan.LeftEyeHasPriority = (smfPlayer.CurrentPlaylistItem.S3DProperties.S3DEyePriority == S3D_EyePriorities.LeftFirst) ? 1.0 : 0.0; if (smfPlayer.CurrentPlaylistItem.S3DProperties.S3DFormat == S3D_Formats.TopAndBottom) { //Since we're using the "Top and Bottom" format, we'll set the //"SideBySide" property to "0.0" (false). It's formatted as a double rather //than a bool as that's the parameter format the pixel shader supports grayAnaglyphRedCyan.SideBySide = 0.0; activeMediaPlugin.VisualElement.Effect = grayAnaglyphRedCyan; //Scale vertically by the Pixel Aspect Ratio (PAR) XFactor = 1.0; YFactor = smfPlayer.CurrentPlaylistItem.S3DProperties.S3DLeftEyePAR; } else { //Since we're using the "SideBySide" format, we'll set the //"SideBySide" property to "1.0" (true). It's formatted as a double rather //than a bool as that's the parameter format the pixel shader supports grayAnaglyphRedCyan.SideBySide = 1.0; activeMediaPlugin.VisualElement.Effect = grayAnaglyphRedCyan; //Scale horizontally by the Pixel Aspect Ratio (PAR) XFactor = smfPlayer.CurrentPlaylistItem.S3DProperties.S3DLeftEyePAR; YFactor = 1.0; } break; case AnaglyphDisplayMechanism.AnaglyphHalfColorRedCyan: HalfColorRedCyanAnaglyph halfColorRedCyanAnaglyph = new HalfColorRedCyanAnaglyph(); //Passing in the eye priority as a double. It's formatted as a double rather //than a bool as that's the parameter format the pixel shader supports halfColorRedCyanAnaglyph.LeftEyeHasPriority = (smfPlayer.CurrentPlaylistItem.S3DProperties.S3DEyePriority == S3D_EyePriorities.LeftFirst) ? 1.0 : 0.0; if (smfPlayer.CurrentPlaylistItem.S3DProperties.S3DFormat == S3D_Formats.TopAndBottom) { //Since we're using the "Top and Bottom" format, we'll set the //"SideBySide" property to "0.0" (false). It's formatted as a double rather //than a bool as that's the parameter format the pixel shader supports halfColorRedCyanAnaglyph.SideBySide = 0.0; activeMediaPlugin.VisualElement.Effect = halfColorRedCyanAnaglyph; //Scale vertically by the Pixel Aspect Ratio (PAR) XFactor = 1.0; YFactor = smfPlayer.CurrentPlaylistItem.S3DProperties.S3DLeftEyePAR; } else { //Since we're using the "SideBySide" format, we'll set the //"SideBySide" property to "1.0" (true). It's formatted as a double rather //than a bool as that's the parameter format the pixel shader supports halfColorRedCyanAnaglyph.SideBySide = 1.0; activeMediaPlugin.VisualElement.Effect = halfColorRedCyanAnaglyph; //Scale horizontally by the Pixel Aspect Ratio (PAR) XFactor = smfPlayer.CurrentPlaylistItem.S3DProperties.S3DLeftEyePAR; YFactor = 1.0; } break; } } }