VEX Engine
Retro looking game engine made in vulkan mostly because i wanted to understand it better.
Loading...
Searching...
No Matches
Interface.hpp
Go to the documentation of this file.
1
6
7#pragma once
8
9#include <cstdint>
10#define VMA_STATIC_VULKAN_FUNCTIONS 0
11#define VMA_DYNAMIC_VULKAN_FUNCTIONS 1
12
13#include "context.hpp"
14#include "SwapchainManager.hpp"
15#include "PhysicsDebug.hpp"
16#include "Resources.hpp"
17#include "Pipeline.hpp"
18#include "MeshManager.hpp"
19#include "Renderer.hpp"
20#include <SDL3/SDL.h>
21#include <memory>
25#include "components/Environment.hpp"
26
27namespace vex {
34 class Interface {
35 public:
42 Interface(SDL_Window* window, glm::uvec2 initialResolution, GameInfo gInfo, VirtualFileSystem* vfs);
43
46 ~Interface();
47
51 void bindWindow(SDL_Window* window);
52
55 void unbindWindow();
56
60
63 VulkanContext* getContext() { return &m_context; }
64
67 VulkanResources* getResources() { return m_p_resources.get(); }
68
71 MeshManager& getMeshManager() { return *m_p_meshManager; }
72
75 Renderer& getRenderer() { return *m_p_renderer; }
76
80 void setEnvironment(environment env) {m_context.m_environment = env;}
81
84 environment getEnvironment() { return m_context.m_environment;}
85
88 void WaitForGPUToFinish();
89
93 void setVSync(bool enabled);
94
95 #if DEBUG
98 VulkanPhysicsDebug* getPhysicsDebug() { return m_p_physicsDebug.get(); }
99 #endif
100 private:
101 VulkanContext m_context;
102 SDL_Window* m_p_window;
103 VirtualFileSystem* m_vfs;
104 std::unique_ptr<VulkanSwapchainManager> m_p_swapchainManager;
105 std::unique_ptr<VulkanResources> m_p_resources;
106 std::unique_ptr<VulkanPipeline> m_p_pipeline;
107 std::unique_ptr<VulkanPipeline> m_p_transPipeline;
108 std::unique_ptr<VulkanPipeline> m_p_maskPipeline;
109 std::unique_ptr<VulkanPipeline> m_p_billboardMaskedPipeline;
110 std::unique_ptr<VulkanPipeline> m_p_billboardTransPipeline;
111 std::unique_ptr<VulkanPipeline> m_p_particleMaskedPipeline;
112 std::unique_ptr<VulkanPipeline> m_p_particleTransPipeline;
113 std::unique_ptr<VulkanPipeline> m_p_uiPipeline;
114 std::unique_ptr<VulkanPipeline> m_p_compositePipeline;
115 std::unique_ptr<VulkanPipeline> m_p_fullscreenPipeline;
116 std::unique_ptr<MeshManager> m_p_meshManager;
117 std::unique_ptr<Renderer> m_p_renderer;
118
119 uint32_t GetBestDeviceVersion();
120 bool CheckValidationLayerSupport();
121
122 #if DEBUG
123 std::unique_ptr<VulkanPipeline> m_p_debugPipeline;
124 std::unique_ptr<VulkanPhysicsDebug> m_p_physicsDebug;
125 #endif
126 };
127}
This file defines struct GameInfo.
This file defines VulkanPipeline Class.
This file defines Renderer Class.
This file defines VulkanResources Class.
This file defines VulkanSwapchainManager Class.
This file defines structs needed for UI rendering.
This file defines VirtualFileSystem and VPKStream classes.
environment getEnvironment()
Getter for Enviroment settings.
Definition Interface.hpp:84
void bindWindow(SDL_Window *window)
Binds the backend to a window.
void unbindWindow()
Unbinds the current window.
Renderer & getRenderer()
Getter for Renderer.
Definition Interface.hpp:75
~Interface()
Simple destructor cleaning up resources.
Interface(SDL_Window *window, glm::uvec2 initialResolution, GameInfo gInfo, VirtualFileSystem *vfs)
Constructor for Interface class.
Definition Interface.cpp:74
VulkanContext * getContext()
Getter for VulkanContext.
Definition Interface.hpp:63
void WaitForGPUToFinish()
Helper function to wait for GPU to finish.
void createDefaultTexture()
Creates the default texture.
MeshManager & getMeshManager()
Getter for MeshManager.
Definition Interface.hpp:71
void setVSync(bool enabled)
Sets VSync (Vertical Synchronization).
void setEnvironment(environment env)
Allows to update Enviroment settings at runtime.
Definition Interface.hpp:80
VulkanResources * getResources()
Getter for VulkanResources.
Definition Interface.hpp:67
Class responsible for rendering the scene using Vulkan backend.
Definition Renderer.hpp:66
This class provides abstraction of file system needed for loading packed and unpacked assets.
This class manages resources like textures, descriptor sets, and uniform buffers.
Definition Resources.hpp:23
This file defines struct holding all vulkan data, like device, surface, swapchain,...
this struct contains information about the game. like project name and version.
Definition GameInfo.hpp:15
Struct holding all vulkan data, like device, surface, swapchain, images, views, and more.
Definition context.hpp:26
This struct is used to hold all environment settings. eg. shading details or lighting setup.