-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModuleImGui.h
More file actions
85 lines (66 loc) · 2.42 KB
/
Copy pathModuleImGui.h
File metadata and controls
85 lines (66 loc) · 2.42 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
#pragma once
#include "Module.h"
#include <d3d12.h>
#include "Module.h"
#include "ImGuiPass.h"
#include <memory>
struct ImGuiContext;
struct ID3D12DescriptorHeap;
struct ID3D12GraphicsCommandList;
class ModuleImGui : public Module
{
public:
ModuleImGui();
~ModuleImGui() override;
bool init() override;
void preRender() override;
void render() override;
void postRender() override;
bool showConfigWindow = true;
bool showAboutWindow = true;
bool showPhongControls = true;
bool showTransformControls = true;
bool isPhongControlsVisible() const { return showPhongControls; }
void setPhongControlsVisible(bool visible) { showPhongControls = visible; }
bool wantsCaptureMouse() const { return ImGui::GetIO().WantCaptureMouse; }
bool wantsCaptureKeyboard() const { return ImGui::GetIO().WantCaptureKeyboard; }
struct TransformData
{
DirectX::SimpleMath::Vector3 translation = DirectX::SimpleMath::Vector3(0.0f, 0.0f, 0.0f);
DirectX::SimpleMath::Vector3 rotation = DirectX::SimpleMath::Vector3(0.0f, 0.0f, 0.0f); // Euler angles in degrees
DirectX::SimpleMath::Vector3 scale = DirectX::SimpleMath::Vector3(1.0f, 1.0f, 1.0f);
};
const TransformData& getTransformData() const { return transformData; }
TransformData& getTransformData() { return transformData; }
void setTransformData(const TransformData& data) { transformData = data; }
struct LightData
{
DirectX::SimpleMath::Vector3 direction;
DirectX::SimpleMath::Vector3 color;
DirectX::SimpleMath::Vector3 ambient;
DirectX::SimpleMath::Vector3 viewPos;
};
struct MaterialData
{
DirectX::XMFLOAT4 diffuseColor;
DirectX::XMFLOAT4 specularColor;
float shininess;
float hasTexture;
};
const LightData& getLightData() const { return lightData; }
const MaterialData& getMaterialData() const { return materialData; }
LightData& getLightData() { return lightData; }
MaterialData& getMaterialData() { return materialData; }
private:
std::unique_ptr<ImGuiPass> imguiPass;
ComPtr<ID3D12DescriptorHeap> srvDescHeap;
float fpsLog[100] = { 0.0f };
LightData lightData;
MaterialData materialData;
TransformData transformData;
void drawPhongControls();
void drawMainMenuBar();
// void drawDemoWindow();
void drawTransformControls();
void drawConfigurationWindow();
};