diff options
author | Juan Linietsky <reduzio@gmail.com> | 2015-12-02 11:15:48 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2015-12-02 11:15:48 -0300 |
commit | 4b1f0afb014cae7c9a84c8d7c0429f45f425214b (patch) | |
tree | e9cbbafa5f117bda785eff261e9eb8f7a1b41af5 /scene/resources | |
parent | 7ac31a7209e0be79a9d5c7c91cd35228821c545d (diff) |
-several fixes to Android to work better on Tegra 3/4 devices, uses 16 bits FBOs so all 2D shader effects should now work in every single Android device.
Diffstat (limited to 'scene/resources')
-rw-r--r-- | scene/resources/texture.cpp | 13 | ||||
-rw-r--r-- | scene/resources/texture.h | 1 |
2 files changed, 14 insertions, 0 deletions
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index 994473f11e..5df3d64d1a 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -329,6 +329,16 @@ void ImageTexture::normal_to_xy() { create_from_image(img,flags); } +void ImageTexture::shrink_x2_and_keep_size() { + + Size2 sizeov=get_size(); + Image img = get_data(); + img.resize(img.get_width()/2,img.get_height()/2,Image::INTERPOLATE_BILINEAR); + create_from_image(img,flags); + set_size_override(sizeov); + +} + bool ImageTexture::has_alpha() const { return ( format==Image::FORMAT_GRAYSCALE_ALPHA || format==Image::FORMAT_INDEXED_ALPHA || format==Image::FORMAT_RGBA ); @@ -424,10 +434,13 @@ void ImageTexture::_bind_methods() { ObjectTypeDB::bind_method(_MD("fix_alpha_edges"),&ImageTexture::fix_alpha_edges); ObjectTypeDB::bind_method(_MD("premultiply_alpha"),&ImageTexture::premultiply_alpha); ObjectTypeDB::bind_method(_MD("normal_to_xy"),&ImageTexture::normal_to_xy); + ObjectTypeDB::bind_method(_MD("shrink_x2_and_keep_size"),&ImageTexture::shrink_x2_and_keep_size); + ObjectTypeDB::bind_method(_MD("set_size_override","size"),&ImageTexture::set_size_override); ObjectTypeDB::set_method_flags(get_type_static(),_SCS("fix_alpha_edges"),METHOD_FLAGS_DEFAULT|METHOD_FLAG_EDITOR); ObjectTypeDB::set_method_flags(get_type_static(),_SCS("premultiply_alpha"),METHOD_FLAGS_DEFAULT|METHOD_FLAG_EDITOR); ObjectTypeDB::set_method_flags(get_type_static(),_SCS("normal_to_xy"),METHOD_FLAGS_DEFAULT|METHOD_FLAG_EDITOR); + ObjectTypeDB::set_method_flags(get_type_static(),_SCS("shrink_x2_and_keep_size"),METHOD_FLAGS_DEFAULT|METHOD_FLAG_EDITOR); ObjectTypeDB::bind_method(_MD("_reload_hook","rid"),&ImageTexture::_reload_hook); diff --git a/scene/resources/texture.h b/scene/resources/texture.h index 1a4f211af1..3be13bf815 100644 --- a/scene/resources/texture.h +++ b/scene/resources/texture.h @@ -148,6 +148,7 @@ public: void fix_alpha_edges(); void premultiply_alpha(); void normal_to_xy(); + void shrink_x2_and_keep_size(); void set_size_override(const Size2& p_size); |