[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14618] trunk/blender/source/blender/ render/intern/source/rendercore.c:
Brecht Van Lommel
brechtvanlommel at pandora.be
Tue Apr 29 21:51:23 CEST 2008
Revision: 14618
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14618
Author: blendix
Date: 2008-04-29 21:51:23 +0200 (Tue, 29 Apr 2008)
Log Message:
-----------
Fix for bug #8910: FSA + spotlight halo not working correct together.
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-04-29 18:41:34 UTC (rev 14617)
+++ trunk/blender/source/blender/render/intern/source/rendercore.c 2008-04-29 19:51:23 UTC (rev 14618)
@@ -319,22 +319,27 @@
static void lamphalo_tile(RenderPart *pa, RenderLayer *rl)
{
+ RenderLayer *rlpp[RE_MAX_OSA];
ShadeInput shi;
- float *pass= rl->rectf;
- float fac;
+ float *pass;
+ float fac, col[4];
long *rd= pa->rectdaps;
- int x, y, *rz= pa->rectz;
+ int *rz= pa->rectz;
+ int x, y, sample, totsample, fullsample, od;
+ totsample= get_sample_layers(pa, rl, rlpp);
+ fullsample= (totsample > 1);
+
shade_input_initialize(&shi, pa, rl, 0); /* this zero's ShadeInput for us */
- for(y=pa->disprect.ymin; y<pa->disprect.ymax; y++) {
- for(x=pa->disprect.xmin; x<pa->disprect.xmax; x++, rz++, pass+=4) {
+ for(od=0, y=pa->disprect.ymin; y<pa->disprect.ymax; y++) {
+ for(x=pa->disprect.xmin; x<pa->disprect.xmax; x++, rz++, od++) {
calc_view_vector(shi.view, x, y);
if(rd && *rd) {
PixStr *ps= (PixStr *)*rd;
- int samp, totsamp= 0;
+ int count, totsamp= 0, mask= 0;
while(ps) {
if(R.r.mode & R_ORTHO)
@@ -342,15 +347,64 @@
else
calc_renderco_zbuf(shi.co, shi.view, ps->z);
- totsamp+= samp= count_mask(ps->mask);
- fac= ((float)samp)/(float)R.osa;
- renderspothalo(&shi, pass, fac);
+ totsamp+= count= count_mask(ps->mask);
+ mask |= ps->mask;
+
+ col[0]= col[1]= col[2]= col[3]= 0.0f;
+ renderspothalo(&shi, col, 1.0f);
+
+ if(fullsample) {
+ for(sample=0; sample<totsample; sample++) {
+ if(ps->mask & (1 << sample)) {
+ pass= rlpp[sample]->rectf + od*4;
+ pass[0]+= col[0];
+ pass[1]+= col[1];
+ pass[2]+= col[2];
+ pass[3]+= col[3];
+ if(pass[3]>1.0f) pass[3]= 1.0f;
+ }
+ }
+ }
+ else {
+ fac= ((float)count)/(float)R.osa;
+ pass= rl->rectf + od*4;
+ pass[0]+= fac*col[0];
+ pass[1]+= fac*col[1];
+ pass[2]+= fac*col[2];
+ pass[3]+= fac*col[3];
+ if(pass[3]>1.0f) pass[3]= 1.0f;
+ }
+
ps= ps->next;
}
+
if(totsamp<R.osa) {
- fac= ((float)R.osa-totsamp)/(float)R.osa;
shi.co[2]= 0.0f;
- renderspothalo(&shi, pass, fac);
+
+ col[0]= col[1]= col[2]= col[3]= 0.0f;
+ renderspothalo(&shi, col, 1.0f);
+
+ if(fullsample) {
+ for(sample=0; sample<totsample; sample++) {
+ if(!(mask & (1 << sample))) {
+ pass= rlpp[sample]->rectf + od*4;
+ pass[0]+= col[0];
+ pass[1]+= col[1];
+ pass[2]+= col[2];
+ pass[3]+= col[3];
+ if(pass[3]>1.0f) pass[3]= 1.0f;
+ }
+ }
+ }
+ else {
+ fac= ((float)R.osa-totsamp)/(float)R.osa;
+ pass= rl->rectf + od*4;
+ pass[0]+= fac*col[0];
+ pass[1]+= fac*col[1];
+ pass[2]+= fac*col[2];
+ pass[3]+= fac*col[3];
+ if(pass[3]>1.0f) pass[3]= 1.0f;
+ }
}
}
else {
@@ -359,7 +413,17 @@
else
calc_renderco_zbuf(shi.co, shi.view, *rz);
- renderspothalo(&shi, pass, 1.0f);
+ col[0]= col[1]= col[2]= col[3]= 0.0f;
+ renderspothalo(&shi, col, 1.0f);
+
+ for(sample=0; sample<totsample; sample++) {
+ pass= rlpp[sample]->rectf + od*4;
+ pass[0]+= col[0];
+ pass[1]+= col[1];
+ pass[2]+= col[2];
+ pass[3]+= col[3];
+ if(pass[3]>1.0f) pass[3]= 1.0f;
+ }
}
if(rd) rd++;
More information about the Bf-blender-cvs
mailing list