Blender Internal: Add material property "Cast" which can disable both ray and buffer shadows.
Also refactor: - Material property UI related to shadows - Preparation of OR-ed mode flags (ma->mode_l) of render materials Reviewers: brecht Reviewed By: brecht Differential Revision: https://developer.blender.org/D313
This commit is contained in:
@@ -81,7 +81,7 @@ struct ShadeInputCopy {
|
||||
short osatex;
|
||||
float vn[3], vno[3]; /* actual render normal, and a copy to restore it */
|
||||
float n1[3], n2[3], n3[3]; /* vertex normals, corrected */
|
||||
int mode; /* base material mode (OR-ed result of entire node tree) */
|
||||
int mode, mode2; /* base material mode (OR-ed result of entire node tree) */
|
||||
};
|
||||
|
||||
typedef struct ShadeInputUV {
|
||||
@@ -113,7 +113,7 @@ typedef struct ShadeInput {
|
||||
short osatex;
|
||||
float vn[3], vno[3]; /* actual render normal, and a copy to restore it */
|
||||
float n1[3], n2[3], n3[3]; /* vertex normals, corrected */
|
||||
int mode; /* base material mode (OR-ed result of entire node tree) */
|
||||
int mode, mode2; /* base material mode (OR-ed result of entire node tree) */
|
||||
|
||||
/* internal face coordinates */
|
||||
float u, v, dx_u, dx_v, dy_u, dy_v;
|
||||
|
||||
@@ -119,7 +119,7 @@ MALWAYS_INLINE int vlr_check_intersect(Isect *is, ObjectInstanceRen *obi, VlakRe
|
||||
if (is->mode == RE_RAY_MIRROR)
|
||||
return !(vlr->mat->mode & MA_ONLYCAST);
|
||||
else
|
||||
return (is->lay & obi->lay);
|
||||
return (vlr->mat->mode2 & MA_CASTSHADOW) && (is->lay & obi->lay);
|
||||
}
|
||||
|
||||
MALWAYS_INLINE int vlr_check_intersect_solid(Isect *UNUSED(is), ObjectInstanceRen *UNUSED(obi), VlakRen *vlr)
|
||||
|
||||
@@ -660,7 +660,7 @@ static void shadowbuf_autoclip(Render *re, LampRen *lar)
|
||||
if (vlr->mat!= ma) {
|
||||
ma= vlr->mat;
|
||||
ok= 1;
|
||||
if ((ma->mode & MA_SHADBUF)==0) ok= 0;
|
||||
if ((ma->mode2 & MA_CASTSHADOW)==0 || (ma->mode & MA_SHADBUF)==0) ok= 0;
|
||||
}
|
||||
|
||||
if (ok && (obi->lay & lay)) {
|
||||
@@ -2013,7 +2013,7 @@ static void isb_bsp_fillfaces(Render *re, LampRen *lar, ISBBranch *root)
|
||||
if (vlr->mat!= ma) {
|
||||
ma= vlr->mat;
|
||||
ok= 1;
|
||||
if ((ma->mode & MA_SHADBUF)==0) ok= 0;
|
||||
if ((ma->mode2 & MA_CASTSHADOW)==0 || (ma->mode & MA_SHADBUF)==0) ok= 0;
|
||||
if (ma->material_type == MA_TYPE_WIRE) ok= 0;
|
||||
zspanstrand.shad_alpha= zspan.shad_alpha= ma->shad_alpha;
|
||||
}
|
||||
|
||||
@@ -276,6 +276,7 @@ void shade_input_set_triangle_i(ShadeInput *shi, ObjectInstanceRen *obi, VlakRen
|
||||
|
||||
shi->osatex = (shi->mat->texco & TEXCO_OSA);
|
||||
shi->mode = shi->mat->mode_l; /* or-ed result for all nodes */
|
||||
shi->mode2 = shi->mat->mode2_l;
|
||||
|
||||
/* facenormal copy, can get flipped */
|
||||
shi->flippednor = 0;
|
||||
|
||||
@@ -862,7 +862,7 @@ int zbuffer_strands_abuf(Render *re, RenderPart *pa, APixstrand *apixbuf, ListBa
|
||||
/* test if we should skip it */
|
||||
ma = obr->strandbuf->ma;
|
||||
|
||||
if (shadow && !(ma->mode & MA_SHADBUF))
|
||||
if (shadow && (!(ma->mode2 & MA_CASTSHADOW) || !(ma->mode & MA_SHADBUF)))
|
||||
continue;
|
||||
else if (!shadow && (ma->mode & MA_ONLYCAST))
|
||||
continue;
|
||||
|
||||
@@ -2367,7 +2367,7 @@ void zbuffer_shadow(Render *re, float winmat[4][4], LampRen *lar, int *rectz, in
|
||||
if (vlr->mat!= ma) {
|
||||
ma= vlr->mat;
|
||||
ok= 1;
|
||||
if ((ma->mode & MA_SHADBUF)==0) ok= 0;
|
||||
if ((ma->mode2 & MA_CASTSHADOW)==0 || (ma->mode & MA_SHADBUF)==0) ok= 0;
|
||||
}
|
||||
|
||||
if (ok && (obi->lay & lay) && !(vlr->flag & R_HIDDEN)) {
|
||||
@@ -2420,7 +2420,7 @@ void zbuffer_shadow(Render *re, float winmat[4][4], LampRen *lar, int *rectz, in
|
||||
if (sseg.buffer->ma!= ma) {
|
||||
ma= sseg.buffer->ma;
|
||||
ok= 1;
|
||||
if ((ma->mode & MA_SHADBUF)==0) ok= 0;
|
||||
if ((ma->mode2 & MA_CASTSHADOW)==0 || (ma->mode & MA_SHADBUF)==0) ok= 0;
|
||||
}
|
||||
|
||||
if (ok && (sseg.buffer->lay & lay)) {
|
||||
@@ -3348,7 +3348,7 @@ static int zbuffer_abuf(Render *re, RenderPart *pa, APixstr *APixbuf, ListBase *
|
||||
if (vlr->mat!=ma) {
|
||||
ma= vlr->mat;
|
||||
if (shadow)
|
||||
dofill= (ma->mode & MA_SHADBUF);
|
||||
dofill= (ma->mode2 & MA_CASTSHADOW) && (ma->mode & MA_SHADBUF);
|
||||
else
|
||||
dofill= (((ma->mode & MA_TRANSP) && (ma->mode & MA_ZTRANSP)) && !(ma->mode & MA_ONLYCAST));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user