#include <rendertarget.h>
Public Member Functions | |
RenderTarget (Core &core) | |
~RenderTarget () | |
virtual bool | init (utility::ErrorState &errorState) override |
virtual void | beginRendering () override |
virtual void | endRendering () override |
virtual const glm::ivec2 | getBufferSize () const override |
virtual void | setClearColor (const RGBAColorFloat &color) override |
virtual const RGBAColorFloat & | getClearColor () const override |
virtual ECullWindingOrder | getWindingOrder () const override |
virtual VkRenderPass | getRenderPass () const override |
bool | hasDepthTexture () const |
RenderTexture2D & | getColorTexture () |
DepthRenderTexture2D & | getDepthTexture () |
virtual VkFormat | getColorFormat () const override |
virtual VkFormat | getDepthFormat () const override |
virtual VkSampleCountFlagBits | getSampleCount () const override |
virtual bool | getSampleShadingEnabled () const override |
![]() | |
Resource () | |
![]() | |
Object () | |
virtual | ~Object () |
virtual void | onDestroy () |
Object (Object &)=delete | |
Object & | operator= (const Object &)=delete |
Object (Object &&)=delete | |
Object & | operator= (Object &&)=delete |
Public Attributes | |
bool | mSampleShading = true |
Property: 'SampleShading' Reduces texture aliasing when enabled, at higher computational cost. More... | |
RGBAColorFloat | mClearColor = { 0.0f, 0.0f, 0.0f, 0.0f } |
Property: 'ClearColor' color selection used for clearing the render target. More... | |
ERasterizationSamples | mRequestedSamples = ERasterizationSamples::One |
Property: 'Samples' The number of samples used during Rasterization. For better results turn on 'SampleShading'. More... | |
ResourcePtr< RenderTexture2D > | mColorTexture |
Property: 'ColorTexture' texture to render to. More... | |
ResourcePtr< DepthRenderTexture2D > | mDepthTexture |
Property: 'DepthTexture' optional depth texture to render to. More... | |
![]() | |
std::string | mID |
Property: 'mID' unique name of the object. Used as an identifier by the system. More... | |
Additional Inherited Members | |
![]() | |
static bool | isIDProperty (rtti::Instance &object, const rtti::Property &property) |
A resource that is used to render one or multiple objects to a nap::RenderTexture2D instead of a nap::RenderWindow. This objects requires a link to a nap::RenderTexture2D to store the result of the render pass. Only render to a render target within a headless recording pass, failure to do so will result in undefined behavior. Make sure to call beginRendering() to start the render pass and endRendering() to end the render pass. Always call RenderService::endHeadlessRecording after having recorded all off-screen render operations.
nap::RenderTarget can also be used to hook up a nap::DepthRenderTexture2D as a depth attachment. This lets you use the depth buffer as a shader resource in a subsequent render operation. The property DepthTexture
is optional. When empty, an internal depth attachment is created to use during rendering and calls to nap::RenderTarget::getDepthTexture()
will fail (always make sure hasDepthTexture()
returns true first). When a depth texture is set, nap::RenderTarget::getDepthTexture()
return a reference to the resource successfully.
RenderTarget | ( | Core & | core | ) |
Every render target requires a reference to core.
core | link to a nap core instance |
~RenderTarget | ( | ) |
Destroys allocated render resources
|
overridevirtual |
Starts the render pass. Only start the render pass after a successful call to RenderService::beginHeadlessRecording().
Implements IRenderTarget.
|
overridevirtual |
Ends the render pass. Always call this after beginRendering().
Implements IRenderTarget.
|
overridevirtual |
Implements IRenderTarget.
|
overridevirtual |
Implements IRenderTarget.
|
overridevirtual |
Implements IRenderTarget.
RenderTexture2D& getColorTexture | ( | ) |
|
overridevirtual |
Implements IRenderTarget.
DepthRenderTexture2D& getDepthTexture | ( | ) |
Returns the depth texture resource if available, asserts if this is not the case. Always make sure hasDepthTexture()
returns true before calling this function.
|
overridevirtual |
Implements IRenderTarget.
|
overridevirtual |
Implements IRenderTarget.
|
overridevirtual |
Implements IRenderTarget.
|
overridevirtual |
Geometry winding order, defaults to clockwise.
Implements IRenderTarget.
bool hasDepthTexture | ( | ) | const |
|
overridevirtual |
Initializes the render target, including all the required resources.
errorState | contains the error if initialization failed. |
Reimplemented from Object.
|
overridevirtual |
Updates the render target clear color.
color | the new clear color to use. |
Implements IRenderTarget.
RGBAColorFloat mClearColor = { 0.0f, 0.0f, 0.0f, 0.0f } |
Property: 'ClearColor' color selection used for clearing the render target.
ResourcePtr<RenderTexture2D> mColorTexture |
Property: 'ColorTexture' texture to render to.
ResourcePtr<DepthRenderTexture2D> mDepthTexture |
Property: 'DepthTexture' optional depth texture to render to.
ERasterizationSamples mRequestedSamples = ERasterizationSamples::One |
Property: 'Samples' The number of samples used during Rasterization. For better results turn on 'SampleShading'.
bool mSampleShading = true |
Property: 'SampleShading' Reduces texture aliasing when enabled, at higher computational cost.