summaryrefslogtreecommitdiff
path: root/servers/visual_server.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'servers/visual_server.cpp')
-rw-r--r--servers/visual_server.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp
index 6c57275b3a..c3ae58cf4f 100644
--- a/servers/visual_server.cpp
+++ b/servers/visual_server.cpp
@@ -137,7 +137,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]);
}
@@ -284,7 +284,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)
@@ -295,6 +295,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];
@@ -305,7 +307,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?*/