private void DisposeCurrentVirtualRealityProvider() { if (_splitScreenVirtualRealityProvider != null) { _splitScreenVirtualRealityProvider.Dispose(); _splitScreenVirtualRealityProvider = null; } if (_anaglyphVirtualRealityProvider != null) { _anaglyphVirtualRealityProvider.Dispose(); _anaglyphVirtualRealityProvider = null; } }
private void InitializeSplitScreenVirtualRealityProvider() { DisposeCurrentVirtualRealityProvider(); _splitScreenVirtualRealityProvider = new SplitScreenVirtualRealityProvider(eyeSeparation: 0.07f, // 70 mm parallax: 0.6f, splitScreen: SplitScreenVirtualRealityProvider.SplitScreenType.SideBySide); _splitScreenVirtualRealityProvider.ImagesSeparationDistance = 42; // Based on observations, the 42 works best for 3D TV (this value might be different for your 3D TV; see comments in the (i) info icon) UpdateSeparationDistanceText(); TitleTextBlock.Text = "Split screen stereoscopic rendering for 3D TV"; ProviderSettingsTextBlock.Text = "Split type:"; ProviderSettingsComboBox.Items.Clear(); ProviderSettingsComboBox.Items.Add(new ComboBoxItem() { Content = "Side by side (vertical)", Tag = SplitScreenVirtualRealityProvider.SplitScreenType.SideBySide }); ProviderSettingsComboBox.Items.Add(new ComboBoxItem() { Content = "Top and bottom (horizontal)", Tag = SplitScreenVirtualRealityProvider.SplitScreenType.TopAndBottom }); ProviderSettingsComboBox.SelectedIndex = 0; _currentVirtualRealityProvider = _splitScreenVirtualRealityProvider; if (MainDXViewportView.DXScene != null && MainDXViewportView.UsedGraphicsProfile.DriverType != GraphicsProfile.DriverTypes.Wpf3D) { MainDXViewportView.DXScene.InitializeVirtualRealityRendering(_currentVirtualRealityProvider); } _providerSettingsChangedAction = delegate(ComboBoxItem selectedItem) { if (selectedItem.Tag is SplitScreenVirtualRealityProvider.SplitScreenType) { var splitScreenType = (SplitScreenVirtualRealityProvider.SplitScreenType)selectedItem.Tag; _splitScreenVirtualRealityProvider.SplitScreen = splitScreenType; // When the split screen type is changed from SideBySide to TopAndBottom, // we should divide the current ImagesSeparationDistance by two. // Similarity, we need to duplicate the ImagesSeparationDistance when changed from TopAndBottom to SideBySide if (splitScreenType == SplitScreenVirtualRealityProvider.SplitScreenType.TopAndBottom) { _splitScreenVirtualRealityProvider.ImagesSeparationDistance = (int)(_splitScreenVirtualRealityProvider.ImagesSeparationDistance / 2); } else { _splitScreenVirtualRealityProvider.ImagesSeparationDistance = 2 * _splitScreenVirtualRealityProvider.ImagesSeparationDistance; } UpdateSeparationDistanceText(); } }; SeparationDistancePanel.Visibility = Visibility.Visible; }