Merge "Change the timing of Context::GlContextCreated()" into devel/master
[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) 2020 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   /**
52    * @brief Creates a new TextureSet object.
53    *
54    * @SINCE_1_1.43
55    * @return A handle to a newly allocated TextureSet
56    */
57   static TextureSet New();
58
59   /**
60    * @brief Default constructor, creates an empty handle.
61    *
62    * @SINCE_1_1.43
63    */
64   TextureSet();
65
66   /**
67    * @brief Destructor.
68    *
69    * @SINCE_1_1.43
70    */
71   ~TextureSet();
72
73   /**
74    * @brief Copy constructor, creates a new handle to the same object.
75    *
76    * @SINCE_1_1.43
77    * @param[in] handle Handle to an object
78    */
79   TextureSet( const TextureSet& handle );
80
81   /**
82    * @brief Downcasts to a TextureSet handle.
83    * If handle is not a TextureSet, the returned handle is left uninitialized.
84    * @SINCE_1_1.43
85    * @param[in] handle Handle to an object
86    * @return TextureSet handle or an uninitialized handle
87    */
88   static TextureSet DownCast( BaseHandle handle );
89
90   /**
91    * @brief Assignment operator, changes this handle to point at the same object.
92    *
93    * @SINCE_1_1.43
94    * @param[in] handle Handle to an object
95    * @return A reference to this
96    */
97   TextureSet& operator=( const TextureSet& handle );
98
99   /**
100    * @brief Move constructor.
101    *
102    * @SINCE_1_9.22
103    * @param[in] rhs A reference to the moved handle
104    */
105   TextureSet( TextureSet&& rhs );
106
107   /**
108    * @brief Move assignment operator.
109    *
110    * @SINCE_1_9.22
111    * @param[in] rhs A reference to the moved handle
112    * @return A reference to this handle
113    */
114   TextureSet& operator=( TextureSet&& rhs );
115
116   /**
117    * @brief Sets the texture at position "index".
118    *
119    * @SINCE_1_1.43
120    * @param[in] index The position in the texture set of the texture
121    * @param[in] texture The texture
122    */
123   void SetTexture( size_t index, Texture texture );
124
125   /**
126    * @brief Gets the image at position "index".
127    *
128    * @SINCE_1_1.43
129    * @param[in] index The position in the texture set of the image
130    * @return A handle to the image at the the specified position
131    */
132   Texture GetTexture( size_t index ) const;
133
134   /**
135    * @brief Sets the sampler to be used by the image at position "index".
136    *
137    * @SINCE_1_1.43
138    * @param[in] index The position in the texture set of the sampler
139    * @param[in] sampler The sampler to use
140    */
141   void SetSampler( size_t index, Sampler sampler );
142
143   /**
144    * @brief Sets the sampler to be used by the image at position "index".
145    *
146    * @SINCE_1_1.43
147    * @param[in] index The position in the texture set of the image
148    * @return A handle to the sampler at the specified position
149    */
150   Sampler GetSampler( size_t index ) const;
151
152   /**
153    * @brief Gets the number of textures present in the TextureSet.
154    *
155    * @SINCE_1_1.43
156    * @return The number of textures in the TextureSet
157    */
158   size_t GetTextureCount() const;
159
160 public:
161
162   /**
163    * @brief The constructor.
164    * @note  Not intended for application developers.
165    * @SINCE_1_1.43
166    * @param[in] pointer A pointer to a newly allocated TextureSet
167    */
168   explicit DALI_INTERNAL TextureSet( Internal::TextureSet* pointer );
169 };
170
171 /**
172  * @}
173  */
174 } //namespace Dali
175
176
177 #endif // DALI_TEXTURE_SET_H