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 /scene/3d | |
parent | 5a6ccce97d350011b599e793cea95aa4e7899395 (diff) |
Add double-sided flag to SpriteBase3D (fixes #8007)
Diffstat (limited to 'scene/3d')
-rw-r--r-- | scene/3d/sprite_3d.cpp | 8 | ||||
-rw-r--r-- | scene/3d/sprite_3d.h | 1 |
2 files changed, 6 insertions, 3 deletions
diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp index e97b22f9e0..c37ce98be8 100644 --- a/scene/3d/sprite_3d.cpp +++ b/scene/3d/sprite_3d.cpp @@ -273,10 +273,12 @@ void SpriteBase3D::_bind_methods() { ADD_GROUP("Flags", ""); ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "transparent"), "set_draw_flag", "get_draw_flag", FLAG_TRANSPARENT); ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "shaded"), "set_draw_flag", "get_draw_flag", FLAG_SHADED); + ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "double_sided"), "set_draw_flag", "get_draw_flag", FLAG_DOUBLE_SIDED); ADD_PROPERTY(PropertyInfo(Variant::INT, "alpha_cut", PROPERTY_HINT_ENUM, "Disabled,Discard,Opaque Pre-Pass"), "set_alpha_cut_mode", "get_alpha_cut_mode"); BIND_CONSTANT(FLAG_TRANSPARENT); BIND_CONSTANT(FLAG_SHADED); + BIND_CONSTANT(FLAG_DOUBLE_SIDED); BIND_CONSTANT(FLAG_MAX); BIND_CONSTANT(ALPHA_CUT_DISABLED); @@ -294,7 +296,7 @@ SpriteBase3D::SpriteBase3D() { pI = NULL; for (int i = 0; i < FLAG_MAX; i++) - flags[i] = i == FLAG_TRANSPARENT; + flags[i] = i == FLAG_TRANSPARENT || i == FLAG_DOUBLE_SIDED; axis = Vector3::AXIS_Z; pixel_size = 0.01; @@ -387,7 +389,7 @@ void Sprite3D::_draw() { int axis = get_axis(); normal[axis] = 1.0; - RID mat = VS::get_singleton()->material_2d_get(get_draw_flag(FLAG_SHADED), get_draw_flag(FLAG_TRANSPARENT), get_alpha_cut_mode() == ALPHA_CUT_DISCARD, get_alpha_cut_mode() == ALPHA_CUT_OPAQUE_PREPASS); + RID mat = VS::get_singleton()->material_2d_get(get_draw_flag(FLAG_SHADED), get_draw_flag(FLAG_TRANSPARENT), get_draw_flag(FLAG_DOUBLE_SIDED), get_alpha_cut_mode() == ALPHA_CUT_DISCARD, get_alpha_cut_mode() == ALPHA_CUT_OPAQUE_PREPASS); VS::get_singleton()->immediate_set_material(immediate, mat); VS::get_singleton()->immediate_begin(immediate, VS::PRIMITIVE_TRIANGLE_FAN, texture->get_rid()); @@ -888,7 +890,7 @@ void AnimatedSprite3D::_draw() { int axis = get_axis(); normal[axis] = 1.0; - RID mat = VS::get_singleton()->material_2d_get(get_draw_flag(FLAG_SHADED), get_draw_flag(FLAG_TRANSPARENT), get_alpha_cut_mode() == ALPHA_CUT_DISCARD, get_alpha_cut_mode() == ALPHA_CUT_OPAQUE_PREPASS); + RID mat = VS::get_singleton()->material_2d_get(get_draw_flag(FLAG_SHADED), get_draw_flag(FLAG_TRANSPARENT), get_draw_flag(FLAG_DOUBLE_SIDED), get_alpha_cut_mode() == ALPHA_CUT_DISCARD, get_alpha_cut_mode() == ALPHA_CUT_OPAQUE_PREPASS); VS::get_singleton()->immediate_set_material(immediate, mat); VS::get_singleton()->immediate_begin(immediate, VS::PRIMITIVE_TRIANGLE_FAN, texture->get_rid()); diff --git a/scene/3d/sprite_3d.h b/scene/3d/sprite_3d.h index 625b37c32e..b4600c00b8 100644 --- a/scene/3d/sprite_3d.h +++ b/scene/3d/sprite_3d.h @@ -41,6 +41,7 @@ public: enum DrawFlags { FLAG_TRANSPARENT, FLAG_SHADED, + FLAG_DOUBLE_SIDED, FLAG_MAX }; |