Fixed bug in 3D material

textures that failed to load should now load again properly
This commit is contained in:
Juan Linietsky 2015-01-20 23:58:47 -03:00
parent da0d4e4dea
commit 14ade5500f

View file

@ -4962,15 +4962,19 @@ _FORCE_INLINE_ void RasterizerGLES2::_update_material_shader_params(Material *p_
bool has_old = OLD;
bool old_inuse=has_old && old_mparams[E->key()].inuse;
if (!has_old || !old_inuse)
ud.istexture=(E->get().type==ShaderLanguage::TYPE_TEXTURE || E->get().type==ShaderLanguage::TYPE_CUBEMAP);
if (!has_old || !old_inuse) {
keep=false;
}
else if (OLD->get().value.get_type()!=E->value().default_value.get_type()) {
if (OLD->get().value.get_type()==Variant::INT && E->get().type==ShaderLanguage::TYPE_FLOAT) {
//handle common mistake using shaders (feeding ints instead of float)
OLD->get().value=float(OLD->get().value);
keep=true;
} else if (E->value().default_value.get_type()!=Variant::NIL) {
} else if (!ud.istexture && E->value().default_value.get_type()!=Variant::NIL) {
keep=false;
}
//type changed between old and new
@ -4984,7 +4988,6 @@ _FORCE_INLINE_ void RasterizerGLES2::_update_material_shader_params(Material *p_
;
}
ud.istexture=(E->get().type==ShaderLanguage::TYPE_TEXTURE || E->get().type==ShaderLanguage::TYPE_CUBEMAP);
if (keep) {
ud.value=old_mparams[E->key()].value;