forked from bartvdbraak/blender
Revert own previous commit rBe2f9afbaabbd.
The "Cast Shadows" worked as expected, but it can cause problem in some cases. For example, when using strand render, we need disabling only buffer shadows, but the previous changes made that impossible. "Cast Shadows" should be added as a newly created option.
This commit is contained in:
parent
78f23ce9fc
commit
38e58612ef
@ -222,7 +222,7 @@ class MATERIAL_PT_pipeline(MaterialButtonsPanel, Panel):
|
||||
|
||||
col.prop(mat, "use_cast_shadows_only", text="Cast Only")
|
||||
col.prop(mat, "shadow_cast_alpha", text="Casting Alpha")
|
||||
col.prop(mat, "use_cast_shadows")
|
||||
col.prop(mat, "use_cast_buffer_shadows")
|
||||
col.prop(mat, "use_cast_approximate")
|
||||
col.prop(mat, "pass_index")
|
||||
|
||||
@ -824,9 +824,9 @@ class MATERIAL_PT_shadow(MaterialButtonsPanel, Panel):
|
||||
|
||||
col = split.column()
|
||||
if simple_material(base_mat):
|
||||
col.prop(mat, "use_cast_shadows")
|
||||
col.prop(mat, "use_cast_buffer_shadows")
|
||||
sub = col.column()
|
||||
sub.active = mat.use_cast_shadows
|
||||
sub.active = mat.use_cast_buffer_shadows
|
||||
sub.prop(mat, "shadow_buffer_bias", text="Buffer Bias")
|
||||
col.prop(mat, "use_ray_shadow_bias", text="Auto Ray Bias")
|
||||
sub = col.column()
|
||||
|
@ -202,7 +202,7 @@ void init_material(Material *ma)
|
||||
ma->game.alpha_blend = 0;
|
||||
ma->game.face_orientation = 0;
|
||||
|
||||
ma->mode = MA_TRACEBLE | MA_CASTSHADOW | MA_SHADOW | MA_RAYBIAS | MA_TANGENT_STR | MA_ZTRANSP;
|
||||
ma->mode = MA_TRACEBLE | MA_SHADBUF | MA_SHADOW | MA_RAYBIAS | MA_TANGENT_STR | MA_ZTRANSP;
|
||||
ma->shade_flag = MA_APPROX_OCCLUSION;
|
||||
ma->preview = NULL;
|
||||
}
|
||||
|
@ -2171,7 +2171,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *main)
|
||||
ma->mode |= MA_TANGENT_STR;
|
||||
}
|
||||
if (ma->mode & MA_TRACEBLE)
|
||||
ma->mode |= MA_CASTSHADOW;
|
||||
ma->mode |= MA_SHADBUF;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -350,7 +350,7 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
|
||||
if (base->object->id.name[2] == 'c') {
|
||||
Material *shadmat = give_current_material(base->object, base->object->actcol);
|
||||
if (shadmat) {
|
||||
if (mat->mode & MA_CASTSHADOW) shadmat->septex = 0;
|
||||
if (mat->mode & MA_SHADBUF) shadmat->septex = 0;
|
||||
else shadmat->septex |= 1;
|
||||
}
|
||||
}
|
||||
|
@ -3620,7 +3620,7 @@ static bool draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3
|
||||
if (v3d->flag2 & V3D_RENDER_SHADOW) {
|
||||
for (i = 0; i < ob->totcol; ++i) {
|
||||
Material *ma = give_current_material(ob, i);
|
||||
if (ma && !(ma->mode & MA_CASTSHADOW)) {
|
||||
if (ma && !(ma->mode & MA_SHADBUF)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -267,7 +267,7 @@ typedef struct Material {
|
||||
#define MA_RAYBIAS 0x400000
|
||||
#define MA_FULL_OSA 0x800000
|
||||
#define MA_TANGENT_STR 0x1000000
|
||||
#define MA_CASTSHADOW 0x2000000
|
||||
#define MA_SHADBUF 0x2000000
|
||||
/* note; we drop MA_TANGENT_STR later to become tangent_u */
|
||||
#define MA_TANGENT_V 0x4000000
|
||||
/* qdn: a bit clumsy this, tangents needed for normal maps separated from shading */
|
||||
|
@ -1937,16 +1937,10 @@ void RNA_def_material(BlenderRNA *brna)
|
||||
"Force this material to render full shading/textures for all anti-aliasing samples");
|
||||
RNA_def_property_update(prop, 0, "rna_Material_update");
|
||||
|
||||
prop = RNA_def_property(srna, "use_cast_shadows", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_CASTSHADOW);
|
||||
RNA_def_property_ui_text(prop, "Cast Shadows",
|
||||
"Allow this material to cast shadows");
|
||||
RNA_def_property_update(prop, 0, "rna_Material_update");
|
||||
|
||||
prop = RNA_def_property(srna, "use_cast_buffer_shadows", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_CASTSHADOW);
|
||||
RNA_def_property_ui_text(prop, "Cast Shadows",
|
||||
"This is obsolete RNA path, please use 'use_cast_shadows' instead");
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_SHADBUF);
|
||||
RNA_def_property_ui_text(prop, "Cast Buffer Shadows",
|
||||
"Allow this material to cast shadows from shadow buffer lamps");
|
||||
RNA_def_property_update(prop, 0, "rna_Material_update");
|
||||
|
||||
prop = RNA_def_property(srna, "use_cast_approximate", PROP_BOOLEAN, PROP_NONE);
|
||||
|
@ -118,7 +118,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 (vlr->mat->mode & MA_CASTSHADOW) && (is->lay & obi->lay);
|
||||
return (is->lay & obi->lay);
|
||||
}
|
||||
|
||||
MALWAYS_INLINE int vlr_check_intersect_solid(Isect *UNUSED(is), ObjectInstanceRen *UNUSED(obi), VlakRen *vlr)
|
||||
|
@ -746,7 +746,7 @@ static Material *give_render_material(Render *re, Object *ob, short nr)
|
||||
|
||||
if (ma->material_type == MA_TYPE_VOLUME) {
|
||||
ma->mode |= MA_TRANSP;
|
||||
ma->mode &= ~MA_CASTSHADOW;
|
||||
ma->mode &= ~MA_SHADBUF;
|
||||
}
|
||||
if ((ma->mode & MA_TRANSP) && (ma->mode & MA_ZTRANSP))
|
||||
re->flag |= R_ZTRA;
|
||||
|
@ -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_CASTSHADOW)==0) ok= 0;
|
||||
if ((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_CASTSHADOW)==0) ok= 0;
|
||||
if ((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;
|
||||
}
|
||||
|
@ -860,7 +860,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_CASTSHADOW))
|
||||
if (shadow && !(ma->mode & MA_SHADBUF))
|
||||
continue;
|
||||
else if (!shadow && (ma->mode & MA_ONLYCAST))
|
||||
continue;
|
||||
|
@ -2368,7 +2368,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_CASTSHADOW)==0) ok= 0;
|
||||
if ((ma->mode & MA_SHADBUF)==0) ok= 0;
|
||||
}
|
||||
|
||||
if (ok && (obi->lay & lay) && !(vlr->flag & R_HIDDEN)) {
|
||||
@ -2421,7 +2421,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_CASTSHADOW)==0) ok= 0;
|
||||
if ((ma->mode & MA_SHADBUF)==0) ok= 0;
|
||||
}
|
||||
|
||||
if (ok && (sseg.buffer->lay & lay)) {
|
||||
@ -3349,7 +3349,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_CASTSHADOW);
|
||||
dofill= (ma->mode & MA_SHADBUF);
|
||||
else
|
||||
dofill= (((ma->mode & MA_TRANSP) && (ma->mode & MA_ZTRANSP)) && !(ma->mode & MA_ONLYCAST));
|
||||
}
|
||||
|
@ -610,7 +610,7 @@ static bool ConvertMaterial(
|
||||
material->ras_mode |= ( mat->game.flag & GEMAT_BACKCULL )?0:TWOSIDED;
|
||||
|
||||
// cast shadows?
|
||||
material->ras_mode |= ( mat->mode & MA_CASTSHADOW )?CAST_SHADOW:0;
|
||||
material->ras_mode |= ( mat->mode & MA_SHADBUF )?CAST_SHADOW:0;
|
||||
MTex *mttmp = 0;
|
||||
int valid_index = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user