| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
#pragma once |
| 32 |
|
| 33 |
#include "scene/resources/texture.h" |
| 34 |
|
| 35 |
class PlaceholderTexture2D : public Texture2D { |
| 36 |
GDCLASS(PlaceholderTexture2D, Texture2D) |
| 37 |
|
| 38 |
mutable RID rid; |
| 39 |
Size2 size = Size2(1, 1); |
| 40 |
|
| 41 |
protected: |
| 42 |
static void _bind_methods(); |
| 43 |
|
| 44 |
public: |
| 45 |
void set_size(Size2 p_size); |
| 46 |
|
| 47 |
virtual int get_width() const override; |
| 48 |
virtual int get_height() const override; |
| 49 |
virtual RID get_rid() const override; |
| 50 |
virtual bool has_alpha() const override; |
| 51 |
|
| 52 |
virtual Ref<Image> get_image() const override; |
| 53 |
|
| 54 |
PlaceholderTexture2D(); |
| 55 |
~PlaceholderTexture2D(); |
| 56 |
}; |
| 57 |
|
| 58 |
class PlaceholderTexture3D : public Texture3D { |
| 59 |
GDCLASS(PlaceholderTexture3D, Texture3D) |
| 60 |
|
| 61 |
mutable RID rid; |
| 62 |
Vector3i size = Vector3i(1, 1, 1); |
| 63 |
|
| 64 |
protected: |
| 65 |
static void _bind_methods(); |
| 66 |
|
| 67 |
public: |
| 68 |
void set_size(const Vector3i &p_size); |
| 69 |
Vector3i get_size() const; |
| 70 |
virtual Image::Format get_format() const override; |
| 71 |
virtual int get_width() const override; |
| 72 |
virtual int get_height() const override; |
| 73 |
virtual int get_depth() const override; |
| 74 |
virtual bool has_mipmaps() const override; |
| 75 |
virtual Vector<Ref<Image>> get_data() const override; |
| 76 |
virtual RID get_rid() const override; |
| 77 |
|
| 78 |
PlaceholderTexture3D(); |
| 79 |
~PlaceholderTexture3D(); |
| 80 |
}; |
| 81 |
|
| 82 |
class PlaceholderTextureLayered : public TextureLayered { |
| 83 |
GDCLASS(PlaceholderTextureLayered, TextureLayered) |
| 84 |
|
| 85 |
mutable RID rid; |
| 86 |
Size2i size = Size2i(1, 1); |
| 87 |
int layers = 1; |
| 88 |
LayeredType layered_type = LAYERED_TYPE_2D_ARRAY; |
| 89 |
|
| 90 |
protected: |
| 91 |
static void _bind_methods(); |
| 92 |
|
| 93 |
public: |
| 94 |
void set_size(const Size2i &p_size); |
| 95 |
Size2i get_size() const; |
| 96 |
void set_layers(int p_layers); |
| 97 |
virtual Image::Format get_format() const override; |
| 98 |
virtual LayeredType get_layered_type() const override; |
| 99 |
virtual int get_width() const override; |
| 100 |
virtual int get_height() const override; |
| 101 |
virtual int get_layers() const override; |
| 102 |
virtual bool has_mipmaps() const override; |
| 103 |
virtual Ref<Image> get_layer_data(int p_layer) const override; |
| 104 |
virtual RID get_rid() const override; |
| 105 |
|
| 106 |
PlaceholderTextureLayered(LayeredType p_type); |
| 107 |
~PlaceholderTextureLayered(); |
| 108 |
}; |
| 109 |
|
| 110 |
class PlaceholderTexture2DArray : public PlaceholderTextureLayered { |
| 111 |
GDCLASS(PlaceholderTexture2DArray, PlaceholderTextureLayered) |
| 112 |
public: |
| 113 |
PlaceholderTexture2DArray() : |
| 114 |
PlaceholderTextureLayered(LAYERED_TYPE_2D_ARRAY) {} |
| 115 |
}; |
| 116 |
|
| 117 |
class PlaceholderCubemap : public PlaceholderTextureLayered { |
| 118 |
GDCLASS(PlaceholderCubemap, PlaceholderTextureLayered) |
| 119 |
public: |
| 120 |
PlaceholderCubemap() : |
| 121 |
PlaceholderTextureLayered(LAYERED_TYPE_CUBEMAP) {} |
| 122 |
}; |
| 123 |
|
| 124 |
class PlaceholderCubemapArray : public PlaceholderTextureLayered { |
| 125 |
GDCLASS(PlaceholderCubemapArray, PlaceholderTextureLayered) |
| 126 |
public: |
| 127 |
PlaceholderCubemapArray() : |
| 128 |
PlaceholderTextureLayered(LAYERED_TYPE_CUBEMAP_ARRAY) {} |
| 129 |
}; |