diff options
author | Nicholas Bishop <nicholasbishop@gmail.com> | 2012-05-18 10:10:47 +0400 |
---|---|---|
committer | Nicholas Bishop <nicholasbishop@gmail.com> | 2012-05-18 10:10:47 +0400 |
commit | b5a6be37f1f3ab7bd3d9e27f1bc88657296c4f5c (patch) | |
tree | 9b3a545b40cfcc4607900781a39849cbf61123e9 /source/blender/modifiers/intern/MOD_remesh.c | |
parent | 5fe5a8c2838edc62585e0ed72da23fbeb08ae5e1 (diff) |
Add smooth-shading option for remesh modifier.
The remesh modifier doesn't currently get any data from original
faces, so even if the input mesh was entirely smooth none of the
output faces would be. Solved by adding a new
dna-flag/rna-bool/UI-checkbox to smooth shade the output.
Requested by Daniel Salazar.
Diffstat (limited to 'source/blender/modifiers/intern/MOD_remesh.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_remesh.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/modifiers/intern/MOD_remesh.c b/source/blender/modifiers/intern/MOD_remesh.c index 517791e3e73..57966b5824b 100644 --- a/source/blender/modifiers/intern/MOD_remesh.c +++ b/source/blender/modifiers/intern/MOD_remesh.c @@ -190,6 +190,16 @@ static DerivedMesh *applyModifier(ModifierData *md, result = output->dm; MEM_freeN(output); + if (rmd->flag & MOD_REMESH_SMOOTH_SHADING) { + MPoly *mpoly = CDDM_get_polys(result); + int i, totpoly = result->getNumPolys(result); + + /* Apply smooth shading to output faces */ + for (i = 0; i < totpoly; i++) { + mpoly[i].flag |= ME_SMOOTH; + } + } + CDDM_calc_edges(result); CDDM_calc_normals(result); return result; |