QgsAbstract3DEngine class

3 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:

Derived classes

class QgsOffscreen3DEngine
3 Off-screen 3D engine implementation.
class QgsWindow3DEngine
3 On-screen 3D engine: it creates OpenGL window (QWindow) and displays rendered 3D scene there.

Public functions

auto camera() -> Qt3DRender::QCamera* pure virtual
Returns pointer to the engine's camera entity.
auto renderSettings() -> Qt3DRender::QRenderSettings* pure virtual
Returns access to the engine's render settings (the frame graph can be accessed from here)
void requestCaptureImage() pure virtual
Starts a request for an image rendered by the engine.
void setClearColor(const QColor& color) pure virtual
Sets background color of the scene.
void setFrustumCullingEnabled(bool enabled) pure virtual
Sets whether frustum culling is enabled (this should make rendering faster by not rendering entities outside of camera's view)
void setRootEntity(Qt3DCore::QEntity* root) pure virtual
Sets root entity of the 3D scene.
auto size() const -> QSize pure virtual
Returns size of the engine's rendering area in pixels.

Signals

void imageCaptured(const QImage& image)
Emitted after a call to requestCaptureImage() to return the captured image.

Function documentation

void QgsAbstract3DEngine::requestCaptureImage() pure virtual

Starts a request for an image rendered by the engine.

The function does not block - when the rendered image is captured, it is returned in imageCaptured() signal. Only one image request can be active at a time.