Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Add 3D engine base class + window & offscreen implementations
- Loading branch information
Showing
with
541 additions
and 35 deletions.
- +9 −0 src/3d/CMakeLists.txt
- +13 −10 src/3d/qgs3dmapscene.cpp
- +3 −3 src/3d/qgs3dmapscene.h
- +16 −0 src/3d/qgsabstract3dengine.cpp
- +52 −0 src/3d/qgsabstract3dengine.h
- +217 −0 src/3d/qgsoffscreen3dengine.cpp
- +89 −0 src/3d/qgsoffscreen3dengine.h
- +61 −0 src/3d/qgswindow3dengine.cpp
- +61 −0 src/3d/qgswindow3dengine.h
- +15 −18 src/app/3d/qgs3dmapcanvas.cpp
- +5 −4 src/app/3d/qgs3dmapcanvas.h
@@ -0,0 +1,16 @@ | ||
/*************************************************************************** | ||
qgsabstract3dengine.cpp | ||
-------------------------------------- | ||
Date : July 2018 | ||
Copyright : (C) 2018 by Martin Dobias | ||
Email : wonder dot sk at gmail dot com | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "qgsabstract3dengine.h" |
@@ -0,0 +1,52 @@ | ||
#ifndef QGSABSTRACT3DENGINE_H | ||
#define QGSABSTRACT3DENGINE_H | ||
|
||
#include "qgis_3d.h" | ||
|
||
#include <QObject> | ||
|
||
class QColor; | ||
class QRect; | ||
|
||
namespace Qt3DCore | ||
{ | ||
class QEntity; | ||
} | ||
|
||
namespace Qt3DRender | ||
{ | ||
class QRenderSettings; | ||
class QCamera; | ||
} | ||
|
||
/** | ||
* Base class for 3D engine implementation. A 3D engine is responsible for setting up | ||
* rendering with Qt3D. This means mainly: | ||
* - creating Qt3D aspect engine and registering rendering aspect | ||
* - setting up a camera, render settings and frame graph | ||
* | ||
* We have two implementations: | ||
* - QgsWindow3DEngine - used for rendering on display (has a QWindow that can be embedded into QWidget) | ||
* - QgsOffscreen3DEngine - renders scene to images | ||
* | ||
* \since QGIS 3.4 | ||
*/ | ||
class _3D_EXPORT QgsAbstract3DEngine : public QObject | ||
{ | ||
Q_OBJECT | ||
public: | ||
|
||
virtual void setClearColor( const QColor &color ) = 0; | ||
virtual void setFrustumCullingEnabled( bool enabled ) = 0; | ||
virtual void setRootEntity( Qt3DCore::QEntity *root ) = 0; | ||
|
||
virtual Qt3DRender::QRenderSettings *renderSettings() = 0; | ||
virtual Qt3DRender::QCamera *camera() = 0; | ||
virtual QSize size() const = 0; | ||
|
||
signals: | ||
void imageCaptured( const QImage &image ); | ||
}; | ||
|
||
|
||
#endif // QGSABSTRACT3DENGINE_H |
Oops, something went wrong.