16#ifndef QGSCHUNKEDENTITY_P_H
17#define QGSCHUNKEDENTITY_P_H
38class QgsChunkQueueJob;
39class QgsChunkLoaderFactory;
40class QgsChunkBoundsEntity;
41class QgsChunkQueueJobFactory;
46 struct RayCastContext;
64class QgsChunkedEntity :
public Qgs3DMapSceneEntity
69 QgsChunkedEntity(
float tau, QgsChunkLoaderFactory *loaderFactory,
bool ownsFactory,
70 int primitivesBudget = std::numeric_limits<int>::max(),
71 Qt3DCore::QNode *parent =
nullptr );
72 ~QgsChunkedEntity()
override;
75 void handleSceneUpdate(
const SceneState &state )
override;
78 int pendingJobsCount()
const override;
81 bool needsUpdate()
const override {
return mNeedsUpdate; }
83 QgsRange<float> getNearFarPlaneRange(
const QMatrix4x4 &viewMatrix )
const override;
86 void setShowBoundingBoxes(
bool enabled );
89 void updateNodes(
const QList<QgsChunkNode *> &nodes, QgsChunkQueueJobFactory *updateJobFactory );
92 QList<QgsChunkNode *> activeNodes()
const {
return mActiveNodes; }
94 QgsChunkNode *rootNode()
const {
return mRootNode; }
97 void setUsingAdditiveStrategy(
bool additive ) { mAdditiveStrategy = additive; }
104 bool usingAditiveStrategy()
const {
return mAdditiveStrategy; }
110 void setGpuMemoryLimit(
double gpuMemoryLimit ) { mGpuMemoryLimit = gpuMemoryLimit; }
116 double gpuMemoryLimit()
const {
return mGpuMemoryLimit; }
118 static double calculateEntityGpuMemorySize( Qt3DCore::QEntity *entity );
129 virtual QVector<QgsRayCastingUtils::RayHit> rayIntersection(
const QgsRayCastingUtils::Ray3D &ray,
const QgsRayCastingUtils::RayCastContext &context )
const;
133 void cancelActiveJob( QgsChunkQueueJob *job );
134 void cancelActiveJobs();
136 void setNeedsUpdate(
bool needsUpdate ) { mNeedsUpdate = needsUpdate; }
139 void update( QgsChunkNode *node,
const SceneState &state );
142 void pruneLoaderQueue(
const SceneState &state );
145 void requestResidency( QgsChunkNode *node );
148 QgsChunkQueueJob *startJob( QgsChunkNode *node );
151 void onActiveJobFinished();
155 QgsChunkNode *mRootNode =
nullptr;
157 bool mNeedsUpdate =
false;
168 QgsChunkLoaderFactory *mChunkLoaderFactory =
nullptr;
170 bool mOwnsFactory =
true;
172 QgsChunkList *mChunkLoaderQueue =
nullptr;
174 QgsChunkList *mReplacementQueue =
nullptr;
176 QList<QgsChunkNode *> mActiveNodes;
178 int mFrustumCulled = 0;
185 QgsChunkBoundsEntity *mBboxesEntity =
nullptr;
188 QList<QgsChunkQueueJob *> mActiveJobs;
194 bool mAdditiveStrategy =
false;
196 bool mIsValid =
true;
198 int mPrimitivesBudget = std::numeric_limits<int>::max();
199 double mGpuMemoryLimit = 500.0;
A template based class for storing ranges (lower to upper values).