mirror of https://github.com/CGAL/cgal
Replace pair property map with 2 property maps (simpler for IO)
This commit is contained in:
parent
fe18f20d05
commit
70aab39fa6
|
|
@ -150,9 +150,14 @@ public :
|
|||
pen.setWidth(0);
|
||||
painter->setPen(pen);
|
||||
painter->setBrush(brush);
|
||||
SMesh::Property_map<halfedge_descriptor,std::pair<float, float> > uv;
|
||||
uv = graph->add_property_map<halfedge_descriptor,std::pair<float, float> >
|
||||
("h:uv",std::make_pair(0.0f,0.0f)).first;
|
||||
SMesh::Property_map<halfedge_descriptor, float> u;
|
||||
SMesh::Property_map<halfedge_descriptor, float> v;
|
||||
|
||||
u = graph->add_property_map<halfedge_descriptor, float>
|
||||
("h:u", 0.0f).first;
|
||||
v = graph->add_property_map<halfedge_descriptor, float>
|
||||
("h:v", 0.0f).first;
|
||||
|
||||
for( Component::iterator
|
||||
fi = component->begin();
|
||||
fi != component->end();
|
||||
|
|
@ -161,11 +166,11 @@ public :
|
|||
boost::graph_traits<SMesh>::face_descriptor f(*fi);
|
||||
QPointF points[3];
|
||||
boost::graph_traits<SMesh>::halfedge_descriptor h = halfedge(f, *graph);;
|
||||
points[0] = QPointF(get(uv, h).first, -get(uv, h).second);
|
||||
points[0] = QPointF(get(u, h), -get(v, h));
|
||||
h = next(halfedge(f, *graph), *graph);
|
||||
points[1] = QPointF(get(uv, h).first, -get(uv, h).second);
|
||||
points[1] = QPointF(get(u, h), -get(v, h));
|
||||
h = next(next(halfedge(f, *graph), *graph), *graph);
|
||||
points[2] = QPointF(get(uv, h).first, -get(uv, h).second);
|
||||
points[2] = QPointF(get(u, h), -get(v, h));
|
||||
painter->drawPolygon(points,3);
|
||||
}
|
||||
|
||||
|
|
@ -605,9 +610,12 @@ public Q_SLOTS:
|
|||
{
|
||||
component->insert(*bfit);
|
||||
}
|
||||
SMesh::Property_map<halfedge_descriptor,std::pair<float, float> > uv;
|
||||
uv = sm->add_property_map<halfedge_descriptor,std::pair<float, float> >(
|
||||
"h:uv",std::make_pair(0.0f,0.0f)).first;
|
||||
SMesh::Property_map<halfedge_descriptor, float> umap;
|
||||
SMesh::Property_map<halfedge_descriptor, float> vmap;
|
||||
umap = sm->add_property_map<halfedge_descriptor, float>
|
||||
("h:u", 0.0f).first;
|
||||
vmap = sm->add_property_map<halfedge_descriptor, float>
|
||||
("h:v", 0.0f).first;
|
||||
SMesh::Halfedge_iterator it;
|
||||
SMesh::Property_map<SMesh::Vertex_index, EPICK::Point_2> uv_map =
|
||||
sm->property_map<SMesh::Vertex_index, EPICK::Point_2>("v:uv").first;
|
||||
|
|
@ -618,7 +626,8 @@ public Q_SLOTS:
|
|||
halfedge_descriptor hd(*it);
|
||||
EPICK::FT u = uv_map[target(hd, *sm)].x();
|
||||
EPICK::FT v = uv_map[target(hd, *sm)].y();
|
||||
put(uv, *it, std::make_pair(static_cast<float>(u),static_cast<float>(v)));
|
||||
put(umap, *it, static_cast<float>(u));
|
||||
put(vmap, *it, static_cast<float>(v));
|
||||
}
|
||||
|
||||
//ParamItem does not take ownership of text_mesh_bottom
|
||||
|
|
|
|||
|
|
@ -265,8 +265,11 @@ public :
|
|||
pen.setWidth(0);
|
||||
painter->setPen(pen);
|
||||
painter->setBrush(brush);
|
||||
SMesh::Property_map<halfedge_descriptor,std::pair<float, float> > uv;
|
||||
uv = graph->add_property_map<halfedge_descriptor,std::pair<float, float> >("h:uv",std::make_pair(0.0f,0.0f)).first;
|
||||
SMesh::Property_map<halfedge_descriptor,float> u,v;
|
||||
|
||||
u = graph->add_property_map<halfedge_descriptor,float>("h:u", 0.0f).first;
|
||||
v = graph->add_property_map<halfedge_descriptor,float>("h:v", 0.0f).first;
|
||||
|
||||
for( Component::iterator
|
||||
fi = components->at(m_current_component).begin();
|
||||
fi != components->at(m_current_component).end();
|
||||
|
|
@ -276,11 +279,11 @@ uv = graph->add_property_map<halfedge_descriptor,std::pair<float, float> >("h:uv
|
|||
|
||||
QPointF points[3];
|
||||
boost::graph_traits<Base_face_graph>::halfedge_descriptor h = halfedge(f, *graph);;
|
||||
points[0] = QPointF(get(uv, h).first, get(uv, h).second);
|
||||
points[0] = QPointF(get(u, h), get(v, h));
|
||||
h = next(halfedge(f, *graph), *graph);
|
||||
points[1] = QPointF(get(uv, h).first, get(uv, h).second);
|
||||
points[1] = QPointF(get(u, h), get(v, h));
|
||||
h = next(next(halfedge(f, *graph), *graph), *graph);
|
||||
points[2] = QPointF(get(uv, h).first, get(uv, h).second);
|
||||
points[2] = QPointF(get(u, h), get(v, h));
|
||||
painter->drawPolygon(points,3);
|
||||
}
|
||||
}
|
||||
|
|
@ -906,8 +909,13 @@ void Polyhedron_demo_parameterization_plugin::parameterize(const Parameterizatio
|
|||
QApplication::restoreOverrideCursor();
|
||||
QPointF min(FLT_MAX, FLT_MAX), max(-FLT_MAX, -FLT_MAX);
|
||||
|
||||
SMesh::Property_map<halfedge_descriptor,std::pair<float, float> > uv;
|
||||
uv = tMesh.add_property_map<halfedge_descriptor,std::pair<float, float> >("h:uv",std::make_pair(0.0f,0.0f)).first;
|
||||
SMesh::Property_map<halfedge_descriptor, float> umap;
|
||||
SMesh::Property_map<halfedge_descriptor, float> vmap;
|
||||
|
||||
umap = tMesh.add_property_map<halfedge_descriptor, float>("h:u", 0.0f).first;
|
||||
vmap = tMesh.add_property_map<halfedge_descriptor, float>("h:v", 0.0f).first;
|
||||
|
||||
tMesh.property_stats(std::cerr);
|
||||
Base_face_graph::Halfedge_iterator it;
|
||||
for(it = tMesh.halfedges_begin();
|
||||
it != tMesh.halfedges_end();
|
||||
|
|
@ -916,7 +924,8 @@ void Polyhedron_demo_parameterization_plugin::parameterize(const Parameterizatio
|
|||
Seam_mesh::halfedge_descriptor hd(*it);
|
||||
FT u = uv_pm[target(hd, sMesh)].x();
|
||||
FT v = uv_pm[target(hd, sMesh)].y();
|
||||
put(uv, *it, std::make_pair(static_cast<float>(u),static_cast<float>(v)));
|
||||
put(umap, *it, static_cast<float>(u));
|
||||
put(vmap, *it, static_cast<float>(v));
|
||||
if(u<min.x())
|
||||
min.setX(u);
|
||||
if(u>max.x())
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ struct Scene_textured_surface_mesh_item_priv
|
|||
{
|
||||
item = parent;
|
||||
texture.GenerateCheckerBoard(2048,2048,128,0,0,0,250,250,255);
|
||||
uv = sm->add_property_map<halfedge_descriptor,std::pair<float, float> >("h:uv",std::make_pair(0.0f,0.0f)).first;
|
||||
|
||||
umap = sm->add_property_map<halfedge_descriptor, float>("h:u", 0.0f).first;
|
||||
vmap = sm->add_property_map<halfedge_descriptor, float>("h:v", 0.0f).first;
|
||||
}
|
||||
Scene_textured_surface_mesh_item_priv(const SMesh& p, Scene_textured_surface_mesh_item* parent)
|
||||
: sm(new SMesh(p))
|
||||
|
|
@ -30,14 +30,16 @@ struct Scene_textured_surface_mesh_item_priv
|
|||
{
|
||||
item = parent;
|
||||
texture.GenerateCheckerBoard(2048,2048,128,0,0,0,250,250,255);
|
||||
uv = sm->add_property_map<halfedge_descriptor,std::pair<float, float> >("h:uv",std::make_pair(0.0f,0.0f)).first;
|
||||
umap = sm->add_property_map<halfedge_descriptor, float>("h:u", 0.0f).first;
|
||||
vmap = sm->add_property_map<halfedge_descriptor, float>("h:v", 0.0f).first;
|
||||
}
|
||||
Scene_textured_surface_mesh_item_priv(SMesh* const p,Scene_textured_surface_mesh_item* parent)
|
||||
:sm(p)
|
||||
{
|
||||
item = parent;
|
||||
texture.GenerateCheckerBoard(2048,2048,128,0,0,0,250,250,255);
|
||||
uv = sm->add_property_map<halfedge_descriptor,std::pair<float, float> >("h:uv",std::make_pair(0.0f,0.0f)).first;
|
||||
umap = sm->add_property_map<halfedge_descriptor, float>("h:u", 0.0f).first;
|
||||
vmap = sm->add_property_map<halfedge_descriptor, float>("h:v", 0.0f).first;
|
||||
}
|
||||
|
||||
~Scene_textured_surface_mesh_item_priv()
|
||||
|
|
@ -49,7 +51,8 @@ struct Scene_textured_surface_mesh_item_priv
|
|||
|
||||
SMesh* sm;
|
||||
::Texture texture;
|
||||
SMesh::Property_map<halfedge_descriptor,std::pair<float, float> > uv;
|
||||
SMesh::Property_map<halfedge_descriptor, float> umap;
|
||||
SMesh::Property_map<halfedge_descriptor, float> vmap;
|
||||
|
||||
//[Px][Py][Pz][Nx][Ny][Nz][u][v]
|
||||
mutable std::vector<float> faces_buffer;
|
||||
|
|
@ -102,8 +105,8 @@ Scene_textured_surface_mesh_item_priv::compute_normals_and_vertices(void) const
|
|||
faces_buffer.push_back(n[1]);
|
||||
faces_buffer.push_back(n[2]);
|
||||
//uvs [2]
|
||||
const float u = get(uv, *he).first;
|
||||
const float v = get(uv, *he).second;
|
||||
const float u = get(umap, *he);
|
||||
const float v = get(vmap, *he);
|
||||
faces_buffer.push_back(u);
|
||||
faces_buffer.push_back(v);
|
||||
}
|
||||
|
|
@ -127,8 +130,8 @@ Scene_textured_surface_mesh_item_priv::compute_normals_and_vertices(void) const
|
|||
edges_buffer.push_back(a.y() + offset.y);
|
||||
edges_buffer.push_back(a.z() + offset.z);
|
||||
//uvs [2]
|
||||
float u = get(uv, halfedge(*he, *sm)).first;
|
||||
float v = get(uv, halfedge(*he, *sm)).second;
|
||||
float u = get(umap, halfedge(*he, *sm));
|
||||
float v = get(vmap, halfedge(*he, *sm));
|
||||
|
||||
edges_buffer.push_back(u);
|
||||
edges_buffer.push_back(v);
|
||||
|
|
@ -138,8 +141,8 @@ Scene_textured_surface_mesh_item_priv::compute_normals_and_vertices(void) const
|
|||
edges_buffer.push_back(b.z() + offset.z);
|
||||
|
||||
//uvs [2]
|
||||
u = get(uv, opposite(halfedge(*he, *sm), *sm)).first;
|
||||
v = get(uv, opposite(halfedge(*he, *sm), *sm)).second;
|
||||
u = get(umap, opposite(halfedge(*he, *sm), *sm));
|
||||
v = get(vmap, opposite(halfedge(*he, *sm), *sm));
|
||||
|
||||
edges_buffer.push_back(u);
|
||||
edges_buffer.push_back(v);
|
||||
|
|
|
|||
Loading…
Reference in New Issue