-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApplication.h
94 lines (71 loc) · 2.06 KB
/
Application.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
90
91
92
93
#pragma once
#include <map>
#include <windows.h>
#include <d3d11_1.h>
#include <d3dcompiler.h>
#include <directxcolors.h>
#include "resource.h"
#include "DDSTextureLoader.h"
#include "OBJLoader.h"
#include "Structures.h"
#include "GameObject.h"
#include "Input.h"
#include "Time.h"
#include "yaml-cpp/yaml.h"
#include "Camera.h"
#include "FreeCamera.h"
using namespace DirectX;
class Application
{
private:
HINSTANCE _hInst;
HWND _hWnd;
D3D_DRIVER_TYPE _driverType;
D3D_FEATURE_LEVEL _featureLevel;
ID3D11Device* _pd3dDevice;
ID3D11DeviceContext* _pImmediateContext;
IDXGISwapChain* _pSwapChain;
ID3D11RenderTargetView* _pRenderTargetView;
ID3D11VertexShader* _pVertexShader;
ID3D11PixelShader* _pPixelShader;
ID3D11InputLayout* _pVertexLayout;
ID3D11Buffer* _pConstantBuffer;
XMFLOAT4X4 _world;
ID3D11RasterizerState* _wireframe;
ID3D11DepthStencilView* _depthStencilView;
ID3D11Texture2D* _depthStencilBuffer;
// Make Camera
Camera* _currentCamera;
std::vector<Camera*> _cameras;
// lighting vars
XMFLOAT4 _ambientLight;
Light _lights[20];
int _numLights;
ID3D11SamplerState* _pSamplerLinear = nullptr;
ID3D11BlendState* _pTransparentBlendState = nullptr;
Fog _fog;
// Config file
YAML::Node _config;
// Material map
std::map<std::string, Material> _materials;
// GameObject list
std::vector<GameObject*> _gameObjects;
std::vector<GameObject*> _translucentGameObjects;
std::vector<GameObject*> _orderedGameObjects;
void LoadSceneFromConfig();
HRESULT InitWindow(HINSTANCE hInstance, int nCmdShow);
HRESULT InitDevice();
void Cleanup();
HRESULT CompileShaderFromFile(WCHAR* szFileName, LPCSTR szEntryPoint, LPCSTR szShaderModel, ID3DBlob** ppBlobOut);
HRESULT InitShadersAndInputLayout();
UINT _WindowHeight;
UINT _WindowWidth;
bool CompareDistanceToCamera(GameObject* i1, GameObject* i2);
void Pick();
public:
Application();
~Application();
HRESULT Initialise(HINSTANCE hInstance, int nCmdShow);
void Update();
void Draw();
};