diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-08-29 13:06:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-29 13:06:37 +0200 |
commit | 9762372329253a5d89feac7705770eb2f8e0cc04 (patch) | |
tree | 7f4644e704f0cfacde3f9b65f77e7e3e905759d5 /scene/resources/material.cpp | |
parent | a6b094cdfc6cb102a4c2e378f6ae2a06ac646638 (diff) | |
parent | b055ade1c3043ee5e1089c3a3eeb4953c39e55b7 (diff) |
Merge pull request #30635 from KoBeWi/billbo_3dns
Add a Billboard property for Sprite3D
Diffstat (limited to 'scene/resources/material.cpp')
-rw-r--r-- | scene/resources/material.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index daa51aabd7..0de462d616 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -1772,7 +1772,7 @@ SpatialMaterial::TextureChannel SpatialMaterial::get_refraction_texture_channel( return refraction_texture_channel; } -RID SpatialMaterial::get_material_rid_for_2d(bool p_shaded, bool p_transparent, bool p_double_sided, bool p_cut_alpha, bool p_opaque_prepass) { +RID SpatialMaterial::get_material_rid_for_2d(bool p_shaded, bool p_transparent, bool p_double_sided, bool p_cut_alpha, bool p_opaque_prepass, bool p_billboard, bool p_billboard_y) { int version = 0; if (p_shaded) @@ -1785,6 +1785,10 @@ RID SpatialMaterial::get_material_rid_for_2d(bool p_shaded, bool p_transparent, version |= 8; if (p_double_sided) version |= 16; + if (p_billboard) + version |= 32; + if (p_billboard_y) + version |= 64; if (materials_for_2d[version].is_valid()) { return materials_for_2d[version]->get_rid(); @@ -1800,6 +1804,11 @@ RID SpatialMaterial::get_material_rid_for_2d(bool p_shaded, bool p_transparent, material->set_flag(FLAG_SRGB_VERTEX_COLOR, true); material->set_flag(FLAG_ALBEDO_FROM_VERTEX_COLOR, true); material->set_flag(FLAG_USE_ALPHA_SCISSOR, p_cut_alpha); + if (p_billboard) { + material->set_billboard_mode(BILLBOARD_ENABLED); + } else if (p_billboard_y) { + material->set_billboard_mode(BILLBOARD_FIXED_Y); + } materials_for_2d[version] = material; |