mirror of https://github.com/CGAL/cgal
At least allow to write polyhedral surfaces into .obj files
This commit is contained in:
parent
688af43656
commit
94a09dc4c1
|
|
@ -155,9 +155,16 @@ bool Polyhedron_demo_off_plugin::save(const CGAL::Three::Scene_item* item, QFile
|
|||
|
||||
std::ofstream out(fileinfo.filePath().toUtf8());
|
||||
out.precision (std::numeric_limits<double>::digits10 + 2);
|
||||
return (poly_item && poly_item->save(out)) ||
|
||||
(soup_item && soup_item->save(out)) ||
|
||||
(points_item && points_item->write_off_point_set(out));
|
||||
|
||||
if(fileinfo.suffix().toLower() == "off"){
|
||||
return (poly_item && poly_item->save(out)) ||
|
||||
(soup_item && soup_item->save(out)) ||
|
||||
(points_item && points_item->write_off_point_set(out));
|
||||
}
|
||||
if(fileinfo.suffix().toLower() == "obj"){
|
||||
return (poly_item && poly_item->save_obj(out));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#include "OFF_io_plugin.moc"
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
#include <CGAL/AABB_intersections.h>
|
||||
#include "Kernel_type.h"
|
||||
#include <CGAL/IO/Polyhedron_iostream.h>
|
||||
#include <CGAL/IO/File_writer_wavefront.h>
|
||||
#include <CGAL/IO/generic_copy_OFF.h>
|
||||
|
||||
#include <CGAL/AABB_tree.h>
|
||||
#include <CGAL/AABB_traits.h>
|
||||
|
|
@ -730,6 +732,15 @@ Scene_polyhedron_item::save(std::ostream& out) const
|
|||
return (bool) out;
|
||||
}
|
||||
|
||||
bool
|
||||
Scene_polyhedron_item::save_obj(std::ostream& out) const
|
||||
{
|
||||
CGAL::File_writer_wavefront writer;
|
||||
CGAL::generic_print_polyhedron(out, *poly, writer);
|
||||
return out.good();
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
Scene_polyhedron_item::toolTip() const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ public:
|
|||
bool load(std::istream& in);
|
||||
bool load_obj(std::istream& in);
|
||||
bool save(std::ostream& out) const;
|
||||
bool save_obj(std::ostream& out) const;
|
||||
|
||||
// Function for displaying meta-data of the item
|
||||
virtual QString toolTip() const;
|
||||
|
|
|
|||
Loading…
Reference in New Issue