diff --git a/BGL/include/CGAL/boost/graph/IO/WRL.h b/BGL/include/CGAL/boost/graph/IO/WRL.h index 7b11f7e09ed..4b474e69fcd 100644 --- a/BGL/include/CGAL/boost/graph/IO/WRL.h +++ b/BGL/include/CGAL/boost/graph/IO/WRL.h @@ -12,11 +12,11 @@ #ifndef CGAL_BGL_IO_WRL_H #define CGAL_BGL_IO_WRL_H +#include + #include #include -#include - #include namespace CGAL { @@ -40,70 +40,8 @@ bool write_WRL(std::ostream& os, const FaceGraph& g, const NamedParameters& np) { - typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; - typedef typename boost::graph_traits::face_descriptor face_descriptor; - typedef typename boost::graph_traits::vertices_size_type vertices_size_type; - - using parameters::get_parameter; - using parameters::choose_parameter; - - typename CGAL::GetVertexPointMap::const_type - vpm = choose_parameter(get_parameter(np, internal_np::vertex_point), - get_const_property_map(CGAL::vertex_point, g)); - - boost::container::flat_map reindex; - int n = 0; - - os << "#VRML V2.0 utf8\n" - "Group {\n" - "children [\n" - "Shape {\n" - "appearance DEF A1 Appearance {\n" - "material Material {\n" - "diffuseColor .6 .5 .9\n" - "}\n" - "}\n" - "appearance\n" - "Appearance {\n" - "material DEF Material Material {}\n" - "}\n" - "}\n" - "Group {\n" - "children [\n" - "Shape {\n" - "appearance Appearance { material USE Material }\n" - "geometry IndexedFaceSet {\n" - "convex FALSE\n" - "solid FALSE\n" - "coord Coordinate {\n" - "point [\n"; - - for(vertex_descriptor v : vertices(g)) - { - os << get(vpm,v) << ",\n"; - reindex[v] = n++; - } - - os << "] #point\n" - "} #coord Coordinate\n" - "coordIndex [\n"; - - for(face_descriptor f : faces(g)) - { - for(vertex_descriptor v : vertices_around_face(halfedge(f, g), g)) - os << reindex[v] << ","; - os << "-1,\n"; - } - - os << "] #coordIndex\n" - "} #geometry\n" - "} #Shape\n" - "] #children\n" - "} #group\n" - "]\n" - "}\n"; - - return os.good(); + IO::internal::Generic_facegraph_printer printer(os); + return printer(g, np); } template diff --git a/Stream_support/include/CGAL/IO/VRML/File_writer_VRML_2.h b/Stream_support/include/CGAL/IO/VRML/File_writer_VRML_2.h index 26adc190551..64793b50cde 100644 --- a/Stream_support/include/CGAL/IO/VRML/File_writer_VRML_2.h +++ b/Stream_support/include/CGAL/IO/VRML/File_writer_VRML_2.h @@ -43,15 +43,14 @@ public: m_out = &o.os(); m_facets = facets; - out() << " #-- Begin of Polyhedron_3\n"; + out() << " #-- Begin of Polygon Mesh\n"; out() << " # " << vertices << " vertices\n"; out() << " # " << halfedges << " halfedges\n"; out() << " # " << facets << " facets\n"; out() << " Group {\n" " children [\n" " Shape {\n" - " appearance Appearance { material " - "USE Material }\n" + " appearance Appearance { material USE Material }\n" " geometry IndexedFaceSet {\n" " convex FALSE\n" " solid FALSE\n"