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; }