From b8ecd34eb59d5f8726e1528c5a9cd75a9ac4f9ab Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 27 Apr 2016 11:13:28 +0200 Subject: [PATCH] Fix facet color reading --- .../demo/Polyhedron/Plugins/PMP/Orient_soup_plugin.cpp | 4 ++-- Polyhedron_IO/include/CGAL/IO/OFF_reader.h | 7 ++----- Stream_support/include/CGAL/IO/File_scanner_OFF.h | 1 - 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Orient_soup_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Orient_soup_plugin.cpp index a8cf89d70f3..d7dd1215884 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Orient_soup_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Orient_soup_plugin.cpp @@ -100,7 +100,7 @@ void set_vcolors(Scene_surface_mesh_item::SMesh* smesh, std::vector SMesh::Property_map vcolors = smesh->property_map("v:color").first; bool created; - boost::tie(vcolors, created) = smesh->template add_property_map("v:color",CGAL::Color(0,0,0)); + boost::tie(vcolors, created) = smesh->add_property_map("v:color",CGAL::Color(0,0,0)); assert(colors.size()==smesh->number_of_vertices()); int color_id = 0; BOOST_FOREACH(vertex_descriptor vd, vertices(*smesh)) @@ -114,7 +114,7 @@ void set_fcolors(Scene_surface_mesh_item::SMesh* smesh, std::vector SMesh::Property_map fcolors = smesh->property_map("f:color").first; bool created; - boost::tie(fcolors, created) = smesh->template add_property_map("f:color",CGAL::Color(0,0,0)); + boost::tie(fcolors, created) = smesh->add_property_map("f:color",CGAL::Color(0,0,0)); assert(colors.size()==smesh->number_of_faces()); int color_id = 0; BOOST_FOREACH(face_descriptor fd, faces(*smesh)) diff --git a/Polyhedron_IO/include/CGAL/IO/OFF_reader.h b/Polyhedron_IO/include/CGAL/IO/OFF_reader.h index 77d003bfeb4..917610e10f4 100644 --- a/Polyhedron_IO/include/CGAL/IO/OFF_reader.h +++ b/Polyhedron_IO/include/CGAL/IO/OFF_reader.h @@ -121,7 +121,7 @@ namespace CGAL{ vcolors[i] = Color_rgb(r,g,b); } else - scanner.skip_to_next_vertex(i); + scanner.skip_to_next_vertex(i); } if(!in) return false; @@ -154,10 +154,7 @@ namespace CGAL{ has_fcolors = true; fcolors.resize(scanner.size_of_facets()); std::istringstream iss2(col); - CGAL::File_scanner_OFF scanner2(iss2); - unsigned char r=0, g=0, b=0; - scanner2.scan_color(r,g,b); - fcolors[i] = Color_rgb(r,g,b); + fcolors[i] = scanner.get_color_from_line(iss2); } } else if(has_fcolors) diff --git a/Stream_support/include/CGAL/IO/File_scanner_OFF.h b/Stream_support/include/CGAL/IO/File_scanner_OFF.h index 36b115e49d6..b8a1a77e64c 100644 --- a/Stream_support/include/CGAL/IO/File_scanner_OFF.h +++ b/Stream_support/include/CGAL/IO/File_scanner_OFF.h @@ -569,7 +569,6 @@ public: //else stores the value else rgb[index] = static_cast(atoi(color_info.c_str())); - index++; } CGAL::Color color;