diff options
author | Nicholas Bishop <nicholasbishop@gmail.com> | 2012-07-12 09:55:07 +0400 |
---|---|---|
committer | Nicholas Bishop <nicholasbishop@gmail.com> | 2012-07-12 09:55:07 +0400 |
commit | 677876e4294708784eceb47bfc73698673a6e910 (patch) | |
tree | 35436303e36e77d8216c05d8d531800fe1d9736e /source/blender | |
parent | 4f5d982fb1dda38c104e9800d5156e5acda7fb83 (diff) |
Fix normals around root nodes of skin modifier output.
The direction for these are flipped from other end caps, so add a root
flag to indicate whether the cap polygon's vertex output order should be
reversed.
Fixes bug [#32079] Skin-modifier calculates root's normals wrong
projects.blender.org/tracker/index.php?func=detail&aid=32079&group_id=9&atid=498
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/modifiers/intern/MOD_skin.c | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/source/blender/modifiers/intern/MOD_skin.c b/source/blender/modifiers/intern/MOD_skin.c index 46987f30205..f24898ccee2 100644 --- a/source/blender/modifiers/intern/MOD_skin.c +++ b/source/blender/modifiers/intern/MOD_skin.c @@ -91,6 +91,7 @@ typedef enum { CAP_START = 1, CAP_END = 2, SEAM_FRAME = 4, + ROOT = 8 } SkinNodeFlag; typedef struct Frame { @@ -502,6 +503,9 @@ static void end_node_frames(int v, SkinNode *skin_nodes, const MVert *mvert, /* End frame */ create_frame(&skin_nodes[v].frames[0], mvert[v].co, rad, mat, 0); } + + if (nodes[v].flag & MVERT_SKIN_ROOT) + skin_nodes[v].flag |= ROOT; } /* Returns 1 for seam, 0 otherwise */ @@ -1493,18 +1497,27 @@ static void skin_output_end_nodes(SkinOutput *so, SkinNode *skin_nodes, } if (sn->flag & CAP_START) { - add_poly(so, - sn->frames[0].verts[3], - sn->frames[0].verts[2], - sn->frames[0].verts[1], - sn->frames[0].verts[0]); + if (sn->flag & ROOT) { + add_poly(so, + sn->frames[0].verts[0], + sn->frames[0].verts[1], + sn->frames[0].verts[2], + sn->frames[0].verts[3]); + } + else { + add_poly(so, + sn->frames[0].verts[3], + sn->frames[0].verts[2], + sn->frames[0].verts[1], + sn->frames[0].verts[0]); + } } if (sn->flag & CAP_END) { add_poly(so, - sn->frames[1].verts[3], - sn->frames[1].verts[2], + sn->frames[1].verts[0], sn->frames[1].verts[1], - sn->frames[1].verts[0]); + sn->frames[1].verts[2], + sn->frames[1].verts[3]); } } } |