diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-06-18 00:03:28 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2017-06-18 00:03:28 -0300 |
commit | 33bf180067eb0beb1a514adcdfb6a59cc5f4ac55 (patch) | |
tree | 3296df4806a238a93521beec240de6829f6a6e73 /scene/2d/animated_sprite.cpp | |
parent | 5c6cac4e53058c987ca3c065ae49670e9cd9edbc (diff) | |
download | redot-engine-33bf180067eb0beb1a514adcdfb6a59cc5f4ac55.tar.gz |
Added normalmap support to stylebox and animated sprite.
Diffstat (limited to 'scene/2d/animated_sprite.cpp')
-rw-r--r-- | scene/2d/animated_sprite.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/scene/2d/animated_sprite.cpp b/scene/2d/animated_sprite.cpp index eba638b0f5..6a3238b64e 100644 --- a/scene/2d/animated_sprite.cpp +++ b/scene/2d/animated_sprite.cpp @@ -32,6 +32,8 @@ #include "scene/scene_string_names.h" #include "scene/scene_string_names.h" +#define NORMAL_SUFFIX "_normal" + //////////////////////////// void SpriteFrames::add_frame(const StringName &p_anim, const Ref<Texture> &p_frame, int p_at_pos) { @@ -82,6 +84,7 @@ void SpriteFrames::add_animation(const StringName &p_anim) { ERR_FAIL_COND(animations.has(p_anim)); animations[p_anim] = Anim(); + animations[p_anim].normal_name = String(p_anim) + NORMAL_SUFFIX; } bool SpriteFrames::has_animation(const StringName &p_anim) const { @@ -101,6 +104,7 @@ void SpriteFrames::rename_animation(const StringName &p_prev, const StringName & Anim anim = animations[p_prev]; animations.erase(p_prev); animations[p_next] = anim; + animations[p_next].normal_name = String(p_next) + NORMAL_SUFFIX; } Vector<String> SpriteFrames::_get_animation_list() const { @@ -374,6 +378,8 @@ void AnimatedSprite::_notification(int p_what) { return; } + Ref<Texture> normal = frames->get_normal_frame(animation, frame); + //print_line("DECIDED TO DRAW"); RID ci = get_canvas_item(); @@ -400,7 +406,7 @@ void AnimatedSprite::_notification(int p_what) { dst_rect.size.y = -dst_rect.size.y; //texture->draw_rect(ci,dst_rect,false,modulate); - texture->draw_rect_region(ci, dst_rect, Rect2(Vector2(), texture->get_size())); + texture->draw_rect_region(ci, dst_rect, Rect2(Vector2(), texture->get_size()), Color(1, 1, 1), false, normal); //VisualServer::get_singleton()->canvas_item_add_texture_rect_region(ci,dst_rect,texture->get_rid(),src_rect,modulate); } break; |