16#ifndef QGSCHUNKEDENTITY_H
17#define QGSCHUNKEDENTITY_H
43class QgsChunkBoundsEntity;
46struct QgsChunkLoaderResult;
53struct QgsChunkQueueJob
73class QgsChunkedEntity :
public Qgs3DMapSceneEntity
78 QgsChunkedEntity( Qgs3DMapSettings *mapSettings,
float tau, QgsChunkLoader *loader,
bool ownsLoader,
int primitivesBudget = std::numeric_limits<int>::max(), Qt3DCore::QNode *parent =
nullptr );
79 ~QgsChunkedEntity()
override;
82 void handleSceneUpdate(
const SceneContext &sceneContext )
override;
85 int pendingJobsCount()
const override;
88 bool needsUpdate()
const override {
return mNeedsUpdate; }
90 QgsRange<float> getNearFarPlaneRange(
const QMatrix4x4 &viewMatrix )
const override;
93 void setShowBoundingBoxes(
bool enabled );
96 void updateNodes(
const QList<QgsChunkNode *> &nodes );
99 QList<QgsChunkNode *> activeNodes()
const {
return mActiveNodes; }
101 QgsChunkNode *rootNode()
const {
return mRootNode.get(); }
112 virtual QList<QgsRayCastHit> rayIntersection(
const QgsRay3D &ray,
const QgsRayCastContext &context )
const;
116 void cancelActiveJob( QgsChunkQueueJob &job );
117 void cancelActiveJobs();
119 void setNeedsUpdate(
bool needsUpdate ) { mNeedsUpdate = needsUpdate; }
122 void update( QgsChunkNode *node,
const SceneContext &sceneContext );
125 void pruneLoaderQueue(
const SceneContext &sceneContext );
128 void requestResidency( QgsChunkNode *node );
131 void startJob( QgsChunkNode *node );
135 void eraseJobFromList( QgsChunkQueueJob &job );
137 void onActiveLoadJobFinished( QgsChunkQueueJob &job, QgsChunkLoaderResult &result );
141 std::unique_ptr<QgsChunkNode> mRootNode;
143 bool mNeedsUpdate =
false;
154 QgsChunkLoader *mChunkLoader =
nullptr;
156 bool mOwnsLoader =
true;
158 std::unique_ptr<QgsChunkList> mChunkLoaderQueue;
160 std::unique_ptr<QgsChunkList> mReplacementQueue;
162 QList<QgsChunkNode *> mActiveNodes;
164 int mFrustumCulled = 0;
171 QgsChunkBoundsEntity *mBboxesEntity =
nullptr;
177 std::vector<std::unique_ptr<QgsChunkQueueJob>> mActiveJobs;
179 bool mIsValid =
true;
181 int mPrimitivesBudget = std::numeric_limits<int>::max();
Axis-aligned bounding box - in world coords.
A representation of a ray in 3D.
Responsible for defining parameters of the ray casting operations in 3D map canvases.