Added try/catch around 3D mesh generation

This commit is contained in:
2018-04-04 12:13:24 +02:00
parent 9030841910
commit 3a4deaf314

View File

@@ -87,13 +87,13 @@ public:
void rebuild(Floorplan::IndoorMap* im) { void rebuild(Floorplan::IndoorMap* im) {
// rebuild the mesh
Ray3D::ModelFactory fac(im);
mesh = fac.getMesh();
triaTransp.clear(); triaTransp.clear();
triaSolid.clear(); triaSolid.clear();
// rebuild the mesh
try {
Ray3D::ModelFactory fac(im);
mesh = fac.getMesh();
for (const Ray3D::Obstacle3D& obs : mesh.elements) { for (const Ray3D::Obstacle3D& obs : mesh.elements) {
const int matID = getMaterial(obs); const int matID = getMaterial(obs);
const Material& mat = mats[matID]; const Material& mat = mats[matID];
@@ -106,7 +106,10 @@ public:
} }
} }
} }
}
catch(const std::exception& e) {
std::cout << "Can't create 3D view. Failed to get mesh from model factory with error: '" << e.what() << "'" << std::endl;
}
} }
}; };