Exemplo n.º 1
0
        private void Refresh()
        {
            if (_backBufferPointer == IntPtr.Zero)
            {
                return;
            }

            D3DImageSource.Lock();

            // Calling SetBackBuffer repeatedly with the same IntPtr is a no-op, so there's no
            // performance penalty.
            D3DImageSource.SetBackBuffer(D3DResourceType.IDirect3DSurface9, _backBufferPointer, true);

            ModelEditorViewModel vm = (ModelEditorViewModel)DataContext;

            _renderer.Render(vm.RenderParameters);

            D3DImageSource.AddDirtyRect(new Int32Rect(0, 0, (int)ActualWidth, (int)ActualHeight));
            D3DImageSource.Unlock();
        }
Exemplo n.º 2
0
        private void Refresh()
        {
            if (_backBufferPointer == IntPtr.Zero)
            {
                return;
            }

            D3DImageSource.Lock();

            // Calling SetBackBuffer repeatedly with the same IntPtr is a no-op, so there's no
            // performance penalty.
            D3DImageSource.SetBackBuffer(D3DResourceType.IDirect3DSurface9, _backBufferPointer);

            if (D3DImageSource.IsFrontBufferAvailable)
            {
                Render();
            }

            D3DImageSource.AddDirtyRect(new Int32Rect(0, 0, (int)ActualWidth, (int)ActualHeight));
            D3DImageSource.Unlock();
        }