Skip to content

Commit

Permalink
remove primitiveCount and primitiveBudget from chunk loader
Browse files Browse the repository at this point in the history
  • Loading branch information
NEDJIMAbelgacem authored and wonder-sk committed Feb 10, 2021
1 parent a3af7b7 commit f9e2409
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/3d/chunks/qgschunkedentity_p.cpp
Expand Up @@ -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;
};
Expand Down
11 changes: 1 addition & 10 deletions src/3d/chunks/qgschunkloader_p.h
Expand Up @@ -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;
};


Expand Down
13 changes: 3 additions & 10 deletions src/3d/qgspointcloudlayerchunkloader_p.cpp
Expand Up @@ -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; } );

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

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

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


Expand All @@ -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
Expand Down
5 changes: 1 addition & 4 deletions src/3d/qgspointcloudlayerchunkloader_p.h
Expand Up @@ -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;

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


Expand Down

0 comments on commit f9e2409

Please sign in to comment.