Commit: 3a15ec337ef2bea094e284963584d8fb320520bd
Author: Antony Riakiotakis
Date:   Fri Jul 17 18:30:40 2015 +0200
Branches: master
https://developer.blender.org/rB3a15ec337ef2bea094e284963584d8fb320520bd

Fix issue reported by scorpion81 on irc: material mode + flat shading
artifacts in cycles textured mode.

===================================================================

M       source/blender/blenkernel/intern/cdderivedmesh.c

===================================================================

diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c 
b/source/blender/blenkernel/intern/cdderivedmesh.c
index d5cdc50..9c25771 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -1126,6 +1126,9 @@ static void cdDM_drawMappedFacesMat(
         *       will skip using textures (dyntopo currently destroys UV 
anyway) and
         *       works fine for matcap
         */
+
+       cdDM_update_normals_from_pbvh(dm);
+
        if (cddm->pbvh && cddm->pbvh_draw && BKE_pbvh_type(cddm->pbvh) == 
PBVH_BMESH) {
                if (BKE_pbvh_has_faces(cddm->pbvh)) {
                        setMaterial(userData, 1, &gattribs);
@@ -1135,8 +1138,6 @@ static void cdDM_drawMappedFacesMat(
                return;
        }
 
-       cdDM_update_normals_from_pbvh(dm);
-
        matnr = -1;
 
        glShadeModel(GL_SMOOTH);
@@ -1166,7 +1167,7 @@ static void cdDM_drawMappedFacesMat(
 
                /* skipping faces */
                if (setFace) {
-                       orig = (index_mp_to_orig) ? index_mp_to_orig[a] : 
lt->poly;
+                       orig = (index_mp_to_orig) ? index_mp_to_orig[lt->poly] 
: lt->poly;
 
                        if (orig != ORIGINDEX_NONE && !setFace(userData, orig))
                                continue;
@@ -1175,7 +1176,7 @@ static void cdDM_drawMappedFacesMat(
                /* smooth normal */
                if (!smoothnormal) {
                        if (nors) {
-                               glNormal3fv(nors[a]);
+                               glNormal3fv(nors[lt->poly]);
                        }
                        else {
                                /* TODO ideally a normal layer should always be 
available */

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to