From b85985535dd420e50cc906bd6e7dd352cc2b8b97 Mon Sep 17 00:00:00 2001 From: Tamito Kajiyama Date: Sat, 22 May 2010 22:21:15 +0000 Subject: New option for detecting feature edges at material boundaries. A checkbox "Material Boundaries" has been added to the Freestyle options in the Layers tab of the Render buttons. By enabling the option, any edge between two faces with different materials is detected as a feature edge. In style modules, edges at material boundaries can be tested with pyNatureUP1D(Nature.MATERIAL_BOUNDARY). --- .../freestyle/intern/view_map/FEdgeXDetector.cpp | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp') diff --git a/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp b/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp index 0551fd3ac15..ecab4fc413c 100755 --- a/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp +++ b/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp @@ -64,6 +64,8 @@ void FEdgeXDetector::processShapes(WingedEdge& we) { if (progressBarDisplay) _pProgressBar->setProgress(_pProgressBar->getProgress() + 1); processBorderShape(wxs); + if(_computeMaterialBoundaries) + processMaterialBoundaryShape(wxs); processCreaseShape(wxs); if(_computeRidgesAndValleys) processRidgesAndValleysShape(wxs); @@ -679,6 +681,29 @@ void FEdgeXDetector::postProcessSuggestiveContourFace(WXFace *iFace) { sc_layer->removeSmoothEdge(); } +// MATERIAL_BOUNDARY +//////////////////// +void FEdgeXDetector::processMaterialBoundaryShape(WXShape* iWShape) { + + if(!_computeViewIndependant) + return; + // Make a pass on the edges to detect material boundaries + vector::iterator we, weend; + vector &wedges = iWShape->getEdgeList(); + for(we=wedges.begin(), weend=wedges.end(); + we!=weend; + ++we){ + ProcessMaterialBoundaryEdge((WXEdge*)(*we)); + } +} + +void FEdgeXDetector::ProcessMaterialBoundaryEdge(WXEdge *iEdge) +{ + // check whether the edge is a material boundary? + if(iEdge->GetaFace()->frs_materialIndex() != iEdge->GetbFace()->frs_materialIndex()){ + iEdge->AddNature(Nature::MATERIAL_BOUNDARY); + } +} // Build Smooth edges ///////////////////// -- cgit v1.2.3