VisuTwin Canvas
C++ 3D Engine — Metal Backend
Loading...
Searching...
No Matches
renderPassSsao.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
7#include <memory>
8#include <string>
9
11
12namespace visutwin::canvas
13{
14 class CameraComponent;
16
23 {
24 public:
25 RenderPassSsao(const std::shared_ptr<GraphicsDevice>& device, Texture* sourceTexture,
26 CameraComponent* cameraComponent, bool blurEnabled);
28
29 // SSAO parameters (matching upstream RenderPassSsao)
30 float radius = 30.0f;
31 float intensity = 0.5f;
32 float power = 6.0f;
33 int sampleCount = 12;
34 float minAngle = 10.0f;
35 bool randomize = false;
36
38 Texture* ssaoTexture() const { return _ssaoTexture.get(); }
39
40 void execute() override;
41 void after() override;
42
43 void setScale(float value);
44 float scale() const { return _scale; }
45
46 private:
47 std::shared_ptr<RenderTarget> createSsaoRenderTarget(const std::string& name,
48 std::shared_ptr<Texture>& outTexture) const;
49
50 Texture* _sourceTexture = nullptr;
51 CameraComponent* _cameraComponent = nullptr;
52 bool _blurEnabled = true;
53 float _scale = 1.0f;
54
55 std::shared_ptr<Texture> _ssaoTexture;
56 std::shared_ptr<RenderTarget> _ssaoRenderTarget;
57
58 // Blur temp resources
59 std::shared_ptr<Texture> _blurTempTexture;
60 std::shared_ptr<RenderTarget> _blurTempRenderTarget;
61 std::shared_ptr<RenderPassDepthAwareBlur> _blurPassH;
62 std::shared_ptr<RenderPassDepthAwareBlur> _blurPassV;
63
64 float _blueNoiseValue = 0.0f;
65 };
66}
std::shared_ptr< GraphicsDevice > device() const
Definition renderPass.h:124
RenderPassShaderQuad(const std::shared_ptr< GraphicsDevice > &device)
RenderPassSsao(const std::shared_ptr< GraphicsDevice > &device, Texture *sourceTexture, CameraComponent *cameraComponent, bool blurEnabled)
Texture * ssaoTexture() const
The output SSAO texture (R8, single channel occlusion).
GPU texture resource supporting 2D, cubemap, volume, and array formats with mipmap management.
Definition texture.h:57