16#ifndef QGSCHUNKEDENTITY_P_H
17#define QGSCHUNKEDENTITY_P_H
30#include <Qt3DCore/QEntity>
38class QgsChunkQueueJob;
39class QgsChunkLoaderFactory;
40class QgsChunkBoundsEntity;
41class QgsChunkQueueJobFactory;
62class QgsChunkedEntity :
public Qt3DCore::QEntity
67 QgsChunkedEntity(
float tau, QgsChunkLoaderFactory *loaderFactory,
bool ownsFactory,
68 int primitivesBudget = std::numeric_limits<int>::max(),
69 Qt3DCore::QNode *parent =
nullptr );
70 ~QgsChunkedEntity()
override;
78 QMatrix4x4 viewProjectionMatrix;
82 void update(
const SceneState &state );
85 bool needsUpdate()
const {
return mNeedsUpdate; }
88 void setShowBoundingBoxes(
bool enabled );
91 void updateNodes(
const QList<QgsChunkNode *> &nodes, QgsChunkQueueJobFactory *updateJobFactory );
94 QList<QgsChunkNode *> activeNodes()
const {
return mActiveNodes; }
96 QgsChunkNode *rootNode()
const {
return mRootNode; }
99 int pendingJobsCount()
const;
102 void setPickingEnabled(
bool enabled );
104 bool hasPickingEnabled()
const {
return mPickingEnabled; }
107 void setUsingAdditiveStrategy(
bool additive ) { mAdditiveStrategy = additive; }
114 bool usingAditiveStrategy()
const {
return mAdditiveStrategy; }
120 void setGpuMemoryLimit(
double gpuMemoryLimit ) { mGpuMemoryLimit = gpuMemoryLimit; }
126 double gpuMemoryLimit()
const {
return mGpuMemoryLimit; }
128 static double calculateEntityGpuMemorySize( Qt3DCore::QEntity *entity );
132 void cancelActiveJob( QgsChunkQueueJob *job );
133 void cancelActiveJobs();
135 void setNeedsUpdate(
bool needsUpdate ) { mNeedsUpdate = needsUpdate; }
138 void update( QgsChunkNode *node,
const SceneState &state );
141 void pruneLoaderQueue(
const SceneState &state );
144 void requestResidency( QgsChunkNode *node );
147 QgsChunkQueueJob *startJob( QgsChunkNode *node );
150 void onActiveJobFinished();
152 void onPickEvent( Qt3DRender::QPickEvent *event );
156 void pendingJobsCountChanged();
159 void newEntityCreated( Qt3DCore::QEntity *entity );
162 void pickedObject( Qt3DRender::QPickEvent *pickEvent,
QgsFeatureId fid );
166 QgsChunkNode *mRootNode =
nullptr;
168 bool mNeedsUpdate =
false;
179 QgsChunkLoaderFactory *mChunkLoaderFactory =
nullptr;
181 bool mOwnsFactory =
true;
183 QgsChunkList *mChunkLoaderQueue =
nullptr;
185 QgsChunkList *mReplacementQueue =
nullptr;
187 QList<QgsChunkNode *> mActiveNodes;
189 int mFrustumCulled = 0;
196 QgsChunkBoundsEntity *mBboxesEntity =
nullptr;
199 QList<QgsChunkQueueJob *> mActiveJobs;
202 bool mPickingEnabled =
false;
208 bool mAdditiveStrategy =
false;
210 bool mIsValid =
true;
212 int mPrimitivesBudget = std::numeric_limits<int>::max();
213 double mGpuMemoryLimit = 500.0;
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features