The Joe Engine
Joe's engine programming playground
|
The JEVulkanRenderer class. More...
#include <VulkanRenderer.h>
Public Member Functions | |
JEVulkanRenderer () | |
Default constructor. More... | |
~JEVulkanRenderer ()=default | |
Destructor (default). More... | |
void | Initialize (RendererSettings rendererSettings, JESceneManager *sceneManager, JEEngineInstance *engineInstance) |
Renderer subsystem initialization function. More... | |
void | RegisterCallbacks (JEIOHandler *ioHandler) |
void | Cleanup () |
Perform all Vulkan data cleanup. More... | |
void | FramebufferResized () |
Function to invoke when the framebuffer is resized (invoked by the static function 'JEFramebufferResizeCallback'). More... | |
void | StartFrame () |
Perform necessary commands for the beginning of a frame, before draw calls are issued. More... | |
void | SubmitFrame (const std::vector< MaterialComponent > &materialComponents, const std::vector< glm::mat4 > &transforms, const std::vector< glm::mat4 > &transformsSorted) |
Submit work to GPU. More... | |
const std::vector< BoundingBoxData > & | GetBoundingBoxData () const |
MeshComponent | CreateMesh (const std::string &filepath) |
Creates a new Mesh component given a file source path. Simple wrapper around the equivalent JEMeshBufferManager function. More... | |
uint32_t | CreateTexture (const std::string &filepath) |
Creates a new texture given a file source path. Simple wrapper around the equivalent JETextureLibrary function. More... | |
void | CreateShader (MaterialComponent &materialComponent, const std::string &vertFilepath, const std::string &fragFilepath) |
Creates a shader for a material component given file source paths. Simple wrapper around the equivalent JEShaderManager function. More... | |
uint32_t | CreateDescriptor (const MaterialComponent &materialComponent) |
Creates a new descriptor given a material component. Simple wrapper around the equivalent JEShaderManager function. More... | |
void | UpdateMesh (const MeshComponent &meshComponent, const std::vector< JEMeshVertex > &vertices, const std::vector< uint32_t > &indices) |
Updates a mesh buffer to the specified list of triangle mesh vertices and indices. Simple wrapper around the equivalent JEShaderManager function. More... | |
void | UpdateMesh (const MeshComponent &meshComponent, const std::vector< JEMeshPointVertex > &vertices, const std::vector< uint32_t > &indices) |
Updates a mesh buffer to the specified list of point mesh vertices and indices. Simple wrapper around the equivalent JEShaderManager function. More... | |
void | DrawShadowPass (const std::vector< MeshComponent > &meshComponents, const JECamera &camera) |
Performs all command recording for the shadow mapping pass. More... | |
void | DrawMeshes (const std::vector< MeshComponent > &meshComponents, const std::vector< MaterialComponent > &materialComponents, const JECamera &camera, const std::vector< JEParticleSystem > &particleSystems) |
Performs all command recording for mesh rendering. More... | |
void | WaitForIdleDevice () |
Wrapper for Vulkan API call to wait for the logical device to be idle. More... | |
const JEVulkanWindow & | GetWindow () const |
GLFWwindow * | GetGLFWWindow () const |
VkDevice | GetDevice () const |
Friends | |
class | JEEngineInstance |
The engine instance can access private members. More... | |
The JEVulkanRenderer class.
This class encompasses the entire renderer subsystem. It contains all necessary Vulkan-API resources for various render features such as:
|
inline |
Default constructor.
|
default |
Destructor (default).
void JoeEngine::JEVulkanRenderer::Cleanup | ( | ) |
Perform all Vulkan data cleanup.
uint32_t JoeEngine::JEVulkanRenderer::CreateDescriptor | ( | const MaterialComponent & | materialComponent | ) |
Creates a new descriptor given a material component. Simple wrapper around the equivalent JEShaderManager function.
materialComponent | the material component to create a descriptor for. |
MeshComponent JoeEngine::JEVulkanRenderer::CreateMesh | ( | const std::string & | filepath | ) |
Creates a new Mesh component given a file source path. Simple wrapper around the equivalent JEMeshBufferManager function.
filepath | the file source path for the mesh. |
void JoeEngine::JEVulkanRenderer::CreateShader | ( | MaterialComponent & | materialComponent, |
const std::string & | vertFilepath, | ||
const std::string & | fragFilepath | ||
) |
Creates a shader for a material component given file source paths. Simple wrapper around the equivalent JEShaderManager function.
materialComponent | the material component to create a shader for. |
vertFilepath | the vertex shader file source path. |
fragFilepath | the vertex shader file source path. |
uint32_t JoeEngine::JEVulkanRenderer::CreateTexture | ( | const std::string & | filepath | ) |
Creates a new texture given a file source path. Simple wrapper around the equivalent JETextureLibrary function.
filepath | the file source path for the texture. |
void JoeEngine::JEVulkanRenderer::DrawMeshes | ( | const std::vector< MeshComponent > & | meshComponents, |
const std::vector< MaterialComponent > & | materialComponents, | ||
const JECamera & | camera, | ||
const std::vector< JEParticleSystem > & | particleSystems | ||
) |
Performs all command recording for mesh rendering.
meshComponents | the list of all mesh components, sorted for optimal resource binding frequency. |
materialComponents | the list of all material components, sorted for optimal resource binding frequency. |
camera | the rendering camera object. |
particleSystems | the list of all particle systems to draw. |
Construct deferred geometry render pass
Construct OIT first pass
Construct deferred lighting and post processing passes
void JoeEngine::JEVulkanRenderer::DrawShadowPass | ( | const std::vector< MeshComponent > & | meshComponents, |
const JECamera & | camera | ||
) |
Performs all command recording for the shadow mapping pass.
meshComponents | the list of all shadow-casting mesh components. |
camera | the light source shadow map camera. |
|
inline |
Function to invoke when the framebuffer is resized (invoked by the static function 'JEFramebufferResizeCallback').
const std::vector< BoundingBoxData > & JoeEngine::JEVulkanRenderer::GetBoundingBoxData | ( | ) | const |
Get the bounding box data for every entity in the scene.
|
inline |
Get the Vulkan logical device.
|
inline |
Get the GLFW window.
|
inline |
Get the Vulkan window object.
void JoeEngine::JEVulkanRenderer::Initialize | ( | RendererSettings | rendererSettings, |
JESceneManager * | sceneManager, | ||
JEEngineInstance * | engineInstance | ||
) |
Renderer subsystem initialization function.
rendererSettings | the renderer settings for the subsystem. |
sceneManager | the scene manager subsystem. |
engineInstance | the engine instance. |
Vulkan setup
void JoeEngine::JEVulkanRenderer::RegisterCallbacks | ( | JEIOHandler * | ioHandler | ) |
Register input callbacks.
ioHandler | the IOHandler subsystem to register callbacks with. |
void JoeEngine::JEVulkanRenderer::StartFrame | ( | ) |
Perform necessary commands for the beginning of a frame, before draw calls are issued.
void JoeEngine::JEVulkanRenderer::SubmitFrame | ( | const std::vector< MaterialComponent > & | materialComponents, |
const std::vector< glm::mat4 > & | transforms, | ||
const std::vector< glm::mat4 > & | transformsSorted | ||
) |
Submit work to GPU.
void JoeEngine::JEVulkanRenderer::UpdateMesh | ( | const MeshComponent & | meshComponent, |
const std::vector< JEMeshPointVertex > & | vertices, | ||
const std::vector< uint32_t > & | indices | ||
) |
Updates a mesh buffer to the specified list of point mesh vertices and indices. Simple wrapper around the equivalent JEShaderManager function.
meshComponent | the mesh component to update |
vertices | the new point mesh vertices |
indices | the new mesh indices |
void JoeEngine::JEVulkanRenderer::UpdateMesh | ( | const MeshComponent & | meshComponent, |
const std::vector< JEMeshVertex > & | vertices, | ||
const std::vector< uint32_t > & | indices | ||
) |
Updates a mesh buffer to the specified list of triangle mesh vertices and indices. Simple wrapper around the equivalent JEShaderManager function.
meshComponent | the mesh component to update |
vertices | the new triangle mesh vertices |
indices | the new mesh indices |
|
inline |
Wrapper for Vulkan API call to wait for the logical device to be idle.
|
friend |
The engine instance can access private members.