Added a needed Require Normal Components

This commit is contained in:
Paolo Cignoni 2017-03-13 15:46:58 +01:00
parent 781c333821
commit 610e8e49c8
1 changed files with 8 additions and 7 deletions

View File

@ -92,7 +92,7 @@ static void PerVertex(ComputeMeshType &m)
for(FaceIterator f=m.face.begin();f!=m.face.end();++f) for(FaceIterator f=m.face.begin();f!=m.face.end();++f)
if( !(*f).IsD() && (*f).IsR() ) if( !(*f).IsD() && (*f).IsR() )
{ {
typename FaceType::NormalType t = vcg::TriangleNormal(*f); typename VertexType::NormalType t = vcg::TriangleNormal(*f);
for(int j=0; j<(*f).VN(); ++j) for(int j=0; j<(*f).VN(); ++j)
if( !(*f).V(j)->IsD() && (*f).V(j)->IsRW() ) if( !(*f).V(j)->IsD() && (*f).V(j)->IsRW() )
@ -102,11 +102,12 @@ static void PerVertex(ComputeMeshType &m)
static void PerFacePolygonal(ComputeMeshType &m) static void PerFacePolygonal(ComputeMeshType &m)
{ {
for(FaceIterator fi=m.face.begin();fi!=m.face.end();++fi) RequirePerFaceNormal(m);
{ for(FaceIterator fi=m.face.begin();fi!=m.face.end();++fi)
if( !(*fi).IsD() ) {
fi->N() = PolygonNormal(*fi).Normalize(); if( !(*fi).IsD() )
} fi->N() = PolygonNormal(*fi).Normalize();
}
} }
/// \brief Calculates the vertex normal as an angle weighted average. It does not need or exploit current face normals. /// \brief Calculates the vertex normal as an angle weighted average. It does not need or exploit current face normals.
@ -118,7 +119,7 @@ G. Thurmer, C. A. Wuthrich
"Computing vertex normals from polygonal facets" "Computing vertex normals from polygonal facets"
Journal of Graphics Tools, 1998 Journal of Graphics Tools, 1998
*/ */
static void PerVertexAngleWeighted(ComputeMeshType &m) static void PerVertexAngleWeighted(ComputeMeshType &m)
{ {
PerVertexClear(m); PerVertexClear(m);
FaceIterator f; FaceIterator f;