Direct3DBase.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  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:
  7. Direct3DBase();
  8. public:
  9. virtual void Initialize();
  10. virtual void CreateDeviceResources();
  11. virtual void CreateWindowSizeDependentResources();
  12. virtual void UpdateForRenderResolutionChange(float width, float height);
  13. virtual void UpdateForWindowSizeChange(float width, float height);
  14. virtual void Render() = 0;
  15. internal:
  16. virtual ID3D11Texture2D* GetTexture()
  17. {
  18. return m_renderTarget.Get();
  19. }
  20. protected private:
  21. // Direct3D Objects.
  22. Microsoft::WRL::ComPtr<ID3D11Device1> m_d3dDevice;
  23. Microsoft::WRL::ComPtr<ID3D11DeviceContext1> m_d3dContext;
  24. Microsoft::WRL::ComPtr<ID3D11Texture2D> m_renderTarget;
  25. Microsoft::WRL::ComPtr<ID3D11RenderTargetView> m_renderTargetView;
  26. Microsoft::WRL::ComPtr<ID3D11DepthStencilView> m_depthStencilView;
  27. // Cached renderer properties.
  28. D3D_FEATURE_LEVEL m_featureLevel;
  29. Windows::Foundation::Size m_renderTargetSize;
  30. Windows::Foundation::Rect m_windowBounds;
  31. };