Debian Codegraph @

scene/resources/placeholder_textures.h

raw symbols SCIP
1 /**************************************************************************/
2 /* placeholder_textures.h */
3 /**************************************************************************/
4 /* This file is part of: */
5 /* GODOT ENGINE */
6 /* https://godotengine.org */
7 /**************************************************************************/
8 /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9 /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
10 /* */
11 /* Permission is hereby granted, free of charge, to any person obtaining */
12 /* a copy of this software and associated documentation files (the */
13 /* "Software"), to deal in the Software without restriction, including */
14 /* without limitation the rights to use, copy, modify, merge, publish, */
15 /* distribute, sublicense, and/or sell copies of the Software, and to */
16 /* permit persons to whom the Software is furnished to do so, subject to */
17 /* the following conditions: */
18 /* */
19 /* The above copyright notice and this permission notice shall be */
20 /* included in all copies or substantial portions of the Software. */
21 /* */
22 /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23 /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25 /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26 /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27 /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
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 };