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>2011-10-06 06:04:43 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2011-10-06 06:04:43 +0400
commitf84e8e76406a30bd15e6e55e41714e62826315aa (patch)
treee4a077ee05de21155421b35854162ad5f29c53b3 /source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp
parentcb4f6629279ba9792cc46114fe603bebff11c6a3 (diff)
Fine control of feature edge selection with mesh face and edge marks.
New "face marks" and "edge marks" have been introduced in mesh data blocks. In the edit mode of a mesh object, face marks can be put to selected faces by choosing Mesh >> Faces >> Mark Freestyle Face from the menu of a 3D View window or Ctrl-F >> Mark Freestyle Face from the context menu. Similarly, edge marks can be put to selected edges by Mesh >> Edges >> Mark Freestyle Edge or Ctrl-E >> Mark Freestyle Edge. These marks should work fine with the Subdivision surface modifier. Moreover, two new conditions for feature edge selection have been added to the Parameter Editor mode as described below: 1. The Selection by Edge Types option has now the new Edge Mark type, which can be used to (de)select feature edges having edge marks. This option can be used to add to (or remove from) the view map arbitrary edges of mesh objects. 2. Selection by Face Marks option has been newly introduced, in which face marks are used for feature edge selection in two ways. One option is called "One Face" which is to (de)select feature edges if one of faces on the left and right of each feature edge has a face mark. The other option is "Both Faces" to (de)select feature edges if both faces on the left and right have a face mark.
Diffstat (limited to 'source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp')
-rwxr-xr-xsource/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp28
1 files changed, 24 insertions, 4 deletions
diff --git a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp
index a0a80b7ef64..40c14eafe72 100755
--- a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp
+++ b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp
@@ -102,6 +102,8 @@ void WingedEdgeBuilder::buildWShape(WShape& shape, IndexedFaceSet& ifs) {
// else if(_current_frs_material)
// shape.setFrsMaterial(*_current_frs_material);
+ const IndexedFaceSet::FaceEdgeMark *faceEdgeMarks = ifs.faceEdgeMarks();
+
// sets the current WShape to shape
_current_wshape = &shape;
@@ -128,6 +130,7 @@ void WingedEdgeBuilder::buildWShape(WShape& shape, IndexedFaceSet& ifs) {
new_normals,
frs_materials,
texCoords,
+ faceEdgeMarks,
vindices,
nindices,
mindices,
@@ -139,6 +142,7 @@ void WingedEdgeBuilder::buildWShape(WShape& shape, IndexedFaceSet& ifs) {
new_normals,
frs_materials,
texCoords,
+ faceEdgeMarks,
vindices,
nindices,
mindices,
@@ -150,6 +154,7 @@ void WingedEdgeBuilder::buildWShape(WShape& shape, IndexedFaceSet& ifs) {
new_normals,
frs_materials,
texCoords,
+ faceEdgeMarks,
vindices,
nindices,
mindices,
@@ -163,6 +168,7 @@ void WingedEdgeBuilder::buildWShape(WShape& shape, IndexedFaceSet& ifs) {
mindices += numVertexPerFace[index];
if(tindices)
tindices += numVertexPerFace[index];
+ faceEdgeMarks++;
}
delete[] new_vertices;
@@ -219,6 +225,7 @@ void WingedEdgeBuilder::buildTriangleStrip( const real *vertices,
const real *normals,
vector<FrsMaterial>& iMaterials,
const real *texCoords,
+ const IndexedFaceSet::FaceEdgeMark *iFaceEdgeMarks,
const unsigned *vindices,
const unsigned *nindices,
const unsigned *mindices,
@@ -232,6 +239,7 @@ void WingedEdgeBuilder::buildTriangleStrip( const real *vertices,
vector<WVertex *> triangleVertices;
vector<Vec3r> triangleNormals;
vector<Vec2r> triangleTexCoords;
+ vector<bool> triangleFaceEdgeMarks;
while(nDoneVertices < nvertices)
{
@@ -270,10 +278,14 @@ void WingedEdgeBuilder::buildTriangleStrip( const real *vertices,
triangleTexCoords.push_back(Vec2r(texCoords[tindices[nTriangle+1]], texCoords[tindices[nTriangle+1]+1]));
}
}
+ triangleFaceEdgeMarks.push_back((iFaceEdgeMarks[nTriangle/3] & IndexedFaceSet::FACE_MARK) != 0);
+ triangleFaceEdgeMarks.push_back((iFaceEdgeMarks[nTriangle/3] & IndexedFaceSet::EDGE_MARK_V1V2) != 0);
+ triangleFaceEdgeMarks.push_back((iFaceEdgeMarks[nTriangle/3] & IndexedFaceSet::EDGE_MARK_V2V3) != 0);
+ triangleFaceEdgeMarks.push_back((iFaceEdgeMarks[nTriangle/3] & IndexedFaceSet::EDGE_MARK_V3V1) != 0);
if(mindices)
- currentShape->MakeFace(triangleVertices, triangleNormals, triangleTexCoords, mindices[nTriangle/3]);
+ currentShape->MakeFace(triangleVertices, triangleNormals, triangleTexCoords, triangleFaceEdgeMarks, mindices[nTriangle/3]);
else
- currentShape->MakeFace(triangleVertices, triangleNormals, triangleTexCoords, 0);
+ currentShape->MakeFace(triangleVertices, triangleNormals, triangleTexCoords, triangleFaceEdgeMarks, 0);
nDoneVertices++; // with a strip, each triangle is one vertex more
nTriangle++;
}
@@ -283,6 +295,7 @@ void WingedEdgeBuilder::buildTriangleFan( const real *vertices,
const real *normals,
vector<FrsMaterial>& iMaterials,
const real *texCoords,
+ const IndexedFaceSet::FaceEdgeMark *iFaceEdgeMarks,
const unsigned *vindices,
const unsigned *nindices,
const unsigned *mindices,
@@ -295,6 +308,7 @@ void WingedEdgeBuilder::buildTriangles(const real *vertices,
const real *normals,
vector<FrsMaterial>& iMaterials,
const real *texCoords,
+ const IndexedFaceSet::FaceEdgeMark *iFaceEdgeMarks,
const unsigned *vindices,
const unsigned *nindices,
const unsigned *mindices,
@@ -304,6 +318,7 @@ void WingedEdgeBuilder::buildTriangles(const real *vertices,
vector<WVertex *> triangleVertices;
vector<Vec3r> triangleNormals;
vector<Vec2r> triangleTexCoords;
+ vector<bool> triangleFaceEdgeMarks;
// Each triplet of vertices is considered as an independent triangle
for(unsigned i = 0; i < nvertices / 3; i++)
@@ -321,11 +336,16 @@ void WingedEdgeBuilder::buildTriangles(const real *vertices,
triangleTexCoords.push_back(Vec2r(texCoords[tindices[3*i+1]],texCoords[tindices[3*i+1]+1]));
triangleTexCoords.push_back(Vec2r(texCoords[tindices[3*i+2]], texCoords[tindices[3*i+2]+1]));
}
+
+ triangleFaceEdgeMarks.push_back((iFaceEdgeMarks[i] & IndexedFaceSet::FACE_MARK) != 0);
+ triangleFaceEdgeMarks.push_back((iFaceEdgeMarks[i] & IndexedFaceSet::EDGE_MARK_V1V2) != 0);
+ triangleFaceEdgeMarks.push_back((iFaceEdgeMarks[i] & IndexedFaceSet::EDGE_MARK_V2V3) != 0);
+ triangleFaceEdgeMarks.push_back((iFaceEdgeMarks[i] & IndexedFaceSet::EDGE_MARK_V3V1) != 0);
}
if(mindices)
- currentShape->MakeFace(triangleVertices, triangleNormals, triangleTexCoords, mindices[0]);
+ currentShape->MakeFace(triangleVertices, triangleNormals, triangleTexCoords, triangleFaceEdgeMarks, mindices[0]);
else
- currentShape->MakeFace(triangleVertices, triangleNormals, triangleTexCoords,0);
+ currentShape->MakeFace(triangleVertices, triangleNormals, triangleTexCoords, triangleFaceEdgeMarks, 0);
}