[Bf-blender-cvs] [a845a27b903] soc-2016-pbvh-painting: Use 'unsigned int[3]' array for total color

Campbell Barton noreply at git.blender.org
Mon Apr 10 11:49:34 CEST 2017


Commit: a845a27b903f6f0ec82dcbc5f6be30ad96106ac7
Author: Campbell Barton
Date:   Mon Apr 10 19:49:09 2017 +1000
Branches: soc-2016-pbvh-painting
https://developer.blender.org/rBa845a27b903f6f0ec82dcbc5f6be30ad96106ac7

Use 'unsigned int[3]' array for total color

===================================================================

M	source/blender/blenkernel/BKE_paint.h
M	source/blender/editors/sculpt_paint/paint_vertex.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h
index e3fdf66de87..9f472d3b9d1 100644
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@ -209,7 +209,7 @@ typedef struct SculptSession {
 			int *poly_map_mem;
 			struct MeshElemMap *vert_to_poly;
 
-			unsigned int *total_color;
+			unsigned int (*total_color)[3];
 			double *total_weight;
 			unsigned int *tot_loops_hit;
 			float *max_weight;
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index c6e4d6805ad..3008c335b7b 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -3242,9 +3242,9 @@ static void do_vpaint_brush_calc_ave_color_cb_ex(
 	}
 	BKE_pbvh_vertex_iter_end;
 
-	data->ob->sculpt->modes.vwpaint.total_color[n * 3 + 0] = blend[0];
-	data->ob->sculpt->modes.vwpaint.total_color[n * 3 + 1] = blend[1];
-	data->ob->sculpt->modes.vwpaint.total_color[n * 3 + 2] = blend[2];
+	data->ob->sculpt->modes.vwpaint.total_color[n][0] = blend[0];
+	data->ob->sculpt->modes.vwpaint.total_color[n][1] = blend[1];
+	data->ob->sculpt->modes.vwpaint.total_color[n][2] = blend[2];
 }
 
 static void handle_texture_brush(
@@ -3510,9 +3510,9 @@ static void calculate_average_color(SculptThreadedTaskData *data, PBVHNode **UNU
 	unsigned char blend[4] = {0};
 	for (int i = 0; i < totnode; i++) {
 		total_hit_loops += data->ob->sculpt->modes.vwpaint.tot_loops_hit[i];
-		total_color[0] += data->ob->sculpt->modes.vwpaint.total_color[i * 3 + 0];
-		total_color[1] += data->ob->sculpt->modes.vwpaint.total_color[i * 3 + 1];
-		total_color[2] += data->ob->sculpt->modes.vwpaint.total_color[i * 3 + 2];
+		total_color[0] += data->ob->sculpt->modes.vwpaint.total_color[i][0];
+		total_color[1] += data->ob->sculpt->modes.vwpaint.total_color[i][1];
+		total_color[2] += data->ob->sculpt->modes.vwpaint.total_color[i][2];
 	}
 	if (total_hit_loops != 0) {
 		blend[0] = (unsigned char)round(sqrtl(divide_round_i(total_color[0], total_hit_loops)));




More information about the Bf-blender-cvs mailing list