@@ -4,10 +4,8 @@ PointCloud::PointCloud(int id, QOpenGLFunctions_4_3_Core* functions, const QStri
44 : pointcloudId_(id),
55 isVisible_(true ),
66 functions_(functions),
7- srcPath_(srcPath),
8- glPointCloud_(functions, srcPath)
7+ srcPath_(srcPath)
98{
10- glPointCloud_.id_ = " point_cloud_" +QString::number (id);
119 if (!colorscheme.load (srcPath + " Resources/Images/PointCloudColors.png" )) {
1210 qDebug () << " Failed to open point cloud color scheme (" << srcPath << " Resources/Images/PointCloudColors.png)" ;
1311 }
@@ -17,17 +15,17 @@ PointCloud::PointCloud(int id, QOpenGLFunctions_4_3_Core* functions, const QStri
1715void
1816PointCloud::UpdatePointCloud (const QVector<PointStruct>& pm)
1917{
20- glPointCloud_ = GLPointCloud (functions_, srcPath_);
21- glPointCloud_. id_ = " point_cloud_" + QString::number (pointcloudId_);
18+ glPointCloud_ = std::make_unique< GLPointCloud> (functions_, srcPath_);
19+ glPointCloud_-> id_ = " point_cloud_" + QString::number (pointcloudId_);
2220 // Copy data from pm to glPointCloud_
2321 for (const PointStruct& p : pm) {
24- glPointCloud_. vertices_ .append (p.position );
25- glPointCloud_. texCoords_ .append (QVector2D (p.color , p.color ));
22+ glPointCloud_-> vertices_ .append (p.position );
23+ glPointCloud_-> texCoords_ .append (QVector2D (p.color , p.color ));
2624 }
2725 // set up the globject
28- glPointCloud_. Init ();
29- glPointCloud_. SetColor (Qt::white);
30- glPointCloud_. SetTexture (colorscheme, false , GL_CLAMP_TO_EDGE);
31- glPointCloud_. SetObjectType (ObjectType::None);
32- glPointCloud_. UpdateVertexBuffer ();
26+ glPointCloud_-> Init ();
27+ glPointCloud_-> SetColor (Qt::white);
28+ glPointCloud_-> SetTexture (colorscheme, false , GL_CLAMP_TO_EDGE);
29+ glPointCloud_-> SetObjectType (ObjectType::None);
30+ glPointCloud_-> UpdateVertexBuffer ();
3331}
0 commit comments