f1525e67efead8c201c3a084fc249b19b547d2d3
[platform/core/uifw/dali-core.git] / dali / public-api / rendering / texture-set.h
1 #ifndef DALI_TEXTURE_SET_H
2 #define DALI_TEXTURE_SET_H
3
4 /*
5  * Copyright (c) 2022 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <cstddef> // std::size_t
23
24 // INTERNAL INCLUDES
25 #include <dali/public-api/object/handle.h>     // Dali::Handle
26 #include <dali/public-api/rendering/sampler.h> // Dali::Sampler
27 #include <dali/public-api/rendering/shader.h>  // Dali::Shader
28 #include <dali/public-api/rendering/texture.h> // Dali::Texture
29
30 namespace Dali
31 {
32 /**
33  * @addtogroup dali_core_rendering_effects
34  * @{
35  */
36
37 namespace Internal DALI_INTERNAL
38 {
39 class TextureSet;
40 }
41
42 /**
43  * @brief TextureSet is a handle to an object that specifies the set of images used as textures by a renderer.
44  * The images have to be ordered in the same order they are declared in the shader.
45  * @SINCE_1_1.43
46  */
47 class DALI_CORE_API TextureSet : public BaseHandle
48 {
49 public:
50   /**
51    * @brief Creates a new TextureSet object.
52    *
53    * @SINCE_1_1.43
54    * @return A handle to a newly allocated TextureSet
55    */
56   static TextureSet New();
57
58   /**
59    * @brief Default constructor, creates an empty handle.
60    *
61    * @SINCE_1_1.43
62    */
63   TextureSet();
64
65   /**
66    * @brief Destructor.
67    *
68    * @SINCE_1_1.43
69    */
70   ~TextureSet();
71
72   /**
73    * @brief Copy constructor, creates a new handle to the same object.
74    *
75    * @SINCE_1_1.43
76    * @param[in] handle Handle to an object
77    */
78   TextureSet(const TextureSet& handle);
79
80   /**
81    * @brief Downcasts to a TextureSet handle.
82    * If handle is not a TextureSet, the returned handle is left uninitialized.
83    * @SINCE_1_1.43
84    * @param[in] handle Handle to an object
85    * @return TextureSet handle or an uninitialized handle
86    */
87   static TextureSet DownCast(BaseHandle handle);
88
89   /**
90    * @brief Assignment operator, changes this handle to point at the same object.
91    *
92    * @SINCE_1_1.43
93    * @param[in] handle Handle to an object
94    * @return A reference to this
95    */
96   TextureSet& operator=(const TextureSet& handle);
97
98   /**
99    * @brief Move constructor.
100    *
101    * @SINCE_1_9.22
102    * @param[in] rhs A reference to the moved handle
103    */
104   TextureSet(TextureSet&& rhs);
105
106   /**
107    * @brief Move assignment operator.
108    *
109    * @SINCE_1_9.22
110    * @param[in] rhs A reference to the moved handle
111    * @return A reference to this handle
112    */
113   TextureSet& operator=(TextureSet&& rhs);
114
115   /**
116    * @brief Sets the texture at position "index".
117    *
118    * @SINCE_1_1.43
119    * @param[in] index The position in the texture set of the texture
120    * @param[in] texture The texture
121    */
122   void SetTexture(size_t index, Texture texture);
123
124   /**
125    * @brief Gets the image at position "index".
126    *
127    * @SINCE_1_1.43
128    * @param[in] index The position in the texture set of the image
129    * @return A handle to the image at the the specified position
130    */
131   Texture GetTexture(size_t index) const;
132
133   /**
134    * @brief Sets the sampler to be used by the image at position "index".
135    *
136    * @SINCE_1_1.43
137    * @param[in] index The position in the texture set of the sampler
138    * @param[in] sampler The sampler to use
139    */
140   void SetSampler(size_t index, Sampler sampler);
141
142   /**
143    * @brief Sets the sampler to be used by the image at position "index".
144    *
145    * @SINCE_1_1.43
146    * @param[in] index The position in the texture set of the image
147    * @return A handle to the sampler at the specified position
148    */
149   Sampler GetSampler(size_t index) const;
150
151   /**
152    * @brief Gets the number of textures present in the TextureSet.
153    *
154    * @SINCE_1_1.43
155    * @return The number of textures in the TextureSet
156    */
157   uint32_t GetTextureCount() const;
158
159 public:
160   /**
161    * @brief The constructor.
162    * @note  Not intended for application developers.
163    * @SINCE_1_1.43
164    * @param[in] pointer A pointer to a newly allocated TextureSet
165    */
166   explicit DALI_INTERNAL TextureSet(Internal::TextureSet* pointer);
167 };
168
169 /**
170  * @}
171  */
172 } //namespace Dali
173
174 #endif // DALI_TEXTURE_SET_H