NAP
Public Member Functions | List of all members
SnapshotRenderTarget Class Reference

#include <snapshotrendertarget.h>

Public Member Functions

 SnapshotRenderTarget (Core &core)
 
 ~SnapshotRenderTarget ()
 
bool init (Snapshot *snapshot, utility::ErrorState &errorState)
 
virtual void beginRendering () override
 
virtual void endRendering () override
 
virtual const glm::ivec2 getBufferSize () const override
 
virtual void setClearColor (const RGBAColorFloat &color) override
 
virtual const RGBAColorFloatgetClearColor () const override
 
virtual ECullWindingOrder getWindingOrder () const override
 
virtual VkRenderPass getRenderPass () const override
 
virtual VkFormat getColorFormat () const override
 
virtual VkFormat getDepthFormat () const override
 
virtual VkSampleCountFlagBits getSampleCount () const override
 
virtual bool getSampleShadingEnabled () const override
 
void setCellIndex (uint32_t cellIndex)
 

Description

Special version of RenderTarget made to work exclusively in conjunction with Snapshot. Renders to multiple VkFramebuffers in a sequence to reduce the memory consumption of an otherwise large Texture2D. This makes a huge difference when MSAA samples > 1 is configured as fewer additional image resources may be allocated when multiple samples are used.

Inheritance diagram for SnapshotRenderTarget:
[legend]
Collaboration diagram for SnapshotRenderTarget:
[legend]

Constructor & Destructor Documentation

◆ SnapshotRenderTarget()

Every render target requires a reference to core.

Parameters
corelink to a nap core instance

◆ ~SnapshotRenderTarget()

Destroys allocated render resources

Member Function Documentation

◆ beginRendering()

virtual void beginRendering ( )
overridevirtual

Starts the render pass. Only start the render pass after a successful call to RenderService::beginHeadlessRecording().

Implements IRenderTarget.

◆ endRendering()

virtual void endRendering ( )
overridevirtual

Ends the render pass. Always call this after beginRendering().

Implements IRenderTarget.

◆ getBufferSize()

virtual const glm::ivec2 getBufferSize ( ) const
overridevirtual
Returns
size in pixels of the render target.

Implements IRenderTarget.

◆ getClearColor()

virtual const RGBAColorFloat& getClearColor ( ) const
overridevirtual
Returns
the currently used render target clear color.

Implements IRenderTarget.

◆ getColorFormat()

virtual VkFormat getColorFormat ( ) const
overridevirtual
Returns
render target color format. This is the format of the linked in color texture.

Implements IRenderTarget.

◆ getDepthFormat()

virtual VkFormat getDepthFormat ( ) const
overridevirtual
Returns
render target depth format

Implements IRenderTarget.

◆ getRenderPass()

virtual VkRenderPass getRenderPass ( ) const
overridevirtual
Returns
the render pass

Implements IRenderTarget.

◆ getSampleCount()

virtual VkSampleCountFlagBits getSampleCount ( ) const
overridevirtual
Returns
used number of samples when rendering to the target.

Implements IRenderTarget.

◆ getSampleShadingEnabled()

virtual bool getSampleShadingEnabled ( ) const
overridevirtual
Returns
if sample based shading is enabled when rendering to the target.

Implements IRenderTarget.

◆ getWindingOrder()

virtual ECullWindingOrder getWindingOrder ( ) const
overridevirtual

Geometry winding order, defaults to clockwise.

Implements IRenderTarget.

◆ init()

bool init ( Snapshot snapshot,
utility::ErrorState errorState 
)

Initializes the render target, including all the required resources.

Parameters
snapshotpointer to a snapshot object
errorStatecontains the error if initialization failed.
Returns
if initialization succeeded.

◆ setCellIndex()

void setCellIndex ( uint32_t  cellIndex)
Parameters
cellIndexchange the index of the cell to setup for rendering

◆ setClearColor()

virtual void setClearColor ( const RGBAColorFloat color)
overridevirtual

Updates the render target clear color.

Parameters
colorthe new clear color to use.

Implements IRenderTarget.