[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37421] branches/soc-2011-onion: Revision: 30798

Jason Wilkins Jason.A.Wilkins at gmail.com
Sat Jun 11 22:57:48 CEST 2011


Revision: 37421
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37421
Author:   jwilkins
Date:     2011-06-11 20:57:48 +0000 (Sat, 11 Jun 2011)
Log Message:
-----------
Revision: 30798
Author: nicholasbishop
Date: 2:50:03 AM, Tuesday, July 27, 2010
Message:
== VPaint ==

* Changed add vcol operator to not duplicate previous layer's data
* Updated pbvh mesh drawing to work with layers (still requiring VBO though)

Modified Paths:
--------------
    branches/soc-2011-onion/source/blender/gpu/intern/gpu_buffers.c

Property Changed:
----------------
    branches/soc-2011-onion/


Property changes on: branches/soc-2011-onion
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/soc-2010-jwilkins:28499-37009
/branches/soc-2010-nicolasbishop:28448-30783,30792-30793,30797
/trunk/blender:36833-37386
   + /branches/soc-2010-jwilkins:28499-37009
/branches/soc-2010-nicolasbishop:28448-30783,30792-30793,30797-30798
/trunk/blender:36833-37386

Modified: branches/soc-2011-onion/source/blender/gpu/intern/gpu_buffers.c
===================================================================
--- branches/soc-2011-onion/source/blender/gpu/intern/gpu_buffers.c	2011-06-11 20:39:11 UTC (rev 37420)
+++ branches/soc-2011-onion/source/blender/gpu/intern/gpu_buffers.c	2011-06-11 20:57:48 UTC (rev 37421)
@@ -448,13 +448,6 @@
 	out[2] = col[2] * 255;
 }
 
-static void mcol_to_gpu_colors(unsigned char out[3], MCol *mcol)
-{
-	out[0] = mcol->b;
-	out[1] = mcol->g;
-	out[2] = mcol->r;
-}
-
 /* For purposes of displaying the mask on the mesh,
    convert the mask strength to RGB-bytes */
 static void mask_to_gpu_colors(unsigned char out[3], float mask_strength)
@@ -495,21 +488,21 @@
 	unsigned char *color_data;
 	CustomData *fdata;
 	MFace *mface;
-	int *face_indices, *face_vert_indices, totface, mcol_active_layer, totvert;
+	int *face_indices, *face_vert_indices, totface, mcol_first_layer, totvert;
 
 	BLI_pbvh_node_num_verts(bvh, node, NULL, &totvert);
 	BLI_pbvh_node_get_faces(bvh, node, &mface, &fdata, &face_indices,
 				&face_vert_indices, &totface);
 
-	mcol_active_layer = CustomData_get_active_layer_index(fdata, CD_MCOL);
+	mcol_first_layer = CustomData_get_layer_index(fdata, CD_MCOL);
 
-	color_data = map_color_buffer(buffers, mcol_active_layer != -1, totvert);
+	color_data = map_color_buffer(buffers, mcol_first_layer != -1, totvert);
 
 	if(color_data) {
 		MCol *mcol;
-		int i, j;
+		int i, j, k, mcol_totlayer;
 
-		mcol = fdata->layers[mcol_active_layer].data;
+		mcol_totlayer = CustomData_number_of_layers(fdata, CD_MCOL);
 		
 		for(i = 0; i < totface; ++i) {
 			int face_index = face_indices[i];
@@ -522,9 +515,24 @@
 			   transition from one face to another */
 			for(j = 0; j < S; ++j) {
 				int node_vert_index = face_vert_indices[i*4 + j];
+				float v[3] = {1, 1, 1};
 
-				mcol_to_gpu_colors(color_data + node_vert_index * 3,
-						   mcol + face_index*4+j);
+				for(k = mcol_first_layer;
+				    k < mcol_first_layer+mcol_totlayer; ++k) {
+					float col[3];
+
+					mcol = fdata->layers[k].data;
+					mcol += face_index*4+j;
+
+					col[0] = mcol->b / 255.0f;
+					col[1] = mcol->g / 255.0f;
+					col[2] = mcol->r / 255.0f;
+
+					interp_v3_v3v3(v, v, col,
+						       mcol->a / 255.0f);
+				}
+
+				float_col_to_gpu_colors(color_data + node_vert_index*3, v);
 			}
 		}
 		glUnmapBufferARB(GL_ARRAY_BUFFER_ARB);
@@ -711,7 +719,6 @@
 					   don't guarantee the order of cdm data) */
 					interp_v3_v3v3(v, v, col, col[3]);
 				}
-				// clamp?
 
 				float_col_to_gpu_colors(color_data, v);
 			}




More information about the Bf-blender-cvs mailing list