Commit 337fb457 authored by Max Lyon's avatar Max Lyon

add methods to import to set positions and normals from doubles

parent 23563640
......@@ -91,6 +91,9 @@ public:
// add a vertex with coordinate \c _point
virtual VertexHandle add_vertex(const Vec3f& _point) = 0;
// add a vertex with coordinate \c _point
virtual VertexHandle add_vertex(const Vec3d& _point) { return add_vertex(Vec3f(_point)); }
// add a vertex without coordinate. Use set_point to set the position deferred
virtual VertexHandle add_vertex() = 0;
......@@ -122,6 +125,9 @@ public:
// set vertex normal
virtual void set_normal(VertexHandle _vh, const Vec3f& _normal) = 0;
// set vertex normal
virtual void set_normal(VertexHandle _vh, const Vec3d& _normal) { set_normal(_vh, Vec3f(_normal)); }
// set vertex color
virtual void set_color(VertexHandle _vh, const Vec3uc& _color) = 0;
......
......@@ -97,6 +97,11 @@ public:
return mesh_.add_vertex(vector_cast<Point>(_point));
}
virtual VertexHandle add_vertex(const Vec3d& _point) override
{
return mesh_.add_vertex(vector_cast<Point>(_point));
}
virtual VertexHandle add_vertex() override
{
return mesh_.new_vertex();
......@@ -222,6 +227,17 @@ public:
halfedgeNormals_[_vh] = vector_cast<Normal>(_normal);
}
virtual void set_normal(VertexHandle _vh, const Vec3d& _normal) override
{
if (mesh_.has_vertex_normals())
mesh_.set_normal(_vh, vector_cast<Normal>(_normal));
//saves normals for half edges.
//they will be written, when the face is added
if (mesh_.has_halfedge_normals())
halfedgeNormals_[_vh] = vector_cast<Normal>(_normal);
}
virtual void set_color(VertexHandle _vh, const Vec4uc& _color) override
{
if (mesh_.has_vertex_colors())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment