コード例 #1
0
ファイル: ImageViewer.xaml.cs プロジェクト: Mokry667/Uroboros
        private void fullScreen_Click(object sender, RoutedEventArgs e)
        {
            //FullScreenWindow newWindow = new FullScreenWindow(image);
            FullScreenWindow newWindow = new FullScreenWindow(filename);

            newWindow.Show();
        }
コード例 #2
0
        public void Shutdown()
        {
            // Release the light object.
            Light = null;
            // Release the camera object.
            Camera = null;

            // Release the light shader object.
            LightShader?.ShutDown();
            LightShader = null;
            // Release the deferred shader object.
            DeferredShader?.ShutDown();
            DeferredShader = null;
            // Release the deferred buffers object.
            DeferredBuffers?.Shutdown();
            DeferredBuffers = null;
            // Release the full screen ortho window object.
            FullScreenWindow?.Shutdown();
            FullScreenWindow = null;
            // Release the tree object.
            Model?.Shutdown();
            Model = null;
            // Release the input object.
            Input?.Shutdown();
            Input = null;
            // Release the Direct3D object.
            D3D?.ShutDown();
            D3D = null;
        }
コード例 #3
0
        private bool Render2DTextureScene()
        {
            // Clear the buffers to begin the scene.
            D3D.BeginScene(1.0f, 0.0f, 0.0f, 0.0f);

            // Generate the view matrix based on the camera's position.
            Camera.Render();

            // Get the world, view, and ortho matrices from the camera and d3d objects.
            Matrix worldMatrix = D3D.WorldMatrix;
            Matrix viewMatrix  = Camera.ViewMatrix;
            Matrix orthoMatrix = D3D.OrthoMatrix;

            // Turn off the Z buffer to begin all 2D rendering.
            D3D.TurnZBufferOff();

            // Put the full screen ortho window vertex and index buffers on the graphics pipeline to prepare them for drawing.
            FullScreenWindow.Render(D3D.DeviceContext);

            // Render the full screen ortho window using the texture shader and the full screen sized blurred render to texture resource.
            if (!TextureShader.Render(D3D.DeviceContext, FullScreenWindow.IndexCount, worldMatrix, viewMatrix, orthoMatrix, UpSampleTexure.ShaderResourceView))
            {
                return(false);
            }

            // Turn the Z buffer back on now that all 2D rendering has completed.
            D3D.TurnZBufferOn();

            // Present the rendered scene to the screen.
            D3D.EndScene();

            return(true);
        }
コード例 #4
0
        public void Shutdown()
        {
            // Release the camera object.
            Camera = null;

            // Release the glow shader object.
            GlowShader?.ShutDown();
            GlowShader = null;
            // Release the glow map shader object.
            GlowMapShader?.ShutDown();
            GlowMapShader = null;
            // Release the full screen ortho window object.
            FullScreenWindow?.Shutdown();
            FullScreenWindow = null;
            // Release the small ortho window object.
            SmallWindow?.Shutdown();
            SmallWindow = null;
            // Release the up sample render to texture object.
            UpSampleTexure?.Shutdown();
            UpSampleTexure = null;
            // Release the vertical blur render to texture object.
            VerticalBlurTexture?.Shutdown();
            VerticalBlurTexture = null;
            // Release the vertical blur shader object.
            VerticalBlurShader?.ShutDown();
            VerticalBlurShader = null;
            // Release the horizontal blur render to texture object.
            HorizontalBlurTexture?.Shutdown();
            HorizontalBlurTexture = null;
            // Release the horizontal blur shader object.
            HorizontalBlurShader?.ShutDown();
            HorizontalBlurShader = null;
            // Release the small ortho window object.
            SmallWindow?.Shutdown();
            SmallWindow = null;
            // Release the down sample render to texture object.
            DownSampleTexture?.Shutdown();
            DownSampleTexture = null;
            // Release the render to texture object.
            RenderTexture?.Shutdown();
            RenderTexture = null;
            // Release the model object.
            BitMap?.Shutdown();
            BitMap = null;
            // Release the texture shader object.
            TextureShader?.ShutDown();
            TextureShader = null;
            // Release the Direct3D object.
            D3D?.ShutDown();
            D3D = null;
        }
コード例 #5
0
 public void ToFullScreen()
 {
     if (Settings.Instance.UseWindowMode)
     {
         WindowedFullScreenWindow             = new WindowedWindow();
         WindowedFullScreenWindow.DataContext = Video;
         WindowedFullScreenWindow.Show();
     }
     else
     {
         FullScreenWindow             = new FullScreenWindow();
         FullScreenWindow.DataContext = Video;
         FullScreenWindow.Show();
     }
 }
コード例 #6
0
        private bool UpSampleTexture()
        {
            // Set the render target to be the render to texture.
            UpSampleTexure.SetRenderTarget(D3D.DeviceContext);

            // Clear the render to texture.
            UpSampleTexure.ClearRenderTarget(D3D.DeviceContext, 0.0f, 0.0f, 0.0f, 1.0f);

            // Generate the view matrix based on the camera's position.
            Camera.Render();

            // Get the world and view matrices from the camera and d3d objects.
            Matrix cameraViewMatrix = Camera.BaseViewMatrix;
            Matrix worldMatrix      = D3D.WorldMatrix;

            // Get the ortho matrix from the render to texture since texture has different dimensions.
            Matrix orthoMatrix = UpSampleTexure.OrthoMatrix;

            // Turn off the Z buffer to begin all 2D rendering.
            D3D.TurnZBufferOff();

            // Put the full screen ortho window vertex and index buffers on the graphics pipeline to prepare them for drawing.
            if (!FullScreenWindow.Render(D3D.DeviceContext))
            {
                return(false);
            }

            // Render the full screen ortho window using the texture shader and the small sized final blurred render to texture resource.
            if (!TextureShader.Render(D3D.DeviceContext, FullScreenWindow.IndexCount, worldMatrix, cameraViewMatrix, orthoMatrix, VerticalBlurTexture.ShaderResourceView))
            {
                return(false);
            }

            // Turn the Z buffer back on now that all 2D rendering has completed.
            D3D.TurnZBufferOn();

            // Reset the render target back to the original back buffer and not the render to texture anymore.
            D3D.SetBackBufferRenderTarget();

            // Reset the viewport back to the original.
            D3D.ResetViewPort();

            return(true);
        }
コード例 #7
0
        //ウィンドウモードに戻す
        public void ReturnFromFullScreen()
        {
            if (!IsFullScreen)
            {
                return;
            }

            IsFullScreen = false;

            //Flash部分をフルスクリーンウィンドウから消去
            FullScreenWindow.ContentControl.Content = null;

            //ウィンドウを閉じる
            FullScreenWindow.Close();
            App.ViewModelRoot.Visibility = Visibility.Visible;

            //ウィンドウにFlash部分を追加
            Video.Grid.Children.Add(VideoFlash);
        }
コード例 #8
0
        private bool Render()
        {
            // Render the depth of the scene to a texture.
            if (!RenderSceneToTexture())
            {
                return(false);
            }

            // Clear the scene.
            D3D.BeginScene(0.0f, 0.5f, 0.8f, 1.0f);

            // Get the matrices.
            Matrix worldMatrix          = D3D.WorldMatrix;
            Matrix cameraBaseViewMatrix = Camera.BaseViewMatrix;
            Matrix orthoMatrix          = D3D.OrthoMatrix;

            // Turn off the Z buffer to begin all 2D rendering.
            D3D.TurnZBufferOff();

            // Put the full screen ortho window vertex and index buffers on the graphics pipeline to prepare them for drawing.
            if (!FullScreenWindow.Render(D3D.DeviceContext))
            {
                return(false);
            }

            // Render the full screen ortho window using the deferred light shader and the render buffers.
            if (!LightShader.Render(D3D.DeviceContext, FullScreenWindow.IndexCount, worldMatrix, cameraBaseViewMatrix, orthoMatrix, DeferredBuffers.ShaderResourceViewArray[0], DeferredBuffers.ShaderResourceViewArray[1], Light.Direction))
            {
                return(false);
            }

            // Turn the Z buffer back on now that all 2D rendering has completed.
            D3D.TurnZBufferOn();

            // Present the rendered scene to the screen.
            D3D.EndScene();

            return(true);
        }
