diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-05-24 19:31:39 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-05-24 19:31:39 +0300 |
commit | 214c42157a2d4e64c599adb6d2c0c47a0ebb7bb2 (patch) | |
tree | c340dab86b99bb192d262f2cc40a4f920c28d1bb /source/blender/draw | |
parent | 154ff1afdef97947190f5de9225284b9d9f556fd (diff) |
Only calc split normals when auto-smooth is enabled
This matches cycles & derived-mesh
Diffstat (limited to 'source/blender/draw')
-rw-r--r-- | source/blender/draw/intern/draw_cache_impl_mesh.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c index 06738b87a0b..70135389a8d 100644 --- a/source/blender/draw/intern/draw_cache_impl_mesh.c +++ b/source/blender/draw/intern/draw_cache_impl_mesh.c @@ -393,6 +393,8 @@ static MeshRenderData *mesh_render_data_create(Mesh *me, const int types) } } + const bool is_auto_smooth = (me->flag & ME_AUTOSMOOTH) != 0; + /* don't access mesh directly, instead use vars taken from BMesh or Mesh */ #define me DONT_USE_THIS #ifdef me /* quiet warning */ @@ -479,6 +481,10 @@ static MeshRenderData *mesh_render_data_create(Mesh *me, const int types) BMEditMesh *em = rdata->edit_bmesh; BMesh *bm = em->bm; + if (is_auto_smooth) { + /* TODO: split normals, see below */ + } + bool calc_active_tangent = false; float (*poly_normals)[3] = rdata->poly_normals; float (*loop_normals)[3] = CustomData_get_layer(cd_ldata, CD_NORMAL); @@ -493,12 +499,12 @@ static MeshRenderData *mesh_render_data_create(Mesh *me, const int types) } else { #undef me - /* XXX. this should work, check on this when we add split normals, see: T51561. */ -#if 0 - if (!CustomData_has_layer(cd_ldata, CD_NORMAL)) { - BKE_mesh_calc_normals_split(me); + + if (is_auto_smooth) { + if (!CustomData_has_layer(cd_ldata, CD_NORMAL)) { + BKE_mesh_calc_normals_split(me); + } } -#endif bool calc_active_tangent = false; const float (*poly_normals)[3] = rdata->poly_normals; |