Polygon Mesh Processing Library
Loading...
Searching...
No Matches
io

Read and write common mesh formats. More...

Classes

struct  IOFlags
 Flags to control reading and writing. More...
 

Functions

void read (SurfaceMesh &mesh, const std::filesystem::path &file)
 Read into mesh from file.
 
void write (const SurfaceMesh &mesh, const std::filesystem::path &file, const IOFlags &flags=IOFlags())
 Write mesh to file controlled by flags.
 

Detailed Description

Read and write common mesh formats.

Function Documentation

◆ read()

void read ( SurfaceMesh mesh,
const std::filesystem::path &  file 
)

Read into mesh from file.

File extension determines file type. Supported formats and vertex attributes (a=ASCII, b=binary):

Format ASCII Binary Normals Colors Texcoords
OBJ yes no a no no
OFF yes yes a / b a a / b
PMP no yes no no no
STL yes yes no no no

In addition, the OBJ and PMP formats support reading per-halfedge texture coordinates.

◆ write()

void write ( const SurfaceMesh mesh,
const std::filesystem::path &  file,
const IOFlags flags = IOFlags() 
)

Write mesh to file controlled by flags.

File extension determines file type. Supported formats and vertex attributes (a=ASCII, b=binary):

Format ASCII Binary Normals Colors Texcoords
OBJ yes no a no no
OFF yes yes a a a
PMP no yes no no no
STL yes yes no no no

In addition, the OBJ and PMP formats support writing per-halfedge texture coordinates.