Fix for the view map construction not taking account of face marks.
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>
Sat, 12 Nov 2011 19:08:16 +0000 (19:08 +0000)
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>
Sat, 12 Nov 2011 19:08:16 +0000 (19:08 +0000)
source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp
source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.h

index 0f282fb643f0322253336999d19c8beb49db92ab..d158e345505bc26a53f4b335d129e7e013305480 100755 (executable)
@@ -311,6 +311,9 @@ OWXFaceLayer ViewEdgeXBuilder::FindNextFaceLayer(const OWXFaceLayer& iFaceLayer)
           // maybe should test whether this face has 
           // also a vertex_edge configuration
           WXFaceLayer * winner = sameNatureLayers[0];
+                 // check face mark continuity
+                 if(winner->getFace()->GetMark() != iFaceLayer.fl->getFace()->GetMark())
+                       return OWXFaceLayer(0,true);
           if(woeend == winner->getSmoothEdge()->woea()->twin())
             return OWXFaceLayer(winner,true);
           else
@@ -333,6 +336,9 @@ OWXFaceLayer ViewEdgeXBuilder::FindNextFaceLayer(const OWXFaceLayer& iFaceLayer)
       return OWXFaceLayer(0,true);
     else{
       WXFaceLayer * winner = sameNatureLayers[0];
+         // check face mark continuity
+         if(winner->getFace()->GetMark() != iFaceLayer.fl->getFace()->GetMark())
+               return OWXFaceLayer(0,true);
       if(woeend == winner->getSmoothEdge()->woea()->twin())
         return OWXFaceLayer(winner,true);
       else
@@ -375,6 +381,9 @@ OWXFaceLayer ViewEdgeXBuilder::FindPreviousFaceLayer(const OWXFaceLayer& iFaceLa
           // maybe should test whether this face has 
           // also a vertex_edge configuration
           WXFaceLayer * winner = sameNatureLayers[0];
+                 // check face mark continuity
+                 if(winner->getFace()->GetMark() != iFaceLayer.fl->getFace()->GetMark())
+                       return OWXFaceLayer(0,true);
           if(woebegin == winner->getSmoothEdge()->woeb()->twin())
             return OWXFaceLayer(winner,true);
           else
@@ -398,6 +407,9 @@ OWXFaceLayer ViewEdgeXBuilder::FindPreviousFaceLayer(const OWXFaceLayer& iFaceLa
       return OWXFaceLayer(0,true);
     else{
       WXFaceLayer * winner = sameNatureLayers[0];
+         // check face mark continuity
+         if(winner->getFace()->GetMark() != iFaceLayer.fl->getFace()->GetMark())
+           return OWXFaceLayer(0,true);
       if(woebegin == winner->getSmoothEdge()->woeb()->twin())
         return OWXFaceLayer(winner,true);
       else
@@ -501,6 +513,18 @@ bool ViewEdgeXBuilder::stopSmoothViewEdge(WXFaceLayer *iFaceLayer){
   return true;
 }
 
+int ViewEdgeXBuilder::retrieveFaceMarks(WXEdge *iEdge)
+{
+  WFace *aFace = iEdge->GetaFace();
+  WFace *bFace = iEdge->GetbFace();
+  int result = 0;
+  if (aFace && aFace->GetMark())
+    result += 1;
+  if (bFace && bFace->GetMark())
+    result += 2;
+  return result;
+}
+
 OWXEdge ViewEdgeXBuilder::FindNextWEdge(const OWXEdge& iEdge){
   if(Nature::NO_FEATURE == iEdge.e->nature())
     return OWXEdge(0, true);
@@ -515,6 +539,7 @@ OWXEdge ViewEdgeXBuilder::FindNextWEdge(const OWXEdge& iEdge){
     return 0;
 
   
+  int faceMarks = retrieveFaceMarks(iEdge.e);
   vector<WEdge*>& vEdges = (v)->GetEdges();
   for(vector<WEdge*>::iterator ve=vEdges.begin(),veend=vEdges.end();
   ve!=veend;
@@ -526,6 +551,10 @@ OWXEdge ViewEdgeXBuilder::FindNextWEdge(const OWXEdge& iEdge){
     if(wxe->nature() != iEdge.e->nature())
       continue;
       
+       // check face mark continuity
+       if(retrieveFaceMarks(wxe) != faceMarks)
+         continue;
+
     if(wxe->GetaVertex() == v){
      // That means that the face necesarily lies on the edge left.
      // So the vertex order is OK.
@@ -554,6 +583,7 @@ OWXEdge ViewEdgeXBuilder::FindPreviousWEdge(const OWXEdge& iEdge){
     return 0;
 
   
+  int faceMarks = retrieveFaceMarks(iEdge.e);
   vector<WEdge*>& vEdges = (v)->GetEdges();
   for(vector<WEdge*>::iterator ve=vEdges.begin(),veend=vEdges.end();
   ve!=veend;
@@ -565,6 +595,10 @@ OWXEdge ViewEdgeXBuilder::FindPreviousWEdge(const OWXEdge& iEdge){
     if(wxe->nature() != iEdge.e->nature())
       continue;
       
+       // check face mark continuity
+       if(retrieveFaceMarks(wxe) != faceMarks)
+         continue;
+
     if(wxe->GetbVertex() == v){
       return OWXEdge(wxe, true);
     }else{
index 69134f5a212fb3123654df5ad6615724c2615723..744cc520b2b4256d26a872bef4fd495069312e1c 100755 (executable)
@@ -193,6 +193,7 @@ protected:
   // SHARP //
   /*! checks whether a WEdge has already been processed or not */
   bool stopSharpViewEdge(WXEdge *iFace);
+  int retrieveFaceMarks(WXEdge *iEdge);
   OWXEdge FindNextWEdge(const OWXEdge& iEdge);
   OWXEdge FindPreviousWEdge(const OWXEdge& iEdge);
   FEdge * BuildSharpFEdge(FEdge *feprevious, const OWXEdge& iwe);