-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathHelloTriangleApplication.h
98 lines (78 loc) · 2.36 KB
/
HelloTriangleApplication.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
94
95
96
97
98
/**
* @file HelloTriangleApplication.h
* @author wicast ([email protected])
* @brief
* @version 0.1
* @date 2020-11-26
*
* @copyright Copyright (c) 2020
*
*/
#pragma once
#include <algorithm>
#include <array>
#include <chrono>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <optional>
#include <set>
#include <stdexcept>
#include <vector>
#include "3rd/GLFW/glfw.h"
#include "3rd/volk/volk_imp.h"
#include "common/CVTimer.h"
#include "common/GLMath.h"
#include "resource/ResourceManager.h"
#include "common/AssetResourceBridge.hpp"
#include "assets_manager/AssetManager.hpp"
#include "components/Camera.h"
#include "containers/glfw/glfwContainerImpl.h"
#include "flecs.h"
#include "graphic/vk_render/Context.h"
#include "graphic/vk_render/GpuResourceManager.h"
#include "graphic/vk_render/RenderServer.h"
#include "graphic/vk_render/Uniform.h"
#include "graphic/vk_render/VkResourceBridge.hpp"
#include "graphic/vk_render/renderGraph/RenderGraph.h"
#include "graphic/vk_render/vulkan/windowContext.h"
#include "stl/CreviceSharedPtr.h"
class HelloTriangleApplication {
private:
crevice::GLFWContainer container;
crevice::RenderServer* renderServer;
AssetManager* assetManager;
ResourceManager* rManager;
AssetResourceBridge* assetResourceBridge;
crevice::VkResourceBridge* vkResourceBridge;
flecs::world ecs;
// TODO
bool framebufferResized = false;
void serverSetup();
void setupECS();
void mainLoop();
void processInput(GLFWwindow* window);
void cleanupSwapChain();
void recreateSwapChain();
void cleanup();
static void framebufferResizeCallback(GLFWwindow* window,
int width,
int height) {
auto app = reinterpret_cast<HelloTriangleApplication*>(
glfwGetWindowUserPointer(window));
app->framebufferResized = true;
}
public:
static HelloTriangleApplication* event_handling_instance;
static void mouse_callback_dispatch(GLFWwindow* window,
double xpos,
double ypos) {
if (event_handling_instance)
event_handling_instance->mouse_callback(window, xpos, ypos);
}
void setEventHandling() { event_handling_instance = this; }
void mouse_callback(GLFWwindow* window, double xpos, double ypos);
void run();
};