fixed compile-time compatibility toward meshes without Tangent Dirs

This commit is contained in:
mtarini 2016-04-13 11:33:59 +00:00
parent e4fce70f35
commit 480af9d03d
1 changed files with 4 additions and 2 deletions

View File

@ -1361,7 +1361,7 @@ public:
{ {
FaceType *f=&mesh.face[i]; FaceType *f=&mesh.face[i];
if (f->IsD())continue; if (f->IsD())continue;
CoordType Ntest=mesh.face[i].PD1()^mesh.face[i].PD2(); CoordType Ntest= CoordType::Construct( mesh.face[i].PD1()^mesh.face[i].PD2() );
if ((Ntest*vcg::Normal(f->P(0),f->P(1),f->P(2)))<0)mesh.face[i].PD2()=-mesh.face[i].PD2(); if ((Ntest*vcg::Normal(f->P(0),f->P(1),f->P(2)))<0)mesh.face[i].PD2()=-mesh.face[i].PD2();
} }
} }
@ -1471,7 +1471,9 @@ public:
vcg::Point2<ScalarType> UV0=mesh.face[i].WT(0).P(); vcg::Point2<ScalarType> UV0=mesh.face[i].WT(0).P();
vcg::Point2<ScalarType> UV1=mesh.face[i].WT(1).P(); vcg::Point2<ScalarType> UV1=mesh.face[i].WT(1).P();
vcg::Point2<ScalarType> UV2=mesh.face[i].WT(2).P(); vcg::Point2<ScalarType> UV2=mesh.face[i].WT(2).P();
GradientToCross(mesh.face[i],UV0,UV1,UV2,mesh.face[i].PD1(),mesh.face[i].PD2()); GradientToCross(mesh.face[i],UV0,UV1,UV2,
CoordType::Construct(mesh.face[i].PD1()),
CoordType::Construct(mesh.face[i].PD2()) );
} }
OrientDirectionFaceCoherently(mesh); OrientDirectionFaceCoherently(mesh);
} }