mesh VBO drawing code was swapping red/blue vertex colors - this is confusing because...
authorCampbell Barton <ideasman42@gmail.com>
Mon, 10 Oct 2011 00:01:44 +0000 (00:01 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 10 Oct 2011 00:01:44 +0000 (00:01 +0000)
- fixed this error in 4 places.

source/blender/blenkernel/intern/cdderivedmesh.c
source/blender/editors/space_view3d/drawmesh.c

index 707bf95f9c3d494b721282ec4b2297fc349fc0d6..0b5fd93958028e0309543aa7bdf58bb37177c359 100644 (file)
@@ -756,9 +756,10 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm,
                                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);
index 3cb55c0c10a23a83e5aa92066bb7a7cc98dd7659..76263f5ac3d93e2fadaf73330e912e7d053b5f8e 100644 (file)
@@ -450,9 +450,9 @@ static void add_tface_color_layer(DerivedMesh *dm)
                        }
                } 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 @@ static void add_tface_color_layer(DerivedMesh *dm)
                                        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 @@ static void add_tface_color_layer(DerivedMesh *dm)
                        }
                } 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;
                        }
                }
        }