16#ifndef QGS3DMAPSCENE_H
17#define QGS3DMAPSCENE_H
24#include <Qt3DCore/QEntity>
29 class QRenderSettings;
40 class QForwardRenderer;
51class QgsTerrainEntity;
53class QgsChunkedEntity;
59class Qgs3DMapSceneEntity;
112 QVector<QgsPointXY> viewFrustum2DExtent()
const;
118 int totalPendingJobsCount()
const;
134 double worldSpaceError(
double epsilon,
double distance )
const;
176 QgsDoubleRange elevationRange(
bool ignoreTerrain =
false )
const;
251 Q_DECL_DEPRECATED
static QMap<QString, Qgs3DMapScene *> openScenes()
SIP_DEPRECATED;
273 void enableClipping( const QList<QVector4D> &clipPlaneEquations );
281 void disableClipping();
289 void addSceneEntity( Qgs3DMapSceneEntity *entity )
SIP_SKIP;
296 void removeSceneEntity( Qgs3DMapSceneEntity *entity )
SIP_SKIP;
308 static std::function<QMap<QString, Qgs3DMapScene *>()> sOpenScenesFunction;
347 void onCameraChanged();
348 void onFrameTriggered(
float dt );
349 void createTerrain();
350 void onLayerRenderer3DChanged();
351 void onLayersChanged();
352 void createTerrainDeferred();
353 void onBackgroundColorChanged();
355 void updateCameraLens();
356 void onSkyboxSettingsChanged();
357 void onShadowSettingsChanged();
358 void onAmbientOcclusionSettingsChanged();
359 void onEyeDomeShadingSettingsChanged();
360 void onDebugShadowMapSettingsChanged();
361 void onDebugDepthMapSettingsChanged();
362 void onCameraMovementSpeedChanged();
363 void onCameraNavigationModeChanged();
364 void onDebugOverlayEnabledChanged();
365 void onStopUpdatesChanged();
366 void on3DAxisSettingsChanged();
368 void onOriginChanged();
370 bool updateCameraNearFarPlanes();
380 void addCameraViewCenterEntity( Qt3DRender::QCamera *camera );
383 void updateSceneState();
385 bool updateScene(
bool forceUpdate =
false );
386 void finalizeNewEntity( Qt3DCore::QEntity *newEntity );
387 int maximumTextureSize()
const;
389 void handleClippingOnEntity( QEntity *entity )
const;
390 void handleClippingOnAllEntities()
const;
396 Qt3DLogic::QFrameAction *mFrameAction =
nullptr;
398 QgsTerrainEntity *mTerrain =
nullptr;
399 QgsGlobeEntity *mGlobe =
nullptr;
400 QList<Qgs3DMapSceneEntity *> mSceneEntities;
402 Qt3DCore::QEntity *mEntityCameraViewCenter =
nullptr;
404 QMap<QgsMapLayer *, Qt3DCore::QEntity *> mLayerEntities;
405 bool mTerrainUpdateScheduled =
false;
408 QList<Qt3DCore::QEntity *> mLightEntities;
409 QList<QgsMapLayer *> mModelVectorLayers;
412 Qt3DCore::QEntity *mEntityRotationCenter =
nullptr;
417 bool mSceneUpdatesEnabled =
true;
418 bool mSceneOriginShiftEnabled =
true;
420 QList<QVector4D> mClipPlanesEquations;
421 int mMaxClipPlanes = 6;
Display 3D ortho axis in the main 3D view.
Manages the various settings the user can choose from when exporting a 3D scene.
Qgs3DAxis * get3DAxis() const
Returns the 3D axis object.
void viewed2DExtentFrom3DChanged(QVector< QgsPointXY > extent)
Emitted when the viewed 2D extent seen by the 3D camera has changed.
QList< QVector4D > clipPlaneEquations() const
Returns list of clipping planes if clipping is enabled, otherwise an empty list.
void fpsCountChanged(float fpsCount)
Emitted when the FPS count changes.
QgsGlobeEntity * globeEntity()
Returns globe entity (may be nullptr if not using globe scene, terrain rendering is disabled or when ...
friend class TestQgs3DRendering
Qgs3DMapScene(Qgs3DMapSettings &map, QgsAbstract3DEngine *engine)
Constructs a 3D scene based on map settings and Qt 3D renderer configuration.
Qgs3DMapSettings * mapSettings() const
Returns the 3D map settings.
QgsAbstract3DEngine * engine() const
Returns the abstract 3D engine.
void gpuMemoryLimitReached()
Emitted when one of the entities reaches its GPU memory limit and it is not possible to lower the GPU...
QgsCameraController * cameraController() const
Returns camera controller.
SceneState
Enumeration of possible states of the 3D scene.
@ Ready
The scene is fully loaded/updated.
@ Updating
The scene is still being loaded/updated.
QgsTerrainEntity * terrainEntity()
Returns terrain entity (may be nullptr if using globe scene, terrain rendering is disabled or when te...
bool hasSceneOriginShiftEnabled() const
Returns whether the 3D scene is allowed to automatically move the scene's origin.
bool hasSceneUpdatesEnabled() const
Returns whether updates of the 3D scene's entities are allowed.
void updateTemporal()
Updates the temporale entities.
void totalPendingJobsCountChanged()
Emitted when the total number of pending jobs changes.
Qt3DCore::QEntity * layerEntity(QgsMapLayer *layer) const
Returns the entity belonging to layer.
void fpsCounterEnabledChanged(bool fpsCounterEnabled)
Emitted when the FPS counter is activated or deactivated.
void sceneStateChanged()
Emitted when the scene's state has changed.
SceneState sceneState() const
Returns the current state of the scene.
QList< QgsMapLayer * > layers() const
Returns the layers that contain chunked entities.
void terrainEntityChanged()
Emitted when the current terrain entity is replaced by a new one.
void setSceneUpdatesEnabled(bool enabled)
Sets whether updates of the 3D scene's entities are allowed.
void setSceneOriginShiftEnabled(bool enabled)
Returns whether the 3D scene is allowed to automatically move the scene's origin.
Base class for 3D engine implementation.
Base class for all renderers that participate in 3D views.
Object that controls camera movement based on user input.
QgsRange which stores a range of double values.
Base class for all map layer types.
A rectangle specified with double values.
Base class for all skybox types.
Contains the configuration of a skybox entity.