Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2010-05-23 02:21:15 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2010-05-23 02:21:15 +0400
commitb85985535dd420e50cc906bd6e7dd352cc2b8b97 (patch)
tree79c4e7703d218855b7460bd5b32e85ee3926d885 /source/blender/freestyle/intern/view_map
parentdbcb73c033fc15fc0df2ab0a05ac0b2c4a9a31b1 (diff)
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).
Diffstat (limited to 'source/blender/freestyle/intern/view_map')
-rwxr-xr-xsource/blender/freestyle/intern/view_map/FEdgeXDetector.cpp25
-rwxr-xr-xsource/blender/freestyle/intern/view_map/FEdgeXDetector.h7
2 files changed, 32 insertions, 0 deletions
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<WEdge*>::iterator we, weend;
+ vector<WEdge*> &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
/////////////////////
diff --git a/source/blender/freestyle/intern/view_map/FEdgeXDetector.h b/source/blender/freestyle/intern/view_map/FEdgeXDetector.h
index 28034f3f42b..e0d76b5b0f9 100755
--- a/source/blender/freestyle/intern/view_map/FEdgeXDetector.h
+++ b/source/blender/freestyle/intern/view_map/FEdgeXDetector.h
@@ -55,6 +55,7 @@ public:
_meanEdgeSize = 0;
_computeRidgesAndValleys = true;
_computeSuggestiveContours = true;
+ _computeMaterialBoundaries = true;
_sphereRadius = 1.0;
_orthographicProjection = false;
_changes = false;
@@ -103,6 +104,10 @@ public:
}
}
+ // MATERIAL BOUNDARY
+ virtual void FEdgeXDetector::processMaterialBoundaryShape(WXShape* iWShape);
+ virtual void FEdgeXDetector::ProcessMaterialBoundaryEdge(WXEdge *iEdge);
+
// EVERYBODY
virtual void buildSmoothEdges(WXShape* iShape);
@@ -111,6 +116,7 @@ public:
inline void enableOrthographicProjection(bool b) {_orthographicProjection = b;}
inline void enableRidgesAndValleysFlag(bool b) {_computeRidgesAndValleys = b;}
inline void enableSuggestiveContours(bool b) {_computeSuggestiveContours = b;}
+ inline void enableMaterialBoundaries(bool b) {_computeMaterialBoundaries = b;}
/*! Sets the radius of the geodesic sphere around each vertex (for the curvature computation)
* \param r
* The radius of the sphere expressed as a ratio of the mean edge size
@@ -142,6 +148,7 @@ protected:
bool _computeRidgesAndValleys;
bool _computeSuggestiveContours;
+ bool _computeMaterialBoundaries;
real _sphereRadius; // expressed as a ratio of the mean edge size
bool _changes;