1
0
mirror of https://github.com/godotengine/godot.git synced 2025-12-31 18:41:20 +00:00

Fix Sprite3D texture bleed when not wrapping

# Conflicts:
#	scene/resources/material.cpp
This commit is contained in:
Cadence
2024-10-12 14:01:29 -04:00
parent bbe9654327
commit fc9ea462ca
4 changed files with 8 additions and 4 deletions

View File

@@ -3010,7 +3010,7 @@ float BaseMaterial3D::get_fov_override() const {
return fov_override;
}
Ref<Material> BaseMaterial3D::get_material_for_2d(bool p_shaded, Transparency p_transparency, bool p_double_sided, bool p_billboard, bool p_billboard_y, bool p_msdf, bool p_no_depth, bool p_fixed_size, TextureFilter p_filter, AlphaAntiAliasing p_alpha_antialiasing_mode, RID *r_shader_rid) {
Ref<Material> BaseMaterial3D::get_material_for_2d(bool p_shaded, Transparency p_transparency, bool p_double_sided, bool p_billboard, bool p_billboard_y, bool p_msdf, bool p_no_depth, bool p_fixed_size, TextureFilter p_filter, AlphaAntiAliasing p_alpha_antialiasing_mode, bool p_texture_repeat, RID *r_shader_rid) {
uint64_t key = 0;
key |= ((int8_t)p_shaded & 0x01) << 0;
key |= ((int8_t)p_transparency & 0x07) << 1; // Bits 1-3.
@@ -3022,6 +3022,7 @@ Ref<Material> BaseMaterial3D::get_material_for_2d(bool p_shaded, Transparency p_
key |= ((int8_t)p_fixed_size & 0x01) << 9;
key |= ((int8_t)p_filter & 0x07) << 10; // Bits 10-12.
key |= ((int8_t)p_alpha_antialiasing_mode & 0x07) << 13; // Bits 13-15.
key |= ((int8_t)p_texture_repeat & 0x01) << 16;
if (materials_for_2d.has(key)) {
if (r_shader_rid) {
@@ -3041,6 +3042,7 @@ Ref<Material> BaseMaterial3D::get_material_for_2d(bool p_shaded, Transparency p_
material->set_flag(FLAG_ALBEDO_TEXTURE_MSDF, p_msdf);
material->set_flag(FLAG_DISABLE_DEPTH_TEST, p_no_depth);
material->set_flag(FLAG_FIXED_SIZE, p_fixed_size);
material->set_flag(FLAG_USE_TEXTURE_REPEAT, p_texture_repeat);
material->set_alpha_antialiasing(p_alpha_antialiasing_mode);
material->set_texture_filter(p_filter);
if (p_billboard || p_billboard_y) {

View File

@@ -878,7 +878,7 @@ public:
static void finish_shaders();
static void flush_changes();
static Ref<Material> get_material_for_2d(bool p_shaded, Transparency p_transparency, bool p_double_sided, bool p_billboard = false, bool p_billboard_y = false, bool p_msdf = false, bool p_no_depth = false, bool p_fixed_size = false, TextureFilter p_filter = TEXTURE_FILTER_LINEAR_WITH_MIPMAPS, AlphaAntiAliasing p_alpha_antialiasing_mode = ALPHA_ANTIALIASING_OFF, RID *r_shader_rid = nullptr);
static Ref<Material> get_material_for_2d(bool p_shaded, Transparency p_transparency, bool p_double_sided, bool p_billboard = false, bool p_billboard_y = false, bool p_msdf = false, bool p_no_depth = false, bool p_fixed_size = false, TextureFilter p_filter = TEXTURE_FILTER_LINEAR_WITH_MIPMAPS, AlphaAntiAliasing p_alpha_antialiasing_mode = ALPHA_ANTIALIASING_OFF, bool p_texture_repeat = false, RID *r_shader_rid = nullptr);
virtual RID get_rid() const override;
virtual RID get_shader_rid() const override;