Code cleanup: remove unused drawFacesColored from DerivedMesh.
authorNicholas Bishop <nicholasbishop@gmail.com>
Mon, 5 Mar 2012 21:27:28 +0000 (21:27 +0000)
committerNicholas Bishop <nicholasbishop@gmail.com>
Mon, 5 Mar 2012 21:27:28 +0000 (21:27 +0000)
This function pointer isn't called anymore, so removing it and the
cddm/ccgdm/gpu code associated with it.

source/blender/blenkernel/BKE_DerivedMesh.h
source/blender/blenkernel/intern/cdderivedmesh.c
source/blender/blenkernel/intern/subsurf_ccg.c
source/blender/gpu/GPU_buffers.h
source/blender/gpu/intern/gpu_buffers.c

index 116b3e05a8eb3025728ce168702591b47866ee6b..b9e2fddb895a154178d85fc9c4641db0ca513355 100644 (file)
@@ -302,14 +302,6 @@ struct DerivedMesh {
        void (*drawFacesSolid)(DerivedMesh *dm, float (*partial_redraw_planes)[4],
                                                   int fast, int (*setMaterial)(int, void *attribs));
 
-       /* Draw all faces
-        *  o If useTwoSided, draw front and back using col arrays
-        *  o col1,col2 are arrays of length numFace*4 of 4 component colors
-        *    in ABGR format, and should be passed as per-face vertex color.
-        */
-       void (*drawFacesColored)(DerivedMesh *dm, int useTwoSided,
-                                                        unsigned char *col1, unsigned char *col2);
-
        /* Draw all faces using MTFace 
         *  o Drawing options too complicated to enumerate, look at code.
         */
index 50d0f2daab916669e09ce039f65d703607e164da..04d438ebf0cd9b0c56a077b3a2cc295b8b37718e 100644 (file)
@@ -604,93 +604,6 @@ static void cdDM_drawFacesSolid(DerivedMesh *dm,
        glShadeModel(GL_FLAT);
 }
 
-static void cdDM_drawFacesColored(DerivedMesh *dm, int useTwoSided, unsigned char *col1, unsigned char *col2)
-{
-       CDDerivedMesh *cddm = (CDDerivedMesh*) dm;
-       int a, glmode;
-       unsigned char *cp1, *cp2;
-       MVert *mvert = cddm->mvert;
-       MFace *mface = cddm->mface;
-
-       cp1 = col1;
-       if(col2) {
-               cp2 = col2;
-       } else {
-               cp2 = NULL;
-               useTwoSided = 0;
-       }
-
-       /* there's a conflict here... twosided colors versus culling...? */
-       /* defined by history, only texture faces have culling option */
-       /* we need that as mesh option builtin, next to double sided lighting */
-       if(col2) {
-               glEnable(GL_CULL_FACE);
-       }
-
-       cdDM_update_normals_from_pbvh(dm);
-
-       if( GPU_buffer_legacy(dm) ) {
-               DEBUG_VBO( "Using legacy code. cdDM_drawFacesColored\n" );
-               glShadeModel(GL_SMOOTH);
-               glBegin(glmode = GL_QUADS);
-               for(a = 0; a < dm->numTessFaceData; a++, mface++, cp1 += 16) {
-                       int new_glmode = mface->v4?GL_QUADS:GL_TRIANGLES;
-
-                       if(new_glmode != glmode) {
-                               glEnd();
-                               glBegin(glmode = new_glmode);
-                       }
-                               
-                       glColor3ubv(cp1+0);
-                       glVertex3fv(mvert[mface->v1].co);
-                       glColor3ubv(cp1+4);
-                       glVertex3fv(mvert[mface->v2].co);
-                       glColor3ubv(cp1+8);
-                       glVertex3fv(mvert[mface->v3].co);
-                       if(mface->v4) {
-                               glColor3ubv(cp1+12);
-                               glVertex3fv(mvert[mface->v4].co);
-                       }
-                               
-                       if(useTwoSided) {
-                               glColor3ubv(cp2+8);
-                               glVertex3fv(mvert[mface->v3].co );
-                               glColor3ubv(cp2+4);
-                               glVertex3fv(mvert[mface->v2].co );
-                               glColor3ubv(cp2+0);
-                               glVertex3fv(mvert[mface->v1].co );
-                               if(mface->v4) {
-                                       glColor3ubv(cp2+12);
-                                       glVertex3fv(mvert[mface->v4].co );
-                               }
-                       }
-                       if(col2) cp2 += 16;
-               }
-               glEnd();
-       }
-       else { /* use OpenGL VBOs or Vertex Arrays instead for better, faster rendering */
-               GPU_color4_upload(dm,cp1);
-               GPU_vertex_setup(dm);
-               GPU_color_setup(dm);
-               if( !GPU_buffer_legacy(dm) ) {
-                       glShadeModel(GL_SMOOTH);
-                       glDrawArrays(GL_TRIANGLES, 0, dm->drawObject->tot_triangle_point);
-
-                       if( useTwoSided ) {
-                               GPU_color4_upload(dm,cp2);
-                               GPU_color_setup(dm);
-                               glCullFace(GL_FRONT);
-                               glDrawArrays(GL_TRIANGLES, 0, dm->drawObject->tot_triangle_point);
-                               glCullFace(GL_BACK);
-                       }
-               }
-               GPU_buffer_unbind();
-       }
-
-       glShadeModel(GL_FLAT);
-       glDisable(GL_CULL_FACE);
-}
-
 static void cdDM_drawFacesTex_common(DerivedMesh *dm,
                           int (*drawParams)(MTFace *tface, int has_mcol, int matnr),
                           int (*drawParamsMapped)(void *userData, int index),
@@ -1691,7 +1604,6 @@ static CDDerivedMesh *cdDM_create(const char *desc)
        dm->drawMappedEdges = cdDM_drawMappedEdges;
 
        dm->drawFacesSolid = cdDM_drawFacesSolid;
-       dm->drawFacesColored = cdDM_drawFacesColored;
        dm->drawFacesTex = cdDM_drawFacesTex;
        dm->drawFacesGLSL = cdDM_drawFacesGLSL;
        dm->drawMappedFaces = cdDM_drawMappedFaces;
index 8d381299ab3c3412eb891af9f1dd42a9e8c84637..944602b66d0bb35ef1b55d20f8a1bd7571694f6a 100644 (file)
@@ -1920,75 +1920,6 @@ static void ccgDM_drawMappedFacesMat(DerivedMesh *dm, void (*setMaterial)(void *
 #undef PASSATTRIB
 }
 
-
-static void ccgDM_drawFacesColored(DerivedMesh *dm, int UNUSED(useTwoSided), unsigned char *col1, unsigned char *col2)
-{
-       CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
-       CCGSubSurf *ss = ccgdm->ss;
-       int gridSize = ccgSubSurf_getGridSize(ss);
-       unsigned char *cp1, *cp2;
-       int useTwoSide=1, i, totface;
-
-       ccgdm_pbvh_update(ccgdm);
-
-       cp1= col1;
-       if(col2) {
-               cp2= col2;
-       } else {
-               cp2= NULL;
-               useTwoSide= 0;
-       }
-
-       glShadeModel(GL_SMOOTH);
-
-       if(col2) {
-               glEnable(GL_CULL_FACE);
-       }
-
-       glBegin(GL_QUADS);
-       totface = ccgSubSurf_getNumFaces(ss);
-       for(i = 0; i < totface; i++) {
-               CCGFace *f = ccgdm->faceMap[i].face;
-               int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f);
-
-               for (S=0; S<numVerts; S++) {
-                       DMGridData *faceGridData = ccgSubSurf_getFaceGridDataArray(ss, f, S);
-                       for (y=0; y<gridSize-1; y++) {
-                               for (x=0; x<gridSize-1; x++) {
-                                       float *a = faceGridData[(y+0)*gridSize + x].co;
-                                       float *b = faceGridData[(y+0)*gridSize + x + 1].co;
-                                       float *c = faceGridData[(y+1)*gridSize + x + 1].co;
-                                       float *d = faceGridData[(y+1)*gridSize + x].co;
-
-                                       glColor3ub(cp1[3], cp1[2], cp1[1]);
-                                       glVertex3fv(d);
-                                       glColor3ub(cp1[7], cp1[6], cp1[5]);
-                                       glVertex3fv(c);
-                                       glColor3ub(cp1[11], cp1[10], cp1[9]);
-                                       glVertex3fv(b);
-                                       glColor3ub(cp1[15], cp1[14], cp1[13]);
-                                       glVertex3fv(a);
-
-                                       if (useTwoSide) {
-                                               glColor3ub(cp2[15], cp2[14], cp2[13]);
-                                               glVertex3fv(a);
-                                               glColor3ub(cp2[11], cp2[10], cp2[9]);
-                                               glVertex3fv(b);
-                                               glColor3ub(cp2[7], cp2[6], cp2[5]);
-                                               glVertex3fv(c);
-                                               glColor3ub(cp2[3], cp2[2], cp2[1]);
-                                               glVertex3fv(d);
-                                       }
-
-                                       if (cp2) cp2+=16;
-                                       cp1+=16;
-                               }
-                       }
-               }
-       }
-       glEnd();
-}
-
 static void ccgDM_drawFacesTex_common(DerivedMesh *dm,
        int (*drawParams)(MTFace *tface, int has_mcol, int matnr),
        int (*drawParamsMapped)(void *userData, int index),
@@ -2978,7 +2909,6 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
        ccgdm->dm.drawEdges = ccgDM_drawEdges;
        ccgdm->dm.drawLooseEdges = ccgDM_drawLooseEdges;
        ccgdm->dm.drawFacesSolid = ccgDM_drawFacesSolid;
-       ccgdm->dm.drawFacesColored = ccgDM_drawFacesColored;
        ccgdm->dm.drawFacesTex = ccgDM_drawFacesTex;
        ccgdm->dm.drawFacesGLSL = ccgDM_drawFacesGLSL;
        ccgdm->dm.drawMappedFaces = ccgDM_drawMappedFaces;
index b3a317364a9608ef6b33ce0efb078b35a83b27d5..b89219c2d56029bed5fe41eb1fb79531aef92409 100644 (file)
@@ -142,8 +142,6 @@ void GPU_buffer_unlock( GPUBuffer *buffer );
 
 /* upload three unsigned chars, representing RGB colors, for each vertex. Resets dm->drawObject->colType to -1 */
 void GPU_color3_upload( struct DerivedMesh *dm, unsigned char *data );
-/* upload four unsigned chars, representing RGBA colors, for each vertex. Resets dm->drawObject->colType to -1 */
-void GPU_color4_upload( struct DerivedMesh *dm, unsigned char *data );
 /* switch color rendering on=1/off=0 */
 void GPU_color_switch( int mode );
 
index 00e34b41faf99a65dfe0c4d1f1437f48becfeec2..6e7ec98e65b3031009223d38999e23a9ee364234 100644 (file)
@@ -1170,18 +1170,6 @@ void GPU_color3_upload(DerivedMesh *dm, unsigned char *data)
                                                  GL_ARRAY_BUFFER_ARB, data, GPU_buffer_copy_color3);
 }
 
-/* this is used only in cdDM_drawFacesColored, which I think is no
-   longer used, so can probably remove this --nicholas */
-void GPU_color4_upload(DerivedMesh *UNUSED(dm), unsigned char *UNUSED(data))
-{
-       /*if(dm->drawObject == 0)
-               dm->drawObject = GPU_drawobject_new(dm);
-       GPU_buffer_free(dm->drawObject->colors);
-       dm->drawObject->colors = gpu_buffer_setup(dm, dm->drawObject, 3,
-                                                 sizeof(char)*3*dm->drawObject->tot_triangle_point,
-                                                 GL_ARRAY_BUFFER_ARB, data, GPU_buffer_copy_color4);*/
-}
-
 void GPU_color_switch(int mode)
 {
        if(mode) {