implement status informationr reading and writing

This commit is contained in:
Max Lyon
2018-10-12 11:35:18 +02:00
parent f6b106155f
commit f9b39f21c7
6 changed files with 177 additions and 51 deletions

View File

@@ -142,6 +142,9 @@ public:
// set vertex texture coordinate
virtual void set_texcoord(VertexHandle _vh, const Vec2f& _texcoord) = 0;
// set vertex status
virtual void set_status(VertexHandle _vh, const OpenMesh::Attributes::StatusInfo& _status) = 0;
// set next halfedge handle
virtual void set_next(HalfedgeHandle _heh, HalfedgeHandle _next) = 0;
@@ -157,6 +160,9 @@ public:
// set 3d vertex texture coordinate
virtual void set_texcoord(HalfedgeHandle _heh, const Vec3f& _texcoord) = 0;
// set halfedge status
virtual void set_status(HalfedgeHandle _heh, const OpenMesh::Attributes::StatusInfo& _status) = 0;
// set edge color
virtual void set_color(EdgeHandle _eh, const Vec3uc& _color) = 0;
@@ -169,6 +175,9 @@ public:
// set edge color
virtual void set_color(EdgeHandle _eh, const Vec4f& _color) = 0;
// set edge status
virtual void set_status(EdgeHandle _eh, const OpenMesh::Attributes::StatusInfo& _status) = 0;
// set face normal
virtual void set_normal(FaceHandle _fh, const Vec3f& _normal) = 0;
@@ -184,6 +193,9 @@ public:
// set face color
virtual void set_color(FaceHandle _fh, const Vec4f& _color) = 0;
// set face status
virtual void set_status(FaceHandle _fh, const OpenMesh::Attributes::StatusInfo& _status) = 0;
// Store a property in the mesh mapping from an int to a texture file
// Use set_face_texindex to set the index for each face
virtual void add_texture_information( int _id , std::string _name ) = 0;

View File

@@ -257,6 +257,13 @@ public:
mesh_.set_texcoord2D(_vh, vector_cast<TexCoord2D>(_texcoord));
}
virtual void set_status(VertexHandle _vh, const OpenMesh::Attributes::StatusInfo& _status)
{
if (!mesh_.has_vertex_status())
mesh_.request_vertex_status();
mesh_.status(_vh) = _status;
}
virtual void set_next(HalfedgeHandle _heh, HalfedgeHandle _next) override
{
mesh_.set_next_halfedge_handle(_heh, _next);
@@ -286,6 +293,12 @@ public:
mesh_.set_texcoord3D(_heh, vector_cast<TexCoord3D>(_texcoord));
}
virtual void set_status(HalfedgeHandle _heh, const OpenMesh::Attributes::StatusInfo& _status)
{
if (!mesh_.has_halfedge_status())
mesh_.request_halfedge_status();
mesh_.status(_heh) = _status;
}
// edge attributes
@@ -313,6 +326,13 @@ public:
mesh_.set_color(_eh, color_cast<Color>(_color));
}
virtual void set_status(EdgeHandle _eh, const OpenMesh::Attributes::StatusInfo& _status)
{
if (!mesh_.has_edge_status())
mesh_.request_edge_status();
mesh_.status(_eh) = _status;
}
// face attributes
virtual void set_normal(FaceHandle _fh, const Vec3f& _normal)
@@ -345,6 +365,13 @@ public:
mesh_.set_color(_fh, color_cast<Color>(_color));
}
virtual void set_status(FaceHandle _fh, const OpenMesh::Attributes::StatusInfo& _status)
{
if (!mesh_.has_face_status())
mesh_.request_face_status();
mesh_.status(_fh) = _status;
}
virtual void add_face_texcoords( FaceHandle _fh, VertexHandle _vh, const std::vector<Vec2f>& _face_texcoords)
{
// get first halfedge handle