[Bf-blender-cvs] [06059af] bake-cycles: Cycles-Bake: bump primitive id and create new face if tessface has 4 vertices

Dalai Felinto noreply at git.blender.org
Wed Apr 23 02:46:23 CEST 2014


Commit: 06059af38653f45ecae30a11cb915d55a7cf08c2
Author: Dalai Felinto
Date:   Mon Jan 13 17:54:29 2014 -0200
https://developer.blender.org/rB06059af38653f45ecae30a11cb915d55a7cf08c2

Cycles-Bake: bump primitive id and create new face if tessface has 4 vertices

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

M	source/blender/render/intern/source/bake_new.c

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

diff --git a/source/blender/render/intern/source/bake_new.c b/source/blender/render/intern/source/bake_new.c
index b1d7e44..8dc4e50 100644
--- a/source/blender/render/intern/source/bake_new.c
+++ b/source/blender/render/intern/source/bake_new.c
@@ -106,7 +106,9 @@ void RE_populate_bake_pixels(Object *object, BakePixel pixel_array[], const int
 	BakeData bd;
 	const int num_pixels = width * height;
 	int i, a;
+	int p_id;
 	MTFace *mtface;
+	MFace *mface;
 
 	Mesh *me = (Mesh *)object->data;
 
@@ -129,15 +131,18 @@ void RE_populate_bake_pixels(Object *object, BakePixel pixel_array[], const int
 	BKE_mesh_tessface_calc(me);
 
 	mtface = CustomData_get_layer(&me->fdata, CD_MTFACE);
+	mface = CustomData_get_layer(&me->fdata, CD_MFACE);
 
 	if (mtface == NULL)
 		return;
 
+	p_id = -1;
 	for (i = 0; i < me->totface; i++) {
 		float vec[4][2];
 		MTFace *mtf = &mtface[i];
+		MFace *mf = &mface[i];
 
-		bd.primitive_id = i;
+		bd.primitive_id = ++p_id;
 
 		for (a = 0; a < 4; a++) {
 			/* Note, workaround for pixel aligned UVs which are common and can screw up our intersection tests
@@ -150,10 +155,11 @@ void RE_populate_bake_pixels(Object *object, BakePixel pixel_array[], const int
 
 		zspan_scanconvert(&bd.zspan, (void *)&bd, vec[0], vec[1], vec[2], store_bake_pixel);
 
-		/* XXX TODO
-		if (...) // verts == 4
+		/* 4 vertices in the face */
+		if (mf->v4 != 0) {
+			bd.primitive_id = ++p_id;
 			zspan_scanconvert(&bd.zspan, (void *)&bd, vec[0], vec[2], vec[3], store_bake_pixel);
-		*/
+		}
 	}
 
 	zbuf_free_span(&bd.zspan);




More information about the Bf-blender-cvs mailing list