small change to refactor the use of viewpoint for normal disambiguation
This commit is contained in:
parent
9c310f6ab4
commit
682586d0fa
|
@ -121,10 +121,19 @@ public:
|
|||
if(p.coherentAdjNum==0) return;
|
||||
// tree.setMaxNofNeighbors(p.coherentAdjNum+1);
|
||||
|
||||
if(p.useViewPoint) // Simple case use the viewpoint position to determine the right orientation of each point
|
||||
{
|
||||
for(VertexIterator vi=m.vert.begin();vi!=m.vert.end();++vi)
|
||||
{
|
||||
if ( vi->N().dot(p.viewPoint- vi->P())<0.0f)
|
||||
vi->N()=-(*vi).N();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
tri::UpdateFlags<MeshType>::VertexClearV(m);
|
||||
std::vector<WArc> heap;
|
||||
VertexIterator vi=m.vert.begin();
|
||||
|
||||
while(true)
|
||||
{
|
||||
// search an unvisited vertex
|
||||
|
@ -133,10 +142,6 @@ public:
|
|||
|
||||
if(vi==m.vert.end()) return;
|
||||
|
||||
if ( p.useViewPoint &&
|
||||
( vi->N().dot(p.viewPoint- vi->P())<0.0f) )
|
||||
vi->N()=-(*vi).N();
|
||||
|
||||
vi->SetV();
|
||||
AddNeighboursToHeap(m,&*vi,p.coherentAdjNum,tree,heap);
|
||||
|
||||
|
@ -149,7 +154,6 @@ public:
|
|||
{
|
||||
a.trg->SetV();
|
||||
if(a.src->cN()*a.trg->cN()<0.0f)
|
||||
if(!p.useViewPoint || ( a.trg->N().dot(p.viewPoint- a.trg->P())<0.0f)) // test to prevent flipping according to viewpos
|
||||
a.trg->N()=-a.trg->N();
|
||||
AddNeighboursToHeap(m,a.trg,p.coherentAdjNum,tree,heap);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue