Direct3DBase.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * Copyright (c) 2014, Oculus VR, Inc.
  3. * All rights reserved.
  4. *
  5. * This source code is licensed under the BSD-style license found in the
  6. * LICENSE file in the root directory of this source tree. An additional grant
  7. * of patent rights can be found in the PATENTS file in the same directory.
  8. *
  9. */
  10. #pragma once
  11. #include "DirectXHelper.h"
  12. // Helper class that initializes DirectX APIs for 3D rendering.
  13. ref class Direct3DBase abstract
  14. {
  15. internal:
  16. Direct3DBase();
  17. public:
  18. virtual void Initialize(Windows::UI::Core::CoreWindow^ window);
  19. virtual void HandleDeviceLost();
  20. virtual void CreateDeviceResources();
  21. virtual void CreateWindowSizeDependentResources();
  22. virtual void UpdateForWindowSizeChange();
  23. virtual void ReleaseResourcesForSuspending();
  24. virtual void Render() = 0;
  25. virtual void Present();
  26. virtual float ConvertDipsToPixels(float dips);
  27. protected private:
  28. // Direct3D Objects.
  29. Microsoft::WRL::ComPtr<ID3D11Device1> m_d3dDevice;
  30. Microsoft::WRL::ComPtr<ID3D11DeviceContext1> m_d3dContext;
  31. Microsoft::WRL::ComPtr<IDXGISwapChain1> m_swapChain;
  32. Microsoft::WRL::ComPtr<ID3D11RenderTargetView> m_renderTargetView;
  33. Microsoft::WRL::ComPtr<ID3D11DepthStencilView> m_depthStencilView;
  34. // Cached renderer properties.
  35. D3D_FEATURE_LEVEL m_featureLevel;
  36. Windows::Foundation::Size m_renderTargetSize;
  37. Windows::Foundation::Rect m_windowBounds;
  38. Platform::Agile<Windows::UI::Core::CoreWindow> m_window;
  39. };
粤ICP备19079148号