Direct3DBase.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #pragma once
  2. #include "DirectXHelper.h"
  3. // Helper class that initializes DirectX APIs for 3D rendering.
  4. ref class Direct3DBase abstract
  5. {
  6. internal : Direct3DBase();
  7. public:
  8. virtual void Initialize(Windows::UI::Core::CoreWindow ^ window);
  9. virtual void HandleDeviceLost();
  10. virtual void CreateDeviceResources();
  11. virtual void CreateWindowSizeDependentResources();
  12. virtual void UpdateForWindowSizeChange();
  13. virtual void ReleaseResourcesForSuspending();
  14. virtual void Render() = 0;
  15. virtual void Present();
  16. virtual float ConvertDipsToPixels(float dips);
  17. protected
  18. private:
  19. // Direct3D Objects.
  20. Microsoft::WRL::ComPtr<ID3D11Device1> m_d3dDevice;
  21. Microsoft::WRL::ComPtr<ID3D11DeviceContext1> m_d3dContext;
  22. Microsoft::WRL::ComPtr<IDXGISwapChain1> m_swapChain;
  23. Microsoft::WRL::ComPtr<ID3D11RenderTargetView> m_renderTargetView;
  24. Microsoft::WRL::ComPtr<ID3D11DepthStencilView> m_depthStencilView;
  25. // Cached renderer properties.
  26. D3D_FEATURE_LEVEL m_featureLevel;
  27. Windows::Foundation::Size m_renderTargetSize;
  28. Windows::Foundation::Rect m_windowBounds;
  29. Platform::Agile<Windows::UI::Core::CoreWindow> m_window;
  30. Windows::Graphics::Display::DisplayOrientations m_orientation;
  31. // Transform used for display orientation.
  32. DirectX::XMFLOAT4X4 m_orientationTransform3D;
  33. };