64 lines
1.7 KiB
C++
64 lines
1.7 KiB
C++
#pragma once
|
|
#include <vector>
|
|
#include "Framework.h"
|
|
#include "DirectXCore.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<ID3D11Device> GetDevice() { return _device; }
|
|
inline ComPtr<ID3D11DeviceContext> GetDeviceContext() { return _deviceContext; }
|
|
|
|
XMMATRIX GetViewTransformation();
|
|
XMMATRIX GetProjectionTransformation();
|
|
|
|
void SetBackgroundColour(XMFLOAT4 backgroundColour);
|
|
|
|
private:
|
|
ComPtr<ID3D11Device> _device;
|
|
ComPtr<ID3D11DeviceContext> _deviceContext;
|
|
ComPtr<IDXGISwapChain> _swapChain;
|
|
ComPtr<ID3D11Texture2D> _depthStencilBuffer;
|
|
ComPtr<ID3D11RenderTargetView> _renderTargetView;
|
|
ComPtr<ID3D11DepthStencilView> _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();
|
|
};
|
|
|