Good morning,
premising that I am completely new to 3d programming the only knowledge I have are the studies I did at university more than 20 years ago..
I would like to develop a basic app able to import 3d mesh data from ply files and, after taking 2 points on the surface, should be able to find the shortest path between them.

I started modifying the basicshapes-cpp Qt demo to import the polygon data from an external ply file instead of creating the shapes from coding.
The basic app compile and run successfully, but when I load a shape from the files I have, I can not see it centered or I see it too small.

Here the code I've used (code modified from basichapes-cpp demo):

Qt Code:
  1. int main(int argc, char **argv)
  2. {
  3. QApplication app(argc, argv);
  4. Qt3DExtras::Qt3DWindow *view = new Qt3DExtras::Qt3DWindow();
  5. view->defaultFrameGraph()->setClearColor(QColor(QRgb(0x4d4d4f)));
  6. QWidget *container = QWidget::createWindowContainer(view);
  7. QSize screenSize = view->screen()->size();
  8. container->setMinimumSize(QSize(200, 100));
  9. container->setMaximumSize(screenSize);
  10.  
  11. QWidget *widget = new QWidget;
  12. QHBoxLayout *hLayout = new QHBoxLayout(widget);
  13. QVBoxLayout *vLayout = new QVBoxLayout();
  14. vLayout->setAlignment(Qt::AlignTop);
  15. hLayout->addWidget(container, 1);
  16. hLayout->addLayout(vLayout);
  17.  
  18. widget->setWindowTitle(QStringLiteral("Basic Mesh Viewer"));
  19.  
  20. Qt3DInput::QInputAspect *input = new Qt3DInput::QInputAspect;
  21. view->registerAspect(input);
  22.  
  23. // Root entity
  24. Qt3DCore::QEntity *rootEntity = new Qt3DCore::QEntity();
  25.  
  26. // Camera
  27. Qt3DRender::QCamera *cameraEntity = view->camera();
  28.  
  29. cameraEntity->lens()->setPerspectiveProjection(45.0f, 16.0f/9.0f, 0.1f, 1000.0f);
  30. cameraEntity->setPosition(QVector3D(0, 0, -1.0f));
  31. cameraEntity->setUpVector(QVector3D(0, 1, 0));
  32. cameraEntity->setViewCenter(QVector3D(0, 0, 0));
  33.  
  34. Qt3DCore::QEntity *lightEntity = new Qt3DCore::QEntity(rootEntity);
  35. Qt3DRender::QPointLight *light = new Qt3DRender::QPointLight(lightEntity);
  36. light->setColor("white");
  37. light->setIntensity(1);
  38. lightEntity->addComponent(light);
  39.  
  40. Qt3DCore::QTransform *lightTransform = new Qt3DCore::QTransform(lightEntity);
  41. lightTransform->setTranslation(cameraEntity->position());
  42. lightEntity->addComponent(lightTransform);
  43.  
  44. // Loading .ply data
  45. QUrl data = QUrl::fromLocalFile("monster.ply");
  46.  
  47. Qt3DRender::QMesh *bodyMesh = new Qt3DRender::QMesh();
  48. bodyMesh->setMeshName("bodyMesh");
  49. bodyMesh->setSource(data);
  50.  
  51. Qt3DCore::QTransform *bodyTransform = new Qt3DCore::QTransform;
  52. bodyTransform->setScale3D(QVector3D(10.0, 10.0, 10.0));
  53.  
  54. Qt3DExtras::QPhongMaterial *bodyMaterial = new Qt3DExtras::QPhongMaterial();
  55. bodyMaterial->setDiffuse(QColor(QRgb(0x928327)));
  56.  
  57. Qt3DCore::QEntity *plyEntity = new Qt3DCore::QEntity(rootEntity);
  58. plyEntity->addComponent(bodyMesh);
  59. plyEntity->addComponent(bodyMaterial);
  60. plyEntity->addComponent(bodyTransform);
  61.  
  62. // Set root object of the scene
  63. view->setRootEntity(rootEntity);
  64.  
  65. // Show window
  66. widget->show();
  67. widget->resize(1200, 800);
  68.  
  69. return app.exec();
  70. }
To copy to clipboard, switch view to plain text mode 

I would like to have the following help:
* Understand why I see the shape infinitely small and how to fix it
* Understand how I can center the shape in the screen and big enough so I can see it well
* Understand how to add mouse interaction so I can zoom/move the scene
* After a mouse left click, understand how I can get the coordinates of a specific polygon so that a shortest path algorithm can be applied.
Thank you very much