Skip to content
Permalink
Browse files

remove primitiveCount and primitiveBudget from chunk loader

  • Loading branch information
NEDJIMAbelgacem authored and wonder-sk committed Feb 10, 2021
1 parent a3af7b7 commit f9e24098665ff091a3e8eed5d77a7a776d751150
@@ -250,7 +250,7 @@ void QgsChunkedEntity::update( QgsChunkNode *root, const SceneState &state )
QSet<QgsChunkNode *> nodes;

using slot = std::pair<QgsChunkNode *, float>;
auto cmp_funct = []( slot &p1, slot &p2 )
auto cmp_funct = []( slot & p1, slot & p2 )
{
return p1.second < p2.second;
};
@@ -44,22 +44,13 @@ class QgsChunkLoader : public QgsChunkQueueJob
Q_OBJECT
public:
//! Construct chunk loader for a node
QgsChunkLoader( QgsChunkNode *node, int primitiveBudget = 1000000 )
: QgsChunkQueueJob( node )
, mPrimitiveBudget( primitiveBudget )
{
}
QgsChunkLoader( QgsChunkNode *node ) : QgsChunkQueueJob( node ) { }

/**
* Run in main thread to use loaded data.
* Returns entity attached to the given parent entity in disabled state
*/
virtual Qt3DCore::QEntity *createEntity( Qt3DCore::QEntity *parent ) = 0;

virtual int primitiveCount() const { return 0; }
virtual int primitiveBudget() const { return mPrimitiveBudget; }
protected:
int mPrimitiveBudget = 1000000;
};


@@ -47,11 +47,10 @@
///////////////

QgsPointCloudLayerChunkLoader::QgsPointCloudLayerChunkLoader( const QgsPointCloudLayerChunkLoaderFactory *factory, QgsChunkNode *node, std::unique_ptr< QgsPointCloud3DSymbol > symbol,
double zValueScale, double zValueOffset, int pointBudget, int count )
: QgsChunkLoader( node, pointBudget )
double zValueScale, double zValueOffset )
: QgsChunkLoader( node )
, mFactory( factory )
, mContext( factory->mMap, std::move( symbol ), zValueScale, zValueOffset )
, mPointsCount( count )
{
mContext.setIsCanceledCallback( [this] { return mCanceled; } );

@@ -126,11 +125,6 @@ Qt3DCore::QEntity *QgsPointCloudLayerChunkLoader::createEntity( Qt3DCore::QEntit
return entity;
}

int QgsPointCloudLayerChunkLoader::primitiveCount() const
{
return mPointsCount;
}

///////////////


@@ -150,8 +144,7 @@ QgsChunkLoader *QgsPointCloudLayerChunkLoaderFactory::createChunkLoader( QgsChun
QgsChunkNodeId id = node->tileId();
IndexedPointCloudNode n( id.d, id.x, id.y, id.z );
Q_ASSERT( mPointCloudIndex->hasNode( n ) );
int pointCount = mPointCloudIndex->nodePointCount( n );
return new QgsPointCloudLayerChunkLoader( this, node, std::unique_ptr< QgsPointCloud3DSymbol >( static_cast< QgsPointCloud3DSymbol * >( mSymbol->clone() ) ), mZValueScale, mZValueOffset, mPointBudget, pointCount );
return new QgsPointCloudLayerChunkLoader( this, node, std::unique_ptr< QgsPointCloud3DSymbol >( static_cast< QgsPointCloud3DSymbol * >( mSymbol->clone() ) ), mZValueScale, mZValueOffset );
}

int QgsPointCloudLayerChunkLoaderFactory::primitivesCount( QgsChunkNode *node ) const
@@ -92,11 +92,9 @@ class QgsPointCloudLayerChunkLoader : public QgsChunkLoader
* Constructs the loader
* QgsPointCloudLayerChunkLoader takes ownership over symbol
*/
QgsPointCloudLayerChunkLoader( const QgsPointCloudLayerChunkLoaderFactory *factory, QgsChunkNode *node, std::unique_ptr< QgsPointCloud3DSymbol > symbol, double zValueScale, double zValueOffset, int pointBudget, int count );
QgsPointCloudLayerChunkLoader( const QgsPointCloudLayerChunkLoaderFactory *factory, QgsChunkNode *node, std::unique_ptr< QgsPointCloud3DSymbol > symbol, double zValueScale, double zValueOffset );
~QgsPointCloudLayerChunkLoader() override;

int primitiveCount() const override;

virtual void cancel() override;
virtual Qt3DCore::QEntity *createEntity( Qt3DCore::QEntity *parent ) override;

@@ -106,7 +104,6 @@ class QgsPointCloudLayerChunkLoader : public QgsChunkLoader
QgsPointCloud3DRenderContext mContext;
bool mCanceled = false;
QFutureWatcher<void> *mFutureWatcher = nullptr;
int mPointsCount;
};


0 comments on commit f9e2409

Please sign in to comment.