Fix several Material texture parameter updates
(cherry picked from commit 1ec97a7b91
)
This commit is contained in:
parent
98002e03d7
commit
28a44d7bbc
|
@ -82,7 +82,7 @@ float FogMaterial::get_edge_fade() const {
|
||||||
|
|
||||||
void FogMaterial::set_density_texture(const Ref<Texture3D> &p_texture) {
|
void FogMaterial::set_density_texture(const Ref<Texture3D> &p_texture) {
|
||||||
density_texture = p_texture;
|
density_texture = p_texture;
|
||||||
RID tex_rid = p_texture.is_valid() ? p_texture->get_rid() : RID();
|
Variant tex_rid = p_texture.is_valid() ? Variant(p_texture->get_rid()) : Variant();
|
||||||
RS::get_singleton()->material_set_param(_get_material(), "density_texture", tex_rid);
|
RS::get_singleton()->material_set_param(_get_material(), "density_texture", tex_rid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1914,7 +1914,7 @@ void BaseMaterial3D::set_texture(TextureParam p_param, const Ref<Texture2D> &p_t
|
||||||
ERR_FAIL_INDEX(p_param, TEXTURE_MAX);
|
ERR_FAIL_INDEX(p_param, TEXTURE_MAX);
|
||||||
|
|
||||||
textures[p_param] = p_texture;
|
textures[p_param] = p_texture;
|
||||||
RID rid = p_texture.is_valid() ? p_texture->get_rid() : RID();
|
Variant rid = p_texture.is_valid() ? Variant(p_texture->get_rid()) : Variant();
|
||||||
RS::get_singleton()->material_set_param(_get_material(), shader_names->texture_names[p_param], rid);
|
RS::get_singleton()->material_set_param(_get_material(), shader_names->texture_names[p_param], rid);
|
||||||
|
|
||||||
if (p_texture.is_valid() && p_param == TEXTURE_ALBEDO) {
|
if (p_texture.is_valid() && p_param == TEXTURE_ALBEDO) {
|
||||||
|
|
|
@ -1118,7 +1118,7 @@ void ParticleProcessMaterial::set_param_texture(Parameter p_param, const Ref<Tex
|
||||||
|
|
||||||
tex_parameters[p_param] = p_texture;
|
tex_parameters[p_param] = p_texture;
|
||||||
|
|
||||||
RID tex_rid = p_texture.is_valid() ? p_texture->get_rid() : RID();
|
Variant tex_rid = p_texture.is_valid() ? Variant(p_texture->get_rid()) : Variant();
|
||||||
|
|
||||||
switch (p_param) {
|
switch (p_param) {
|
||||||
case PARAM_INITIAL_LINEAR_VELOCITY: {
|
case PARAM_INITIAL_LINEAR_VELOCITY: {
|
||||||
|
@ -1201,7 +1201,7 @@ Color ParticleProcessMaterial::get_color() const {
|
||||||
|
|
||||||
void ParticleProcessMaterial::set_color_ramp(const Ref<Texture2D> &p_texture) {
|
void ParticleProcessMaterial::set_color_ramp(const Ref<Texture2D> &p_texture) {
|
||||||
color_ramp = p_texture;
|
color_ramp = p_texture;
|
||||||
RID tex_rid = p_texture.is_valid() ? p_texture->get_rid() : RID();
|
Variant tex_rid = p_texture.is_valid() ? Variant(p_texture->get_rid()) : Variant();
|
||||||
RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->color_ramp, tex_rid);
|
RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->color_ramp, tex_rid);
|
||||||
_queue_shader_change();
|
_queue_shader_change();
|
||||||
notify_property_list_changed();
|
notify_property_list_changed();
|
||||||
|
@ -1213,7 +1213,7 @@ Ref<Texture2D> ParticleProcessMaterial::get_color_ramp() const {
|
||||||
|
|
||||||
void ParticleProcessMaterial::set_color_initial_ramp(const Ref<Texture2D> &p_texture) {
|
void ParticleProcessMaterial::set_color_initial_ramp(const Ref<Texture2D> &p_texture) {
|
||||||
color_initial_ramp = p_texture;
|
color_initial_ramp = p_texture;
|
||||||
RID tex_rid = p_texture.is_valid() ? p_texture->get_rid() : RID();
|
Variant tex_rid = p_texture.is_valid() ? Variant(p_texture->get_rid()) : Variant();
|
||||||
RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->color_initial_ramp, tex_rid);
|
RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->color_initial_ramp, tex_rid);
|
||||||
_queue_shader_change();
|
_queue_shader_change();
|
||||||
notify_property_list_changed();
|
notify_property_list_changed();
|
||||||
|
@ -1256,19 +1256,19 @@ void ParticleProcessMaterial::set_emission_box_extents(Vector3 p_extents) {
|
||||||
|
|
||||||
void ParticleProcessMaterial::set_emission_point_texture(const Ref<Texture2D> &p_points) {
|
void ParticleProcessMaterial::set_emission_point_texture(const Ref<Texture2D> &p_points) {
|
||||||
emission_point_texture = p_points;
|
emission_point_texture = p_points;
|
||||||
RID tex_rid = p_points.is_valid() ? p_points->get_rid() : RID();
|
Variant tex_rid = p_points.is_valid() ? Variant(p_points->get_rid()) : Variant();
|
||||||
RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_texture_points, tex_rid);
|
RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_texture_points, tex_rid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParticleProcessMaterial::set_emission_normal_texture(const Ref<Texture2D> &p_normals) {
|
void ParticleProcessMaterial::set_emission_normal_texture(const Ref<Texture2D> &p_normals) {
|
||||||
emission_normal_texture = p_normals;
|
emission_normal_texture = p_normals;
|
||||||
RID tex_rid = p_normals.is_valid() ? p_normals->get_rid() : RID();
|
Variant tex_rid = p_normals.is_valid() ? Variant(p_normals->get_rid()) : Variant();
|
||||||
RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_texture_normal, tex_rid);
|
RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_texture_normal, tex_rid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParticleProcessMaterial::set_emission_color_texture(const Ref<Texture2D> &p_colors) {
|
void ParticleProcessMaterial::set_emission_color_texture(const Ref<Texture2D> &p_colors) {
|
||||||
emission_color_texture = p_colors;
|
emission_color_texture = p_colors;
|
||||||
RID tex_rid = p_colors.is_valid() ? p_colors->get_rid() : RID();
|
Variant tex_rid = p_colors.is_valid() ? Variant(p_colors->get_rid()) : Variant();
|
||||||
RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_texture_color, tex_rid);
|
RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_texture_color, tex_rid);
|
||||||
_queue_shader_change();
|
_queue_shader_change();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue