Exemple #1
0
        public void Shutdown()
        {
            //_TextureShader?.Shutdown();
            //_TextureShader = null;


            //_DebugWindow?.Shutdown();
            //_DebugWindow = null;

            //_RenderTexture?.Shutdown();
            //_RenderTexture = null;

            _Data = null;
            _Data = null;

            _DataHeader = null;
            _DataHeader = null;

            CpuUsage_?.Shutdown();
            CpuUsage_ = null;



            _AxisMini?.Shutdown();
            _AxisMini = null;

            FontShader_?.Shutdown();
            FontShader_ = null;

            //_Cpu?.Shutdown();
            //_Cpu = null;

            //_Fps = null;

            _Position = null;

            _Timer = null;

            _ColorShader?.Shutdown();
            _ColorShader = null;

            _Camera = null;

            _Direct3D?.Shutdown();
            _Direct3D = null;

            _Input?.Shutdown();
            _Input = null;

            ShutdownButtons();
            return;
        }
Exemple #2
0
        private bool RenderSceneToFile()
        {
            var direct3D = new D3DX();

            if (!direct3D.Initialize(SaveWidth, SaveHeight, VSYNC_ENABLED, _hwnd, FULL_SCREEN, SCREEN_DEPTH, SCREEN_NEAR))
            {
                MessageBox.Show("Could not initialize DirectX 11.", "Error", MessageBoxButtons.OK);
                return(false);
            }

            var colorShader = new ColorShader();

            if (!colorShader.Initialize(direct3D.Device))
            {
                MessageBox.Show("Could not initialize the color shader object.", "Error", MessageBoxButtons.OK);
                return(false);
            }

            var monocolorShader = new MonocolorShader();

            if (!monocolorShader.Initialize(direct3D.Device))
            {
                MessageBox.Show("Could not initialize the monocolor shader object.", "Error", MessageBoxButtons.OK);
                return(false);
            }

            var graph = new Graph(in this.graph, direct3D.Device);


            direct3D.SetBackBufferRenderTarget();
            direct3D.BeginScene(BackgroundColour);
            #region Render
            _Camera.Render();

            var worldMatrix      = direct3D.WorldMatrix;
            var viewMatrix       = _Camera._viewMatrix;
            var projectionMatrix = direct3D.ProjectionMatrix;

            var rotation = _Camera.Rotation;

            direct3D.TurnOnAlphaBlending();

            if (!graph.Render(direct3D, colorShader, monocolorShader, worldMatrix, viewMatrix, projectionMatrix, rotation))
            {
                return(false);
            }
            #endregion
            SaveToFile(direct3D, direct3D.BackBuffer, SharpDX.WIC.PixelFormat.Format32bppRGB);

            graph.Dispose();
            colorShader.Shutdown();
            monocolorShader.Shutdown();
            direct3D.Shutdown();
            return(true);
        }