Debian Codegraph @

scene/resources/texture_rd.h

raw symbols SCIP
1 /**************************************************************************/
2 /* texture_rd.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 // Note, these classes are part of the Rendering Device based renderer.
34 // They are included here to ensure the correct order of registration
35 // is performed.
36 // Once the renderer has been moved into a module, these classes should
37 // be moved as well.
38
39 #include "scene/resources/texture.h"
40
41 class Texture2DRD : public Texture2D {
42 GDCLASS(Texture2DRD, Texture2D)
43
44 mutable RID texture_rid;
45 RID texture_rd_rid;
46 Size2i size;
47
48 protected:
49 static void _bind_methods();
50
51 public:
52 virtual int get_width() const override;
53 virtual int get_height() const override;
54 virtual RID get_rid() const override;
55 virtual bool has_alpha() const override;
56
57 virtual Ref<Image> get_image() const override;
58
59 void set_texture_rd_rid(RID p_texture_rd_rid);
60 RID get_texture_rd_rid() const;
61
62 // Internal function that should only be called from the rendering thread.
63 void _set_texture_rd_rid(RID p_texture_rd_rid);
64
65 Texture2DRD();
66 ~Texture2DRD();
67 };
68
69 class TextureLayeredRD : public TextureLayered {
70 GDCLASS(TextureLayeredRD, TextureLayered)
71
72 LayeredType layer_type;
73
74 mutable RID texture_rid;
75 RID texture_rd_rid;
76
77 Image::Format image_format;
78 Size2i size;
79 uint32_t layers = 0;
80 uint32_t mipmaps = 0;
81
82 protected:
83 static void _bind_methods();
84
85 public:
86 virtual Image::Format get_format() const override;
87 virtual LayeredType get_layered_type() const override;
88 virtual int get_width() const override;
89 virtual int get_height() const override;
90 virtual int get_layers() const override;
91 virtual bool has_mipmaps() const override;
92 virtual RID get_rid() const override;
93
94 virtual Ref<Image> get_layer_data(int p_layer) const override;
95
96 void set_texture_rd_rid(RID p_texture_rd_rid);
97 RID get_texture_rd_rid() const;
98
99 // Internal function that should only be called from the rendering thread.
100 void _set_texture_rd_rid(RID p_texture_rd_rid);
101
102 TextureLayeredRD(LayeredType p_layer_type);
103 ~TextureLayeredRD();
104 };
105
106 class Texture2DArrayRD : public TextureLayeredRD {
107 GDCLASS(Texture2DArrayRD, TextureLayeredRD)
108
109 public:
110 Texture2DArrayRD() :
111 TextureLayeredRD(LAYERED_TYPE_2D_ARRAY) {}
112 };
113
114 class TextureCubemapRD : public TextureLayeredRD {
115 GDCLASS(TextureCubemapRD, TextureLayeredRD)
116
117 public:
118 TextureCubemapRD() :
119 TextureLayeredRD(LAYERED_TYPE_CUBEMAP) {}
120 };
121
122 class TextureCubemapArrayRD : public TextureLayeredRD {
123 GDCLASS(TextureCubemapArrayRD, TextureLayeredRD)
124
125 public:
126 TextureCubemapArrayRD() :
127 TextureLayeredRD(LAYERED_TYPE_CUBEMAP_ARRAY) {}
128 };
129
130 class Texture3DRD : public Texture3D {
131 GDCLASS(Texture3DRD, Texture3D)
132
133 mutable RID texture_rid;
134 RID texture_rd_rid;
135
136 Image::Format image_format;
137 Vector3i size;
138 uint32_t mipmaps = 0;
139
140 protected:
141 static void _bind_methods();
142
143 public:
144 virtual Image::Format get_format() const override;
145 virtual int get_width() const override;
146 virtual int get_height() const override;
147 virtual int get_depth() const override;
148 virtual bool has_mipmaps() const override;
149 virtual RID get_rid() const override;
150
151 void set_texture_rd_rid(RID p_texture_rd_rid);
152 RID get_texture_rd_rid() const;
153
154 // Internal function that should only be called from the rendering thread.
155 void _set_texture_rd_rid(RID p_texture_rd_rid);
156
157 Texture3DRD();
158 ~Texture3DRD();
159 };