summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-11-17 21:48:00 +0100
committerGitHub <noreply@github.com>2019-11-17 21:48:00 +0100
commit0a96235b44f9a8c19a1d463e057be7b8b1a20df9 (patch)
tree6514973df68b3498085e45149e4984d53ab398fa /scene
parentcc025fc8e7e379cb157890d08720f2cbcc96e3ad (diff)
parent2bc6302607c19e1e7b7b3c7862a4ca3907524ff1 (diff)
Merge pull request #33683 from clayjohn/material-texture-bug
Properly update texture when roughness/metallic set
Diffstat (limited to 'scene')
-rw-r--r--scene/resources/material.cpp2
-rw-r--r--scene/resources/material.h4
2 files changed, 5 insertions, 1 deletions
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp
index fab0aace14..41bf7f4bf0 100644
--- a/scene/resources/material.cpp
+++ b/scene/resources/material.cpp
@@ -1405,8 +1405,8 @@ void SpatialMaterial::set_texture(TextureParam p_param, const Ref<Texture> &p_te
textures[p_param] = p_texture;
RID rid = p_texture.is_valid() ? p_texture->get_rid() : RID();
VS::get_singleton()->material_set_param(_get_material(), shader_names->texture_names[p_param], rid);
- _queue_shader_change();
_change_notify();
+ _queue_shader_change();
}
Ref<Texture> SpatialMaterial::get_texture(TextureParam p_param) const {
diff --git a/scene/resources/material.h b/scene/resources/material.h
index 2423d6d48b..1c69a754b6 100644
--- a/scene/resources/material.h
+++ b/scene/resources/material.h
@@ -260,6 +260,8 @@ private:
uint64_t proximity_fade : 1;
uint64_t distance_fade : 2;
uint64_t emission_op : 1;
+ uint64_t texture_metallic : 1;
+ uint64_t texture_roughness : 1;
};
uint64_t key;
@@ -305,6 +307,8 @@ private:
mk.proximity_fade = proximity_fade_enabled;
mk.distance_fade = distance_fade;
mk.emission_op = emission_op;
+ mk.texture_metallic = textures[TEXTURE_METALLIC].is_valid() ? 1 : 0;
+ mk.texture_roughness = textures[TEXTURE_ROUGHNESS].is_valid() ? 1 : 0;
return mk;
}