QGIS API Documentation 3.38.0-Grenoble (exported)
Loading...
Searching...
No Matches
qgs3dmapsceneentity_p.h
Go to the documentation of this file.
1/***************************************************************************
2 qgs3dmapsceneentity_p.h
3 --------------------------------------
4 Date : May 2023
5 Copyright : (C) 2023 by Stefanos Natsis
6 Email : uclaros at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGS3DMAPSCENEENTITY_P_H
17#define QGS3DMAPSCENEENTITY_P_H
18
20
21//
22// W A R N I N G
23// -------------
24//
25// This file is not part of the QGIS API. It exists purely as an
26// implementation detail. This header file may change from version to
27// version without notice, or even be removed.
28//
29
30#include <Qt3DCore/QEntity>
31#include <QVector3D>
32#include <QMatrix4x4>
33
34#include "qgsrange.h"
35#include "qgssettings.h"
36
37#define SIP_NO_FILE
38
39
45class Qgs3DMapSceneEntity : public Qt3DCore::QEntity
46{
47 Q_OBJECT
48 public:
50 Qgs3DMapSceneEntity( Qt3DCore::QNode *parent = nullptr )
51 : Qt3DCore::QEntity( parent )
52 {
53 const QgsSettings settings;
54 mGpuMemoryLimit = settings.value( QStringLiteral( "map3d/gpuMemoryLimit" ), 500.0, QgsSettings::App ).toDouble();
55 }
56
58 struct SceneContext
59 {
60 QVector3D cameraPos;
61 float cameraFov;
62 int screenSizePx;
63 QMatrix4x4 viewProjectionMatrix;
64 };
65
67 virtual void handleSceneUpdate( const SceneContext &sceneContext ) { Q_UNUSED( sceneContext ) }
68
70 virtual int pendingJobsCount() const { return 0; }
71
73 virtual bool needsUpdate() const { return false; }
74
76 virtual QgsRange<float> getNearFarPlaneRange( const QMatrix4x4 &viewMatrix ) const { Q_UNUSED( viewMatrix ) return QgsRange<float>( 1e9, 0 ); }
77
78
80 void setGpuMemoryLimit( double gpuMemoryLimit ) { mGpuMemoryLimit = gpuMemoryLimit; }
81
83 double gpuMemoryLimit() const { return mGpuMemoryLimit; }
84
86 bool hasReachedGpuMemoryLimit() const { return mHasReachedGpuMemoryLimit; }
87
88 protected:
90 void setHasReachedGpuMemoryLimit( bool reached ) { mHasReachedGpuMemoryLimit = reached; }
91
92 signals:
94 void pendingJobsCountChanged();
95
97 void newEntityCreated( Qt3DCore::QEntity *entity );
98
99 protected:
101 double mGpuMemoryLimit = 500.0; // in megabytes
103 bool mHasReachedGpuMemoryLimit = false;
104};
105
107
108#endif // QGS3DMAPSCENEENTITY_P_H
A template based class for storing ranges (lower to upper values).
Definition qgsrange.h:46
This class is a composition of two QSettings instances:
Definition qgssettings.h:64
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.