QGIS API Documentation 4.0.0-Norrköping (1ddcee3d0e4)
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
31{
32 Qt3DRender::QRenderCaptureReply *captureReply;
33 mFrameGraph->setRenderCaptureEnabled( true );
34 captureReply = mFrameGraph->renderCapture()->requestCapture();
35
36 connect( captureReply, &Qt3DRender::QRenderCaptureReply::completed, this, [this, captureReply] {
37 emit imageCaptured( captureReply->image() );
38 captureReply->deleteLater();
39 mFrameGraph->setRenderCaptureEnabled( false );
40 } );
41}
42
44{
45 Qt3DRender::QRenderCaptureReply *captureReply;
46 captureReply = mFrameGraph->depthRenderCapture()->requestCapture();
47
48 connect( captureReply, &Qt3DRender::QRenderCaptureReply::completed, this, [this, captureReply] {
49 emit depthBufferCaptured( captureReply->image() );
50 captureReply->deleteLater();
51 } );
52}
53
55{
56 if ( mFrameGraph )
57 {
58 QgsDebugMsgLevel( QString( "FrameGraph:\n%1" ).arg( mFrameGraph->dumpFrameGraph() ), 1 );
59 QgsDebugMsgLevel( QString( "SceneGraph:\n%1" ).arg( mFrameGraph->dumpSceneGraph() ), 1 );
60 }
61}
62
64{
65 if ( mFrameGraph )
66 {
67 return mFrameGraph->dumpFrameGraph();
68 }
69 return QString();
70}
71
73{
74 if ( mFrameGraph )
75 {
76 return mFrameGraph->dumpSceneGraph();
77 }
78 return QString();
79}
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:63