Wasabi
|
#include <WRenderTarget.hpp>
Public Member Functions | |
virtual std::string | GetTypeName () const override |
virtual void | SetID (uint32_t newID) override |
virtual void | SetName (std::string newName) override |
WError | Create (uint32_t width, uint32_t height, class WImage *target, class WImage *depth=nullptr) |
WError | Create (uint32_t width, uint32_t height, vector< class WImage * > targets, class WImage *depth=nullptr) |
WError | Create (uint32_t width, uint32_t height, VkImageView *views, uint32_t numViews, VkFormat colorFormat, VkFormat depthFormat) |
WError | Begin () |
WError | End (bool bSubmit=true) |
WError | Submit (VkSubmitInfo custom_info={}) |
void | SetClearColor (WColor col, uint32_t index=0) |
void | SetCamera (class WCamera *cam) |
VkRenderPass | GetRenderPass () const |
VkPipelineCache | GetPipelineCache () const |
VkCommandBuffer | GetCommnadBuffer () const |
int | GetNumColorOutputs () const |
bool | HasDepthOutput () const |
class WCamera * | GetCamera () const |
virtual bool | Valid () const override |
![]() | |
WBase (class Wasabi *const app, uint32_t ID=0) | |
uint32_t | GetID () const |
std::string | GetName () const |
class Wasabi * | GetAppPtr () const |
void | AddReference () |
void | RemoveReference () |
Static Public Member Functions | |
static std::string | _GetTypeName () |
Protected Member Functions | |
WRenderTarget (Wasabi *const app, uint32_t ID=0) | |
Friends | |
class | WRenderTargetManager |
Additional Inherited Members | |
![]() | |
class Wasabi * | m_app |
uint32_t | m_ID |
std::string | m_name |
This class represents a render target, which can be used to render things onto. A render target may be backed by a WImage, in which case any rendering that happens on the render target will be reflected on that image, which can then be used normally.
|
static |
Returns "RenderTarget" string.
WError WRenderTarget::Begin | ( | ) |
Begin recording renders on this render target.
WError WRenderTarget::Create | ( | uint32_t | width, |
uint32_t | height, | ||
class WImage * | target, | ||
class WImage * | depth = nullptr |
||
) |
Create a render target with a single color attachment backed by a WImage. The format of the render target attachment will match that of the WImage. Iif bDepth == true, the created render target will have an attachment for depth. This function will cause exactly one frame buffer to be created.
Examples:
width | Width of the render target |
height | Height of the render target |
target | A pointer to a WImage backing the render target |
depth | A WImage backing the created depth attachment (can be null) |
WError WRenderTarget::Create | ( | uint32_t | width, |
uint32_t | height, | ||
vector< class WImage * > | targets, | ||
class WImage * | depth = nullptr |
||
) |
Create a render target with a multiple color attachments, each backed by a WImage. The format of the render target attachments will match those of the WImage's. Iif bDepth == true, the created render target will also have an attachment for depth. This function will cause exactly one frame buffer to be created.
width | Width of the render target |
height | Height of the render target |
targets | An array of WImage's backing the created render target attachments |
depth | A WImage backing the created depth attachment (can be null) |
WError WRenderTarget::Create | ( | uint32_t | width, |
uint32_t | height, | ||
VkImageView * | views, | ||
uint32_t | numViews, | ||
VkFormat | colorFormat, | ||
VkFormat | depthFormat | ||
) |
Create a render target backed by VkImageViews (such as the frame buffer). This render target will have 1 attachment for color and one attachment for depth. This function will create as many frame buffers as num_views.
width | Width of the render target |
height | Height of the render target |
views | An array of VkImageViews to back the render target |
numViews | Number of views in views |
colorFormat | Color format for the render target |
depthFormat | Depth format for the render target |
WError WRenderTarget::End | ( | bool | bSubmit = true | ) |
End recording renders on this render target. If bSubmit is set to false, you have to call Submit() afterwards to actually perform the rendering.
bSubmit | When set to true, recorded renders will be submitted to the Vulkan graphics queue and thus will be reflected on the backing WImage of VkImageViews |
class WCamera* WRenderTarget::GetCamera | ( | ) | const |
Retrieve the camera for this render target.
VkCommandBuffer WRenderTarget::GetCommnadBuffer | ( | ) | const |
Retrieves the command buffer onto which rendering should occur to happen on this render target.
int WRenderTarget::GetNumColorOutputs | ( | ) | const |
Retrieves the number of color output attachments.
VkPipelineCache WRenderTarget::GetPipelineCache | ( | ) | const |
Retrieves the pipeline cache associated with this render target.
VkRenderPass WRenderTarget::GetRenderPass | ( | ) | const |
Retrieves the render pass associated with this render target.
|
overridevirtual |
This function must be implemented by a child class. This is used for debugging, in which a class should return its name.
Implements WBase.
bool WRenderTarget::HasDepthOutput | ( | ) | const |
Checks whether or not the render target has a depth attachment.
void WRenderTarget::SetCamera | ( | class WCamera * | cam | ) |
Sets the camera that will be used when things are rendered using this render target.
cam | Camera to use |
void WRenderTarget::SetClearColor | ( | WColor | col, |
uint32_t | index = 0 |
||
) |
Sets the color to use when the render target is cleared upon calling Begin().
col | Clear color to use |
index | Attachment index (as supplied to Create()). The depth target attachment index is the last one (so if this render target has 1 color attachment and one depth attachment, they will have indices 0 and 1 respectively) and the clear value of the depth attachment will only use the red component of the supplied WColor (the stencil will be green component) |
|
overridevirtual |
|
overridevirtual |
WError WRenderTarget::Submit | ( | VkSubmitInfo | custom_info = {} | ) |
Submit the command queue (generated between a call to Begin() and End()) to be performed by Vulkan. @params custom_info Optional custom VkSubmitInfo structure passed to vkQueueSubmit, this will be filled automatically if you ignore this argument (or pass a VkSubmitInfo with pCommandBuffers = NULL. Normally, you should fill pCommandBuffers with GetCommnadBuffer()
|
overridevirtual |
Checks the validity of this render target. A render target is valid when it has at least one frame buffer.
Implements WBase.