Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2006-02-03 00:08:39 +0300
committerTon Roosendaal <ton@blender.org>2006-02-03 00:08:39 +0300
commit4249bce1bfbe5ecbd18af8fc5eb211fa97ae9a16 (patch)
tree8996075f8e5a1c33283c937efaf6629143c87b9a /source
parent15eebf614f8e7ba8d2632032cfa22453e0ad7def (diff)
Three feats;
- RenderLayers with 'view layers' set, now also take visible lights into account. Works just like for scene layer settings. - On ESC from render, compositing (if set) is being skipped too - While rendering with multiple RenderLayers it will end with a display of the current RenderLayer (as in Scene buttons)
Diffstat (limited to 'source')
-rw-r--r--source/blender/render/extern/include/RE_shader_ext.h2
-rw-r--r--source/blender/render/intern/include/rendercore.h11
-rw-r--r--source/blender/render/intern/source/pipeline.c12
-rw-r--r--source/blender/render/intern/source/ray.c1
-rw-r--r--source/blender/render/intern/source/rendercore.c85
-rw-r--r--source/blender/render/intern/source/zbuf.c33
6 files changed, 88 insertions, 56 deletions
diff --git a/source/blender/render/extern/include/RE_shader_ext.h b/source/blender/render/extern/include/RE_shader_ext.h
index 54307d933e9..8a840c28a08 100644
--- a/source/blender/render/extern/include/RE_shader_ext.h
+++ b/source/blender/render/extern/include/RE_shader_ext.h
@@ -103,7 +103,7 @@ typedef struct ShadeInput
short osatex, puno;
int mask;
int depth;
-
+ unsigned int lay;
} ShadeInput;
diff --git a/source/blender/render/intern/include/rendercore.h b/source/blender/render/intern/include/rendercore.h
index 91aeaf788c9..4c28959ceba 100644
--- a/source/blender/render/intern/include/rendercore.h
+++ b/source/blender/render/intern/include/rendercore.h
@@ -49,6 +49,14 @@ struct ShadeResult;
/* ------------------------------------------------------------------------- */
+/* to make passing on variables to shadepixel() easier */
+typedef struct ShadePixelInfo {
+ int thread;
+ int passflag;
+ unsigned int lay;
+ ShadeResult shr;
+} ShadePixelInfo;
+
typedef struct PixStr
{
struct PixStr *next;
@@ -85,8 +93,7 @@ void shade_material_loop(struct ShadeInput *shi, struct ShadeResult *shr);
void zbufshade(void);
void zbufshadeDA(void); /* Delta Accum Pixel Struct */
-void *shadepixel(RenderPart *pa, float x, float y, int z, int facenr, int mask, struct ShadeResult *shr, float *rco, int passflag);
-
+void *shadepixel(ShadePixelInfo *shpi, float x, float y, int z, volatile int facenr, int mask, float *rco);
int count_mask(unsigned short mask);
void zbufshade_tile(struct RenderPart *pa);
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c
index 558e1cc17ff..b07145c119c 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -866,11 +866,13 @@ static void do_render_final(Render *re, Scene *scene)
render_one_frame(re);
}
- ntreeCompositTagRender(scene->nodetree);
- ntreeCompositTagAnimated(scene->nodetree);
-
- if(re->r.scemode & R_DOCOMP)
- ntreeCompositExecTree(scene->nodetree, &re->r, 0);
+ if(!re->test_break()) {
+ ntreeCompositTagRender(scene->nodetree);
+ ntreeCompositTagAnimated(scene->nodetree);
+
+ if(re->r.scemode & R_DOCOMP)
+ ntreeCompositExecTree(scene->nodetree, &re->r, 0);
+ }
}
diff --git a/source/blender/render/intern/source/ray.c b/source/blender/render/intern/source/ray.c
index 02dcf4bb60d..ff27a287339 100644
--- a/source/blender/render/intern/source/ray.c
+++ b/source/blender/render/intern/source/ray.c
@@ -1539,6 +1539,7 @@ static void traceray(ShadeInput *origshi, short depth, float *start, float *vec,
shi.thread= origshi->thread;
shi.xs= origshi->xs;
shi.ys= origshi->ys;
+ shi.lay= origshi->lay;
shi.do_preview= 0;
shade_ray(&isec, &shi, &shr);
diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c
index c5d362d8c2d..cdf3f18253b 100644
--- a/source/blender/render/intern/source/rendercore.c
+++ b/source/blender/render/intern/source/rendercore.c
@@ -1479,7 +1479,7 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int
}
-
+#if 0
static void shade_lamp_loop_pass(ShadeInput *shi, ShadeResult *shr, int passflag)
{
Material *ma= shi->mat;
@@ -1551,7 +1551,8 @@ static void shade_lamp_loop_pass(ShadeInput *shi, ShadeResult *shr, int passflag
/* test for lamp layer */
if(lar->mode & LA_LAYER) if((lar->lay & vlr->lay)==0) continue;
-
+ if((lar->lay & shi->lay)==0) continue;
+
/* accumulates in shr->diff and shr->spec and shr->shad */
shade_one_light(lar, shi, shr, passflag);
}
@@ -1620,8 +1621,8 @@ static void shade_lamp_loop_pass(ShadeInput *shi, ShadeResult *shr, int passflag
/* doesnt look 'correct', but is better for preview, plus envmaps dont raytrace this */
if(shi->mat->mode & MA_RAYTRANSP) shr->alpha= 1.0;
}
-
}
+#endif
void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
{
@@ -1661,6 +1662,7 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
if (lar->type==LA_YF_PHOTON) continue;
if(lar->mode & LA_LAYER) if((lar->lay & vlr->lay)==0) continue;
+ if((lar->lay & shi->lay)==0) continue;
lv[0]= shi->co[0]-lar->co[0];
lv[1]= shi->co[1]-lar->co[1];
@@ -1792,6 +1794,7 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
/* test for lamp layer */
if(lar->mode & LA_LAYER) if((lar->lay & vlr->lay)==0) continue;
+ if((lar->lay & shi->lay)==0) continue;
/* accumulates in shr->diff and shr->spec, 0= no passrender */
shade_one_light(lar, shi, shr, 0);
@@ -2282,8 +2285,9 @@ void shade_material_loop(ShadeInput *shi, ShadeResult *shr)
/* note, facenr declared volatile due to over-eager -O2 optimizations
* on cygwin (particularly -frerun-cse-after-loop)
*/
-void *shadepixel(RenderPart *pa, float x, float y, int z, volatile int facenr, int mask, ShadeResult *shr, float *rco, int passflag)
+void *shadepixel(ShadePixelInfo *shpi, float x, float y, int z, volatile int facenr, int mask, float *rco)
{
+ ShadeResult *shr= &shpi->shr;
ShadeInput shi;
VlakRen *vlr=NULL;
@@ -2293,8 +2297,10 @@ void *shadepixel(RenderPart *pa, float x, float y, int z, volatile int facenr, i
/* currently in use for dithering (soft shadow) node preview */
shi.xs= (int)(x+0.5f);
shi.ys= (int)(y+0.5f);
- shi.thread= pa->thread;
+
+ shi.thread= shpi->thread;
shi.do_preview= R.r.scemode & R_NODE_PREVIEW;
+ shi.lay= shpi->lay;
/* mask is used to indicate amount of samples (ray shad/mir and AO) */
shi.mask= mask;
@@ -2585,21 +2591,21 @@ void *shadepixel(RenderPart *pa, float x, float y, int z, volatile int facenr, i
return vlr;
}
-static void shadepixel_sky(RenderPart *pa, float x, float y, int z, int facenr, int mask, ShadeResult *shr, int passflag)
+static void shadepixel_sky(ShadePixelInfo *shpi, float x, float y, int z, int facenr, int mask)
{
VlakRen *vlr;
float collector[4], rco[3];
- vlr= shadepixel(pa, x, y, z, facenr, mask, shr, rco, passflag);
- if(shr->combined[3] != 1.0) {
+ vlr= shadepixel(shpi, x, y, z, facenr, mask, rco);
+ if(shpi->shr.combined[3] != 1.0) {
/* bail out when raytrace transparency (sky included already) */
if(vlr && (R.r.mode & R_RAYTRACE))
if(vlr->mat->mode & MA_RAYTRANSP) return;
renderSkyPixelFloat(collector, x, y, vlr?rco:NULL);
- addAlphaOverFloat(collector, shr->combined);
- QUATCOPY(shr->combined, collector);
+ addAlphaOverFloat(collector, shpi->shr.combined);
+ QUATCOPY(shpi->shr.combined, collector);
}
}
@@ -2770,13 +2776,13 @@ static void add_passes(RenderLayer *rl, int offset, ShadeResult *shr)
static void shadeDA_tile(RenderPart *pa, RenderLayer *rl)
{
RenderResult *rr= pa->result;
- ShadeResult shr;
+ ShadePixelInfo shpi;
PixStr *ps;
float xs, ys;
- float *fcol= shr.combined, *rf, *rectf= rl->rectf;
+ float *fcol= shpi.shr.combined, *rf, *rectf= rl->rectf;
long *rd, *rectdaps= pa->rectdaps;
int zbuf, samp, curmask, face, mask, fullmask;
- int b, x, y, full_osa, seed, crop=0, offs=0, od, renderpassflag, addpassflag;
+ int b, x, y, full_osa, seed, crop=0, offs=0, od, addpassflag;
if(R.test_break()) return;
@@ -2785,11 +2791,13 @@ static void shadeDA_tile(RenderPart *pa, RenderLayer *rl)
fullmask= (1<<R.osa)-1;
- /* bit clumsy, but with passes we need different shade code */
+ /* fill shadepixel info struct */
+ shpi.thread= pa->thread;
+ shpi.lay= rl->lay;
+ shpi.passflag= 0;
+
if(rl->passflag & ~(SCE_PASS_Z|SCE_PASS_NORMAL|SCE_PASS_VECTOR|SCE_PASS_COMBINED))
- renderpassflag= rl->passflag;
- else
- renderpassflag= 0;
+ shpi.passflag= rl->passflag;
addpassflag= rl->passflag & ~(SCE_PASS_Z|SCE_PASS_COMBINED);
/* filtered render, for now we assume only 1 filter size */
@@ -2841,7 +2849,7 @@ static void shadeDA_tile(RenderPart *pa, RenderLayer *rl)
if(curmask & (1<<samp)) {
xs= (float)x + R.jit[samp][0];
ys= (float)y + R.jit[samp][1];
- shadepixel_sky(pa, xs, ys, zbuf, face, (1<<samp), &shr, renderpassflag);
+ shadepixel_sky(&shpi, xs, ys, zbuf, face, (1<<samp));
if(R.do_gamma) {
fcol[0]= gammaCorrect(fcol[0]);
@@ -2851,7 +2859,7 @@ static void shadeDA_tile(RenderPart *pa, RenderLayer *rl)
add_filt_fmask(1<<samp, fcol, rf, pa->rectx);
if(addpassflag)
- add_filt_passes(rl, curmask, pa->rectx, od, &shr);
+ add_filt_passes(rl, curmask, pa->rectx, od, &shpi.shr);
}
}
}
@@ -2859,7 +2867,7 @@ static void shadeDA_tile(RenderPart *pa, RenderLayer *rl)
b= R.samples->centmask[curmask];
xs= (float)x+R.samples->centLut[b & 15];
ys= (float)y+R.samples->centLut[b>>4];
- shadepixel_sky(pa, xs, ys, zbuf, face, curmask, &shr, renderpassflag);
+ shadepixel_sky(&shpi, xs, ys, zbuf, face, curmask);
if(R.do_gamma) {
fcol[0]= gammaCorrect(fcol[0]);
@@ -2869,7 +2877,7 @@ static void shadeDA_tile(RenderPart *pa, RenderLayer *rl)
add_filt_fmask(curmask, fcol, rf, pa->rectx);
if(addpassflag)
- add_filt_passes(rl, curmask, pa->rectx, od, &shr);
+ add_filt_passes(rl, curmask, pa->rectx, od, &shpi.shr);
}
mask |= curmask;
@@ -3061,6 +3069,8 @@ void zbufshadeDA_tile(RenderPart *pa)
if(edgerect) RE_freeN(edgerect);
+ /* display active layer */
+ rr->renlay= BLI_findlink(&rr->layers, R.r.actlay);
}
@@ -3070,9 +3080,10 @@ void zbufshadeDA_tile(RenderPart *pa)
/* supposed to be fully threadable! */
void zbufshade_tile(RenderPart *pa)
{
- ShadeResult *shr= RE_mallocN(sizeof(ShadeResult), "shaderesult");
+ ShadePixelInfo shpi;
RenderResult *rr= pa->result;
RenderLayer *rl;
+ int addpassflag;
set_part_zbuf_clipflag(pa);
@@ -3080,35 +3091,38 @@ void zbufshade_tile(RenderPart *pa)
pa->rectp= RE_mallocN(sizeof(int)*pa->rectx*pa->recty, "rectp");
pa->rectz= RE_mallocN(sizeof(int)*pa->rectx*pa->recty, "rectz");
+ shpi.thread= pa->thread;
+
for(rl= rr->layers.first; rl; rl= rl->next) {
/* indication for scanline updates */
rr->renlay= rl;
+ /* fill shadepixel info struct */
+ shpi.lay= rl->lay;
+ shpi.passflag= 0;
+
+ if(rl->passflag & ~(SCE_PASS_Z|SCE_PASS_NORMAL|SCE_PASS_VECTOR|SCE_PASS_COMBINED))
+ shpi.passflag= rl->passflag;
+ addpassflag= rl->passflag & ~(SCE_PASS_Z|SCE_PASS_COMBINED);
+
zbuffer_solid(pa, rl->lay, rl->layflag);
if(!R.test_break()) {
if(rl->layflag & SCE_LAY_SOLID) {
float *fcol= rl->rectf;
- int x, y, *rp= pa->rectp, *rz= pa->rectz, offs=0, renderpassflag, addpassflag;
-
- /* bit clumsy, but with passes we shade differently */
- if(rl->passflag & ~(SCE_PASS_Z|SCE_PASS_NORMAL|SCE_PASS_VECTOR|SCE_PASS_COMBINED))
- renderpassflag= rl->passflag;
- else
- renderpassflag= 0;
- addpassflag= rl->passflag & ~(SCE_PASS_Z|SCE_PASS_COMBINED);
+ int x, y, *rp= pa->rectp, *rz= pa->rectz, offs=0;
/* init scanline updates */
rr->renrect.ymin=rr->renrect.ymax= 0;
for(y=pa->disprect.ymin; y<pa->disprect.ymax; y++, rr->renrect.ymax++) {
for(x=pa->disprect.xmin; x<pa->disprect.xmax; x++, rz++, rp++, fcol+=4, offs++) {
- shadepixel_sky(pa, (float)x, (float)y, *rz, *rp, 0, shr, renderpassflag);
- QUATCOPY(fcol, shr->combined);
+ shadepixel_sky(&shpi, (float)x, (float)y, *rz, *rp, 0);
+ QUATCOPY(fcol, shpi.shr.combined);
/* passes */
if(*rp && addpassflag)
- add_passes(rl, offs, shr);
+ add_passes(rl, offs, &shpi.shr);
}
if(y&1)
if(R.test_break()) break;
@@ -3153,7 +3167,10 @@ void zbufshade_tile(RenderPart *pa)
convert_zbuf_to_distbuf(pa, rl);
}
- RE_freeN(shr);
+
+ /* display active layer */
+ rr->renlay= BLI_findlink(&rr->layers, R.r.actlay);
+
RE_freeN(pa->rectp); pa->rectp= NULL;
RE_freeN(pa->rectz); pa->rectz= NULL;
}
diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c
index eb1385cab95..cc6764f8bc4 100644
--- a/source/blender/render/intern/source/zbuf.c
+++ b/source/blender/render/intern/source/zbuf.c
@@ -2032,9 +2032,8 @@ static int vergzvlak(const void *a1, const void *a2)
/**
* Shade this face at this location in SCS.
*/
-static void shadetrapixel(RenderPart *pa, float x, float y, int z, int facenr, int mask, float *fcol)
+static void shadetrapixel(ShadePixelInfo *shpi, float x, float y, int z, int facenr, int mask, float *fcol)
{
- ShadeResult shr;
float rco[3];
if( (facenr & 0x7FFFFF) > R.totvlak) {
@@ -2049,11 +2048,11 @@ static void shadetrapixel(RenderPart *pa, float x, float y, int z, int facenr, i
if(vlr->flag & R_FULL_OSA) {
for(a=0; a<R.osa; a++) {
if(mask & (1<<a)) {
- shadepixel(pa, x+R.jit[a][0], y+R.jit[a][1], z, facenr, 1<<a, &shr, rco, 0);
- accumcol[0]+= shr.combined[0];
- accumcol[1]+= shr.combined[1];
- accumcol[2]+= shr.combined[2];
- accumcol[3]+= shr.combined[3];
+ shadepixel(shpi, x+R.jit[a][0], y+R.jit[a][1], z, facenr, 1<<a, rco);
+ accumcol[0]+= shpi->shr.combined[0];
+ accumcol[1]+= shpi->shr.combined[1];
+ accumcol[2]+= shpi->shr.combined[2];
+ accumcol[3]+= shpi->shr.combined[3];
tot+= 1.0;
}
}
@@ -2067,13 +2066,13 @@ static void shadetrapixel(RenderPart *pa, float x, float y, int z, int facenr, i
int b= R.samples->centmask[mask];
x= x+R.samples->centLut[b & 15];
y= y+R.samples->centLut[b>>4];
- shadepixel(pa, x, y, z, facenr, mask, &shr, rco, 0);
- QUATCOPY(fcol, shr.combined);
+ shadepixel(shpi, x, y, z, facenr, mask, rco);
+ QUATCOPY(fcol, shpi->shr.combined);
}
}
else {
- shadepixel(pa, x, y, z, facenr, mask, &shr, rco, 0);
- QUATCOPY(fcol, shr.combined);
+ shadepixel(shpi, x, y, z, facenr, mask, rco);
+ QUATCOPY(fcol, shpi->shr.combined);
}
}
@@ -2095,6 +2094,7 @@ static int addtosampcol(float *sampcol, float *fcol, int mask)
void zbuffer_transp_shade(RenderPart *pa, float *pass, unsigned int lay, short layflag)
{
RenderResult *rr= pa->result;
+ ShadePixelInfo shpi;
APixstr *APixbuf; /* Zbuffer: linked list of face samples */
APixstr *ap, *aprect, *apn;
ListBase apsmbase={NULL, NULL};
@@ -2115,6 +2115,11 @@ void zbuffer_transp_shade(RenderPart *pa, float *pass, unsigned int lay, short l
return;
}
+ /* fill shadepixel info struct */
+ shpi.thread= pa->thread;
+ shpi.lay= lay;
+ shpi.passflag= 0;
+
/* alpha LUT */
if(R.osa) {
fac= (1.0/(float)R.osa);
@@ -2166,7 +2171,7 @@ void zbuffer_transp_shade(RenderPart *pa, float *pass, unsigned int lay, short l
if(totface==1) {
- shadetrapixel(pa, (float)x, (float)y, zrow[0][0], zrow[0][1], zrow[0][2], fcol);
+ shadetrapixel(&shpi, (float)x, (float)y, zrow[0][0], zrow[0][1], zrow[0][2], fcol);
if(R.osa) {
add_filt_fmask(zrow[0][2], fcol, pass, rr->rectx);
@@ -2193,7 +2198,7 @@ void zbuffer_transp_shade(RenderPart *pa, float *pass, unsigned int lay, short l
while(totface>0) {
totface--;
- shadetrapixel(pa, (float)x, (float)y, zrow[totface][0], zrow[totface][1], zrow[totface][2], fcol);
+ shadetrapixel(&shpi, (float)x, (float)y, zrow[totface][0], zrow[totface][1], zrow[totface][2], fcol);
addAlphaUnderFloat(pass, fcol);
if(pass[3]>=0.999) break;
@@ -2206,7 +2211,7 @@ void zbuffer_transp_shade(RenderPart *pa, float *pass, unsigned int lay, short l
while(totface>0) {
totface--;
- shadetrapixel(pa, (float)x, (float)y, zrow[totface][0], zrow[totface][1], zrow[totface][2], fcol);
+ shadetrapixel(&shpi, (float)x, (float)y, zrow[totface][0], zrow[totface][1], zrow[totface][2], fcol);
sval= addtosampcol(sampcol, fcol, zrow[totface][2]);
if(sval==0) break;