16#ifndef QGS3DMAPSCENE_H
17#define QGS3DMAPSCENE_H
21#include <Qt3DCore/QEntity>
30 class QRenderSettings;
41 class QForwardRenderer;
52class QgsTerrainEntity;
54class QgsChunkedEntity;
61class Qgs3DMapSceneEntity;
114 QVector<QgsPointXY> viewFrustum2DExtent()
const;
120 int totalPendingJobsCount()
const;
136 float worldSpaceError(
float epsilon,
float distance )
const;
178 QgsDoubleRange elevationRange(
bool ignoreTerrain =
false )
const;
253 Q_DECL_DEPRECATED
static QMap<QString, Qgs3DMapScene *> openScenes()
SIP_DEPRECATED;
275 void enableClipping( const QList<QVector4D> &clipPlaneEquations );
283 void disableClipping();
291 void addSceneEntity( Qgs3DMapSceneEntity *entity )
SIP_SKIP;
298 void removeSceneEntity( Qgs3DMapSceneEntity *entity )
SIP_SKIP;
306 QList<QVector4D> clipPlaneEquations()
const {
return mClipPlanesEquations; };
310 static std::function<QMap<QString, Qgs3DMapScene *>()> sOpenScenesFunction;
346 void updateTemporal();
349 void onCameraChanged();
350 void onFrameTriggered(
float dt );
351 void createTerrain();
352 void onLayerRenderer3DChanged();
353 void onLayersChanged();
354 void createTerrainDeferred();
355 void onBackgroundColorChanged();
357 void updateCameraLens();
358 void onSkyboxSettingsChanged();
359 void onShadowSettingsChanged();
360 void onAmbientOcclusionSettingsChanged();
361 void onEyeDomeShadingSettingsChanged();
362 void onDebugShadowMapSettingsChanged();
363 void onDebugDepthMapSettingsChanged();
364 void onCameraMovementSpeedChanged();
365 void onCameraNavigationModeChanged();
366 void onDebugOverlayEnabledChanged();
367 void onStopUpdatesChanged();
368 void on3DAxisSettingsChanged();
370 void onOriginChanged();
372 bool updateCameraNearFarPlanes();
382 void addCameraViewCenterEntity( Qt3DRender::QCamera *camera );
385 void updateSceneState();
386 void updateScene(
bool forceUpdate =
false );
387 void finalizeNewEntity( Qt3DCore::QEntity *newEntity );
388 int maximumTextureSize()
const;
390 void handleClippingOnEntity( QEntity *entity )
const;
391 void handleClippingOnAllEntities()
const;
397 Qt3DLogic::QFrameAction *mFrameAction =
nullptr;
399 QgsTerrainEntity *mTerrain =
nullptr;
400 QgsGlobeEntity *mGlobe =
nullptr;
401 QList<Qgs3DMapSceneEntity *> mSceneEntities;
403 Qt3DCore::QEntity *mEntityCameraViewCenter =
nullptr;
405 QMap<QgsMapLayer *, Qt3DCore::QEntity *> mLayerEntities;
406 bool mTerrainUpdateScheduled =
false;
409 QList<Qt3DCore::QEntity *> mLightEntities;
410 QList<QgsMapLayer *> mModelVectorLayers;
413 Qt3DCore::QEntity *mEntityRotationCenter =
nullptr;
418 bool mSceneUpdatesEnabled =
true;
419 bool mSceneOriginShiftEnabled =
true;
421 QList<QVector4D> mClipPlanesEquations;
422 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.
Entity that encapsulates our 3D scene - contains all other entities (such as terrain) as children.
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.
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 ...
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 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.
An entity that is responsible for applying post processing effects.
A rectangle specified with double values.
Base class for all skybox types.
Contains the configuration of a skybox entity.