[Bf-blender-cvs] [214c42157a2] blender2.8: Only calc split normals when auto-smooth is enabled
Campbell Barton
noreply at git.blender.org
Wed May 24 18:28:49 CEST 2017
Commit: 214c42157a2d4e64c599adb6d2c0c47a0ebb7bb2
Author: Campbell Barton
Date: Thu May 25 02:31:39 2017 +1000
Branches: blender2.8
https://developer.blender.org/rB214c42157a2d4e64c599adb6d2c0c47a0ebb7bb2
Only calc split normals when auto-smooth is enabled
This matches cycles & derived-mesh
===================================================================
M source/blender/draw/intern/draw_cache_impl_mesh.c
===================================================================
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;
More information about the Bf-blender-cvs
mailing list