diff options
author | Andrea Faulds <ajf@ajf.me> | 2017-04-17 02:32:51 +0100 |
---|---|---|
committer | Andrea Faulds <ajf@ajf.me> | 2017-05-02 21:03:17 +0100 |
commit | fd5b92983127d790e3422a1853992a16102e0a05 (patch) | |
tree | fca7fc659af5a7df696102500324d469cd37d585 /servers | |
parent | 5a6ccce97d350011b599e793cea95aa4e7899395 (diff) |
Add double-sided flag to SpriteBase3D (fixes #8007)
Diffstat (limited to 'servers')
-rw-r--r-- | servers/visual_server.cpp | 8 | ||||
-rw-r--r-- | servers/visual_server.h | 4 |
2 files changed, 7 insertions, 5 deletions
diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp index 5a7ae93a31..20906d0239 100644 --- a/servers/visual_server.cpp +++ b/servers/visual_server.cpp @@ -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?*/ diff --git a/servers/visual_server.h b/servers/visual_server.h index 7accc7d904..f21271122d 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -59,7 +59,7 @@ protected: RID test_texture; RID white_texture; RID test_material; - RID material_2d[16]; + RID material_2d[32]; Error _surface_set_data(Array p_arrays, uint32_t p_format, uint32_t *p_offsets, uint32_t p_stride, PoolVector<uint8_t> &r_vertex_array, int p_vertex_array_len, PoolVector<uint8_t> &r_index_array, int p_index_array_len, Rect3 &r_aabb, Vector<Rect3> r_bone_aabb); @@ -870,7 +870,7 @@ public: /* Materials for 2D on 3D */ - RID material_2d_get(bool p_shaded, bool p_transparent, bool p_cut_alpha, bool p_opaque_prepass); + RID material_2d_get(bool p_shaded, bool p_transparent, bool p_double_sided, bool p_cut_alpha, bool p_opaque_prepass); /* TESTING */ |