Revision: 56020
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56020
Author:   campbellbarton
Date:     2013-04-13 18:11:27 +0000 (Sat, 13 Apr 2013)
Log Message:
-----------
code cleanup: more minor changes for editmesh face drawing.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/editderivedmesh.c

Modified: trunk/blender/source/blender/blenkernel/intern/editderivedmesh.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/editderivedmesh.c    
2013-04-13 17:57:11 UTC (rev 56019)
+++ trunk/blender/source/blender/blenkernel/intern/editderivedmesh.c    
2013-04-13 18:11:27 UTC (rev 56020)
@@ -809,6 +809,7 @@
        struct BMLoop *(*looptris)[3] = em->looptris;
        float (*vertexCos)[3] = bmdm->vertexCos;
        float (*vertexNos)[3] = bmdm->vertexNos;
+       float (*polyNos)[3]   = bmdm->polyNos;
        BMFace *efa;
        MLoopUV *luv[3], dummyluv = {{0}};
        MLoopCol *lcol[3] = {NULL} /* , dummylcol = {0} */;
@@ -856,13 +857,13 @@
 
                        if (draw_option != DM_DRAW_OPTION_SKIP) {
 
+                               if (has_uv)   bmdm_get_tri_uv(ltri,  luv,  
cd_loop_uv_offset);
+                               if (has_vcol) bmdm_get_tri_col(ltri, lcol, 
cd_loop_color_offset);
+
                                glBegin(GL_TRIANGLES);
                                if (!drawSmooth) {
-                                       
glNormal3fv(bmdm->polyNos[BM_elem_index_get(efa)]);
+                                       
glNormal3fv(polyNos[BM_elem_index_get(efa)]);
 
-                                       if (has_uv)   bmdm_get_tri_uv(ltri,  
luv,  cd_loop_uv_offset);
-                                       if (has_vcol) bmdm_get_tri_col(ltri, 
lcol, cd_loop_color_offset);
-
                                        glTexCoord2fv(luv[0]->uv);
                                        if (has_vcol) glColor3ubv((const 
GLubyte *)&(lcol[0]->r));
                                        
glVertex3fv(vertexCos[BM_elem_index_get(ltri[0]->v)]);
@@ -876,9 +877,6 @@
                                        
glVertex3fv(vertexCos[BM_elem_index_get(ltri[2]->v)]);
                                }
                                else {
-                                       if (has_uv)   bmdm_get_tri_uv(ltri,  
luv,  cd_loop_uv_offset);
-                                       if (has_vcol) bmdm_get_tri_col(ltri, 
lcol, cd_loop_color_offset);
-
                                        glTexCoord2fv(luv[0]->uv);
                                        if (has_vcol) glColor3ubv((const 
GLubyte *)&(lcol[0]->r));
                                        
glNormal3fv(vertexNos[BM_elem_index_get(ltri[0]->v)]);
@@ -924,13 +922,13 @@
 
                        if (draw_option != DM_DRAW_OPTION_SKIP) {
 
+                               if (has_uv)   bmdm_get_tri_uv(ltri,  luv,  
cd_loop_uv_offset);
+                               if (has_vcol) bmdm_get_tri_col(ltri, lcol, 
cd_loop_color_offset);
+
                                glBegin(GL_TRIANGLES);
                                if (!drawSmooth) {
                                        glNormal3fv(efa->no);
 
-                                       if (has_uv)   bmdm_get_tri_uv(ltri,  
luv,  cd_loop_uv_offset);
-                                       if (has_vcol) bmdm_get_tri_col(ltri, 
lcol, cd_loop_color_offset);
-
                                        glTexCoord2fv(luv[0]->uv);
                                        if (has_vcol) glColor3ubv((const 
GLubyte *)&(lcol[0]->r));
                                        glVertex3fv(ltri[0]->v->co);
@@ -944,9 +942,6 @@
                                        glVertex3fv(ltri[2]->v->co);
                                }
                                else {
-                                       if (has_uv)   bmdm_get_tri_uv(ltri,  
luv,  cd_loop_uv_offset);
-                                       if (has_vcol) bmdm_get_tri_col(ltri, 
lcol, cd_loop_color_offset);
-
                                        glTexCoord2fv(luv[0]->uv);
                                        if (has_vcol) glColor3ubv((const 
GLubyte *)&(lcol[0]->r));
                                        glNormal3fv(ltri[0]->v->no);
@@ -1034,6 +1029,7 @@
        struct BMLoop *(*looptris)[3] = em->looptris;
        float (*vertexCos)[3] = bmdm->vertexCos;
        float (*vertexNos)[3] = bmdm->vertexNos;
+       float (*polyNos)[3]   = bmdm->polyNos;
        BMFace *efa;
        DMVertexAttribs attribs;
        GPUVertexAttribs gattribs;
@@ -1069,7 +1065,7 @@
                if (do_draw) {
                        glBegin(GL_TRIANGLES);
                        if (!drawSmooth) {
-                               if (vertexCos) 
glNormal3fv(bmdm->polyNos[BM_elem_index_get(efa)]);
+                               if (vertexCos) 
glNormal3fv(polyNos[BM_elem_index_get(efa)]);
                                else glNormal3fv(efa->no);
 
                                emdm_pass_attrib_vertex_glsl(&attribs, ltri[0], 
0);
@@ -1168,6 +1164,7 @@
        struct BMLoop *(*looptris)[3] = em->looptris;
        float (*vertexCos)[3] = bmdm->vertexCos;
        float (*vertexNos)[3] = bmdm->vertexNos;
+       float (*polyNos)[3]   = bmdm->polyNos;
        BMFace *efa;
        DMVertexAttribs attribs = {{{0}}};
        GPUVertexAttribs gattribs;
@@ -1201,7 +1198,7 @@
                /* face */
                glBegin(GL_TRIANGLES);
                if (!drawSmooth) {
-                       if (vertexCos) 
glNormal3fv(bmdm->polyNos[BM_elem_index_get(efa)]);
+                       if (vertexCos) 
glNormal3fv(polyNos[BM_elem_index_get(efa)]);
                        else glNormal3fv(efa->no);
 
                        emdm_pass_attrib_vertex_mat(&attribs, ltri[0], 0);

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

Reply via email to