Commit of the debugged version of Alex' improvement to OpenMesh. File i/o is now done via istream/ostream instances such that direct buffer writing to files (serialization) will also be possible in future releases.
Code is tested. git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@221 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
@@ -107,6 +107,23 @@ read_mesh(Mesh& _mesh,
|
||||
}
|
||||
|
||||
|
||||
/** Read a mesh from file open std::istream. The file format is determined by
|
||||
parameter _ext. _ext has to include ".[format]" in order to work properly */
|
||||
template <class Mesh>
|
||||
bool
|
||||
read_mesh(Mesh& _mesh,
|
||||
std::istream& _is,
|
||||
const std::string& _ext,
|
||||
Options& _opt,
|
||||
bool _clear = true)
|
||||
{
|
||||
if (_clear) _mesh.clear();
|
||||
ImporterT<Mesh> importer(_mesh);
|
||||
return IOManager().read(_is,_ext, importer, _opt);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -124,6 +141,22 @@ bool write_mesh(const Mesh& _mesh, const std::string& _filename,
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
/** Write a mesh to an open std::ostream. The file format is determined
|
||||
by _ext. */
|
||||
template <class Mesh>
|
||||
bool write_mesh(const Mesh& _mesh,
|
||||
std::ostream& _os,
|
||||
const std::string& _ext,
|
||||
Options _opt = Options::Default)
|
||||
{
|
||||
ExporterT<Mesh> exporter(_mesh);
|
||||
return IOManager().write(_os,_ext, exporter, _opt);
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
template <class Mesh>
|
||||
size_t binary_size(const Mesh& _mesh, const std::string& _format,
|
||||
Options _opt = Options::Default)
|
||||
|
||||
Reference in New Issue
Block a user