The Joe Engine
Joe's engine programming playground
JoeEngine::JEVulkanRenderer Class Reference

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 JEVulkanWindowGetWindow () const
 
GLFWwindow * GetGLFWWindow () const
 
VkDevice GetDevice () const
 

Friends

class JEEngineInstance
 The engine instance can access private members. More...
 

Detailed Description

The JEVulkanRenderer class.

This class encompasses the entire renderer subsystem. It contains all necessary Vulkan-API resources for various render features such as:

  • Deferred rendering
  • Shadow mapping
  • Order-independent translucency
  • Forward rendering (now broken)
  • Post-processing (now broken)

Constructor & Destructor Documentation

◆ JEVulkanRenderer()

JoeEngine::JEVulkanRenderer::JEVulkanRenderer ( )
inline

Default constructor.

◆ ~JEVulkanRenderer()

JoeEngine::JEVulkanRenderer::~JEVulkanRenderer ( )
default

Destructor (default).

Member Function Documentation

◆ Cleanup()

void JoeEngine::JEVulkanRenderer::Cleanup ( )

Perform all Vulkan data cleanup.

◆ CreateDescriptor()

uint32_t JoeEngine::JEVulkanRenderer::CreateDescriptor ( const MaterialComponent materialComponent)

Creates a new descriptor given a material component. Simple wrapper around the equivalent JEShaderManager function.

Parameters
materialComponentthe material component to create a descriptor for.
Returns
a new descriptor ID.

◆ CreateMesh()

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.

Parameters
filepaththe file source path for the mesh.
Returns
a new Mesh Component.

◆ CreateShader()

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.

Parameters
materialComponentthe material component to create a shader for.
vertFilepaththe vertex shader file source path.
fragFilepaththe vertex shader file source path.

◆ CreateTexture()

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.

Parameters
filepaththe file source path for the texture.
Returns
a new texture ID.

◆ DrawMeshes()

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.

Parameters
meshComponentsthe list of all mesh components, sorted for optimal resource binding frequency.
materialComponentsthe list of all material components, sorted for optimal resource binding frequency.
camerathe rendering camera object.
particleSystemsthe list of all particle systems to draw.

Construct deferred geometry render pass

Construct OIT first pass

Construct deferred lighting and post processing passes

◆ DrawShadowPass()

void JoeEngine::JEVulkanRenderer::DrawShadowPass ( const std::vector< MeshComponent > &  meshComponents,
const JECamera camera 
)

Performs all command recording for the shadow mapping pass.

Parameters
meshComponentsthe list of all shadow-casting mesh components.
camerathe light source shadow map camera.

◆ FramebufferResized()

void JoeEngine::JEVulkanRenderer::FramebufferResized ( )
inline

Function to invoke when the framebuffer is resized (invoked by the static function 'JEFramebufferResizeCallback').

◆ GetBoundingBoxData()

const std::vector< BoundingBoxData > & JoeEngine::JEVulkanRenderer::GetBoundingBoxData ( ) const

Get the bounding box data for every entity in the scene.

Returns
list of all bounding box data.

◆ GetDevice()

VkDevice JoeEngine::JEVulkanRenderer::GetDevice ( ) const
inline

Get the Vulkan logical device.

Returns
the Vulkan logical device.

◆ GetGLFWWindow()

GLFWwindow* JoeEngine::JEVulkanRenderer::GetGLFWWindow ( ) const
inline

Get the GLFW window.

Returns
the GLFW window.

◆ GetWindow()

const JEVulkanWindow& JoeEngine::JEVulkanRenderer::GetWindow ( ) const
inline

Get the Vulkan window object.

Returns
the Vulkan window object.

◆ Initialize()

void JoeEngine::JEVulkanRenderer::Initialize ( RendererSettings  rendererSettings,
JESceneManager sceneManager,
JEEngineInstance engineInstance 
)

Renderer subsystem initialization function.

Parameters
rendererSettingsthe renderer settings for the subsystem.
sceneManagerthe scene manager subsystem.
engineInstancethe engine instance.

Vulkan setup

◆ RegisterCallbacks()

void JoeEngine::JEVulkanRenderer::RegisterCallbacks ( JEIOHandler ioHandler)

Register input callbacks.

Parameters
ioHandlerthe IOHandler subsystem to register callbacks with.

◆ StartFrame()

void JoeEngine::JEVulkanRenderer::StartFrame ( )

Perform necessary commands for the beginning of a frame, before draw calls are issued.

◆ SubmitFrame()

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.

◆ UpdateMesh() [1/2]

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.

Parameters
meshComponentthe mesh component to update
verticesthe new point mesh vertices
indicesthe new mesh indices

◆ UpdateMesh() [2/2]

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.

Parameters
meshComponentthe mesh component to update
verticesthe new triangle mesh vertices
indicesthe new mesh indices

◆ WaitForIdleDevice()

void JoeEngine::JEVulkanRenderer::WaitForIdleDevice ( )
inline

Wrapper for Vulkan API call to wait for the logical device to be idle.

Friends And Related Function Documentation

◆ JEEngineInstance

friend class JEEngineInstance
friend

The engine instance can access private members.


The documentation for this class was generated from the following files: