Wasabi
|
#include <WRenderer.hpp>
Public Member Functions | |
WRenderer (class Wasabi *const app) | |
WError | Initialize () |
void | Render () |
void | Cleanup () |
WError | Resize (uint32_t width, uint32_t height) |
WError | SetRenderingStages (std::vector< class WRenderStage * > stages) |
class WRenderStage * | GetRenderStage (std::string stageName) const |
std::string | GetSpritesRenderStageName () const |
std::string | GetTextsRenderStageName () const |
std::string | GetParticlesRenderStageName () const |
std::string | GetPickingRenderStageName () const |
class WRenderTarget * | GetRenderTarget (std::string stageName="") const |
class WImage * | GetRenderTargetImage (std::string imageName) const |
VulkanSwapChain * | GetSwapchain () const |
VkSampler | GetTextureSampler (W_TEXTURE_SAMPLER_TYPE type=TEXTURE_SAMPLER_DEFAULT) const |
VkCommandBuffer | GetCurrentPrimaryCommandBuffer () const |
uint32_t | GetCurrentBufferingIndex () const |
VkQueue | GetQueue () const |
Friends | |
class | Wasabi |
int | RunWasabi (class Wasabi *) |
A WRenderer is a base class that can be derived to implement a certain rendering method (e.g. a forward rendering variant or deferred rendering variant). A renderer can be assigned to the engine the same way components are, during the initialization in Wasabi::SetupComponents().
void WRenderer::Cleanup | ( | ) |
Frees all resources allocated by the renderer. This function should be implemented by a child class and it should perform the child-specific cleanup procedure. For a renderer bound to Wasabi, this function will be called before the application closes.
uint32_t WRenderer::GetCurrentBufferingIndex | ( | ) | const |
Retrieves the current buffering index. The current buffering index is the index of buffers that should be used for the current frame (safe to assume GPU access to it is done). All memory access to those buffers have to use a memory barriers to ensure no races happen.
VkCommandBuffer WRenderer::GetCurrentPrimaryCommandBuffer | ( | ) | const |
Retrieves the primary command buffer used in the current frame (should be called within a WRenderStage's render).
std::string WRenderer::GetParticlesRenderStageName | ( | ) | const |
std::string WRenderer::GetPickingRenderStageName | ( | ) | const |
VkQueue WRenderer::GetQueue | ( | ) | const |
Retrieves the currently used Vulkan graphics queue.
class WRenderStage* WRenderer::GetRenderStage | ( | std::string | stageName | ) | const |
Retrieves a set render stage with a given name.
stageName | Name of the stage to retrieve |
class WRenderTarget* WRenderer::GetRenderTarget | ( | std::string | stageName = "" | ) | const |
Retrieves the render target of a given render stage. If stageName is "", this will return the backbuffer's render target, which is always the last
stageName | Name of the stage, using "" will return the backbuffer's render target |
class WImage* WRenderer::GetRenderTargetImage | ( | std::string | imageName | ) | const |
Retrieves a render target output image from a currently set render stage.
imageName | Name of the image in one of the render stages |
std::string WRenderer::GetSpritesRenderStageName | ( | ) | const |
VulkanSwapChain* WRenderer::GetSwapchain | ( | ) | const |
Retrieves the swap chain.
std::string WRenderer::GetTextsRenderStageName | ( | ) | const |
VkSampler WRenderer::GetTextureSampler | ( | W_TEXTURE_SAMPLER_TYPE | type = TEXTURE_SAMPLER_DEFAULT | ) | const |
Retrieves a Vulkan image sampler of a given type
type | Type of the requested sampler |
WError WRenderer::Initialize | ( | ) |
Initializes the renderer resources. This function should be implemented by a child class and it should initialize the child-specific resources. For a renderer bound to Wasabi, this function will be called during Wasabi's Wasabi::StartEngine() call.
void WRenderer::Render | ( | ) |
Begin rendering a frame. This function is responsible for semaphore synchronization and swap chain presentation.
WError WRenderer::Resize | ( | uint32_t | width, |
uint32_t | height | ||
) |
Notifies the renderer of a change in screen (window) size. This function could be implemented by a child class to perform child-specific resizing procedures. An overridden implementation may (and probably should) call the WRenderer implementation of resize at some point, which will resize the swap chain and the default render target attached to it.
width | New screen (window) width |
height | New screen (window) height |
WError WRenderer::SetRenderingStages | ( | std::vector< class WRenderStage * > | stages | ) |
Destroys the previously set render stages and assigns the new ones. This function will call Initialize on all the render stages. Render stages define the sequence of rendering events that happen when each frame is rendered.
stages | Render stages to use |
|
friend |
Runs a Wasabi instance. This function blocks until the instance quits. This function will run the message loop and render frames and do everything required to run the engine in the right environment.