diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-04-04 17:02:12 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-04-04 17:02:12 +0400 |
commit | 709e4b309e21a0e2b7569924446b0295382e8b82 (patch) | |
tree | de54b839b253597cdca0c3f9cb3af0a979ba2ed0 /source/blender/editors/mesh | |
parent | 265cdf29fb62a6dc437ccafddc33045e5b32f9cf (diff) |
Revert mesh recalculation change that gives different vertex normals based
on smooth/flat flag on faces. This does give better results for low poly
game models, but there's just too much functionality that depends on this
(modifiers, displacey, editmode tools, extrude, ...), that there's not
enough time to fix these before the release.
Diffstat (limited to 'source/blender/editors/mesh')
-rw-r--r-- | source/blender/editors/mesh/editmesh_lib.c | 40 |
1 files changed, 3 insertions, 37 deletions
diff --git a/source/blender/editors/mesh/editmesh_lib.c b/source/blender/editors/mesh/editmesh_lib.c index d3945a53f0d..b2ff8306526 100644 --- a/source/blender/editors/mesh/editmesh_lib.c +++ b/source/blender/editors/mesh/editmesh_lib.c @@ -2001,12 +2001,14 @@ void recalc_editnormals(EditMesh *em) { EditFace *efa; EditVert *eve; - int found_flat= 0; for(eve= em->verts.first; eve; eve=eve->next) zero_v3(eve->no); for(efa= em->faces.first; efa; efa=efa->next) { + float *n4= (efa->v4)? efa->v4->no: NULL; + float *c4= (efa->v4)? efa->v4->co: NULL; + if(efa->v4) { normal_quad_v3(efa->n, efa->v1->co, efa->v2->co, efa->v3->co, efa->v4->co); cent_quad_v3(efa->cent, efa->v1->co, efa->v2->co, efa->v3->co, efa->v4->co); @@ -2015,42 +2017,6 @@ void recalc_editnormals(EditMesh *em) normal_tri_v3(efa->n, efa->v1->co, efa->v2->co, efa->v3->co); cent_tri_v3(efa->cent, efa->v1->co, efa->v2->co, efa->v3->co); } - - if(efa->flag & ME_SMOOTH) { - float *n4= (efa->v4)? efa->v4->no: NULL; - float *c4= (efa->v4)? efa->v4->co: NULL; - - accumulate_vertex_normals(efa->v1->no, efa->v2->no, efa->v3->no, n4, - efa->n, efa->v1->co, efa->v2->co, efa->v3->co, c4); - } - else - found_flat= 1; - } - - /* build smooth normals for uninitialized normals at faces set to flat */ - /* For such faces the renderer/3Dview and exporters will be using the face normal */ - /* The vertex normals built inside this if-statement are entirely to support the needs of the modeler */ - if(found_flat!=0) { - for(efa= em->faces.first; efa; efa=efa->next) { - efa->v1->tmp.t= 0; - efa->v2->tmp.t= 0; - efa->v3->tmp.t= 0; - if(efa->v4) efa->v4->tmp.t= 0; - - if(!(efa->flag & ME_SMOOTH)) { - if(is_zero_v3(efa->v1->no)) efa->v1->tmp.t= 1; - if(is_zero_v3(efa->v2->no)) efa->v2->tmp.t= 1; - if(is_zero_v3(efa->v3->no)) efa->v3->tmp.t= 1; - if(efa->v4 && is_zero_v3(efa->v4->no)) efa->v4->tmp.t= 1; - } - } - - for(efa= em->faces.first; efa; efa=efa->next) { - if(efa->v1->tmp.t) add_v3_v3(efa->v1->no, efa->n); - if(efa->v2->tmp.t) add_v3_v3(efa->v2->no, efa->n); - if(efa->v3->tmp.t) add_v3_v3(efa->v3->no, efa->n); - if(efa->v4 && efa->v4->tmp.t) add_v3_v3(efa->v4->no, efa->n); - } } /* following Mesh convention; we use vertex coordinate itself for normal in this case */ |