Jazz2::Rendering::BlurRenderPass class

Applies blur to a scene.

Post-processing pass that renders a source texture through a downsample or directional Gaussian blur shader into its own off-screen target. Several instances are chained per PlayerViewport to build the half- and quarter-resolution blur buffers used for bloom and underwater effects.

Base classes

class nCine::SceneNode
Base node of the scene graph transformation hierarchy.

Constructors, destructors, conversion operators

BlurRenderPass(PlayerViewport* owner)
Creates a new instance attached to a given viewport.

Public functions

void Initialize(Texture* source, std::int32_t width, std::int32_t height, Vector2f direction)
Initializes the render pass.
void InitializeCopy(Texture* source, std::int32_t width, std::int32_t height)
Initializes the render pass to a plain copy, which a reflection mirrors.
void SetScissor(Recti rect)
Limits the pass to a rectangle of its target in pixels from the top left corner, the rest keeps what it had.
void Register()
Registers the render pass into the viewport chain.
void Dispose()
Releases all allocated resources.
auto OnDraw(RenderQueue& renderQueue) -> bool override
Called when the node needs to be drawn, returning true if a command was added.
auto GetTarget() const -> Texture*
Returns the resulting target texture.
auto GetView() const -> Viewport*
Returns the viewport the pass renders through, or nullptr if it isn't initialized.

Function documentation

void Jazz2::Rendering::BlurRenderPass::Initialize(Texture* source, std::int32_t width, std::int32_t height, Vector2f direction)

Initializes the render pass.

Parameters
source Source texture to blur
width Width of the target texture
height Height of the target texture
direction Blur direction (zero vector performs only downsampling)

void Jazz2::Rendering::BlurRenderPass::InitializeCopy(Texture* source, std::int32_t width, std::int32_t height)

Initializes the render pass to a plain copy, which a reflection mirrors.

Parameters
source Source texture to copy
width Width of the target texture
height Height of the target texture

Unlike a downsampling pass of the same size, which averages each texel with its neighbours, this keeps the copy as sharp as the source.