-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGraphics.h
89 lines (73 loc) · 2.53 KB
/
Graphics.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#pragma once
#include "ErrorLogger.h"
#include <d3d11.h>
#include <d3dx11.h>
#include <d3dx10.h>
#include <d3dcompiler.h>
#pragma comment (lib, "d3d11.lib")
#pragma comment (lib, "d3dx11.lib")
#pragma comment (lib, "d3dx10.lib")
#pragma comment (lib, "DirectXTK.lib")
#pragma comment (lib, "DXGI.lib")
#pragma comment (lib, "D3DCompiler.lib")
#include "Shader.h"
#include "ConstantBuffer.h"
#include "ConstantBufferTypes.h"
#include <SpriteBatch.h>
#include <SpriteFont.h>
#include "Timer.h"
#include "ImGuiWindow.h"
#include "Camera.h"
#include "Entity.h"
#include "QuadTree.h"
#include <cstdlib>
#include "ini.h"
class Graphics
{
public:
bool Initialize(HWND hWnd, int width, int height);
bool InitD3D11(HWND hWnd); // sets up and initializes Direct3D
bool InitImGui(HWND hWnd); // initialize imgui window
bool InitPipeline(void); // loads and prepares pipeline
bool InitGraphicsD3D11(void); // creates the shape to render
void CleanD3D(void); // closes Direct3D and releases memory
void RenderFrame(void); // renders a single frame
Camera& GetCamera();
XMFLOAT2 GetOrbitalVelocity(const Entity* p1, const Entity* p2);
void SpiralGalaxy(int N);
void GalaxyCollision(int N);
private:
mINI::INIFile* _INIFile;
mINI::INIStructure _INIData; // structure hold data for config.ini
int _wWidth;
int _wHeight;
IDXGISwapChain* _swapchain; // pointer to swap chain interface
ID3D11Device* _dev; // pointer to Direct3D device interface
ID3D11DeviceContext* _devcon; // pointer to Direct3D device context
ID3D11RenderTargetView* _backbuffer; // pointer to back buffer
VertexShader _pVS; // vertex shader (run once for each vertex rendered)
PixelShader _pPS; // pixel shader (run for each pixel drawn)
ID3D11RasterizerState* _rasterizerState;
ID3D11Texture2D* _depthStencilBuffer;
ID3D11DepthStencilView* _depthStencilView;
ID3D11DepthStencilState* _depthStencilState;
ConstantBuffer<CB_VS_vertexshader> _cb_vs_vertexshader;
ConstantBuffer<CB_PS_pixelshader> _cb_ps_pixelshader;
ID3D11BlendState* _blendState;
std::unique_ptr<DirectX::SpriteBatch> _spriteBatch;
std::unique_ptr<DirectX::SpriteFont> _spriteFont;
ID3D11SamplerState* _samplerState;
ID3D11ShaderResourceView* _imageShaderResourceView;
Timer _fpsTimer;
int fpsCount = 0;
std::string fpsString = "FPS: 0";
ImGuiWindow* _imgui;
Camera _camera;
XMFLOAT3 _cameraPos;
bool _cameraTracking = true;
public:
bool _pause = true;
bool _enableColors = true;
QuadTreeNode* _qtRoot;
std::vector<Entity*> _particles;
};