| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | /*************************************************************************/ | 
					
						
							|  |  |  | /*  texture.h                                                            */ | 
					
						
							|  |  |  | /*************************************************************************/ | 
					
						
							|  |  |  | /*                       This file is part of:                           */ | 
					
						
							|  |  |  | /*                           GODOT ENGINE                                */ | 
					
						
							| 
									
										
										
										
											2017-08-27 14:16:55 +02:00
										 |  |  | /*                      https://godotengine.org                          */ | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | /*************************************************************************/ | 
					
						
							| 
									
										
										
										
											2020-01-01 11:16:22 +01:00
										 |  |  | /* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur.                 */ | 
					
						
							|  |  |  | /* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md).   */ | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | /*                                                                       */ | 
					
						
							|  |  |  | /* Permission is hereby granted, free of charge, to any person obtaining */ | 
					
						
							|  |  |  | /* a copy of this software and associated documentation files (the       */ | 
					
						
							|  |  |  | /* "Software"), to deal in the Software without restriction, including   */ | 
					
						
							|  |  |  | /* without limitation the rights to use, copy, modify, merge, publish,   */ | 
					
						
							|  |  |  | /* distribute, sublicense, and/or sell copies of the Software, and to    */ | 
					
						
							|  |  |  | /* permit persons to whom the Software is furnished to do so, subject to */ | 
					
						
							|  |  |  | /* the following conditions:                                             */ | 
					
						
							|  |  |  | /*                                                                       */ | 
					
						
							|  |  |  | /* The above copyright notice and this permission notice shall be        */ | 
					
						
							|  |  |  | /* included in all copies or substantial portions of the Software.       */ | 
					
						
							|  |  |  | /*                                                                       */ | 
					
						
							|  |  |  | /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       */ | 
					
						
							|  |  |  | /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    */ | 
					
						
							|  |  |  | /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ | 
					
						
							|  |  |  | /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  */ | 
					
						
							|  |  |  | /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  */ | 
					
						
							|  |  |  | /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     */ | 
					
						
							|  |  |  | /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */ | 
					
						
							|  |  |  | /*************************************************************************/ | 
					
						
							| 
									
										
										
										
											2018-01-05 00:50:27 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | #ifndef TEXTURE_H
 | 
					
						
							|  |  |  | #define TEXTURE_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-11 18:13:45 +02:00
										 |  |  | #include "core/io/resource_loader.h"
 | 
					
						
							|  |  |  | #include "core/math/rect2.h"
 | 
					
						
							| 
									
										
										
										
											2019-09-26 23:16:44 -03:00
										 |  |  | #include "core/os/file_access.h"
 | 
					
						
							| 
									
										
										
										
											2018-09-11 18:13:45 +02:00
										 |  |  | #include "core/os/mutex.h"
 | 
					
						
							|  |  |  | #include "core/os/rw_lock.h"
 | 
					
						
							|  |  |  | #include "core/os/thread_safe.h"
 | 
					
						
							|  |  |  | #include "core/resource.h"
 | 
					
						
							| 
									
										
										
										
											2018-09-13 22:54:35 +02:00
										 |  |  | #include "scene/resources/curve.h"
 | 
					
						
							| 
									
										
										
										
											2019-02-12 17:18:13 +01:00
										 |  |  | #include "scene/resources/gradient.h"
 | 
					
						
							| 
									
										
										
										
											2017-08-21 00:17:24 +10:00
										 |  |  | #include "servers/camera_server.h"
 | 
					
						
							| 
									
										
										
										
											2020-03-27 15:21:27 -03:00
										 |  |  | #include "servers/rendering_server.h"
 | 
					
						
							| 
									
										
										
										
											2018-09-13 22:54:35 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-19 17:03:19 -03:00
										 |  |  | class Texture : public Resource { | 
					
						
							|  |  |  | 	GDCLASS(Texture, Resource); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  | 	Texture() {} | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class Texture2D : public Texture { | 
					
						
							| 
									
										
										
										
											2020-02-16 20:17:22 +03:00
										 |  |  | 	GDCLASS(Texture2D, Texture); | 
					
						
							| 
									
										
										
										
											2019-06-11 15:43:37 -03:00
										 |  |  | 	OBJ_SAVE_TYPE(Texture2D); // Saves derived classes with common type so they can be interchanged.
 | 
					
						
							| 
									
										
										
										
											2020-01-26 11:24:14 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | protected: | 
					
						
							|  |  |  | 	static void _bind_methods(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | public: | 
					
						
							|  |  |  | 	virtual int get_width() const = 0; | 
					
						
							|  |  |  | 	virtual int get_height() const = 0; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	virtual Size2 get_size() const; | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	virtual RID get_rid() const = 0; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-23 22:10:15 -03:00
										 |  |  | 	virtual bool is_pixel_opaque(int p_x, int p_y) const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	virtual bool has_alpha() const = 0; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-27 15:21:27 -03:00
										 |  |  | 	virtual void draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const; | 
					
						
							|  |  |  | 	virtual void draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const; | 
					
						
							|  |  |  | 	virtual void draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT, bool p_clip_uv = true) const; | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	virtual bool get_rect_region(const Rect2 &p_rect, const Rect2 &p_src_rect, Rect2 &r_rect, Rect2 &r_src_rect) const; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-17 07:36:47 -03:00
										 |  |  | 	virtual Ref<Image> get_data() const { return Ref<Image>(); } | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-11 15:43:37 -03:00
										 |  |  | 	Texture2D(); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-23 22:10:15 -03:00
										 |  |  | class BitMap; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-11 15:43:37 -03:00
										 |  |  | class ImageTexture : public Texture2D { | 
					
						
							|  |  |  | 	GDCLASS(ImageTexture, Texture2D); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	RES_BASE_EXTENSION("tex"); | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-11 15:43:37 -03:00
										 |  |  | 	mutable RID texture; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	Image::Format format; | 
					
						
							| 
									
										
										
										
											2019-06-11 15:43:37 -03:00
										 |  |  | 	bool mipmaps; | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	int w, h; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	Size2 size_override; | 
					
						
							| 
									
										
										
										
											2018-08-23 22:10:15 -03:00
										 |  |  | 	mutable Ref<BitMap> alpha_cache; | 
					
						
							| 
									
										
										
										
											2019-02-21 20:49:42 -03:00
										 |  |  | 	bool image_stored; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-09 00:00:52 +01:00
										 |  |  | protected: | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	virtual void reload_from_file(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	bool _set(const StringName &p_name, const Variant &p_value); | 
					
						
							|  |  |  | 	bool _get(const StringName &p_name, Variant &r_ret) const; | 
					
						
							|  |  |  | 	void _get_property_list(List<PropertyInfo> *p_list) const; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	void _reload_hook(const RID &p_hook); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	virtual void _resource_path_changed(); | 
					
						
							|  |  |  | 	static void _bind_methods(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2019-06-11 15:43:37 -03:00
										 |  |  | 	void create_from_image(const Ref<Image> &p_image); | 
					
						
							| 
									
										
										
										
											2016-03-09 00:00:52 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	Image::Format get_format() const; | 
					
						
							| 
									
										
										
										
											2019-06-11 15:43:37 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	void update(const Ref<Image> &p_image, bool p_immediate = false); | 
					
						
							| 
									
										
										
										
											2017-05-17 07:36:47 -03:00
										 |  |  | 	Ref<Image> get_data() const; | 
					
						
							| 
									
										
										
										
											2016-03-09 00:00:52 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	int get_width() const; | 
					
						
							|  |  |  | 	int get_height() const; | 
					
						
							| 
									
										
										
										
											2016-03-09 00:00:52 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	virtual RID get_rid() const; | 
					
						
							| 
									
										
										
										
											2016-03-09 00:00:52 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	bool has_alpha() const; | 
					
						
							| 
									
										
										
										
											2020-03-27 15:21:27 -03:00
										 |  |  | 	virtual void draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const; | 
					
						
							|  |  |  | 	virtual void draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const; | 
					
						
							|  |  |  | 	virtual void draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT, bool p_clip_uv = true) const; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-23 22:10:15 -03:00
										 |  |  | 	bool is_pixel_opaque(int p_x, int p_y) const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	void set_size_override(const Size2 &p_size); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	virtual void set_path(const String &p_path, bool p_take_over = false); | 
					
						
							| 
									
										
										
										
											2015-10-21 09:50:44 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	ImageTexture(); | 
					
						
							|  |  |  | 	~ImageTexture(); | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-01 09:34:23 -03:00
										 |  |  | class StreamTexture2D : public Texture2D { | 
					
						
							|  |  |  | 	GDCLASS(StreamTexture2D, Texture2D); | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-01 09:45:45 -03:00
										 |  |  | public: | 
					
						
							|  |  |  | 	enum DataFormat { | 
					
						
							|  |  |  | 		DATA_FORMAT_IMAGE, | 
					
						
							|  |  |  | 		DATA_FORMAT_LOSSLESS, | 
					
						
							| 
									
										
										
										
											2019-09-26 23:16:44 -03:00
										 |  |  | 		DATA_FORMAT_LOSSY, | 
					
						
							|  |  |  | 		DATA_FORMAT_BASIS_UNIVERSAL, | 
					
						
							|  |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	enum { | 
					
						
							|  |  |  | 		FORMAT_VERSION = 1 | 
					
						
							| 
									
										
										
										
											2017-02-01 09:45:45 -03:00
										 |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	enum FormatBits { | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 		FORMAT_MASK_IMAGE_FORMAT = (1 << 20) - 1, | 
					
						
							|  |  |  | 		FORMAT_BIT_LOSSLESS = 1 << 20, | 
					
						
							|  |  |  | 		FORMAT_BIT_LOSSY = 1 << 21, | 
					
						
							|  |  |  | 		FORMAT_BIT_STREAM = 1 << 22, | 
					
						
							|  |  |  | 		FORMAT_BIT_HAS_MIPMAPS = 1 << 23, | 
					
						
							|  |  |  | 		FORMAT_BIT_DETECT_3D = 1 << 24, | 
					
						
							| 
									
										
										
										
											2019-06-11 15:43:37 -03:00
										 |  |  | 		//FORMAT_BIT_DETECT_SRGB = 1 << 25,
 | 
					
						
							| 
									
										
										
										
											2017-06-16 21:47:28 -03:00
										 |  |  | 		FORMAT_BIT_DETECT_NORMAL = 1 << 26, | 
					
						
							| 
									
										
										
										
											2019-06-11 15:43:37 -03:00
										 |  |  | 		FORMAT_BIT_DETECT_ROUGNESS = 1 << 27, | 
					
						
							| 
									
										
										
										
											2017-02-01 09:45:45 -03:00
										 |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2019-09-26 23:16:44 -03:00
										 |  |  | 	Error _load_data(const String &p_path, int &tw, int &th, int &tw_custom, int &th_custom, Ref<Image> &image, bool &r_request_3d, bool &r_request_normal, bool &r_request_roughness, int &mipmap_limit, int p_size_limit = 0); | 
					
						
							| 
									
										
										
										
											2017-02-01 09:45:45 -03:00
										 |  |  | 	String path_to_file; | 
					
						
							| 
									
										
										
										
											2019-06-11 15:43:37 -03:00
										 |  |  | 	mutable RID texture; | 
					
						
							| 
									
										
										
										
											2017-02-01 09:45:45 -03:00
										 |  |  | 	Image::Format format; | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	int w, h; | 
					
						
							| 
									
										
										
										
											2018-08-23 22:10:15 -03:00
										 |  |  | 	mutable Ref<BitMap> alpha_cache; | 
					
						
							| 
									
										
										
										
											2017-02-01 09:45:45 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	virtual void reload_from_file(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	static void _requested_3d(void *p_ud); | 
					
						
							| 
									
										
										
										
											2020-03-27 15:21:27 -03:00
										 |  |  | 	static void _requested_roughness(void *p_ud, const String &p_normal_path, RS::TextureDetectRoughnessChannel p_roughness_channel); | 
					
						
							| 
									
										
										
										
											2017-06-16 21:47:28 -03:00
										 |  |  | 	static void _requested_normal(void *p_ud); | 
					
						
							| 
									
										
										
										
											2017-02-06 00:38:39 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-01 09:45:45 -03:00
										 |  |  | protected: | 
					
						
							|  |  |  | 	static void _bind_methods(); | 
					
						
							| 
									
										
										
										
											2019-03-06 12:50:24 -03:00
										 |  |  | 	void _validate_property(PropertyInfo &property) const; | 
					
						
							| 
									
										
										
										
											2017-02-01 09:45:45 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2019-09-26 23:16:44 -03:00
										 |  |  | 	static Ref<Image> load_image_from_file(FileAccess *p_file, int p_size_limit); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-01 09:34:23 -03:00
										 |  |  | 	typedef void (*TextureFormatRequestCallback)(const Ref<StreamTexture2D> &); | 
					
						
							|  |  |  | 	typedef void (*TextureFormatRoughnessRequestCallback)(const Ref<StreamTexture2D> &, const String &p_normal_path, RS::TextureDetectRoughnessChannel p_roughness_channel); | 
					
						
							| 
									
										
										
										
											2017-02-06 00:38:39 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	static TextureFormatRequestCallback request_3d_callback; | 
					
						
							| 
									
										
										
										
											2019-06-11 15:43:37 -03:00
										 |  |  | 	static TextureFormatRoughnessRequestCallback request_roughness_callback; | 
					
						
							| 
									
										
										
										
											2017-06-16 21:47:28 -03:00
										 |  |  | 	static TextureFormatRequestCallback request_normal_callback; | 
					
						
							| 
									
										
										
										
											2017-02-06 00:38:39 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-01 09:45:45 -03:00
										 |  |  | 	Image::Format get_format() const; | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	Error load(const String &p_path); | 
					
						
							| 
									
										
										
										
											2017-02-01 09:45:45 -03:00
										 |  |  | 	String get_load_path() const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	int get_width() const; | 
					
						
							|  |  |  | 	int get_height() const; | 
					
						
							|  |  |  | 	virtual RID get_rid() const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-29 13:40:29 +02:00
										 |  |  | 	virtual void set_path(const String &p_path, bool p_take_over); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-27 15:21:27 -03:00
										 |  |  | 	virtual void draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const; | 
					
						
							|  |  |  | 	virtual void draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const; | 
					
						
							|  |  |  | 	virtual void draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT, bool p_clip_uv = true) const; | 
					
						
							| 
									
										
										
										
											2017-02-01 09:45:45 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	virtual bool has_alpha() const; | 
					
						
							| 
									
										
										
										
											2018-08-23 22:10:15 -03:00
										 |  |  | 	bool is_pixel_opaque(int p_x, int p_y) const; | 
					
						
							| 
									
										
										
										
											2017-02-01 09:45:45 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-17 07:36:47 -03:00
										 |  |  | 	virtual Ref<Image> get_data() const; | 
					
						
							| 
									
										
										
										
											2017-02-15 08:29:46 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-01 09:34:23 -03:00
										 |  |  | 	StreamTexture2D(); | 
					
						
							|  |  |  | 	~StreamTexture2D(); | 
					
						
							| 
									
										
										
										
											2017-02-01 09:45:45 -03:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-01 09:34:23 -03:00
										 |  |  | class ResourceFormatLoaderStreamTexture2D : public ResourceFormatLoader { | 
					
						
							| 
									
										
										
										
											2017-02-01 09:45:45 -03:00
										 |  |  | public: | 
					
						
							| 
									
										
										
										
											2020-04-19 23:19:21 -03:00
										 |  |  | 	virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, bool p_no_cache = false); | 
					
						
							| 
									
										
										
										
											2017-02-01 09:45:45 -03:00
										 |  |  | 	virtual void get_recognized_extensions(List<String> *p_extensions) const; | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	virtual bool handles_type(const String &p_type) const; | 
					
						
							| 
									
										
										
										
											2017-02-01 09:45:45 -03:00
										 |  |  | 	virtual String get_resource_type(const String &p_path) const; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-11 15:43:37 -03:00
										 |  |  | class AtlasTexture : public Texture2D { | 
					
						
							|  |  |  | 	GDCLASS(AtlasTexture, Texture2D); | 
					
						
							| 
									
										
										
										
											2017-06-15 19:44:11 -03:00
										 |  |  | 	RES_BASE_EXTENSION("atlastex"); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | protected: | 
					
						
							| 
									
										
										
										
											2019-06-11 15:43:37 -03:00
										 |  |  | 	Ref<Texture2D> atlas; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	Rect2 region; | 
					
						
							|  |  |  | 	Rect2 margin; | 
					
						
							| 
									
										
										
										
											2017-11-05 21:45:36 +01:00
										 |  |  | 	bool filter_clip; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	static void _bind_methods(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | public: | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	virtual int get_width() const; | 
					
						
							|  |  |  | 	virtual int get_height() const; | 
					
						
							|  |  |  | 	virtual RID get_rid() const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	virtual bool has_alpha() const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-11 15:43:37 -03:00
										 |  |  | 	void set_atlas(const Ref<Texture2D> &p_atlas); | 
					
						
							|  |  |  | 	Ref<Texture2D> get_atlas() const; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	void set_region(const Rect2 &p_region); | 
					
						
							|  |  |  | 	Rect2 get_region() const; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	void set_margin(const Rect2 &p_margin); | 
					
						
							|  |  |  | 	Rect2 get_margin() const; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-05 21:45:36 +01:00
										 |  |  | 	void set_filter_clip(const bool p_enable); | 
					
						
							|  |  |  | 	bool has_filter_clip() const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-27 15:21:27 -03:00
										 |  |  | 	virtual void draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const; | 
					
						
							|  |  |  | 	virtual void draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const; | 
					
						
							|  |  |  | 	virtual void draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT, bool p_clip_uv = true) const; | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	virtual bool get_rect_region(const Rect2 &p_rect, const Rect2 &p_src_rect, Rect2 &r_rect, Rect2 &r_src_rect) const; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-23 22:10:15 -03:00
										 |  |  | 	bool is_pixel_opaque(int p_x, int p_y) const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	AtlasTexture(); | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-19 15:54:33 -03:00
										 |  |  | class Mesh; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-11 15:43:37 -03:00
										 |  |  | class MeshTexture : public Texture2D { | 
					
						
							|  |  |  | 	GDCLASS(MeshTexture, Texture2D); | 
					
						
							| 
									
										
										
										
											2019-04-19 15:54:33 -03:00
										 |  |  | 	RES_BASE_EXTENSION("meshtex"); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-11 15:43:37 -03:00
										 |  |  | 	Ref<Texture2D> base_texture; | 
					
						
							| 
									
										
										
										
											2019-04-19 15:54:33 -03:00
										 |  |  | 	Ref<Mesh> mesh; | 
					
						
							|  |  |  | 	Size2i size; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | protected: | 
					
						
							|  |  |  | 	static void _bind_methods(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  | 	virtual int get_width() const; | 
					
						
							|  |  |  | 	virtual int get_height() const; | 
					
						
							|  |  |  | 	virtual RID get_rid() const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	virtual bool has_alpha() const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	void set_mesh(const Ref<Mesh> &p_mesh); | 
					
						
							|  |  |  | 	Ref<Mesh> get_mesh() const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	void set_image_size(const Size2 &p_size); | 
					
						
							|  |  |  | 	Size2 get_image_size() const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-11 15:43:37 -03:00
										 |  |  | 	void set_base_texture(const Ref<Texture2D> &p_texture); | 
					
						
							|  |  |  | 	Ref<Texture2D> get_base_texture() const; | 
					
						
							| 
									
										
										
										
											2019-04-19 15:54:33 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-27 15:21:27 -03:00
										 |  |  | 	virtual void draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const; | 
					
						
							|  |  |  | 	virtual void draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const; | 
					
						
							|  |  |  | 	virtual void draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT, bool p_clip_uv = true) const; | 
					
						
							| 
									
										
										
										
											2019-04-19 15:54:33 -03:00
										 |  |  | 	virtual bool get_rect_region(const Rect2 &p_rect, const Rect2 &p_src_rect, Rect2 &r_rect, Rect2 &r_src_rect) const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	bool is_pixel_opaque(int p_x, int p_y) const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	MeshTexture(); | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-11 15:43:37 -03:00
										 |  |  | class LargeTexture : public Texture2D { | 
					
						
							|  |  |  | 	GDCLASS(LargeTexture, Texture2D); | 
					
						
							| 
									
										
										
										
											2017-06-15 19:44:11 -03:00
										 |  |  | 	RES_BASE_EXTENSION("largetex"); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | protected: | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	struct Piece { | 
					
						
							|  |  |  | 		Point2 offset; | 
					
						
							| 
									
										
										
										
											2019-06-11 15:43:37 -03:00
										 |  |  | 		Ref<Texture2D> texture; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	Vector<Piece> pieces; | 
					
						
							|  |  |  | 	Size2i size; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	Array _get_data() const; | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	void _set_data(const Array &p_array); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	static void _bind_methods(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | public: | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	virtual int get_width() const; | 
					
						
							|  |  |  | 	virtual int get_height() const; | 
					
						
							|  |  |  | 	virtual RID get_rid() const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	virtual bool has_alpha() const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-11 15:43:37 -03:00
										 |  |  | 	int add_piece(const Point2 &p_offset, const Ref<Texture2D> &p_texture); | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	void set_piece_offset(int p_idx, const Point2 &p_offset); | 
					
						
							| 
									
										
										
										
											2019-06-11 15:43:37 -03:00
										 |  |  | 	void set_piece_texture(int p_idx, const Ref<Texture2D> &p_texture); | 
					
						
							| 
									
										
										
										
											2014-04-28 21:56:43 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	void set_size(const Size2 &p_size); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	void clear(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	int get_piece_count() const; | 
					
						
							|  |  |  | 	Vector2 get_piece_offset(int p_idx) const; | 
					
						
							| 
									
										
										
										
											2019-06-11 15:43:37 -03:00
										 |  |  | 	Ref<Texture2D> get_piece_texture(int p_idx) const; | 
					
						
							| 
									
										
										
										
											2019-01-03 13:08:06 +01:00
										 |  |  | 	Ref<Image> to_image() const; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-27 15:21:27 -03:00
										 |  |  | 	virtual void draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const; | 
					
						
							|  |  |  | 	virtual void draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const; | 
					
						
							|  |  |  | 	virtual void draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT, bool p_clip_uv = true) const; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-23 22:10:15 -03:00
										 |  |  | 	bool is_pixel_opaque(int p_x, int p_y) const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	LargeTexture(); | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-19 17:03:19 -03:00
										 |  |  | class TextureLayered : public Texture { | 
					
						
							| 
									
										
										
										
											2020-02-16 20:17:22 +03:00
										 |  |  | 	GDCLASS(TextureLayered, Texture); | 
					
						
							| 
									
										
										
										
											2018-06-26 13:59:26 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-01 09:34:23 -03:00
										 |  |  | protected: | 
					
						
							|  |  |  | 	static void _bind_methods(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  | 	enum LayeredType { | 
					
						
							|  |  |  | 		LAYERED_TYPE_2D_ARRAY, | 
					
						
							|  |  |  | 		LAYERED_TYPE_CUBEMAP, | 
					
						
							|  |  |  | 		LAYERED_TYPE_CUBEMAP_ARRAY | 
					
						
							|  |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	virtual Image::Format get_format() const = 0; | 
					
						
							|  |  |  | 	virtual LayeredType get_layered_type() const = 0; | 
					
						
							|  |  |  | 	virtual int get_width() const = 0; | 
					
						
							|  |  |  | 	virtual int get_height() const = 0; | 
					
						
							|  |  |  | 	virtual int get_layers() const = 0; | 
					
						
							|  |  |  | 	virtual bool has_mipmaps() const = 0; | 
					
						
							|  |  |  | 	virtual Ref<Image> get_layer_data(int p_layer) const = 0; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | VARIANT_ENUM_CAST(TextureLayered::LayeredType) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class ImageTextureLayered : public TextureLayered { | 
					
						
							|  |  |  | 	GDCLASS(ImageTextureLayered, TextureLayered); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	LayeredType layered_type; | 
					
						
							| 
									
										
										
										
											2018-06-26 13:59:26 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-11 15:43:37 -03:00
										 |  |  | 	mutable RID texture; | 
					
						
							| 
									
										
										
										
											2018-06-26 13:59:26 +02:00
										 |  |  | 	Image::Format format; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-06 14:56:06 -03:00
										 |  |  | 	int width; | 
					
						
							|  |  |  | 	int height; | 
					
						
							| 
									
										
										
										
											2019-06-11 15:43:37 -03:00
										 |  |  | 	int layers; | 
					
						
							|  |  |  | 	bool mipmaps; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	Error _create_from_images(const Array &p_images); | 
					
						
							| 
									
										
										
										
											2018-06-26 13:59:26 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-11 15:43:37 -03:00
										 |  |  | 	Array _get_images() const; | 
					
						
							| 
									
										
										
										
											2018-06-26 13:59:26 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | protected: | 
					
						
							|  |  |  | 	static void _bind_methods(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2020-05-01 09:34:23 -03:00
										 |  |  | 	virtual Image::Format get_format() const; | 
					
						
							|  |  |  | 	virtual int get_width() const; | 
					
						
							|  |  |  | 	virtual int get_height() const; | 
					
						
							|  |  |  | 	virtual int get_layers() const; | 
					
						
							|  |  |  | 	virtual bool has_mipmaps() const; | 
					
						
							|  |  |  | 	virtual LayeredType get_layered_type() const; | 
					
						
							| 
									
										
										
										
											2018-06-26 13:59:26 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-17 07:33:00 +01:00
										 |  |  | 	Error create_from_images(Vector<Ref<Image>> p_images); | 
					
						
							| 
									
										
										
										
											2019-06-11 15:43:37 -03:00
										 |  |  | 	void update_layer(const Ref<Image> &p_image, int p_layer); | 
					
						
							| 
									
										
										
										
											2020-05-01 09:34:23 -03:00
										 |  |  | 	virtual Ref<Image> get_layer_data(int p_layer) const; | 
					
						
							| 
									
										
										
										
											2018-06-26 13:59:26 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	virtual RID get_rid() const; | 
					
						
							| 
									
										
										
										
											2018-08-06 14:56:06 -03:00
										 |  |  | 	virtual void set_path(const String &p_path, bool p_take_over = false); | 
					
						
							| 
									
										
										
										
											2018-06-26 13:59:26 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-01 09:34:23 -03:00
										 |  |  | 	ImageTextureLayered(LayeredType p_layered_type); | 
					
						
							|  |  |  | 	~ImageTextureLayered(); | 
					
						
							| 
									
										
										
										
											2018-08-06 14:56:06 -03:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2018-06-26 13:59:26 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-01 09:34:23 -03:00
										 |  |  | class Texture2DArray : public ImageTextureLayered { | 
					
						
							|  |  |  | 	GDCLASS(Texture2DArray, ImageTextureLayered) | 
					
						
							| 
									
										
										
										
											2019-06-11 15:43:37 -03:00
										 |  |  | public: | 
					
						
							|  |  |  | 	Texture2DArray() : | 
					
						
							| 
									
										
										
										
											2020-05-01 09:34:23 -03:00
										 |  |  | 			ImageTextureLayered(LAYERED_TYPE_2D_ARRAY) {} | 
					
						
							| 
									
										
										
										
											2019-06-11 15:43:37 -03:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2018-06-26 13:59:26 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-01 09:34:23 -03:00
										 |  |  | class Cubemap : public ImageTextureLayered { | 
					
						
							|  |  |  | 	GDCLASS(Cubemap, ImageTextureLayered); | 
					
						
							| 
									
										
										
										
											2019-09-14 00:37:42 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-06 14:56:06 -03:00
										 |  |  | public: | 
					
						
							| 
									
										
										
										
											2019-06-11 15:43:37 -03:00
										 |  |  | 	Cubemap() : | 
					
						
							| 
									
										
										
										
											2020-05-01 09:34:23 -03:00
										 |  |  | 			ImageTextureLayered(LAYERED_TYPE_CUBEMAP) {} | 
					
						
							| 
									
										
										
										
											2018-08-06 14:56:06 -03:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2018-06-26 13:59:26 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-01 09:34:23 -03:00
										 |  |  | class CubemapArray : public ImageTextureLayered { | 
					
						
							|  |  |  | 	GDCLASS(CubemapArray, ImageTextureLayered); | 
					
						
							| 
									
										
										
										
											2019-09-14 00:37:42 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-06 14:56:06 -03:00
										 |  |  | public: | 
					
						
							| 
									
										
										
										
											2019-06-11 15:43:37 -03:00
										 |  |  | 	CubemapArray() : | 
					
						
							| 
									
										
										
										
											2020-05-01 09:34:23 -03:00
										 |  |  | 			ImageTextureLayered(LAYERED_TYPE_CUBEMAP_ARRAY) {} | 
					
						
							| 
									
										
										
										
											2018-08-06 14:56:06 -03:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-01 09:34:23 -03:00
										 |  |  | class StreamTextureLayered : public TextureLayered { | 
					
						
							|  |  |  | 	GDCLASS(StreamTextureLayered, TextureLayered); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-06 14:56:06 -03:00
										 |  |  | public: | 
					
						
							| 
									
										
										
										
											2020-05-01 09:34:23 -03:00
										 |  |  | 	enum DataFormat { | 
					
						
							|  |  |  | 		DATA_FORMAT_IMAGE, | 
					
						
							|  |  |  | 		DATA_FORMAT_LOSSLESS, | 
					
						
							|  |  |  | 		DATA_FORMAT_LOSSY, | 
					
						
							|  |  |  | 		DATA_FORMAT_BASIS_UNIVERSAL, | 
					
						
							|  |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	enum { | 
					
						
							|  |  |  | 		FORMAT_VERSION = 1 | 
					
						
							| 
									
										
										
										
											2018-08-06 14:56:06 -03:00
										 |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-01 09:34:23 -03:00
										 |  |  | 	enum FormatBits { | 
					
						
							|  |  |  | 		FORMAT_MASK_IMAGE_FORMAT = (1 << 20) - 1, | 
					
						
							|  |  |  | 		FORMAT_BIT_LOSSLESS = 1 << 20, | 
					
						
							|  |  |  | 		FORMAT_BIT_LOSSY = 1 << 21, | 
					
						
							|  |  |  | 		FORMAT_BIT_STREAM = 1 << 22, | 
					
						
							|  |  |  | 		FORMAT_BIT_HAS_MIPMAPS = 1 << 23, | 
					
						
							|  |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							|  |  |  | 	Error _load_data(const String &p_path, Vector<Ref<Image>> &images, int &mipmap_limit, int p_size_limit = 0); | 
					
						
							|  |  |  | 	String path_to_file; | 
					
						
							|  |  |  | 	mutable RID texture; | 
					
						
							|  |  |  | 	Image::Format format; | 
					
						
							|  |  |  | 	int w, h, layers; | 
					
						
							|  |  |  | 	bool mipmaps; | 
					
						
							|  |  |  | 	LayeredType layered_type; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	virtual void reload_from_file(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | protected: | 
					
						
							|  |  |  | 	static void _bind_methods(); | 
					
						
							|  |  |  | 	void _validate_property(PropertyInfo &property) const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  | 	Image::Format get_format() const; | 
					
						
							|  |  |  | 	Error load(const String &p_path); | 
					
						
							|  |  |  | 	String get_load_path() const; | 
					
						
							|  |  |  | 	virtual LayeredType get_layered_type() const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	int get_width() const; | 
					
						
							|  |  |  | 	int get_height() const; | 
					
						
							|  |  |  | 	int get_layers() const; | 
					
						
							|  |  |  | 	virtual bool has_mipmaps() const; | 
					
						
							|  |  |  | 	virtual RID get_rid() const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	virtual void set_path(const String &p_path, bool p_take_over); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	virtual Ref<Image> get_layer_data(int p_layer) const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	StreamTextureLayered(LayeredType p_layered_type); | 
					
						
							|  |  |  | 	~StreamTextureLayered(); | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class StreamTexture2DArray : public StreamTextureLayered { | 
					
						
							|  |  |  | 	GDCLASS(StreamTexture2DArray, StreamTextureLayered) | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  | 	StreamTexture2DArray() : | 
					
						
							|  |  |  | 			StreamTextureLayered(LAYERED_TYPE_2D_ARRAY) {} | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class StreamCubemap : public StreamTextureLayered { | 
					
						
							|  |  |  | 	GDCLASS(StreamCubemap, StreamTextureLayered); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  | 	StreamCubemap() : | 
					
						
							|  |  |  | 			StreamTextureLayered(LAYERED_TYPE_CUBEMAP) {} | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class StreamCubemapArray : public StreamTextureLayered { | 
					
						
							|  |  |  | 	GDCLASS(StreamCubemapArray, StreamTextureLayered); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  | 	StreamCubemapArray() : | 
					
						
							|  |  |  | 			StreamTextureLayered(LAYERED_TYPE_CUBEMAP_ARRAY) {} | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class ResourceFormatLoaderStreamTextureLayered : public ResourceFormatLoader { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2020-04-19 23:19:21 -03:00
										 |  |  | 	virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, bool p_no_cache = false); | 
					
						
							| 
									
										
										
										
											2018-08-06 14:56:06 -03:00
										 |  |  | 	virtual void get_recognized_extensions(List<String> *p_extensions) const; | 
					
						
							|  |  |  | 	virtual bool handles_type(const String &p_type) const; | 
					
						
							|  |  |  | 	virtual String get_resource_type(const String &p_path) const; | 
					
						
							| 
									
										
										
										
											2018-06-26 13:59:26 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-11 15:43:37 -03:00
										 |  |  | class CurveTexture : public Texture2D { | 
					
						
							|  |  |  | 	GDCLASS(CurveTexture, Texture2D); | 
					
						
							| 
									
										
										
										
											2017-04-30 16:27:10 +02:00
										 |  |  | 	RES_BASE_EXTENSION("curvetex") | 
					
						
							| 
									
										
										
										
											2017-04-06 23:36:37 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2019-06-11 15:43:37 -03:00
										 |  |  | 	mutable RID _texture; | 
					
						
							| 
									
										
										
										
											2017-04-30 16:27:10 +02:00
										 |  |  | 	Ref<Curve> _curve; | 
					
						
							|  |  |  | 	int _width; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	void _update(); | 
					
						
							| 
									
										
										
										
											2017-04-06 23:36:37 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | protected: | 
					
						
							|  |  |  | 	static void _bind_methods(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  | 	void set_width(int p_width); | 
					
						
							|  |  |  | 	int get_width() const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-30 22:53:40 +02:00
										 |  |  | 	void ensure_default_setup(float p_min = 0, float p_max = 1); | 
					
						
							| 
									
										
										
										
											2017-04-30 16:27:10 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	void set_curve(Ref<Curve> p_curve); | 
					
						
							|  |  |  | 	Ref<Curve> get_curve() const; | 
					
						
							| 
									
										
										
										
											2017-04-06 23:36:37 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	virtual RID get_rid() const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	virtual int get_height() const { return 1; } | 
					
						
							|  |  |  | 	virtual bool has_alpha() const { return false; } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	CurveTexture(); | 
					
						
							|  |  |  | 	~CurveTexture(); | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | /*
 | 
					
						
							|  |  |  | 	enum CubeMapSide { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		CUBEMAP_LEFT, | 
					
						
							|  |  |  | 		CUBEMAP_RIGHT, | 
					
						
							|  |  |  | 		CUBEMAP_BOTTOM, | 
					
						
							|  |  |  | 		CUBEMAP_TOP, | 
					
						
							|  |  |  | 		CUBEMAP_FRONT, | 
					
						
							|  |  |  | 		CUBEMAP_BACK, | 
					
						
							|  |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | //VARIANT_ENUM_CAST( Texture::CubeMapSide );
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-11 15:43:37 -03:00
										 |  |  | class GradientTexture : public Texture2D { | 
					
						
							|  |  |  | 	GDCLASS(GradientTexture, Texture2D); | 
					
						
							| 
									
										
										
										
											2017-04-06 23:36:37 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  | 	struct Point { | 
					
						
							|  |  |  | 		float offset; | 
					
						
							|  |  |  | 		Color color; | 
					
						
							|  |  |  | 		bool operator<(const Point &p_ponit) const { | 
					
						
							|  |  |  | 			return offset < p_ponit.offset; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2017-06-24 21:28:22 +02:00
										 |  |  | 	Ref<Gradient> gradient; | 
					
						
							| 
									
										
										
										
											2017-04-06 23:36:37 -03:00
										 |  |  | 	bool update_pending; | 
					
						
							|  |  |  | 	RID texture; | 
					
						
							|  |  |  | 	int width; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	void _queue_update(); | 
					
						
							|  |  |  | 	void _update(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | protected: | 
					
						
							|  |  |  | 	static void _bind_methods(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2017-06-24 21:28:22 +02:00
										 |  |  | 	void set_gradient(Ref<Gradient> p_gradient); | 
					
						
							|  |  |  | 	Ref<Gradient> get_gradient() const; | 
					
						
							| 
									
										
										
										
											2017-04-06 23:36:37 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	void set_width(int p_width); | 
					
						
							|  |  |  | 	int get_width() const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	virtual RID get_rid() const { return texture; } | 
					
						
							|  |  |  | 	virtual int get_height() const { return 1; } | 
					
						
							|  |  |  | 	virtual bool has_alpha() const { return true; } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-09 00:23:50 -03:00
										 |  |  | 	virtual Ref<Image> get_data() const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-06 23:36:37 -03:00
										 |  |  | 	GradientTexture(); | 
					
						
							|  |  |  | 	virtual ~GradientTexture(); | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-11 15:43:37 -03:00
										 |  |  | class ProxyTexture : public Texture2D { | 
					
						
							|  |  |  | 	GDCLASS(ProxyTexture, Texture2D); | 
					
						
							| 
									
										
										
										
											2017-12-04 16:54:17 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2019-06-24 16:13:06 -03:00
										 |  |  | 	mutable RID proxy_ph; | 
					
						
							|  |  |  | 	mutable RID proxy; | 
					
						
							| 
									
										
										
										
											2019-06-11 15:43:37 -03:00
										 |  |  | 	Ref<Texture2D> base; | 
					
						
							| 
									
										
										
										
											2017-12-04 16:54:17 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | protected: | 
					
						
							|  |  |  | 	static void _bind_methods(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2019-06-11 15:43:37 -03:00
										 |  |  | 	void set_base(const Ref<Texture2D> &p_texture); | 
					
						
							|  |  |  | 	Ref<Texture2D> get_base() const; | 
					
						
							| 
									
										
										
										
											2017-12-04 16:54:17 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	virtual int get_width() const; | 
					
						
							|  |  |  | 	virtual int get_height() const; | 
					
						
							|  |  |  | 	virtual RID get_rid() const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	virtual bool has_alpha() const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	ProxyTexture(); | 
					
						
							|  |  |  | 	~ProxyTexture(); | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-11 15:43:37 -03:00
										 |  |  | class AnimatedTexture : public Texture2D { | 
					
						
							|  |  |  | 	GDCLASS(AnimatedTexture, Texture2D); | 
					
						
							| 
									
										
										
										
											2018-07-16 11:43:26 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-23 13:27:17 -03:00
										 |  |  | 	//use readers writers lock for this, since its far more times read than written to
 | 
					
						
							|  |  |  | 	RWLock *rw_lock; | 
					
						
							| 
									
										
										
										
											2018-07-16 11:43:26 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							|  |  |  | 	enum { | 
					
						
							|  |  |  | 		MAX_FRAMES = 256 | 
					
						
							|  |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-24 16:13:06 -03:00
										 |  |  | 	RID proxy_ph; | 
					
						
							| 
									
										
										
										
											2018-07-16 11:43:26 -03:00
										 |  |  | 	RID proxy; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	struct Frame { | 
					
						
							| 
									
										
										
										
											2019-06-11 15:43:37 -03:00
										 |  |  | 		Ref<Texture2D> texture; | 
					
						
							| 
									
										
										
										
											2018-07-16 11:43:26 -03:00
										 |  |  | 		float delay_sec; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		Frame() { | 
					
						
							|  |  |  | 			delay_sec = 0; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	Frame frames[MAX_FRAMES]; | 
					
						
							|  |  |  | 	int frame_count; | 
					
						
							|  |  |  | 	int current_frame; | 
					
						
							| 
									
										
										
										
											2020-04-28 17:03:36 +08:00
										 |  |  | 	bool pause; | 
					
						
							|  |  |  | 	bool oneshot; | 
					
						
							| 
									
										
										
										
											2018-07-16 11:43:26 -03:00
										 |  |  | 	float fps; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	float time; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	uint64_t prev_ticks; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	void _update_proxy(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | protected: | 
					
						
							|  |  |  | 	static void _bind_methods(); | 
					
						
							|  |  |  | 	void _validate_property(PropertyInfo &property) const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  | 	void set_frames(int p_frames); | 
					
						
							|  |  |  | 	int get_frames() const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-28 17:03:36 +08:00
										 |  |  | 	void set_current_frame(int p_frame); | 
					
						
							|  |  |  | 	int get_current_frame() const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	void set_pause(bool p_pause); | 
					
						
							|  |  |  | 	bool get_pause() const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	void set_oneshot(bool p_oneshot); | 
					
						
							|  |  |  | 	bool get_oneshot() const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-11 15:43:37 -03:00
										 |  |  | 	void set_frame_texture(int p_frame, const Ref<Texture2D> &p_texture); | 
					
						
							|  |  |  | 	Ref<Texture2D> get_frame_texture(int p_frame) const; | 
					
						
							| 
									
										
										
										
											2018-07-16 11:43:26 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	void set_frame_delay(int p_frame, float p_delay_sec); | 
					
						
							|  |  |  | 	float get_frame_delay(int p_frame) const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	void set_fps(float p_fps); | 
					
						
							|  |  |  | 	float get_fps() const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	virtual int get_width() const; | 
					
						
							|  |  |  | 	virtual int get_height() const; | 
					
						
							|  |  |  | 	virtual RID get_rid() const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	virtual bool has_alpha() const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	virtual Ref<Image> get_data() const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-23 22:10:15 -03:00
										 |  |  | 	bool is_pixel_opaque(int p_x, int p_y) const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-16 11:43:26 -03:00
										 |  |  | 	AnimatedTexture(); | 
					
						
							|  |  |  | 	~AnimatedTexture(); | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-11 15:43:37 -03:00
										 |  |  | class CameraTexture : public Texture2D { | 
					
						
							|  |  |  | 	GDCLASS(CameraTexture, Texture2D); | 
					
						
							| 
									
										
										
										
											2017-08-21 00:17:24 +10:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							|  |  |  | 	int camera_feed_id; | 
					
						
							|  |  |  | 	CameraServer::FeedImage which_feed; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | protected: | 
					
						
							|  |  |  | 	static void _bind_methods(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  | 	virtual int get_width() const; | 
					
						
							|  |  |  | 	virtual int get_height() const; | 
					
						
							|  |  |  | 	virtual RID get_rid() const; | 
					
						
							|  |  |  | 	virtual bool has_alpha() const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	virtual void set_flags(uint32_t p_flags); | 
					
						
							|  |  |  | 	virtual uint32_t get_flags() const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	virtual Ref<Image> get_data() const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	void set_camera_feed_id(int p_new_id); | 
					
						
							|  |  |  | 	int get_camera_feed_id() const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	void set_which_feed(CameraServer::FeedImage p_which); | 
					
						
							|  |  |  | 	CameraServer::FeedImage get_which_feed() const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	void set_camera_active(bool p_active); | 
					
						
							|  |  |  | 	bool get_camera_active() const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	CameraTexture(); | 
					
						
							|  |  |  | 	~CameraTexture(); | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | #endif
 |