VisuTwin Canvas
C++ 3D Engine — Metal Backend
Loading...
Searching...
No Matches
renderPassDof.h
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2025-2026 Arnis Lektauers
3//
4//
5#pragma once
6
8#include "renderPassCoC.h"
9#include "renderPassDofBlur.h"
11
12namespace visutwin::canvas
13{
15 {
16 public:
17 RenderPassDof(const std::shared_ptr<GraphicsDevice>& device, CameraComponent* cameraComponent, Texture* sceneTexture,
18 Texture* sceneTextureHalf, bool highQuality, bool nearBlur);
19
20 void frameUpdate() const override;
21
22 float focusDistance = 100.0f;
23 float focusRange = 10.0f;
24 float blurRadius = 3.0f;
25 int blurRings = 4;
27 bool highQuality = true;
28 bool nearBlur = false;
29
30 Texture* cocTexture() const { return _cocTexture.get(); }
31 Texture* blurTexture() const { return _blurTexture.get(); }
32
33 private:
34 std::shared_ptr<Texture> createTexture(const std::string& name, PixelFormat format) const;
35 std::shared_ptr<RenderTarget> createRenderTarget(const std::string& name, PixelFormat format,
36 std::shared_ptr<Texture>& outColorTexture) const;
37
38 CameraComponent* _cameraComponent = nullptr;
39 Texture* _sceneTexture = nullptr;
40 Texture* _sceneTextureHalf = nullptr;
41
42 std::shared_ptr<RenderPassCoC> _cocPass;
43 std::shared_ptr<RenderPassDownsample> _farPass;
44 std::shared_ptr<RenderPassDofBlur> _blurPass;
45
46 std::shared_ptr<Texture> _cocTexture;
47 std::shared_ptr<Texture> _farTexture;
48 std::shared_ptr<Texture> _blurTexture;
49 std::shared_ptr<RenderTarget> _cocTarget;
50 std::shared_ptr<RenderTarget> _farTarget;
51 std::shared_ptr<RenderTarget> _blurTarget;
52 };
53}
void frameUpdate() const override
RenderPassDof(const std::shared_ptr< GraphicsDevice > &device, CameraComponent *cameraComponent, Texture *sceneTexture, Texture *sceneTextureHalf, bool highQuality, bool nearBlur)
std::shared_ptr< GraphicsDevice > device() const
Definition renderPass.h:124
RenderPass(const std::shared_ptr< GraphicsDevice > &device)
Definition renderPass.h:66
GPU texture resource supporting 2D, cubemap, volume, and array formats with mipmap management.
Definition texture.h:57