diff options
author | Juan Linietsky <reduzio@gmail.com> | 2015-06-24 18:15:43 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2015-06-24 18:15:43 -0300 |
commit | 52308aba68516d4b4ca29a176d6053cf3f623ce4 (patch) | |
tree | f6e7bb32ca38060e508fcd55ce5cd77d5c1b722f /scene/2d | |
parent | 48f1d02da4795ba9d485fe5fe2bea907be2fc467 (diff) |
ability to change shadow color in light2d
Diffstat (limited to 'scene/2d')
-rw-r--r-- | scene/2d/light_2d.cpp | 16 | ||||
-rw-r--r-- | scene/2d/light_2d.h | 5 |
2 files changed, 21 insertions, 0 deletions
diff --git a/scene/2d/light_2d.cpp b/scene/2d/light_2d.cpp index c0ab544d42..852a6fb46b 100644 --- a/scene/2d/light_2d.cpp +++ b/scene/2d/light_2d.cpp @@ -237,6 +237,16 @@ float Light2D::get_shadow_esm_multiplier() const{ return shadow_esm_multiplier; } +void Light2D::set_shadow_color( const Color& p_shadow_color) { + shadow_color=p_shadow_color; + VS::get_singleton()->canvas_light_set_shadow_color(canvas_light,shadow_color); +} + +Color Light2D::get_shadow_color() const { + return shadow_color; +} + + void Light2D::_notification(int p_what) { @@ -313,6 +323,10 @@ void Light2D::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_shadow_esm_multiplier","multiplier"),&Light2D::set_shadow_esm_multiplier); ObjectTypeDB::bind_method(_MD("get_shadow_esm_multiplier"),&Light2D::get_shadow_esm_multiplier); + ObjectTypeDB::bind_method(_MD("set_shadow_color","shadow_color"),&Light2D::set_shadow_color); + ObjectTypeDB::bind_method(_MD("get_shadow_color"),&Light2D::get_shadow_color); + + ADD_PROPERTY( PropertyInfo(Variant::BOOL,"enabled"),_SCS("set_enabled"),_SCS("is_enabled")); ADD_PROPERTY( PropertyInfo(Variant::OBJECT,"texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture")); ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"offset"),_SCS("set_texture_offset"),_SCS("get_texture_offset")); @@ -327,6 +341,7 @@ void Light2D::_bind_methods() { ADD_PROPERTY( PropertyInfo(Variant::INT,"range/layer_max",PROPERTY_HINT_RANGE,"-512,512,1"),_SCS("set_layer_range_max"),_SCS("get_layer_range_max")); ADD_PROPERTY( PropertyInfo(Variant::INT,"range/item_mask",PROPERTY_HINT_ALL_FLAGS),_SCS("set_item_mask"),_SCS("get_item_mask")); ADD_PROPERTY( PropertyInfo(Variant::BOOL,"shadow/enabled"),_SCS("set_shadow_enabled"),_SCS("is_shadow_enabled")); + ADD_PROPERTY( PropertyInfo(Variant::COLOR,"shadow/color"),_SCS("set_shadow_color"),_SCS("get_shadow_color")); ADD_PROPERTY( PropertyInfo(Variant::INT,"shadow/buffer_size",PROPERTY_HINT_RANGE,"32,16384,1"),_SCS("set_shadow_buffer_size"),_SCS("get_shadow_buffer_size")); ADD_PROPERTY( PropertyInfo(Variant::REAL,"shadow/esm_multiplier",PROPERTY_HINT_RANGE,"1,4096,0.1"),_SCS("set_shadow_esm_multiplier"),_SCS("get_shadow_esm_multiplier")); ADD_PROPERTY( PropertyInfo(Variant::INT,"shadow/item_mask",PROPERTY_HINT_ALL_FLAGS),_SCS("set_item_shadow_mask"),_SCS("get_item_shadow_mask")); @@ -356,6 +371,7 @@ Light2D::Light2D() { shadow_buffer_size=2048; shadow_esm_multiplier=80; energy=1.0; + shadow_color=Color(0,0,0,0); } diff --git a/scene/2d/light_2d.h b/scene/2d/light_2d.h index ef875aec2f..bf61868bac 100644 --- a/scene/2d/light_2d.h +++ b/scene/2d/light_2d.h @@ -18,6 +18,7 @@ private: bool enabled; bool shadow; Color color; + Color shadow_color; float height; float _scale; float energy; @@ -95,6 +96,10 @@ public: void set_shadow_esm_multiplier( float p_multiplier); float get_shadow_esm_multiplier() const; + void set_shadow_color( const Color& p_shadow_color); + Color get_shadow_color() const; + + virtual Rect2 get_item_rect() const; Light2D(); |