#pragma once #include #include "Framework.h" #include "DirectXCore.h" #include "ResourceManager.h" #include "SceneGraph.h" class DirectXFramework : public Framework { public: DirectXFramework(); DirectXFramework(unsigned int width, unsigned int height); virtual void CreateSceneGraph(); virtual void UpdateSceneGraph(); bool Initialise(); void Update(); void Render(); void OnResize(WPARAM wParam); void Shutdown(); static DirectXFramework * GetDXFramework(); inline SceneGraphPointer GetSceneGraph() { return _sceneGraph; } inline ComPtr GetDevice() { return _device; } inline ComPtr GetDeviceContext() { return _deviceContext; } inline shared_ptr GetResourceManager() { return _resourceManager; } XMMATRIX GetViewTransformation(); XMMATRIX GetProjectionTransformation(); void SetBackgroundColour(XMFLOAT4 backgroundColour); private: ComPtr _device; ComPtr _deviceContext; ComPtr _swapChain; ComPtr _depthStencilBuffer; ComPtr _renderTargetView; ComPtr _depthStencilView; D3D11_VIEWPORT _screenViewport; // Our vectors and matrices. Note that we cannot use // XMVECTOR and XMMATRIX for class variables since they need // to be aligned on 16-byte boundaries and the compiler cannot // guarantee this for class variables // For now, we are storing our camera vectors and matrix here. // We will move it to a separate Camera class later XMFLOAT4 _eyePosition; XMFLOAT4 _focalPointPosition; XMFLOAT4 _upVector; XMFLOAT4X4 _viewTransformation; XMFLOAT4X4 _projectionTransformation; SceneGraphPointer _sceneGraph; float _backgroundColour[4]; bool GetDeviceAndSwapChain(); shared_ptr _resourceManager; };