17#include "MeshManager.hpp"
18#include "PhysicsDebug.hpp"
58 VkCommandBuffer commandBuffer;
61 VkDescriptorSet imguiTextureID;
62 bool isSwapchainValid;
84 std::unique_ptr<VulkanResources>& resources,
85 std::unique_ptr<VulkanPipeline>& pipeline,
86 std::unique_ptr<VulkanPipeline>& transPipeline,
87 std::unique_ptr<VulkanPipeline>& maskPipeline,
88 std::unique_ptr<VulkanPipeline>& billboardTransPipeline,
89 std::unique_ptr<VulkanPipeline>& billboardMaskedPipeline,
90 std::unique_ptr<VulkanPipeline>& particleTransPipeline,
91 std::unique_ptr<VulkanPipeline>& particleMaskedPipeline,
92 std::unique_ptr<VulkanPipeline>& uiPipeline,
93 std::unique_ptr<VulkanPipeline>& fullscreenPipeline,
94 std::unique_ptr<VulkanPipeline>& compositePipeline,
95 std::unique_ptr<VulkanSwapchainManager>& swapchainManager,
96 std::unique_ptr<MeshManager>& meshManager);
127 const std::vector<DebugVertex>* debugLines =
nullptr,
128 bool isEditorMode =
false);
155 void setDebugPipeline(std::unique_ptr<VulkanPipeline>* pipeline) { m_pp_debugPipeline = pipeline; }
162 void renderDebug(VkCommandBuffer cmd,
int frameIndex,
const std::vector<DebugVertex>& lines);
177 VkImageLayout oldLayout, VkImageLayout newLayout,
178 VkAccessFlags srcAccessMask, VkAccessFlags dstAccessMask,
179 VkPipelineStageFlags srcStage, VkPipelineStageFlags dstStage);
184 void issueMultiDrawIndexed(VkCommandBuffer cmd,
const std::vector<VkMultiDrawIndexedInfoEXT>& commands);
191 std::unique_ptr<VulkanResources>& m_p_resources;
192 std::unique_ptr<VulkanPipeline>& m_p_pipeline;
199 std::unique_ptr<VulkanPipeline>& m_p_uiPipeline;
200 std::unique_ptr<VulkanPipeline>& m_p_fullscreenPipeline;
201 std::unique_ptr<VulkanPipeline>& m_p_compositePipeline;
202 std::unique_ptr<VulkanSwapchainManager>& m_p_swapchainManager;
203 std::unique_ptr<MeshManager>& m_p_meshManager;
205 std::chrono::high_resolution_clock::time_point startTime;
206 float currentTime = 0.0f;
208 bool basicDiag =
true;
210 std::vector<TransparentTriangle> m_transparentTriangles;
211 std::map<uint32_t, glm::mat4> trnasMatrixes;
212 std::vector<UiComponent> m_uiObjects;
213 std::vector<VkMultiDrawIndexedInfoEXT> m_multiDrawInfos;
214 size_t approxTriangles = 0;
218 VkDescriptorSet m_screenDescriptorSet = VK_NULL_HANDLE;
219 VkDescriptorSet m_crtDescriptorSet = VK_NULL_HANDLE;
220 VkSampler m_screenSampler = VK_NULL_HANDLE;
221 VkSampler m_linearSampler = VK_NULL_HANDLE;
222 VkImageView m_lastUsedView = VK_NULL_HANDLE;
223 VkDescriptorSet m_cachedImGuiDescriptor = VK_NULL_HANDLE;
224 std::vector<std::vector<VkDescriptorSet>> m_garbageDescriptors;
225 VkDescriptorPool m_localPool = VK_NULL_HANDLE;
236 std::vector<VkBuffer> m_indirectBuffers;
237 std::vector<VmaAllocation> m_indirectAllocations;
240 std::vector<VkBuffer> m_debugBuffers;
241 std::vector<VmaAllocation> m_debugAllocations;
242 std::unique_ptr<VulkanPipeline>* m_pp_debugPipeline =
nullptr;
243 std::unique_ptr<VulkanMesh> m_editorCameraVulkanMesh;
Contains basic components like transform, camera, name components..
Simple 2D quad rendered in 3d space, great for placeholders or visualising invisible objects.
Particle emitter component.
This file defines VulkanPipeline Class.
This file defines VulkanResources Class.
This file defines VulkanSwapchainManager Class.
Component you add to your GameObject to add ui elements to your game. ex. hud to player.
This file defines vex ui class, very basic ui system.
This file defines class with Imgui for vulkan backend definition.
This file defines VulkanMesh class.
This class provides an interface template for ImGui Implementation. Every backend should implement th...
Central registry for managing entities and their components in the ECS system.
std::vector< vex::Entity > pMaskedQueue
Queue of entities with masked particle emitters.
void issueMultiDrawIndexed(VkCommandBuffer cmd, const std::vector< VkMultiDrawIndexedInfoEXT > &commands)
Issues a multi-draw indexed command used by transparent meshes since they are drawn triangle by trian...
std::unique_ptr< VulkanPipeline > & m_p_transPipeline
Standard transparent geometry pipeline.
bool beginFrame(glm::uvec2 renderResolution, SceneRenderData &outData)
Prepares the frame for rendering.
std::unique_ptr< VulkanPipeline > & m_p_billboardTransPipeline
Transparent billboard rendering pipeline.
void transitionImageLayout(VkCommandBuffer cmd, VkImage image, VkImageLayout oldLayout, VkImageLayout newLayout, VkAccessFlags srcAccessMask, VkAccessFlags dstAccessMask, VkPipelineStageFlags srcStage, VkPipelineStageFlags dstStage)
Helper function for image transition.
void composeFrame(SceneRenderData &data, ImGUIWrapper &ui, bool isEditorMode)
Composes the final frame onto the Swapchain image.
void updateScreenDescriptor(VkImageView view)
Updates the screen descriptor.
std::vector< BillboardItem > bTransQueue
Queue of transparent billboards to render.
std::unique_ptr< VulkanPipeline > & m_p_maskPipeline
Standard masked geometry pipeline.
std::vector< EditorBillboardItem > bEditorQueue
Queue of editor billboards to render.
std::unique_ptr< VulkanPipeline > & m_p_particleMaskedPipeline
Masked particle rendering pipeline.
VkDescriptorSet getImGuiTextureID(ImGUIWrapper &ui)
Gets or creates a cached ImGui texture descriptor for the scene.
std::vector< RenderItem > maskedQueue
Queue of masked (alpha-cutout) 3D objects to render.
std::unique_ptr< VulkanPipeline > & m_p_billboardMaskedPipeline
Masked billboard rendering pipeline.
std::vector< vex::Entity > pTransQueue
Queue of entities with transparent particle emitters.
~Renderer()
Destructor for Renderer class.
std::vector< BillboardItem > bMaskedQueue
Queue of masked billboards to render.
Renderer(VulkanContext &context, std::unique_ptr< VulkanResources > &resources, std::unique_ptr< VulkanPipeline > &pipeline, std::unique_ptr< VulkanPipeline > &transPipeline, std::unique_ptr< VulkanPipeline > &maskPipeline, std::unique_ptr< VulkanPipeline > &billboardTransPipeline, std::unique_ptr< VulkanPipeline > &billboardMaskedPipeline, std::unique_ptr< VulkanPipeline > &particleTransPipeline, std::unique_ptr< VulkanPipeline > &particleMaskedPipeline, std::unique_ptr< VulkanPipeline > &uiPipeline, std::unique_ptr< VulkanPipeline > &fullscreenPipeline, std::unique_ptr< VulkanPipeline > &compositePipeline, std::unique_ptr< VulkanSwapchainManager > &swapchainManager, std::unique_ptr< MeshManager > &meshManager)
Constructor for Renderer class.
void endFrame(SceneRenderData &data)
Submits the command buffer and presents the image.
std::vector< RenderItem > transparentQueue
Queue of transparent 3D objects to render.
std::unique_ptr< VulkanPipeline > & m_p_particleTransPipeline
Transparent particle rendering pipeline.
void renderScene(SceneRenderData &data, const vex::Entity cameraEntity, vex::Registry ®istry, int frame, const std::vector< DebugVertex > *debugLines=nullptr, bool isEditorMode=false)
Renders the 3D scene and UI to an offscreen low-res texture.
std::vector< RenderItem > opaqueQueue
Queue of opaque 3D objects to render.
This file defines struct holding all vulkan data, like device, surface, swapchain,...
uint32_t Entity
Type alias representing a unique entity identifier in the ECS system.
Struct to hold information about a billboard render item.
Struct to hold push data for billboard rendering.
uint32_t tID
Texture ID for bindless access.
uint32_t unlit
Flag determining if the billboard is unlit.
glm::vec4 col
Tint color of the billboard.
float sx
Horizontal scale.
glm::vec3 pos
World position of the billboard.
float pad
Padding for 16-byte alignment.
Mesh data structure for loading and managing mesh data.
Struct to hold information about a render item.
Data structure to pass state between render stages.
Scene uniform buffer object. Holds data that is bind once per scene.
Struct holding all vulkan data, like device, surface, swapchain, images, views, and more.