WIP fixes for OBJ

This commit is contained in:
Maxime Gimeno 2020-06-05 15:59:00 +02:00
parent 6a466dd6b5
commit 366422714c
3 changed files with 14 additions and 3 deletions

View File

@ -146,6 +146,11 @@ bool read_OBJ(const char* fname,
bool verbose = true)
{
std::ifstream in(fname);
if(!in)
{
std::cerr<<"File doesn't exist"<<std::endl;
return false;
}
return read_OBJ(in, g, np, verbose);
}

View File

@ -392,7 +392,7 @@ void test_bgl_OBJ(const std::string filename)
clear(fg);
VertexNormalMap vnm = get(CGAL::dynamic_vertex_property_t<Vector>(), fg);
ok = CGAL::read_OBJ("data/90089.obj", fg, CGAL::parameters::vertex_normal_map(vnm));
ok = CGAL::read_OBJ("data/sphere.obj", fg, CGAL::parameters::vertex_normal_map(vnm));
assert(ok);
assert(num_vertices(fg) == 434 && num_faces(fg) == 864);
@ -760,14 +760,15 @@ void test_bgl_VTP<Polyhedron>(const char* filename,
int main(int argc, char** argv)
{
// OFF
/*
const char* off_file = (argc > 1) ? argv[1] : "data/prim.off";
//test_bgl_OFF<Polyhedron>(off_file);
test_bgl_OFF<Polyhedron>(off_file);
test_bgl_OFF<SM>(off_file);
test_bgl_OFF<LCC>(off_file);
#ifdef CGAL_USE_OPENMESH
test_bgl_OFF<OMesh>(off_file);
#endif
*/
// OBJ
const char* obj_file = (argc > 2) ? argv[2] : "data/sphere.obj";
test_bgl_OBJ<Polyhedron>(obj_file);

View File

@ -167,6 +167,11 @@ bool read_OBJ(const char* fname, PointRange& points, PolygonRange& polygons,
const CGAL_BGL_NP_CLASS& np, bool verbose = true)
{
std::ifstream in(fname);
if(!in)
{
std::cerr<<"File doesn't exist."<<std::endl;
return false;
}
return read_OBJ(in, points, polygons, np, verbose);
}