16#ifndef QGSFRAMEGRAPH_H
17#define QGSFRAMEGRAPH_H
24#include <Qt3DRender/QCamera>
25#include <Qt3DRender/QCameraSelector>
26#include <Qt3DRender/QClearBuffers>
27#include <Qt3DRender/QCullFace>
28#include <Qt3DRender/QDebugOverlay>
29#include <Qt3DRender/QDepthTest>
30#include <Qt3DRender/QFrustumCulling>
31#include <Qt3DRender/QLayer>
32#include <Qt3DRender/QLayerFilter>
33#include <Qt3DRender/QParameter>
34#include <Qt3DRender/QPolygonOffset>
35#include <Qt3DRender/QRenderCapture>
36#include <Qt3DRender/QRenderStateSet>
37#include <Qt3DRender/QRenderSurfaceSelector>
38#include <Qt3DRender/QRenderTarget>
39#include <Qt3DRender/QRenderTargetSelector>
40#include <Qt3DRender/QTexture>
41#include <Qt3DRender/QViewport>
77 Qt3DRender::QFrameGraphNode *
frameGraphRoot() {
return mRenderSurfaceSelector; }
80 Qt3DRender::QCamera *
mainCamera() {
return mMainCamera; }
145 bool registerRenderView( std::unique_ptr<QgsAbstractRenderView>
renderView,
const QString &name, Qt3DRender::QFrameGraphNode *topNode =
nullptr );
234 Qt3DRender::QRenderSurfaceSelector *mRenderSurfaceSelector =
nullptr;
235 Qt3DRender::QViewport *mMainViewPort =
nullptr;
237 Qt3DRender::QCamera *mMainCamera =
nullptr;
240 Qt3DRender::QRenderTargetSelector *mRenderCaptureTargetSelector =
nullptr;
241 Qt3DRender::QRenderCapture *mRenderCapture =
nullptr;
243 Qt3DRender::QTexture2D *mRenderCaptureColorTexture =
nullptr;
244 Qt3DRender::QTexture2D *mRenderCaptureDepthTexture =
nullptr;
247 Qt3DRender::QCameraSelector *mRubberBandsCameraSelector =
nullptr;
248 Qt3DRender::QLayerFilter *mRubberBandsLayerFilter =
nullptr;
249 Qt3DRender::QRenderStateSet *mRubberBandsStateSet =
nullptr;
250 Qt3DRender::QRenderTargetSelector *mRubberBandsRenderTargetSelector =
nullptr;
252 QSize mSize = QSize( 1024, 768 );
254 QVector3D mLightDirection = QVector3D( 0.0, -1.0f, 0.0f );
256 Qt3DCore::QEntity *mRootEntity =
nullptr;
258 Qt3DRender::QLayer *mRubberBandsLayer =
nullptr;
262 Qt3DCore::QEntity *mRubberBandsRootEntity =
nullptr;
269 void constructShadowRenderPass();
270 void constructForwardRenderPass();
271 void constructDebugTexturePass( Qt3DRender::QFrameGraphNode *topNode =
nullptr );
272 Qt3DRender::QFrameGraphNode *constructPostprocessingPass();
273 void constructDepthRenderPass();
274 void constructAmbientOcclusionRenderPass();
275 Qt3DRender::QFrameGraphNode *constructRubberBandsPass();
277 Qt3DRender::QFrameGraphNode *constructSubPostPassForProcessing();
278 Qt3DRender::QFrameGraphNode *constructSubPostPassForRenderCapture();
280 bool mRenderCaptureEnabled =
false;
283 std::map<QString, std::unique_ptr<QgsAbstractRenderView>> mRenderViewMap;
Base class for 3D render view.
Container class that holds different objects related to ambient occlusion rendering.
Contains the configuration of ambient occlusion rendering.
Object that controls camera movement based on user input.
An entity that is responsible for debugging texture.
Container class that holds different objects related to depth rendering.
Definition of a directional light in a 3D map scene.
Container class that holds different objects related to forward rendering.
void updateAmbientOcclusionSettings(const QgsAmbientOcclusionSettings &settings)
Updates settings for ambient occlusion.
void updateEyeDomeSettings(const Qgs3DMapSettings &settings)
Updates settings for eye dome lighting.
bool isRenderViewEnabled(const QString &name)
Returns true if the render view named name is found and enabled.
void setRenderViewEnabled(const QString &name, bool enable)
Enables or disables the render view named name according to enable.
void updateShadowSettings(const QgsShadowSettings &shadowSettings, const QList< QgsLightSource * > &lightSources)
Updates shadow bias, light and texture size according to shadowSettings and lightSources.
void addClipPlanes(int nrClipPlanes)
Setups nrClipPlanes clip planes in the forward pass to enable OpenGL clipping.
void unregisterRenderView(const QString &name)
Unregisters the render view named name, if any.
bool registerRenderView(std::unique_ptr< QgsAbstractRenderView > renderView, const QString &name, Qt3DRender::QFrameGraphNode *topNode=nullptr)
Registers a new the render view renderView with name name.
QString dumpFrameGraph() const
Dumps frame graph as string.
void setRenderCaptureEnabled(bool enabled)
Sets whether it will be possible to render to an image.
QgsAmbientOcclusionRenderView & ambientOcclusionRenderView()
Returns ambient occlusion renderview.
Qt3DRender::QRenderCapture * depthRenderCapture()
Returns the render capture object used to take an image of the depth buffer of the scene.
void updateDebugShadowMapSettings(const Qgs3DMapSettings &settings)
Updates settings for shadows debug map.
QgsAbstractRenderView * renderView(const QString &name)
Returns the render view named name, if any.
void removeClipPlanes()
Disables OpenGL clipping.
static const QString AMBIENT_OCCLUSION_RENDERVIEW
Ambient occlusion render view name.
Qt3DRender::QFrameGraphNode * frameGraphRoot()
Returns the root of the frame graph object.
QgsDepthRenderView & depthRenderView()
Returns depth renderview.
void setClearColor(const QColor &clearColor)
Sets the clear color of the scene (background color).
QgsPostprocessingEntity * postprocessingEntity()
Returns the postprocessing entity.
static const QString FORWARD_RENDERVIEW
Qt3DCore::QEntity * rubberBandsRootEntity()
Returns entity for all rubber bands (to show them always on top).
void setFrustumCullingEnabled(bool enabled)
Sets whether frustum culling is enabled.
static const QString SHADOW_RENDERVIEW
void setDebugOverlayEnabled(bool enabled)
Sets whether debug overlay is enabled.
void updateDebugDepthMapSettings(const Qgs3DMapSettings &settings)
Updates settings for depth debug map.
static const QString AXIS3D_RENDERVIEW
QgsForwardRenderView & forwardRenderView()
Returns forward renderview.
QString dumpSceneGraph() const
Dumps scene graph as string.
QgsShadowRenderView & shadowRenderView()
Returns shadow renderview.
static const QString DEBUG_RENDERVIEW
void setSize(QSize s)
Sets the size of the buffers used for rendering.
static const QString DEPTH_RENDERVIEW
Qt3DRender::QCamera * mainCamera()
Returns the main camera.
QgsFrameGraph(QSurface *surface, QSize s, Qt3DRender::QCamera *mainCamera, Qt3DCore::QEntity *root)
Constructor.
Qt3DRender::QRenderCapture * renderCapture()
Returns the render capture object used to take an image of the scene.
An entity that is responsible for applying post processing effects.
A rectangle specified with double values.
Container class that holds different objects related to shadow rendering.
Contains configuration for rendering shadows.