Merge pull request #37914 from clayjohn/VULKAN-decal-fix
Fix texture check in decal setup
This commit is contained in:
commit
3c1218a39a
|
@ -60,24 +60,24 @@ float Decal::get_emission_energy() const {
|
||||||
return emission_energy;
|
return emission_energy;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Decal::set_albedo_mix(float p_energy) {
|
void Decal::set_albedo_mix(float p_mix) {
|
||||||
albedo_mix = p_energy;
|
albedo_mix = p_mix;
|
||||||
RS::get_singleton()->decal_set_albedo_mix(decal, albedo_mix);
|
RS::get_singleton()->decal_set_albedo_mix(decal, albedo_mix);
|
||||||
}
|
}
|
||||||
float Decal::get_albedo_mix() const {
|
float Decal::get_albedo_mix() const {
|
||||||
return albedo_mix;
|
return albedo_mix;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Decal::set_upper_fade(float p_energy) {
|
void Decal::set_upper_fade(float p_fade) {
|
||||||
upper_fade = p_energy;
|
upper_fade = p_fade;
|
||||||
RS::get_singleton()->decal_set_fade(decal, upper_fade, lower_fade);
|
RS::get_singleton()->decal_set_fade(decal, upper_fade, lower_fade);
|
||||||
}
|
}
|
||||||
float Decal::get_upper_fade() const {
|
float Decal::get_upper_fade() const {
|
||||||
return upper_fade;
|
return upper_fade;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Decal::set_lower_fade(float p_energy) {
|
void Decal::set_lower_fade(float p_fade) {
|
||||||
lower_fade = p_energy;
|
lower_fade = p_fade;
|
||||||
RS::get_singleton()->decal_set_fade(decal, upper_fade, lower_fade);
|
RS::get_singleton()->decal_set_fade(decal, upper_fade, lower_fade);
|
||||||
}
|
}
|
||||||
float Decal::get_lower_fade() const {
|
float Decal::get_lower_fade() const {
|
||||||
|
|
|
@ -75,7 +75,7 @@ public:
|
||||||
void set_emission_energy(float p_energy);
|
void set_emission_energy(float p_energy);
|
||||||
float get_emission_energy() const;
|
float get_emission_energy() const;
|
||||||
|
|
||||||
void set_albedo_mix(float p_energy);
|
void set_albedo_mix(float p_mix);
|
||||||
float get_albedo_mix() const;
|
float get_albedo_mix() const;
|
||||||
|
|
||||||
void set_modulate(Color p_modulate);
|
void set_modulate(Color p_modulate);
|
||||||
|
@ -84,10 +84,10 @@ public:
|
||||||
void set_upper_fade(float p_energy);
|
void set_upper_fade(float p_energy);
|
||||||
float get_upper_fade() const;
|
float get_upper_fade() const;
|
||||||
|
|
||||||
void set_lower_fade(float p_energy);
|
void set_lower_fade(float p_fade);
|
||||||
float get_lower_fade() const;
|
float get_lower_fade() const;
|
||||||
|
|
||||||
void set_normal_fade(float p_energy);
|
void set_normal_fade(float p_fade);
|
||||||
float get_normal_fade() const;
|
float get_normal_fade() const;
|
||||||
|
|
||||||
void set_enable_distance_fade(bool p_enable);
|
void set_enable_distance_fade(bool p_enable);
|
||||||
|
|
|
@ -2007,6 +2007,7 @@ void RasterizerSceneHighEndRD::_setup_decals(const RID *p_decal_instances, int p
|
||||||
dd.normal_fade = storage->decal_get_normal_fade(decal);
|
dd.normal_fade = storage->decal_get_normal_fade(decal);
|
||||||
|
|
||||||
RID albedo_tex = storage->decal_get_texture(decal, RS::DECAL_TEXTURE_ALBEDO);
|
RID albedo_tex = storage->decal_get_texture(decal, RS::DECAL_TEXTURE_ALBEDO);
|
||||||
|
RID emission_tex = storage->decal_get_texture(decal, RS::DECAL_TEXTURE_EMISSION);
|
||||||
if (albedo_tex.is_valid()) {
|
if (albedo_tex.is_valid()) {
|
||||||
Rect2 rect = storage->decal_atlas_get_texture_rect(albedo_tex);
|
Rect2 rect = storage->decal_atlas_get_texture_rect(albedo_tex);
|
||||||
dd.albedo_rect[0] = rect.position.x;
|
dd.albedo_rect[0] = rect.position.x;
|
||||||
|
@ -2015,6 +2016,9 @@ void RasterizerSceneHighEndRD::_setup_decals(const RID *p_decal_instances, int p
|
||||||
dd.albedo_rect[3] = rect.size.y;
|
dd.albedo_rect[3] = rect.size.y;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
if (!emission_tex.is_valid()) {
|
||||||
|
continue; //no albedo, no emission, no decal.
|
||||||
|
}
|
||||||
dd.albedo_rect[0] = 0;
|
dd.albedo_rect[0] = 0;
|
||||||
dd.albedo_rect[1] = 0;
|
dd.albedo_rect[1] = 0;
|
||||||
dd.albedo_rect[2] = 0;
|
dd.albedo_rect[2] = 0;
|
||||||
|
@ -2022,7 +2026,6 @@ void RasterizerSceneHighEndRD::_setup_decals(const RID *p_decal_instances, int p
|
||||||
}
|
}
|
||||||
|
|
||||||
RID normal_tex = storage->decal_get_texture(decal, RS::DECAL_TEXTURE_NORMAL);
|
RID normal_tex = storage->decal_get_texture(decal, RS::DECAL_TEXTURE_NORMAL);
|
||||||
RID emission_tex = storage->decal_get_texture(decal, RS::DECAL_TEXTURE_EMISSION);
|
|
||||||
|
|
||||||
if (normal_tex.is_valid()) {
|
if (normal_tex.is_valid()) {
|
||||||
Rect2 rect = storage->decal_atlas_get_texture_rect(normal_tex);
|
Rect2 rect = storage->decal_atlas_get_texture_rect(normal_tex);
|
||||||
|
@ -2033,13 +2036,7 @@ void RasterizerSceneHighEndRD::_setup_decals(const RID *p_decal_instances, int p
|
||||||
|
|
||||||
Basis normal_xform = p_camera_inverse_xform.basis * xform.basis.orthonormalized();
|
Basis normal_xform = p_camera_inverse_xform.basis * xform.basis.orthonormalized();
|
||||||
store_basis_3x4(normal_xform, dd.normal_xform);
|
store_basis_3x4(normal_xform, dd.normal_xform);
|
||||||
|
|
||||||
//store normal xform
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (!emission_tex.is_valid()) {
|
|
||||||
continue; //no albedo, no emission, no decal.
|
|
||||||
}
|
|
||||||
dd.normal_rect[0] = 0;
|
dd.normal_rect[0] = 0;
|
||||||
dd.normal_rect[1] = 0;
|
dd.normal_rect[1] = 0;
|
||||||
dd.normal_rect[2] = 0;
|
dd.normal_rect[2] = 0;
|
||||||
|
|
Loading…
Reference in New Issue