This repository was archived by the owner on Jun 2, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApplication.h
More file actions
120 lines (88 loc) · 2.76 KB
/
Copy pathApplication.h
File metadata and controls
120 lines (88 loc) · 2.76 KB
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#pragma once
#include <windows.h>
#include <d3d11_4.h>
#include <d3dcompiler.h>
#include <directxmath.h>
#include <directxcolors.h>
#include <vector>
#include "Loaders\DDSTextureLoader.h"
#include "Loaders\OBJLoader.h"
#include "resource.h"
#include "Camera.h"
#include "Structures.h"
#include "GameObject.h"
#include "Timer.h"
#include "PhysColliderSys.h"
#include "ParticleModel.h"
#include "RigidBodyModel.h"
#include "SphereCollider.h"
#include "PlaneCollider.h"
#include "Transform.h"
#define GRAVITY Vector3(0.0f, -9.81f, 0.0f)
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* _pVertexBuffer;
ID3D11Buffer* _pIndexBuffer;
ID3D11Buffer* _pPlaneVertexBuffer;
ID3D11Buffer* _pPlaneIndexBuffer;
ID3D11Buffer* _pConstantBuffer;
ID3D11DepthStencilView* _depthStencilView = nullptr;
ID3D11Texture2D* _depthStencilBuffer = nullptr;
ID3D11ShaderResourceView * _pTextureRV = nullptr;
ID3D11ShaderResourceView * _pGroundTextureRV = nullptr;
ID3D11SamplerState * _pSamplerLinear = nullptr;
MeshData objMeshData;
Light basicLight;
vector<GameObject *> _gameObjects;
PhysColliderSys* _colliderSystem;
Camera * _camera = nullptr;
float _cameraOrbitRadius = 7.0f;
float _cameraOrbitRadiusMin = 2.0f;
float _cameraOrbitRadiusMax = 50.0f;
float _cameraOrbitAngleXZ = -90.0f;
float _cameraSpeed = 2.0f;
UINT _WindowHeight;
UINT _WindowWidth;
// Render dimensions - Change here to alter screen resolution
UINT _renderHeight = 1080;
UINT _renderWidth = 1920;
ID3D11DepthStencilState* DSLessEqual;
ID3D11RasterizerState* RSCullNone;
ID3D11RasterizerState* CCWcullMode;
ID3D11RasterizerState* CWcullMode;
Timer* _timer;
private:
HRESULT InitWindow(HINSTANCE hInstance, int nCmdShow);
HRESULT InitDevice();
void Cleanup();
HRESULT CompileShaderFromFile(WCHAR* szFileName, LPCSTR szEntryPoint, LPCSTR szShaderModel, ID3DBlob** ppBlobOut);
HRESULT InitShadersAndInputLayout();
HRESULT InitVertexBuffer();
HRESULT InitIndexBuffer();
void moveForward(int objectNumber);
void moveBackward(int objectNumber);
void moveLeft(int objectNumber);
void moveRight(int objectNumber);
public:
Application();
~Application();
HRESULT Initialise(HINSTANCE hInstance, int nCmdShow);
bool HandleKeyboard(MSG msg);
void Tick();
void Update();
void PhysicsUpdate();
void Draw();
};