QGIS API Documentation 3.41.0-Master (cea29feecf2)
Loading...
Searching...
No Matches
qgsabstract3dengine.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsabstract3dengine.cpp
3 --------------------------------------
4 Date : July 2018
5 Copyright : (C) 2018 by Martin Dobias
6 Email : wonder dot sk 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#include "qgsabstract3dengine.h"
17#include "moc_qgsabstract3dengine.cpp"
18
19#include "qgsframegraph.h"
20
21#include <Qt3DRender/QRenderCapture>
22#include <Qt3DRender/QRenderSettings>
23
25 : QObject( parent )
26{
27}
28
30{
31 Qt3DRender::QRenderCaptureReply *captureReply;
32 captureReply = mFrameGraph->renderCapture()->requestCapture();
33
34 connect( captureReply, &Qt3DRender::QRenderCaptureReply::completed, this, [=] {
35 emit imageCaptured( captureReply->image() );
36 captureReply->deleteLater();
37 } );
38}
39
41{
42 Qt3DRender::QRenderCaptureReply *captureReply;
43 captureReply = mFrameGraph->depthRenderCapture()->requestCapture();
44
45 connect( captureReply, &Qt3DRender::QRenderCaptureReply::completed, this, [=] {
46 emit depthBufferCaptured( captureReply->image() );
47 captureReply->deleteLater();
48 } );
49}
50
55
60
62{
63 if ( mFrameGraph )
64 {
65 qDebug() << "FrameGraph:\n"
67 qDebug() << "SceneGraph:\n"
69 }
70}
71
73{
74 if ( mFrameGraph )
75 {
77 }
78 return QString();
79}
80
82{
83 if ( mFrameGraph )
84 {
86 }
87 return QString();
88}
void requestCaptureImage()
Starts a request for an image rendered by the engine.
void requestDepthBufferCapture()
Starts a request for an image containing the depth buffer data of the engine.
void imageCaptured(const QImage &image)
Emitted after a call to requestCaptureImage() to return the captured image.
bool renderCaptureEnabled() const
Returns whether it will be possible to render to an image.
void depthBufferCaptured(const QImage &image)
Emitted after a call to requestDepthBufferCapture() to return the captured depth buffer.
QString dumpFrameGraph() const
Dump frame graph as string.
void setRenderCaptureEnabled(bool enabled)
Sets whether it will be possible to render to an image.
QgsAbstract3DEngine(QObject *parent=nullptr)
Constructor for QgsAbstract3DEngine with the specified parent object.
QgsFrameGraph * mFrameGraph
QString dumpSceneGraph() const
Dump scene graph as string.
void dumpFrameGraphToConsole() const
Dump the current frame graph and scene graph to the console.
bool renderCaptureEnabled() const
Returns whether it will be possible to render to an image.
QString dumpFrameGraph() const
Dumps frame graph as string.
void setRenderCaptureEnabled(bool enabled)
Sets whether it will be possible to render to an image.
Qt3DRender::QRenderCapture * depthRenderCapture()
Returns the render capture object used to take an image of the depth buffer of the scene.
QString dumpSceneGraph() const
Dumps scene graph as string.
Qt3DRender::QRenderCapture * renderCapture()
Returns the render capture object used to take an image of the scene.