1#pragma once 2 3#include "DirectXHelper.h" 4 5// Helper class that initializes DirectX APIs for 3D rendering. 6ref class Direct3DBase abstract 7{ 8internal: 9 Direct3DBase(); 10 11public: 12 virtual void Initialize(); 13 virtual void CreateDeviceResources(); 14 virtual void CreateWindowSizeDependentResources(); 15 virtual void UpdateForRenderResolutionChange(float width, float height); 16 virtual void UpdateForWindowSizeChange(float width, float height); 17 virtual void Render() = 0; 18 19internal: 20 virtual ID3D11Texture2D* GetTexture() 21 { 22 return m_renderTarget.Get(); 23 } 24 25protected private: 26 // Direct3D Objects. 27 Microsoft::WRL::ComPtr<ID3D11Device1> m_d3dDevice; 28 Microsoft::WRL::ComPtr<ID3D11DeviceContext1> m_d3dContext; 29 Microsoft::WRL::ComPtr<ID3D11Texture2D> m_renderTarget; 30 Microsoft::WRL::ComPtr<ID3D11RenderTargetView> m_renderTargetView; 31 Microsoft::WRL::ComPtr<ID3D11DepthStencilView> m_depthStencilView; 32 33 // Cached renderer properties. 34 D3D_FEATURE_LEVEL m_featureLevel; 35 Windows::Foundation::Size m_renderTargetSize; 36 Windows::Foundation::Rect m_windowBounds; 37};