1 #ifndef OPENMESH_PYTHON_INPUTOUTPUT_HH 2 #define OPENMESH_PYTHON_INPUTOUTPUT_HH 24 BOOST_PYTHON_FUNCTION_OVERLOADS(read_mesh_overloads,
IO::read_mesh, 3, 4)
25 BOOST_PYTHON_FUNCTION_OVERLOADS(write_mesh_overloads, IO::write_mesh, 2, 4)
39 bool (*read_mesh_tri_options )(
TriMesh&,
const std::string&, IO::Options&, bool) = &
IO::read_mesh;
41 bool (*write_mesh_poly)(
const PolyMesh&,
const std::string&, IO::Options, std::streamsize) = &
IO::write_mesh;
42 bool (*write_mesh_tri )(
const TriMesh&,
const std::string&, IO::Options, std::streamsize) = &
IO::write_mesh;
44 def(
"read_mesh", read_mesh_poly);
45 def(
"read_mesh", read_mesh_poly_options, read_mesh_overloads());
46 def(
"read_mesh", read_mesh_tri);
47 def(
"read_mesh", read_mesh_tri_options, read_mesh_overloads());
49 def(
"write_mesh", write_mesh_poly, write_mesh_overloads());
50 def(
"write_mesh", write_mesh_tri, write_mesh_overloads());
56 scope scope_options = class_<IO::Options>(
"Options")
57 .def(init<IO::Options::Flag>())
61 .def(
"check", &IO::Options::check)
62 .def(
"is_binary", &IO::Options::is_binary)
63 .def(
"vertex_has_normal", &IO::Options::vertex_has_normal)
64 .def(
"vertex_has_color", &IO::Options::vertex_has_color)
65 .def(
"vertex_has_texcoord", &IO::Options::vertex_has_texcoord)
66 .def(
"edge_has_color", &IO::Options::edge_has_color)
67 .def(
"face_has_normal", &IO::Options::face_has_normal)
68 .def(
"face_has_color", &IO::Options::face_has_color)
69 .def(
"face_has_texcoord", &IO::Options::face_has_texcoord)
70 .def(
"color_has_alpha", &IO::Options::color_has_alpha)
71 .def(
"color_is_float", &IO::Options::color_is_float)
78 .def_readonly(
"Default", &FLAG_DEFAULT)
79 .def_readonly(
"Binary", &FLAG_BINARY)
80 .def_readonly(
"MSB", &FLAG_MSB)
81 .def_readonly(
"LSB", &FLAG_LSB)
82 .def_readonly(
"Swap", &FLAG_SWAP)
83 .def_readonly(
"VertexNormal", &FLAG_VERTEXNORMAL)
84 .def_readonly(
"VertexColor", &FLAG_VERTEXCOLOR)
85 .def_readonly(
"VertexTexCoord", &FLAG_VERTEXTEXCOORD)
86 .def_readonly(
"EdgeColor", &FLAG_EDGECOLOR)
87 .def_readonly(
"FaceNormal", &FLAG_FACENORMAL)
88 .def_readonly(
"FaceColor", &FLAG_FACECOLOR)
89 .def_readonly(
"FaceTexCoord", &FLAG_FACETEXCOORD)
90 .def_readonly(
"ColorAlpha", &FLAG_COLORALPHA)
91 .def_readonly(
"ColorFloat", &FLAG_COLORFLOAT)
94 enum_<IO::Options::Flag>(
"Flag")
Assume little endian byte ordering.
Has (r) / store (w) texture coordinates.
bool is_empty(void) const
Returns true if all bits are zero.
Has (r) / store (w) alpha values for colors.
Has (r) / store (w) vertex normals.
Has (r) / store (w) face normals.
void clear(void)
Clear all bits.
Has (r) / store (w) edge colors.
Has (r) / store (w) float values for colors (currently only implemented for PLY and OFF files) ...
bool read_mesh(Mesh &_mesh, const std::string &_filename)
Read a mesh from file _filename.
Set options for reader/writer modules.
Swap byte order in binary mode.
Has (r) / store (w) face texture coordinates.
Has (r) / store (w) face colors.
void cleanup(void)
Restore state after default constructor.
Has (r) / store (w) vertex colors.
Assume big endian byte ordering.
bool write_mesh(const Mesh &_mesh, const std::string &_filename, Options _opt=Options::Default, std::streamsize _precision=6)
Write a mesh to the file _filename.