#include <renderbloomcomponent.h>
Public Member Functions | |
RenderBloomComponentInstance (EntityInstance &entity, Component &resource) | |
virtual bool | init (utility::ErrorState &errorState) override |
void | draw () |
Texture2D & | getOutputTexture () |
![]() | |
RenderableComponentInstance (EntityInstance &entity, Component &resource) | |
void | draw (IRenderTarget &renderTarget, VkCommandBuffer commandBuffer, const glm::mat4 &viewMatrix, const glm::mat4 &projectionMatrix) |
void | setVisible (bool visible) |
bool | isVisible () const |
const std::vector< ResourcePtr< RenderTag > > & | getTags () const |
RenderMask | getMask () const |
bool | includesMask (RenderMask otherMask) |
int | getRank () const |
const RenderLayer * | getLayer () const |
virtual bool | isSupported (nap::CameraComponentInstance &camera) const |
![]() | |
ComponentInstance (EntityInstance &entity, Component &resource) | |
virtual void | update (double deltaTime) |
nap::EntityInstance * | getEntityInstance () const |
nap::Component * | getComponent () const |
template<typename T > | |
T * | getComponent () const |
virtual bool | init (utility::ErrorState &errorState) |
![]() | |
Object () | |
virtual | ~Object () |
virtual void | onDestroy () |
Object (Object &)=delete | |
Object & | operator= (const Object &)=delete |
Object (Object &&)=delete | |
Object & | operator= (Object &&)=delete |
Protected Member Functions | |
virtual void | onDraw (IRenderTarget &renderTarget, VkCommandBuffer commandBuffer, const glm::mat4 &viewMatrix, const glm::mat4 &projectionMatrix) override |
Additional Inherited Members | |
![]() | |
static bool | isIDProperty (rtti::Instance &object, const rtti::Property &property) |
![]() | |
std::string | mID |
Property: 'mID' unique name of the object. Used as an identifier by the system. More... | |
![]() | |
RenderService * | mRenderService = nullptr |
Pre- or post-processing effect that blurs the input texture at a downsampled resolution into internally managed rendertargets.
This component manages its own render target and plane to render to. The plane is automatically scaled to fit the bounds of the render target.
InputTexture
is blitted to an internally managed render target, and then blurred based on the specified pass count. Each blur 'pass' then comprises two passes; horizontal and vertical. The gaussian sampling kernel size can be specified with the 'Kernel' property. Each subsequent pass performs a horizontal and vertical blur at half the resolution of the former pass, with the first being at half the resolution of InputTexture
.
When the bloom passes have been completed, the result is blitted to OutputTexture
. InputTexture
and OutputTexture
are allowed to refer to the same nap::RenderTexture
.
Simply declare the component in json and call RenderBloomComponentInstance::draw() in the render part of your application, in between nap::RenderService::beginHeadlessRecording() and nap::RenderService::endHeadlessRecording().
This component uses the default naprender blur shader and automatically sets its shader variables based on this component's properties configuration.
RenderBloomComponentInstance | ( | EntityInstance & | entity, |
Component & | resource | ||
) |
void draw | ( | ) |
Renders the effect to the output texture, without having to define a render target or mesh. Call this in your application render() call inbetween nap::RenderService::beginHeadlessRecording() and nap::RenderService::endHeadlessRecording(). Do not call this function outside of a headless recording pass i.e. when rendering to a window. The result is rendered into a dynamically created output texture, which is accessible through RenderBloomComponentInstance::getOutputTexture(). Alternatively, you can use the render service to render this component, see onDraw().
Texture2D& getOutputTexture | ( | ) |
Returns the output texture with the bloom effect applied. The size of this texture equals { input_width/2^PassCount, input_height/2^PassCount }
|
overridevirtual |
Initialize RenderBloomComponentInstance based on the RenderBloomComponent resource.
errorState | should hold the error message when initialization fails |
Reimplemented from RenderableComponentInstance.
|
overrideprotectedvirtual |
Draws the effect full screen to the currently active render target, when the view matrix = identity.
renderTarget | the target to render to. |
commandBuffer | the currently active command buffer. |
viewMatrix | often the camera world space location |
projectionMatrix | often the camera projection matrix |
Implements RenderableComponentInstance.