[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13804] trunk/blender/source/blender/ render/intern/source/rendercore.c:

Brecht Van Lommel brechtvanlommel at pandora.be
Thu Feb 21 21:58:24 CET 2008


Revision: 13804
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13804
Author:   blendix
Date:     2008-02-21 21:58:22 +0100 (Thu, 21 Feb 2008)

Log Message:
-----------

Fix for bug #8214: halo didn't render correct with FSA.

Modified Paths:
--------------
    trunk/blender/source/blender/render/intern/source/rendercore.c

Modified: trunk/blender/source/blender/render/intern/source/rendercore.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/rendercore.c	2008-02-21 20:13:33 UTC (rev 13803)
+++ trunk/blender/source/blender/render/intern/source/rendercore.c	2008-02-21 20:58:22 UTC (rev 13804)
@@ -164,10 +164,10 @@
 	return zz;
 }
 
-static void halo_pixelstruct(HaloRen *har, float *rb, float dist, float xn, float yn, PixStr *ps)
+static void halo_pixelstruct(HaloRen *har, RenderLayer **rlpp, int totsample, int od, float dist, float xn, float yn, PixStr *ps)
 {
 	float col[4], accol[4];
-	int amount, amountm, zz, flarec;
+	int amount, amountm, zz, flarec, sample;
 	
 	amount= 0;
 	accol[0]=accol[1]=accol[2]=accol[3]= 0.0f;
@@ -209,19 +209,21 @@
 	col[2]= accol[2];
 	col[3]= accol[3];
 	
-	addalphaAddfacFloat(rb, col, har->add);
-	
+	for(sample=0; sample<totsample; sample++)
+		addalphaAddfacFloat(rlpp[sample]->rectf + od*4, col, har->add);
 }
 
-static void halo_tile(RenderPart *pa, float *pass, unsigned int lay)
+static void halo_tile(RenderPart *pa, RenderLayer *rl)
 {
+	RenderLayer *rlpp[RE_MAX_OSA];
 	HaloRen *har;
 	rcti disprect= pa->disprect, testrect= pa->disprect;
-	float dist, xsq, ysq, xn, yn, *rb;
+	float dist, xsq, ysq, xn, yn;
 	float col[4];
 	long *rd= NULL;
-	int a, *rz, zz, y;
+	int a, *rz, zz, y, sample, totsample, od;
 	short minx, maxx, miny, maxy, x;
+	unsigned int lay= rl->lay;
 
 	/* we don't render halos in the cropped area, gives errors in flare counter */
 	if(pa->crop) {
@@ -231,6 +233,8 @@
 		testrect.ymax-= pa->crop;
 	}
 	
+	totsample= get_sample_layers(pa, rl, rlpp);
+
 	for(a=0; a<R.tothalo; a++) {
 		har= R.sortedhalos[a];
 
@@ -255,8 +259,8 @@
 			
 				for(y=miny; y<maxy; y++) {
 					int rectofs= (y-disprect.ymin)*pa->rectx + (minx - disprect.xmin);
-					rb= pass + 4*rectofs;
 					rz= pa->rectz + rectofs;
+					od= rectofs;
 					
 					if(pa->rectdaps)
 						rd= pa->rectdaps + rectofs;
@@ -264,19 +268,21 @@
 					yn= (y-har->ys)*R.ycor;
 					ysq= yn*yn;
 					
-					for(x=minx; x<maxx; x++, rb+=4, rz++) {
+					for(x=minx; x<maxx; x++, rz++, od++) {
 						xn= x- har->xs;
 						xsq= xn*xn;
 						dist= xsq+ysq;
 						if(dist<har->radsq) {
 							if(rd && *rd) {
-								halo_pixelstruct(har, rb, dist, xn, yn, (PixStr *)*rd);
+								halo_pixelstruct(har, rlpp, totsample, od, dist, xn, yn, (PixStr *)*rd);
 							}
 							else {
 								zz= calchalo_z(har, *rz);
 								if(zz> har->zs) {
 									shadeHaloFloat(har, col, zz, dist, xn, yn, har->flarec);
-									addalphaAddfacFloat(rb, col, har->add);
+
+									for(sample=0; sample<totsample; sample++)
+										addalphaAddfacFloat(rlpp[sample]->rectf + od*4, col, har->add);
 								}
 							}
 						}
@@ -972,7 +978,7 @@
 		/* halo before ztra, because ztra fills in zbuffer now */
 		if(R.flag & R_HALO)
 			if(rl->layflag & SCE_LAY_HALO)
-				halo_tile(pa, rl->rectf, rl->lay);
+				halo_tile(pa, rl);
 
 		/* transp layer */
 		if(R.flag & R_ZTRA || R.totstrand) {
@@ -1158,7 +1164,7 @@
 		/* halo before ztra, because ztra fills in zbuffer now */
 		if(R.flag & R_HALO)
 			if(rl->layflag & SCE_LAY_HALO)
-				halo_tile(pa, rl->rectf, rl->lay);
+				halo_tile(pa, rl);
 		
 		if(R.flag & R_ZTRA || R.totstrand) {
 			if(rl->layflag & (SCE_LAY_ZTRA|SCE_LAY_STRAND)) {





More information about the Bf-blender-cvs mailing list