Add double-sided flag to SpriteBase3D (fixes #8007)

This commit is contained in:
Andrea Faulds
2017-04-17 02:32:51 +01:00
parent 5a6ccce97d
commit fd5b929831
4 changed files with 13 additions and 8 deletions

View File

@ -136,7 +136,7 @@ void VisualServer::_free_internal_rids() {
if (test_material.is_valid())
free(test_material);
for (int i = 0; i < 16; i++) {
for (int i = 0; i < 32; i++) {
if (material_2d[i].is_valid())
free(material_2d[i]);
}
@ -283,7 +283,7 @@ RID VisualServer::make_sphere_mesh(int p_lats, int p_lons, float p_radius) {
return mesh;
}
RID VisualServer::material_2d_get(bool p_shaded, bool p_transparent, bool p_cut_alpha, bool p_opaque_prepass) {
RID VisualServer::material_2d_get(bool p_shaded, bool p_transparent, bool p_double_sided, bool p_cut_alpha, bool p_opaque_prepass) {
int version = 0;
if (p_shaded)
@ -294,6 +294,8 @@ RID VisualServer::material_2d_get(bool p_shaded, bool p_transparent, bool p_cut_
version |= 4;
if (p_opaque_prepass)
version |= 8;
if (p_double_sided)
version |= 16;
if (material_2d[version].is_valid())
return material_2d[version];
@ -304,7 +306,7 @@ RID VisualServer::material_2d_get(bool p_shaded, bool p_transparent, bool p_cut_
fixed_material_set_flag(material_2d[version],FIXED_MATERIAL_FLAG_USE_COLOR_ARRAY,true);
fixed_material_set_flag(material_2d[version],FIXED_MATERIAL_FLAG_DISCARD_ALPHA,p_cut_alpha);
material_set_flag(material_2d[version],MATERIAL_FLAG_UNSHADED,!p_shaded);
material_set_flag(material_2d[version],MATERIAL_FLAG_DOUBLE_SIDED,true);
material_set_flag(material_2d[version], MATERIAL_FLAG_DOUBLE_SIDED, p_double_sided);
material_set_depth_draw_mode(material_2d[version],p_opaque_prepass?MATERIAL_DEPTH_DRAW_OPAQUE_PRE_PASS_ALPHA:MATERIAL_DEPTH_DRAW_OPAQUE_ONLY);
fixed_material_set_texture(material_2d[version],FIXED_MATERIAL_PARAM_DIFFUSE,get_white_texture());
//material cut alpha?*/