16#ifndef QGSCHUNKEDENTITY_H
17#define QGSCHUNKEDENTITY_H
38class QgsChunkQueueJob;
39class QgsChunkLoaderFactory;
40class QgsChunkBoundsEntity;
41class QgsChunkQueueJobFactory;
46 struct RayCastContext;
63class QgsChunkedEntity :
public Qgs3DMapSceneEntity
68 QgsChunkedEntity(
Qgs3DMapSettings *mapSettings,
float tau, QgsChunkLoaderFactory *loaderFactory,
bool ownsFactory,
69 int primitivesBudget = std::numeric_limits<int>::max(),
70 Qt3DCore::QNode *parent =
nullptr );
71 ~QgsChunkedEntity()
override;
74 void handleSceneUpdate(
const SceneContext &sceneContext )
override;
77 int pendingJobsCount()
const override;
80 bool needsUpdate()
const override {
return mNeedsUpdate; }
82 QgsRange<float> getNearFarPlaneRange(
const QMatrix4x4 &viewMatrix )
const override;
85 void setShowBoundingBoxes(
bool enabled );
88 void updateNodes(
const QList<QgsChunkNode *> &nodes, QgsChunkQueueJobFactory *updateJobFactory );
91 QList<QgsChunkNode *> activeNodes()
const {
return mActiveNodes; }
93 QgsChunkNode *rootNode()
const {
return mRootNode; }
108 void cancelActiveJob( QgsChunkQueueJob *job );
109 void cancelActiveJobs();
111 void setNeedsUpdate(
bool needsUpdate ) { mNeedsUpdate = needsUpdate; }
114 void update( QgsChunkNode *node,
const SceneContext &sceneContext );
117 void pruneLoaderQueue(
const SceneContext &sceneContext );
120 void requestResidency( QgsChunkNode *node );
123 QgsChunkQueueJob *startJob( QgsChunkNode *node );
128 void onActiveJobFinished();
132 QgsChunkNode *mRootNode =
nullptr;
134 bool mNeedsUpdate =
false;
145 QgsChunkLoaderFactory *mChunkLoaderFactory =
nullptr;
147 bool mOwnsFactory =
true;
149 QgsChunkList *mChunkLoaderQueue =
nullptr;
151 QgsChunkList *mReplacementQueue =
nullptr;
153 QList<QgsChunkNode *> mActiveNodes;
155 int mFrustumCulled = 0;
162 QgsChunkBoundsEntity *mBboxesEntity =
nullptr;
165 QList<QgsChunkQueueJob *> mActiveJobs;
167 bool mIsValid =
true;
169 int mPrimitivesBudget = std::numeric_limits<int>::max();
A template based class for storing ranges (lower to upper values).
Helper struct to store ray casting parameters.