40 #ifndef GEOGRAM_MESH_NEW_MESH_IO
41 #define GEOGRAM_MESH_NEW_MESH_IO
67 MESH_NO_ATTRIBUTES = 0,
68 MESH_VERTEX_REGION = 1,
69 MESH_VERTEX_TEX_COORD = 2,
70 MESH_VERTEX_COLOR = 4,
71 MESH_FACET_REGION = 8,
72 MESH_CELL_REGION = 16,
73 MESH_EDGE_REGION = 32,
74 MESH_ALL_ATTRIBUTES = 255
152 return (attributes_ & x) != 0;
178 elements_ = MeshElementsFlags(elements_ | x);
188 elements_ = MeshElementsFlags(elements_ & ~x);
200 return (elements_ & x) != 0;
211 texture_filename_ = x;
220 return texture_filename_;
249 MeshElementsFlags elements_;
250 std::string texture_filename_;
270 const std::string& filename,
Mesh& M,
306 const Mesh& M,
const std::string& filename,
387 const std::string& filename,
Mesh& M,
400 const Mesh& M,
const std::string& filename,
416 virtual void bind_attributes(
419 virtual void unbind_attributes();
451 #define geo_register_MeshIOHandler_creator(type, name) \
452 geo_register_creator(GEO::MeshIOHandlerFactory, type, name)
455 void GEOGRAM_API mesh_io_initialize() ;
Generic mechanism for attributes.
Base class for reference-counted objects.
Factory for types without constructor arguments.
void set_element(MeshElementsFlags x)
Sets a mesh element.
bool has_element(MeshElementsFlags x) const
Tests whether a mesh element is set.
void set_attribute(MeshAttributesFlags x)
Sets a mesh attribute.
const std::string & get_texture_filename() const
Gets the name of the texture image file.
void reset_element(MeshElementsFlags x)
Resets a mesh element.
void reset_attribute(MeshAttributesFlags &x)
Resets a mesh attribute..
MeshAttributesFlags attributes() const
Gets the attributes that should be loaded or saved.
MeshIOFlags()
Constructs a new MeshIOFlags with default attributes.
void set_dimension(coord_index_t x)
Sets the dimension of the mesh (number of coordinates of the vertices).
void set_elements(MeshElementsFlags x)
Sets the set of mesh elements that should be loaded or stored.
void set_attributes(MeshAttributesFlags x)
Sets the attributes that should be loaded or stored.
bool has_attribute(MeshAttributesFlags x) const
Tests whether a mesh attribute is set.
void set_verbose(bool x)
Sets verbosity.
void set_texture_filename(const std::string &x)
Sets the name of the texture image file associated with this mesh.
MeshElementsFlags elements() const
Gets the set of mesh elements that should be loaded or stored.
bool verbose() const
Tests whether messages should be displayed.
coord_index_t dimension() const
Gets the dimension of the mesh (number of coordinates of the vertices).
virtual bool load(const std::string &filename, Mesh &M, const MeshIOFlags &ioflags=MeshIOFlags())=0
Loads a double precision mesh from a file.
SmartPointer< MeshIOHandler > MeshIOHandler_var
A smart pointer that contains a MeshIOHandler object.
MeshIOHandler()
MeshIOHandler default constructor.
static MeshIOHandler * create(const std::string &format)
Creates a MeshIOHandler.
~MeshIOHandler() override
MeshIOHandler destructor.
virtual bool save(const Mesh &M, const std::string &filename, const MeshIOFlags &ioflags=MeshIOFlags())=0
Saves a mesh to a file.
Factory0< MeshIOHandler > MeshIOHandlerFactory
MeshIOHandler Factory.
static MeshIOHandler * get_handler(const std::string &filename)
Gets the MeshIOHandler for a file.
Used to write a structured binary file.
A smart pointer with reference-counted copy semantics.
Generic factory mechanism.
Common include file, providing basic definitions. Should be included before anything else by all head...
The class that represents a mesh.
Global Vorpaline namespace.
bool mesh_save(const Mesh &M, const std::string &filename, const MeshIOFlags &ioflags=MeshIOFlags())
Saves a mesh to a file.
MeshAttributesFlags
Indicates the attributes stored in a mesh and attached to the mesh elements (vertices,...
bool mesh_load(const std::string &filename, Mesh &M, const MeshIOFlags &ioflags=MeshIOFlags())
Loads a mesh from a file.
geo_coord_index_t coord_index_t
The type for storing coordinate indices, and iterating on the coordinates of a point.
Types and functions for numbers manipulation.