-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModuleRenderer.h
More file actions
54 lines (44 loc) · 1.44 KB
/
Copy pathModuleRenderer.h
File metadata and controls
54 lines (44 loc) · 1.44 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
#pragma once
#include "Module.h"
#include "ModuleCamera.h"
#include <d3d12.h>
#include <wrl/client.h>
#include "DebugDrawPass.h"
#include "Model.h"
class ModuleD3D12;
class ModuleCamera;
class ModuleRenderer : public Module {
public:
ModuleRenderer();
~ModuleRenderer();
bool init() override;
void render() override;
void preRender() override;
void postRender() override;
void setGridVisible(bool visible) { showGrid = visible; }
void setAxisVisible(bool visible) { showAxis = visible; }
bool isGridVisible() const { return showGrid; }
bool isAxisVisible() const { return showAxis; }
private:
bool createVertexBuffer();
bool createRootSignature();
bool createPipelineState();
void renderModelWithPhong();
void renderModel();
void renderDebugDraw();
Microsoft::WRL::ComPtr<ID3D12Resource> vertexBuffer;
D3D12_VERTEX_BUFFER_VIEW vertexBufferView;
Microsoft::WRL::ComPtr<ID3D12RootSignature> rootSignature;
Microsoft::WRL::ComPtr<ID3D12PipelineState> pipelineState;
Microsoft::WRL::ComPtr<ID3D12Resource> lightConstantBuffer;
void* lightConstantBufferMapped = nullptr;
Microsoft::WRL::ComPtr<ID3D12Resource> materialConstantBuffer;
void* materialConstantBufferMapped = nullptr;
uint32_t vertexCount = 0;
Model model;
bool showGrid = true;
bool showAxis = true;
bool modelLoaded = false;
// Debug drawing
DebugDrawPass* debugDraw = nullptr;
};