summaryrefslogtreecommitdiffstats
path: root/scene/resources/texture.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2015-03-10 21:05:49 -0300
committerJuan Linietsky <reduzio@gmail.com>2015-03-10 21:05:49 -0300
commita6f96f46b779a815b03974fece21728fe32e88d2 (patch)
tree8f450cd516f009e38d9909255bbca283a8868368 /scene/resources/texture.cpp
parent57380f9aba2352755273acb9dcd5f20351e668ce (diff)
downloadredot-engine-a6f96f46b779a815b03974fece21728fe32e88d2.tar.gz
small optimizations to isometric light demo
should work faster, and even faster if exported.. as textures have been optimized.
Diffstat (limited to 'scene/resources/texture.cpp')
-rw-r--r--scene/resources/texture.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp
index 2c1502288b..8d3cbadd06 100644
--- a/scene/resources/texture.cpp
+++ b/scene/resources/texture.cpp
@@ -321,6 +321,13 @@ void ImageTexture::premultiply_alpha() {
}
}
+void ImageTexture::normal_to_xy() {
+
+ Image img = get_data();
+ img.normalmap_to_xy();
+ create_from_image(img,flags);
+}
+
bool ImageTexture::has_alpha() const {
return ( format==Image::FORMAT_GRAYSCALE_ALPHA || format==Image::FORMAT_INDEXED_ALPHA || format==Image::FORMAT_RGBA );
@@ -405,9 +412,11 @@ void ImageTexture::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_lossy_storage_quality"),&ImageTexture::get_lossy_storage_quality);
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("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::bind_method(_MD("_reload_hook","rid"),&ImageTexture::_reload_hook);