From a2f5cc658cd7a250a5452ad43dc7343a5da94fae Mon Sep 17 00:00:00 2001 From: Paolo Cignoni cignoni Date: Fri, 16 Sep 2011 08:00:19 +0000 Subject: [PATCH] Added Normalization step to the bent normal --- src/meshlabplugins/filter_ao/filter_ao.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/meshlabplugins/filter_ao/filter_ao.cpp b/src/meshlabplugins/filter_ao/filter_ao.cpp index 40493f99f..d20557e90 100644 --- a/src/meshlabplugins/filter_ao/filter_ao.cpp +++ b/src/meshlabplugins/filter_ao/filter_ao.cpp @@ -284,13 +284,16 @@ bool AmbientOcclusionPlugin::processGL(MeshModel &m, vector &posVect) { tri::UpdateColor::FaceQualityGray(m.cm); CMeshO::FaceIterator fi; - for(fi=m.cm.face.begin();fi!=m.cm.face.end();++fi) if(!(*fi).IsD()) + for(fi=m.cm.face.begin();fi!=m.cm.face.end();++fi) (*fi).Q()=(*fi).Q()/numViews; } else { tri::UpdateColor::VertexQualityGray(m.cm); CMeshO::VertexIterator vi; - for(vi=m.cm.vert.begin();vi!=m.cm.vert.end();++vi) if(!(*vi).IsD()) + for(vi=m.cm.vert.begin();vi!=m.cm.vert.end();++vi) + { (*vi).Q()=(*vi).Q()/numViews; + BN[vi].Normalize(); + } } Log(0,"Successfully calculated A.O. after %3.2f sec, %3.2f of which is due to initialization", ((float)tAll.elapsed()/1000.0f), ((float)tInitElapsed/1000.0f) );