QGIS API Documentation 4.5.0-Master (c3bae02b63e)
Loading...
Searching...
No Matches
qgsbloomrenderview.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsbloomrenderview.h
3 --------------------------------------
4 Date : May 2026
5 Copyright : (C) 2026 by Nyall Dawson
6 Email : nyall dot dawson at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGSBLOOMRENDERVIEW_H
17#define QGSBLOOMRENDERVIEW_H
18
20
21#include <QSize>
22
23#define SIP_NO_FILE
24
26
27namespace Qt3DCore
28{
29 class QEntity;
30} //namespace Qt3DCore
31
32namespace Qt3DRender
33{
34 class QTexture2D;
35 class QRenderStateSet;
36 class QParameter;
37} //namespace Qt3DRender
38
41
63{
64 public:
66 QgsBloomRenderView( const QString &viewName, Qt3DRender::QTexture2D *sourceColorTexture, const QSize &size, Qt3DCore::QEntity *rootSceneEntity );
68
72 Qt3DRender::QTexture2D *bloomTexture() const;
73
79 void setFilterRadius( float radius );
80
84 void setAspectRatio( float ratio );
85
86 void updateWindowResize( int width, int height ) override;
87 void setEnabled( bool enabled ) override;
88
89 private:
90 void buildRenderPasses( Qt3DRender::QTexture2D *sourceTexture, Qt3DCore::QEntity *rootEntity );
91
92 // from https://learnopengl.com/Guest-Articles/2022/Phys.-Based-Bloom
93 // "You may go as small as you wish, though 5 or 6 is usually good enough" (Jorge Jimenez)
94 static const int MIP_PASSES = 5;
95
96 QSize mBaseSize;
97
98 std::vector<Qt3DRender::QTexture2D *> mTextures;
99
100 Qt3DRender::QParameter *mFilterRadiusParameter = nullptr;
101 Qt3DRender::QParameter *mAspectRatioParameter = nullptr;
102};
103
104#endif // QGSBLOOMRENDERVIEW_H
virtual void setEnabled(bool enable)
Enable or disable via enable the render view sub tree.
virtual void updateWindowResize(int width, int height)
Called when 3D window is resized.
QgsAbstractRenderView(const QString &viewName)
Constructor for QgsAbstractRenderView with the specified parent object.
An entity responsible for applying a 13-tap downsample filter for physically based bloom.
~QgsBloomRenderView() override
QgsBloomRenderView(const QString &viewName, Qt3DRender::QTexture2D *sourceColorTexture, const QSize &size, Qt3DCore::QEntity *rootSceneEntity)
Default constructor.
void setFilterRadius(float radius)
Sets the bloom filter radius.
Qt3DRender::QTexture2D * bloomTexture() const
Returns the texture containing the final bloom effect.
void setAspectRatio(float ratio)
Sets the aspect ratio of the view.
An entity responsible for applying a 9-tap tent upsample filter for physically based bloom.
An entity that is responsible for rendering a screen quad for a specific rendering pass.