From 2c3da1c3c918c482574f173e372ee570b525158a Mon Sep 17 00:00:00 2001 From: cignoni Date: Wed, 24 Jun 2009 20:31:57 +0000 Subject: [PATCH] changed the constructor of the MidPoint functor of the refine. Now it requires a Mesh as an argument to get reliable knowledge of the presence/absence of temporary data. --- vcg/complex/trimesh/refine.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/vcg/complex/trimesh/refine.h b/vcg/complex/trimesh/refine.h index d9310ea6..1c508843 100644 --- a/vcg/complex/trimesh/refine.h +++ b/vcg/complex/trimesh/refine.h @@ -117,7 +117,12 @@ const Split SplitTab[8]={ template struct MidPoint : public std::unary_function , typename MESH_TYPE::CoordType > { + MidPoint(MESH_TYPE *_mp) { mp=_mp; } + + MESH_TYPE *mp; + void operator()(typename MESH_TYPE::VertexType &nv, face::Pos ep){ + assert(mp); nv.P()= (ep.f->V(ep.z)->P()+ep.f->V1(ep.z)->P())/2.0; if( MESH_TYPE::HasPerVertexNormal()) @@ -129,7 +134,7 @@ struct MidPoint : public std::unary_functionV(ep.z)->Q()+ep.f->V1(ep.z)->Q())) / 2.0; - if( MESH_TYPE::HasPerVertexTexCoord()) + if( tri::HasPerVertexTexCoord(*mp)) nv.T().P() = ((ep.f->V(ep.z)->T().P()+ep.f->V1(ep.z)->T().P())) / 2.0; }