24#include <Qt3DExtras/QForwardRenderer>
25#include <Qt3DRender/QRenderSettings>
27#include "moc_qgswindow3dengine.cpp"
32 mMapCanvas3D = parent;
34 mRoot =
new Qt3DCore::QEntity;
38 mMapCanvas3D->setActiveFrameGraph(
mFrameGraph->frameGraphRoot() );
41 mFrameGraph->shadowRenderView().setEnabled(
false );
68 mSceneRoot->setParent( mRoot );
69 mSceneRoot->addComponent(
mFrameGraph->forwardRenderView().renderLayer() );
70 mSceneRoot->addComponent(
mFrameGraph->shadowRenderView().entityCastingShadowsLayer() );
75 return mMapCanvas3D->renderSettings();
80 return mMapCanvas3D->camera();
85 return mMapCanvas3D->size();
97 mMapCanvas3D->setWidth( mSize.width() );
98 mMapCanvas3D->setHeight( mSize.height() );
99 mFrameGraph->setSize( mSize * mMapCanvas3D->devicePixelRatio() );
100 camera()->setAspectRatio(
float( mSize.width() ) /
float( mSize.height() ) );
Convenience wrapper to simplify the creation of a 3D window ready to be used with QGIS.
void setRootEntity(Qt3DCore::QEntity *root)
Sets the specified root entity of the scene.
void sizeChanged()
Emitted after a call to setSize().
QgsAbstract3DEngine(QObject *parent=nullptr)
Constructor for QgsAbstract3DEngine with the specified parent object.
QgsFrameGraph * mFrameGraph
Container class that holds different objects related to frame graphs of 3D scenes.
void setRootEntity(Qt3DCore::QEntity *root) override
Sets root entity of the 3D scene.
QgsWindow3DEngine(Qgs3DMapCanvas *parent)
Constructor for QgsWindow3DEngine with the specified parent Qgs3DMapCanvas.
Qt3DRender::QRenderSettings * renderSettings() override
Returns access to the engine's render settings (the frame graph can be accessed from here).
void setSize(QSize s) override
Sets the size of the rendering area (in pixels).
QSize size() const override
Returns size of the engine's rendering area in pixels.
Qt3DCore::QEntity * root() const
Returns the root entity.
Qt3DRender::QCamera * camera() override
Returns pointer to the engine's camera entity.
QSurface * surface() const override
Returns the surface of the engine.
void setClearColor(const QColor &color) override
Sets background color of the scene.
QWindow * window()
Returns the internal 3D window where all the rendered output is displayed.
void setFrustumCullingEnabled(bool enabled) override
Sets whether frustum culling is enabled (this should make rendering faster by not rendering entities ...