diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2023-01-31 10:40:08 +0200 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2023-01-31 10:46:38 +0200 |
commit | b4fe514aa3c4aa928663eb1cf45cef0afb5015b0 (patch) | |
tree | 5695ec2292b27c225ea6bd01f420eb825ad44e54 /scene/resources | |
parent | e9de988020f3d46c3e7b4fd5a8a80724996035e0 (diff) |
[Sprite3D/Label3D] Expose alpha antialiasing properties.
Diffstat (limited to 'scene/resources')
-rw-r--r-- | scene/resources/material.cpp | 6 | ||||
-rw-r--r-- | scene/resources/material.h | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index d6393966b1..7e84814ab3 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -2316,7 +2316,7 @@ BaseMaterial3D::TextureChannel BaseMaterial3D::get_refraction_texture_channel() return refraction_texture_channel; } -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, 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, 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. @@ -2326,7 +2326,8 @@ Ref<Material> BaseMaterial3D::get_material_for_2d(bool p_shaded, Transparency p_ key |= ((int8_t)p_msdf & 0x01) << 7; key |= ((int8_t)p_no_depth & 0x01) << 8; key |= ((int8_t)p_fixed_size & 0x01) << 9; - key |= ((int8_t)p_filter & 0x07) << 10; // Bits 10-13. + key |= ((int8_t)p_filter & 0x07) << 10; // Bits 10-12. + key |= ((int8_t)p_alpha_antialiasing_mode & 0x07) << 13; // Bits 13-15. if (materials_for_2d.has(key)) { if (r_shader_rid) { @@ -2346,6 +2347,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_alpha_antialiasing(p_alpha_antialiasing_mode); material->set_texture_filter(p_filter); if (p_billboard || p_billboard_y) { material->set_flag(FLAG_BILLBOARD_KEEP_SCALE, true); diff --git a/scene/resources/material.h b/scene/resources/material.h index 23f3a8824d..5ea9a807d4 100644 --- a/scene/resources/material.h +++ b/scene/resources/material.h @@ -760,7 +760,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, 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, RID *r_shader_rid = nullptr); virtual RID get_shader_rid() const override; |