QGIS API Documentation 3.99.0-Master (2fe06baccd8)
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
18#include "qgsframegraph.h"
19#include "qgslogger.h"
20
21#include <Qt3DRender/QRenderCapture>
22#include <Qt3DRender/QRenderSettings>
23
24#include "moc_qgsabstract3dengine.cpp"
25
27 : QObject( parent )
28{
29}
30
32{
33 Qt3DRender::QRenderCaptureReply *captureReply;
34 mFrameGraph->setRenderCaptureEnabled( true );
35 captureReply = mFrameGraph->renderCapture()->requestCapture();
36
37 connect( captureReply, &Qt3DRender::QRenderCaptureReply::completed, this, [this, captureReply] {
38 emit imageCaptured( captureReply->image() );
39 captureReply->deleteLater();
40 mFrameGraph->setRenderCaptureEnabled( false );
41 } );
42}
43
45{
46 Qt3DRender::QRenderCaptureReply *captureReply;
47 captureReply = mFrameGraph->depthRenderCapture()->requestCapture();
48
49 connect( captureReply, &Qt3DRender::QRenderCaptureReply::completed, this, [this, captureReply] {
50 emit depthBufferCaptured( captureReply->image() );
51 captureReply->deleteLater();
52 } );
53}
54
56{
57 if ( mFrameGraph )
58 {
59 QgsDebugMsgLevel( QString( "FrameGraph:\n%1" ).arg( mFrameGraph->dumpFrameGraph() ), 1 );
60 QgsDebugMsgLevel( QString( "SceneGraph:\n%1" ).arg( mFrameGraph->dumpSceneGraph() ), 1 );
61 }
62}
63
65{
66 if ( mFrameGraph )
67 {
68 return mFrameGraph->dumpFrameGraph();
69 }
70 return QString();
71}
72
74{
75 if ( mFrameGraph )
76 {
77 return mFrameGraph->dumpSceneGraph();
78 }
79 return QString();
80}
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.
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.
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.
#define QgsDebugMsgLevel(str, level)
Definition qgslogger.h:61