/** \page tutorial_08 Using IO::Options This example shows: - How to control the behaviour of \c Mesh::IO::read_mesh(), - How to control the behaviour of \c Mesh::IO::write_mesh(). The class \c OpenMesh::IO::Options can be used when reading/writing a mesh. It controls the behaviour of the reader/writer modules by means of enabled/disabled bits in a bitset. The class provides an interface for enabling, disabling and verifying the bits in the set. We distinguish between -# mode bits - control binary reading/writing - Options::Binary - Options::MSB - Options::LSB - Options::Swap (MSB|LSB) -# property bits - controls which standard properties to read/write - Options::VertexNormal - Options::VertexTexCoord - Options::VertexColor - Options::FaceNormal - Options::FaceColor - Options::FaceTexCoord - Options::ColorAlpha - Options::ColorFloat - Options::Custom These bits have different effects when reading or writing. The file format itself is selected by the extension of the filename. Please take into account, each mesh has to request the standard property before loading with the corresponding option. For instance, if you enable Options::VertexNormal, your mesh has to request vertex normals. Otherwise, they will not be written into the mesh. \note Face Tex Coords will not be saved as a property per face, but as a property per halfedge. Therefore, you have to request the "halfedge_texcoords2D" property The OBJ-reader can also read information about the textures in the *.mtl file, if available. These texture information (includes texturename and index) will be saved in the property of type: \code OpenMesh::MPropHandleT< std::map< int, std::string > > \endcode with the name: \code "TextureMapping" \endcode If you want to use the texture information, you have to request this custom property in your mesh before loading it with the obj reader. There is no other option you have to define for reading texture information beside of the request of the property.\n Additionally, the OBJ loader writes the texture index per face, if the property "face_texture_index" is requested. The texture index is the same index as the index written in the texture mapping. So, it is possible to get the name of the texture from a face via its texture index over the texture mapping property to the texture name. But remember, you have to request these properties first before loading to use them. There is no option to check, whether texture mappings were loaded or not, but the size of the map of the TextureMapping property shows, if texture names could be loaded or not. Below in the table you can see what options are suported by which reader/writer (it is possible that the data format can support more). ASCII is not a real option and will be selected, if binary was not defined.
| Format/Option | ASCII | Binary | MSB | LSB | Swap | VertexNormal | VertexColor | VertexTexCoord | EdgeColor | FaceNormal | FaceColor | FaceTexCoord | ColorAlpha | ColorFloat | Custom |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| OBJ | x | x | x *) | x | x | x | x | ||||||||
| OFF | x | x | x | x | x | x | x | x | x | ||||||
| PLY | x | x | x | x | x | x | x | x | x | x **) | |||||
| OM | x | x | x | x | x | x | x | x | x | x (\ref tutorial_09 ) | |||||
| STL | x | x | x | x | |||||||||||
| VTK ***) | x |