QGIS API Documentation 3.99.0-Master (a8f284845db)
Loading...
Searching...
No Matches
qgsforwardrenderview.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsforwardrenderview.h
3 --------------------------------------
4 Date : June 2024
5 Copyright : (C) 2024 by Benoit De Mezzo and (C) 2020 by Belgacem Nedjima
6 Email : benoit dot de dot mezzo at oslandia 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 QGSFORWARDRENDERVIEW_H
17#define QGSFORWARDRENDERVIEW_H
18
20
21#define SIP_NO_FILE
22
23namespace Qt3DRender
24{
25 class QRenderSettings;
26 class QLayer;
27 class QSubtreeEnabler;
28 class QTexture2D;
29 class QCamera;
30 class QCameraSelector;
31 class QLayerFilter;
32 class QRenderTargetSelector;
33 class QRenderTarget;
34 class QClearBuffers;
35 class QFrustumCulling;
36 class QRenderStateSet;
37 class QDebugOverlay;
38} // namespace Qt3DRender
39
40
49{
50 public:
52 QgsForwardRenderView( const QString &viewName, Qt3DRender::QCamera *mainCamera );
53
55 Qt3DRender::QLayer *renderLayer() { return mRenderLayer; }
56
58 Qt3DRender::QLayer *transparentObjectLayer() { return mTransparentObjectsLayer; }
59
61 void setClearColor( const QColor &clearColor );
62
64 bool isFrustumCullingEnabled() const { return mFrustumCullingEnabled; }
66 void setFrustumCullingEnabled( bool enabled );
67
69 void setDebugOverlayEnabled( bool enabled );
70
72 Qt3DRender::QRenderTargetSelector *renderTargetSelector() { return mRenderTargetSelector; }
73
74 void updateWindowResize( int width, int height ) override;
75
77 Qt3DRender::QTexture2D *depthTexture() const;
78
80 Qt3DRender::QTexture2D *colorTexture() const;
81
89 void addClipPlanes( int nrClipPlanes );
90
97 void removeClipPlanes();
98
99 private:
100 Qt3DRender::QCamera *mMainCamera = nullptr;
101
102 Qt3DRender::QCameraSelector *mMainCameraSelector = nullptr;
103 Qt3DRender::QLayerFilter *mLayerFilter = nullptr;
104 Qt3DRender::QRenderTargetSelector *mRenderTargetSelector = nullptr;
105
106 // clip planes render state
107 Qt3DRender::QRenderStateSet *mClipRenderStateSet = nullptr;
108
109 Qt3DRender::QLayer *mRenderLayer = nullptr;
110 Qt3DRender::QLayer *mTransparentObjectsLayer = nullptr;
111 Qt3DRender::QClearBuffers *mClearBuffers = nullptr;
112 bool mFrustumCullingEnabled = true;
113 Qt3DRender::QFrustumCulling *mFrustumCulling = nullptr;
114 // Forward rendering pass texture related objects:
115 Qt3DRender::QTexture2D *mColorTexture = nullptr;
116 Qt3DRender::QTexture2D *mDepthTexture = nullptr;
117 // QDebugOverlay added in the forward pass
118 Qt3DRender::QDebugOverlay *mDebugOverlay = nullptr;
119
123 void buildRenderPasses();
124
128 Qt3DRender::QRenderTarget *buildTextures();
129};
130
131#endif // QGSFORWARDRENDERVIEW_H
QgsAbstractRenderView(const QString &viewName)
Constructor for QgsAbstractRenderView with the specified parent object.
Qt3DRender::QRenderTargetSelector * renderTargetSelector()
Returns current render target selector.
Qt3DRender::QLayer * renderLayer()
Returns a layer object used to indicate that the object is transparent.
void setClearColor(const QColor &clearColor)
Sets the clear color of the scene (background color).
Qt3DRender::QTexture2D * colorTexture() const
Returns forward color texture.
Qt3DRender::QLayer * transparentObjectLayer()
Returns a layer object used to indicate that the object is transparent.
void setDebugOverlayEnabled(bool enabled)
Sets whether debug overlay is enabled.
void updateWindowResize(int width, int height) override
Called when 3D window is resized.
void setFrustumCullingEnabled(bool enabled)
Sets whether frustum culling is enabled.
bool isFrustumCullingEnabled() const
Returns whether frustum culling is enabled.
Qt3DRender::QTexture2D * depthTexture() const
Returns forward depth texture.
void addClipPlanes(int nrClipPlanes)
Setups nrClipPlanes clip planes in the forward pass to enable OpenGL clipping.
void removeClipPlanes()
Disables OpenGL clipping.
QgsForwardRenderView(const QString &viewName, Qt3DRender::QCamera *mainCamera)
Constructor with 3D scene camera.