[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13409] trunk/blender/source/blender: Improvements in Zmask feature of yesterday:
Ton Roosendaal
ton at blender.org
Sat Jan 26 11:58:31 CET 2008
Revision: 13409
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13409
Author: ton
Date: 2008-01-26 11:58:31 +0100 (Sat, 26 Jan 2008)
Log Message:
-----------
Improvements in Zmask feature of yesterday:
- zmask now allows to have solid faces included too
- ctrl+click on render-layer layers (whats in a name!) now works better
Here's the revised and extended doc:
http://www.blender.org/development/current-projects/changes-since-244/rendering-features/
It's a difficult to explain feature... but important for a good compo pipeline
here. Being tested still!
Modified Paths:
--------------
trunk/blender/source/blender/render/intern/source/zbuf.c
trunk/blender/source/blender/src/buttons_scene.c
Modified: trunk/blender/source/blender/render/intern/source/zbuf.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/zbuf.c 2008-01-26 10:55:24 UTC (rev 13408)
+++ trunk/blender/source/blender/render/intern/source/zbuf.c 2008-01-26 10:58:31 UTC (rev 13409)
@@ -2004,7 +2004,7 @@
float winmat[4][4], bounds[4], ho1[4], ho2[4], ho3[4], ho4[4]={0};
unsigned int lay= rl->lay, lay_zmask= rl->lay_zmask;
int i, v, zvlnr, zsample, samples, c1, c2, c3, c4=0;
- short nofill=0, env=0, wire=0;
+ short nofill=0, env=0, wire=0, zmaskpass=0;
short all_z= rl->layflag & SCE_LAY_ALL_Z;
samples= (R.osa? R.osa: 1);
@@ -2057,110 +2057,128 @@
zspan->zbuflinefunc= zbufline;
}
- for(i=0, obi=R.instancetable.first; obi; i++, obi=obi->next) {
- obr= obi->obr;
+ /* in case zmask we fill Z for objects in lay_zmask first, then clear Z, and then do normal zbuffering */
+ if(rl->layflag & SCE_LAY_ZMASK)
+ zmaskpass= 1;
+
+ for(; zmaskpass >=0; zmaskpass--) {
+ /* regular zbuffering loop, does all sample buffers */
+ for(i=0, obi=R.instancetable.first; obi; i++, obi=obi->next) {
+ obr= obi->obr;
- if(!all_z && !(obr->lay & lay))
- continue;
-
- if(obi->flag & R_TRANSFORMED)
- zbuf_make_winmat(&R, obi->mat, winmat);
- else
- zbuf_make_winmat(&R, NULL, winmat);
-
- zbuf_project_cache_clear(cache, obr->totvert);
-
- for(v=0; v<obr->totvlak; v++) {
- if((v & 255)==0) vlr= obr->vlaknodes[v>>8].vlak;
- else vlr++;
-
- /* the cases: visible for render, only z values, zmask, nothing */
- if(obr->lay & lay) {
- if(vlr->mat!=ma) {
- ma= vlr->mat;
- nofill= ma->mode & (MA_ZTRA|MA_ONLYCAST);
- env= (ma->mode & MA_ENV);
- wire= (ma->mode & MA_WIRE);
-
- for(zsample=0; zsample<samples; zsample++) {
- if(ma->mode & MA_ZINV) zspans[zsample].zbuffunc= zbuffillGLinv4;
- else zspans[zsample].zbuffunc= zbuffillGL4;
- }
- }
+ /* continue happens in 2 different ways... zmaskpass only does lay_zmask stuff */
+ if(zmaskpass) {
+ if((obr->lay & lay_zmask)==0)
+ continue;
}
- else if(all_z || (obr->lay & lay_zmask)) {
- env= 1;
- nofill= 0;
- ma= NULL;
- }
else {
- nofill= 1;
- ma= NULL; /* otherwise nofill can hang */
+ if(!all_z && !(obr->lay & lay))
+ continue;
}
+
+ if(obi->flag & R_TRANSFORMED)
+ zbuf_make_winmat(&R, obi->mat, winmat);
+ else
+ zbuf_make_winmat(&R, NULL, winmat);
- if(!(vlr->flag & R_HIDDEN) && nofill==0) {
- unsigned short partclip;
-
- v1= vlr->v1;
- v2= vlr->v2;
- v3= vlr->v3;
- v4= vlr->v4;
+ zbuf_project_cache_clear(cache, obr->totvert);
- c1= zbuf_part_project(cache, v1->index, winmat, bounds, v1->co, ho1);
- c2= zbuf_part_project(cache, v2->index, winmat, bounds, v2->co, ho2);
- c3= zbuf_part_project(cache, v3->index, winmat, bounds, v3->co, ho3);
+ for(v=0; v<obr->totvlak; v++) {
+ if((v & 255)==0) vlr= obr->vlaknodes[v>>8].vlak;
+ else vlr++;
- /* partclipping doesn't need viewplane clipping */
- partclip= c1 & c2 & c3;
- if(v4) {
- c4= zbuf_part_project(cache, v4->index, winmat, bounds, v4->co, ho4);
- partclip &= c4;
+ /* the cases: visible for render, only z values, zmask, nothing */
+ if(obr->lay & lay) {
+ if(vlr->mat!=ma) {
+ ma= vlr->mat;
+ nofill= ma->mode & (MA_ZTRA|MA_ONLYCAST);
+ env= (ma->mode & MA_ENV);
+ wire= (ma->mode & MA_WIRE);
+
+ for(zsample=0; zsample<samples; zsample++) {
+ if(ma->mode & MA_ZINV) zspans[zsample].zbuffunc= zbuffillGLinv4;
+ else zspans[zsample].zbuffunc= zbuffillGL4;
+ }
+ }
}
+ else if(all_z || (obr->lay & lay_zmask)) {
+ env= 1;
+ nofill= 0;
+ ma= NULL;
+ }
+ else {
+ nofill= 1;
+ ma= NULL; /* otherwise nofill can hang */
+ }
- if(partclip==0) {
+ if(!(vlr->flag & R_HIDDEN) && nofill==0) {
+ unsigned short partclip;
- if(env) zvlnr= -1;
- else zvlnr= v+1;
+ v1= vlr->v1;
+ v2= vlr->v2;
+ v3= vlr->v3;
+ v4= vlr->v4;
- c1= testclip(ho1);
- c2= testclip(ho2);
- c3= testclip(ho3);
- if(v4)
- c4= testclip(ho4);
+ c1= zbuf_part_project(cache, v1->index, winmat, bounds, v1->co, ho1);
+ c2= zbuf_part_project(cache, v2->index, winmat, bounds, v2->co, ho2);
+ c3= zbuf_part_project(cache, v3->index, winmat, bounds, v3->co, ho3);
- for(zsample=0; zsample<samples; zsample++) {
- zspan= &zspans[zsample];
+ /* partclipping doesn't need viewplane clipping */
+ partclip= c1 & c2 & c3;
+ if(v4) {
+ c4= zbuf_part_project(cache, v4->index, winmat, bounds, v4->co, ho4);
+ partclip &= c4;
+ }
- if(wire) {
- if(v4)
- zbufclipwire(zspan, i, zvlnr, vlr->ec, ho1, ho2, ho3, ho4, c1, c2, c3, c4);
- else
- zbufclipwire(zspan, i, zvlnr, vlr->ec, ho1, ho2, ho3, 0, c1, c2, c3, 0);
- }
- else {
- /* strands allow to be filled in as quad */
- if(v4 && (vlr->flag & R_STRAND)) {
- zbufclip4(zspan, i, zvlnr, ho1, ho2, ho3, ho4, c1, c2, c3, c4);
+ if(partclip==0) {
+
+ if(env) zvlnr= -1;
+ else zvlnr= v+1;
+
+ c1= testclip(ho1);
+ c2= testclip(ho2);
+ c3= testclip(ho3);
+ if(v4)
+ c4= testclip(ho4);
+
+ for(zsample=0; zsample<samples; zsample++) {
+ zspan= &zspans[zsample];
+
+ if(wire) {
+ if(v4)
+ zbufclipwire(zspan, i, zvlnr, vlr->ec, ho1, ho2, ho3, ho4, c1, c2, c3, c4);
+ else
+ zbufclipwire(zspan, i, zvlnr, vlr->ec, ho1, ho2, ho3, 0, c1, c2, c3, 0);
}
else {
- zbufclip(zspan, i, zvlnr, ho1, ho2, ho3, c1, c2, c3);
- if(v4)
- zbufclip(zspan, i, zvlnr+RE_QUAD_OFFS, ho1, ho3, ho4, c1, c3, c4);
+ /* strands allow to be filled in as quad */
+ if(v4 && (vlr->flag & R_STRAND)) {
+ zbufclip4(zspan, i, zvlnr, ho1, ho2, ho3, ho4, c1, c2, c3, c4);
+ }
+ else {
+ zbufclip(zspan, i, zvlnr, ho1, ho2, ho3, c1, c2, c3);
+ if(v4)
+ zbufclip(zspan, i, zvlnr+RE_QUAD_OFFS, ho1, ho3, ho4, c1, c3, c4);
+ }
}
}
}
}
}
}
+
+ /* clear all z to close value, so it works as mask for next passes (ztra+strand) */
+ if(zmaskpass) {
+ for(zsample=0; zsample<samples; zsample++) {
+ zspan= &zspans[zsample];
+ zmask_rect(zspan->rectz, zspan->rectp, pa->rectx, pa->recty);
+ }
+ }
}
for(zsample=0; zsample<samples; zsample++) {
zspan= &zspans[zsample];
- /* clear all z to close value, so it works as mask for next passes (ztra+strand) */
- if(rl->layflag & SCE_LAY_ZMASK)
- zmask_rect(zspan->rectz, zspan->rectp, pa->rectx, pa->recty);
-
if(fillfunc)
fillfunc(pa, zspan, pa->sample+zsample, data);
Modified: trunk/blender/source/blender/src/buttons_scene.c
===================================================================
--- trunk/blender/source/blender/src/buttons_scene.c 2008-01-26 10:55:24 UTC (rev 13408)
+++ trunk/blender/source/blender/src/buttons_scene.c 2008-01-26 10:58:31 UTC (rev 13409)
@@ -2485,7 +2485,7 @@
unsigned int *lay= lay_p;
int laybit= (int)lay_v;
- if(G.qual & LR_SHIFTKEY) {
+ if(G.qual & (LR_SHIFTKEY|LR_CTRLKEY)) {
if(*lay==0) *lay= 1<<laybit;
}
else
More information about the Bf-blender-cvs
mailing list