Revision: 40886
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40886
Author:   campbellbarton
Date:     2011-10-10 00:01:44 +0000 (Mon, 10 Oct 2011)
Log Message:
-----------
mesh VBO drawing code was swapping red/blue vertex colors - this is confusing 
because MCol.r is blue and MCol.b is red but not excuse! (and how come nobody 
noticed this?).

- fixed this error in 4 places.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/cdderivedmesh.c
    trunk/blender/source/blender/editors/space_view3d/drawmesh.c

Modified: trunk/blender/source/blender/blenkernel/intern/cdderivedmesh.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/cdderivedmesh.c      
2011-10-09 23:21:04 UTC (rev 40885)
+++ trunk/blender/source/blender/blenkernel/intern/cdderivedmesh.c      
2011-10-10 00:01:44 UTC (rev 40886)
@@ -756,9 +756,10 @@
                                unsigned char *colors = 
MEM_mallocN(dm->getNumFaces(dm)*4*3*sizeof(unsigned char), 
"cdDM_drawFacesTex_common");
                                for( i=0; i < dm->getNumFaces(dm); i++ ) {
                                        for( j=0; j < 4; j++ ) {
-                                               colors[i*12+j*3] = col[i*4+j].r;
+                                               /* bgr -> rgb is intentional 
(and stupid), but how its stored internally */
+                                               colors[i*12+j*3] = col[i*4+j].b;
                                                colors[i*12+j*3+1] = 
col[i*4+j].g;
-                                               colors[i*12+j*3+2] = 
col[i*4+j].b;
+                                               colors[i*12+j*3+2] = 
col[i*4+j].r;
                                        }
                                }
                                GPU_color3_upload(dm,colors);

Modified: trunk/blender/source/blender/editors/space_view3d/drawmesh.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/drawmesh.c        
2011-10-09 23:21:04 UTC (rev 40885)
+++ trunk/blender/source/blender/editors/space_view3d/drawmesh.c        
2011-10-10 00:01:44 UTC (rev 40886)
@@ -450,9 +450,9 @@
                        }
                } else if (tface && tface->mode&TF_OBCOL) {
                        for(j=0;j<4;j++) {
-                               finalCol[i*4+j].r = FTOCHAR(Gtexdraw.obcol[0]);
+                               finalCol[i*4+j].b = FTOCHAR(Gtexdraw.obcol[0]);
                                finalCol[i*4+j].g = FTOCHAR(Gtexdraw.obcol[1]);
-                               finalCol[i*4+j].b = FTOCHAR(Gtexdraw.obcol[2]);
+                               finalCol[i*4+j].r = FTOCHAR(Gtexdraw.obcol[2]);
                        }
                } else if (!mcol) {
                        if (tface) {
@@ -471,9 +471,9 @@
                                        else copy_v3_v3(col, &ma->r);
                                        
                                        for(j=0;j<4;j++) {
-                                               finalCol[i*4+j].b = 
FTOCHAR(col[2]);
+                                               finalCol[i*4+j].b = 
FTOCHAR(col[0]);
                                                finalCol[i*4+j].g = 
FTOCHAR(col[1]);
-                                               finalCol[i*4+j].r = 
FTOCHAR(col[0]);
+                                               finalCol[i*4+j].r = 
FTOCHAR(col[2]);
                                        }
                                }
                                else
@@ -485,9 +485,9 @@
                        }
                } else {
                        for(j=0;j<4;j++) {
-                               finalCol[i*4+j].b = mcol[i*4+j].r;
+                               finalCol[i*4+j].r = mcol[i*4+j].r;
                                finalCol[i*4+j].g = mcol[i*4+j].g;
-                               finalCol[i*4+j].r = mcol[i*4+j].b;
+                               finalCol[i*4+j].b = mcol[i*4+j].b;
                        }
                }
        }

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

Reply via email to