コード例 #9
0
        public void MoveProtocolHostToFullScreen(string connectionId)
        {
            if (_protocolHosts.ContainsKey(connectionId))
            {
                var host = _protocolHosts[connectionId];

                // remove from old parent
                TabWindow tab = null;
                {
                    var tabs = _tabWindows.Values.Where(x => x.Vm.Items.Any(y => y.Content == host)).ToArray();
                    if (tabs.Length > 0)
                    {
                        tab = tabs.First();
                        foreach (var t in tabs)
                        {
                            var items = t.Vm.Items.ToArray().Where(x => x.Content == host);
                            foreach (var item in items.ToArray())
                            {
                                t.Vm.Items.Remove(item);
                                if (t.Vm.Items.Count > 0)
                                {
                                    t.Vm.SelectedItem = tab.Vm.Items.First();
                                }
                                SimpleLogHelper.Debug($@"Remove host({host.GetHashCode()}) from tab({t.GetHashCode()})");
                            }
                        }
                    }
                }



                FullScreenWindow full;
                if (_host2FullScreenWindows.ContainsKey(connectionId))
                {
                    full = _host2FullScreenWindows[connectionId];
                    full.LastTabToken = "";
                    // full screen placement
                    if (tab != null)
                    {
                        var screenEx = ScreenInfoEx.GetCurrentScreen(tab);
                        full.Top          = screenEx.VirtualWorkingAreaCenter.Y - full.Height / 2;
                        full.Left         = screenEx.VirtualWorkingAreaCenter.X - full.Width / 2;
                        full.LastTabToken = _lastTabToken;
                    }
                    full.Show();
                    full.SetProtocolHost(host);
                    host.ParentWindow = full;
                    host.GoFullScreen();
                }
                else
                {
                    // move to full
                    full = new FullScreenWindow {
                        LastTabToken = ""
                    };

                    // full screen placement
                    ScreenInfoEx screenEx;
                    if (tab != null)
                    {
                        screenEx          = ScreenInfoEx.GetCurrentScreen(tab);
                        full.LastTabToken = _lastTabToken;
                    }
                    else if (host.ProtocolServer is ProtocolServerRDP rdp &&
                             rdp.RdpFullScreenFlag == ERdpFullScreenFlag.EnableFullScreen &&
                             rdp.AutoSetting.FullScreenLastSessionScreenIndex >= 0 &&
                             rdp.AutoSetting.FullScreenLastSessionScreenIndex < Screen.AllScreens.Length)
                    {
                        screenEx = ScreenInfoEx.GetCurrentScreen(rdp.AutoSetting.FullScreenLastSessionScreenIndex);
                    }
                    else
                    {
                        screenEx = ScreenInfoEx.GetCurrentScreen(App.Window);
                    }
                    full.WindowStartupLocation = WindowStartupLocation.Manual;
                    full.Top  = screenEx.VirtualWorkingAreaCenter.Y - full.Height / 2;
                    full.Left = screenEx.VirtualWorkingAreaCenter.X - full.Width / 2;
                    full.SetProtocolHost(host);
                    host.ParentWindow = full;
                    full.Loaded      += (sender, args) => { host.GoFullScreen(); };
                    full.Show();
                    AddFull(full);
                }
コード例 #10
0
 public void AddFull(FullScreenWindow full)
 {
     Debug.Assert(!_host2FullScreenWindows.ContainsKey(full.ProtocolHostBase.ConnectionId));
     _host2FullScreenWindows.Add(full.ProtocolHostBase.ConnectionId, full);
 }
コード例 #11
0
        public void Shutdown()
        {
            // Release the light object.
            Light = null;
            // Release the camera object.
            Camera = null;

            // Release the soft shadow shader object.
            SoftShadowShader?.ShutDown();
            SoftShadowShader = null;
            // Release the full screen ortho window object.
            FullScreenWindow?.Shutdown();
            FullScreenWindow = null;
            // Release the up sample render to texture object.
            UpSampleTexure?.Shutdown();
            UpSampleTexure = null;
            // Release the vertical blur shader object.
            VerticalBlurShader?.ShutDown();
            VerticalBlurShader = null;
            // Release the vertical blur render to texture object.
            VerticalBlurTexture?.Shutdown();
            VerticalBlurTexture = null;
            // Release the horizontal blur shader object.
            HorizontalBlurShader?.ShutDown();
            HorizontalBlurShader = null;
            // Release the horizontal blur render to texture object.
            HorizontalBlurTexture?.Shutdown();
            HorizontalBlurTexture = null;
            // Release the texture shader object.
            TextureShader?.ShutDown();
            TextureShader = null;
            // Release the small ortho window object.
            SmallWindow?.Shutdown();
            SmallWindow = null;
            // Release the down sample render to texture object.
            DownSampleTexure?.Shutdown();
            DownSampleTexure = null;
            // Release the shadow shader object.
            ShadowShader?.ShutDown();
            ShadowShader = null;
            // Release the black and white render to texture.
            BlackWhiteRenderTexture?.Shutdown();
            BlackWhiteRenderTexture = null;
            // Release the depth shader object.
            DepthShader?.ShutDown();
            DepthShader = null;
            /// Release the render to texture object.
            RenderTexture?.Shutdown();
            RenderTexture = null;
            // Release the ground model object.
            GroundModel?.Shutdown();
            GroundModel = null;
            // Release the sphere model object.
            SphereModel?.Shutdown();
            SphereModel = null;
            // Release the cube model object.
            CubeModel?.Shutdown();
            CubeModel = null;
            // Release the Direct3D object.
            D3D?.ShutDown();
            D3D = null;
        }