[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [21424] branches/soc-2009-imbusy/source/ blender/editors/space_view3d/drawobject.c: fixed some legacy stuff

Lukas Steiblys imbusy at imbusy.org
Wed Jul 8 13:44:40 CEST 2009


Revision: 21424
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21424
Author:   imbusy
Date:     2009-07-08 13:44:40 +0200 (Wed, 08 Jul 2009)

Log Message:
-----------
fixed some legacy stuff

Modified Paths:
--------------
    branches/soc-2009-imbusy/source/blender/editors/space_view3d/drawobject.c

Modified: branches/soc-2009-imbusy/source/blender/editors/space_view3d/drawobject.c
===================================================================
--- branches/soc-2009-imbusy/source/blender/editors/space_view3d/drawobject.c	2009-07-08 11:18:47 UTC (rev 21423)
+++ branches/soc-2009-imbusy/source/blender/editors/space_view3d/drawobject.c	2009-07-08 11:44:40 UTC (rev 21424)
@@ -5599,6 +5599,16 @@
 	Mesh *me = userData;
 
 	if (!(me->mface[index].flag&ME_HIDE)) {
+		return 1;
+	} else {
+		return 0;
+	}
+}
+static int bbs_mesh_solid__setDrawOpts_legacy(void *userData, int index, int *drawSmooth_r)
+{
+	Mesh *me = userData;
+
+	if (!(me->mface[index].flag&ME_HIDE)) {
 		WM_set_framebuffer_index_color(index+1);
 		return 1;
 	} else {
@@ -5615,32 +5625,33 @@
 	int i,j;
 	
 	glColor3ub(0, 0, 0);
-	
-
-	colors = MEM_mallocN(dm->getNumFaces(dm)*sizeof(MCol)*4,"bbs_mesh_solid");
-	for(i=0;i<dm->getNumFaces(dm);i++) {
-		if (!(me->mface[i].flag&ME_HIDE)) {
-			unsigned int fbindex = index_to_framebuffer(i+1);
-			for(j=0;j<4;j++) {
-				colors[i*4+j].b = ((fbindex)&0xFF);
-				colors[i*4+j].g = (((fbindex)>>8)&0xFF);
-				colors[i*4+j].r = (((fbindex)>>16)&0xFF);
-				//colors[i*4+j].a = 255;
+		
+	if( !GPU_buffer_legacy(dm) ) {
+		colors = MEM_mallocN(dm->getNumFaces(dm)*sizeof(MCol)*4,"bbs_mesh_solid");
+		for(i=0;i<dm->getNumFaces(dm);i++) {
+			if (!(me->mface[i].flag&ME_HIDE)) {
+				unsigned int fbindex = index_to_framebuffer(i+1);
+				for(j=0;j<4;j++) {
+					colors[i*4+j].b = ((fbindex)&0xFF);
+					colors[i*4+j].g = (((fbindex)>>8)&0xFF);
+					colors[i*4+j].r = (((fbindex)>>16)&0xFF);
+				}
 			}
+			else {
+				memset(&colors[i*4],0,sizeof(MCol)*4);
+			}
 		}
-		else {
-			memset(&colors[i*4],0,sizeof(MCol)*4);
-		}
-	}
-		
-	CustomData_free_layers( &dm->faceData, CD_WEIGHT_MCOL, dm->getNumFaces(dm) );
-	CustomData_add_layer( &dm->faceData, CD_WEIGHT_MCOL, CD_ASSIGN, colors, dm->numFaceData );
-	if( !GPU_buffer_legacy(dm) ) {
+
+		CustomData_free_layers( &dm->faceData, CD_WEIGHT_MCOL, dm->getNumFaces(dm) );
+		CustomData_add_layer( &dm->faceData, CD_WEIGHT_MCOL, CD_ASSIGN, colors, dm->numFaceData );
 		GPU_buffer_free(dm->drawObject->colors,0);
 		dm->drawObject->colors = 0;
+		dm->drawMappedFaces(dm, bbs_mesh_solid__setDrawOpts, me, 1);
+		CustomData_free_layer( &dm->faceData, CD_WEIGHT_MCOL, dm->getNumFaces(dm), 0 );
 	}
-	dm->drawMappedFaces(dm, bbs_mesh_solid__setDrawOpts, me, 1);
-	CustomData_free_layer( &dm->faceData, CD_WEIGHT_MCOL, dm->getNumFaces(dm), 0 );
+	else {
+		dm->drawMappedFaces(dm, bbs_mesh_solid__setDrawOpts_legacy, me, 0);
+	}
 
 	dm->release(dm);
 }





More information about the Bf-blender-cvs mailing list