#pragma once #include #include #include #include namespace wrl = Microsoft::WRL; class Graphics { friend class Bindable; public: // 构造函数 Graphics(HWND hWnd); // 单例设计模式,禁止复制 Graphics(const Graphics&) = delete; Graphics& operator=(const Graphics&) = delete; ~Graphics() = default; // 初始化3大件,Device/SwapChain/deviceContext void InitD3D(HWND hWnd); void RendorFrame(void); void EndFrame(void); //void DrawTestTriangle(float angle, float x, float y); void DrawIndexed(UINT count) noexcept; void SetProjection(DirectX::FXMMATRIX proj) noexcept; DirectX::XMMATRIX GetProjection() const noexcept; private: DirectX::XMMATRIX projection; // 指向Device的指针 wrl::ComPtr pDevice; // 指向交换链的指针 wrl::ComPtr pSwapChain; // 指向Context的指针 wrl::ComPtr pContext; // 指向View的指针 wrl::ComPtr pTarget; // 指向Depth Buffer View的指针 wrl::ComPtr pDSView; };