Exemplo n.º 1
0
        private void Draw()
        {
            Debug.Assert(_window.Exists);
            int width  = _window.Width;
            int height = _window.Height;

            if (_windowResized)
            {
                _windowResized = false;
                _gd.ResizeMainWindow((uint)width, (uint)height);
                _scene.Camera.WindowResized(width, height);
                _resizeHandled?.Invoke(width, height);
                CommandList cl = _gd.ResourceFactory.CreateCommandList();
                cl.Begin();
                _sc.RecreateWindowSizedResources(_gd, cl);
                cl.End();
                _gd.ExecuteCommands(cl);
                cl.Dispose();
            }

            if (_newSampleCount != null)
            {
                _sc.MainSceneSampleCount = _newSampleCount.Value;
                _newSampleCount          = null;
                DestroyAllObjects();
                CreateAllObjects();
            }

            _frameCommands.Begin();

            CommonMaterials.FlushAll(_frameCommands);

            _scene.RenderAllStages(_gd, _frameCommands, _sc);
            _gd.SwapBuffers();
        }
Exemplo n.º 2
0
        private void Draw()
        {
            Debug.Assert(_window.Exists);
            int width  = _window.Width;
            int height = _window.Height;

            if (_windowResized)
            {
                _windowResized = false;
                _gd.ResizeMainWindow((uint)width, (uint)height);
                _scene.Camera.WindowResized(width, height);
                _resizeHandled?.Invoke(width, height);
            }

            _frameCommands.Begin();
            CommonMaterials.FlushAll(_frameCommands);
            _sc.UpdateCameraBuffers(_frameCommands); // Meh

            _scene.RenderAllStages(_gd, _frameCommands, _sc);
            _frameCommands.End();
            _gd.ExecuteCommands(_frameCommands);
            _gd.SwapBuffers();
        }