summaryrefslogtreecommitdiff
path: root/scene/resources/texture.h
diff options
context:
space:
mode:
Diffstat (limited to 'scene/resources/texture.h')
-rw-r--r--scene/resources/texture.h97
1 files changed, 88 insertions, 9 deletions
diff --git a/scene/resources/texture.h b/scene/resources/texture.h
index 21d3782897..eb7a9ff25c 100644
--- a/scene/resources/texture.h
+++ b/scene/resources/texture.h
@@ -39,6 +39,7 @@
#include "core/resource.h"
#include "scene/resources/curve.h"
#include "scene/resources/gradient.h"
+#include "servers/camera_server.h"
#include "servers/visual_server.h"
/**
@@ -203,6 +204,7 @@ private:
protected:
static void _bind_methods();
+ void _validate_property(PropertyInfo &property) const;
public:
typedef void (*TextureFormatRequestCallback)(const Ref<StreamTexture> &);
@@ -237,7 +239,6 @@ public:
};
class ResourceFormatLoaderStreamTexture : public ResourceFormatLoader {
- GDCLASS(ResourceFormatLoaderStreamTexture, ResourceFormatLoader)
public:
virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
@@ -292,6 +293,49 @@ public:
AtlasTexture();
};
+class Mesh;
+
+class MeshTexture : public Texture {
+
+ GDCLASS(MeshTexture, Texture);
+ RES_BASE_EXTENSION("meshtex");
+
+ Ref<Texture> base_texture;
+ 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;
+
+ virtual void set_flags(uint32_t p_flags);
+ virtual uint32_t get_flags() 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;
+
+ void set_base_texture(const Ref<Texture> &p_texture);
+ Ref<Texture> get_base_texture() const;
+
+ 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<Texture> &p_normal_map = Ref<Texture>()) 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<Texture> &p_normal_map = Ref<Texture>()) 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<Texture> &p_normal_map = Ref<Texture>(), bool p_clip_uv = true) const;
+ 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();
+};
+
class LargeTexture : public Texture {
GDCLASS(LargeTexture, Texture);
@@ -425,7 +469,7 @@ VARIANT_ENUM_CAST(CubeMap::Storage)
class TextureLayered : public Resource {
- GDCLASS(TextureLayered, Resource)
+ GDCLASS(TextureLayered, Resource);
public:
enum Flags {
@@ -477,7 +521,8 @@ VARIANT_ENUM_CAST(TextureLayered::Flags)
class Texture3D : public TextureLayered {
- GDCLASS(Texture3D, TextureLayered)
+ GDCLASS(Texture3D, TextureLayered);
+
public:
Texture3D() :
TextureLayered(true) {}
@@ -485,14 +530,14 @@ public:
class TextureArray : public TextureLayered {
- GDCLASS(TextureArray, TextureLayered)
+ GDCLASS(TextureArray, TextureLayered);
+
public:
TextureArray() :
TextureLayered(false) {}
};
class ResourceFormatLoaderTextureLayered : public ResourceFormatLoader {
- GDCLASS(ResourceFormatLoaderTextureLayered, ResourceFormatLoader)
public:
enum Compression {
COMPRESSION_LOSSLESS,
@@ -508,7 +553,7 @@ public:
class CurveTexture : public Texture {
- GDCLASS(CurveTexture, Texture)
+ GDCLASS(CurveTexture, Texture);
RES_BASE_EXTENSION("curvetex")
private:
@@ -556,7 +601,7 @@ public:
//VARIANT_ENUM_CAST( Texture::CubeMapSide );
class GradientTexture : public Texture {
- GDCLASS(GradientTexture, Texture)
+ GDCLASS(GradientTexture, Texture);
public:
struct Point {
@@ -601,7 +646,7 @@ public:
};
class ProxyTexture : public Texture {
- GDCLASS(ProxyTexture, Texture)
+ GDCLASS(ProxyTexture, Texture);
private:
RID proxy;
@@ -628,7 +673,7 @@ public:
};
class AnimatedTexture : public Texture {
- GDCLASS(AnimatedTexture, Texture)
+ GDCLASS(AnimatedTexture, Texture);
//use readers writers lock for this, since its far more times read than written to
RWLock *rw_lock;
@@ -696,4 +741,38 @@ public:
~AnimatedTexture();
};
+class CameraTexture : public Texture {
+ GDCLASS(CameraTexture, Texture);
+
+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();
+};
+
#endif