mirror of https://github.com/CGAL/cgal
WIP fixes for OBJ
This commit is contained in:
parent
6a466dd6b5
commit
366422714c
|
|
@ -146,6 +146,11 @@ bool read_OBJ(const char* fname,
|
||||||
bool verbose = true)
|
bool verbose = true)
|
||||||
{
|
{
|
||||||
std::ifstream in(fname);
|
std::ifstream in(fname);
|
||||||
|
if(!in)
|
||||||
|
{
|
||||||
|
std::cerr<<"File doesn't exist"<<std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return read_OBJ(in, g, np, verbose);
|
return read_OBJ(in, g, np, verbose);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -392,7 +392,7 @@ void test_bgl_OBJ(const std::string filename)
|
||||||
clear(fg);
|
clear(fg);
|
||||||
VertexNormalMap vnm = get(CGAL::dynamic_vertex_property_t<Vector>(), 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(ok);
|
||||||
assert(num_vertices(fg) == 434 && num_faces(fg) == 864);
|
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)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
// OFF
|
// OFF
|
||||||
|
/*
|
||||||
const char* off_file = (argc > 1) ? argv[1] : "data/prim.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<SM>(off_file);
|
||||||
test_bgl_OFF<LCC>(off_file);
|
test_bgl_OFF<LCC>(off_file);
|
||||||
#ifdef CGAL_USE_OPENMESH
|
#ifdef CGAL_USE_OPENMESH
|
||||||
test_bgl_OFF<OMesh>(off_file);
|
test_bgl_OFF<OMesh>(off_file);
|
||||||
#endif
|
#endif
|
||||||
|
*/
|
||||||
// OBJ
|
// OBJ
|
||||||
const char* obj_file = (argc > 2) ? argv[2] : "data/sphere.obj";
|
const char* obj_file = (argc > 2) ? argv[2] : "data/sphere.obj";
|
||||||
test_bgl_OBJ<Polyhedron>(obj_file);
|
test_bgl_OBJ<Polyhedron>(obj_file);
|
||||||
|
|
|
||||||
|
|
@ -167,6 +167,11 @@ bool read_OBJ(const char* fname, PointRange& points, PolygonRange& polygons,
|
||||||
const CGAL_BGL_NP_CLASS& np, bool verbose = true)
|
const CGAL_BGL_NP_CLASS& np, bool verbose = true)
|
||||||
{
|
{
|
||||||
std::ifstream in(fname);
|
std::ifstream in(fname);
|
||||||
|
if(!in)
|
||||||
|
{
|
||||||
|
std::cerr<<"File doesn't exist."<<std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return read_OBJ(in, points, polygons, np, verbose);
|
return read_OBJ(in, points, polygons, np, verbose);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue