f6c71bfbcbbf4543c78e9c9ad6fc10a15b84bba4
[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) 2016 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 namespace Internal DALI_INTERNAL
34 {
35 class TextureSet;
36 }
37
38 /**
39  * @brief TextureSet is a handle to an object that specifies the set of images used as textures by a renderer.
40  * The images have to be ordered in the same order they are declared in the shader.
41  * @SINCE_1_1.43
42  */
43 class DALI_IMPORT_API TextureSet : public BaseHandle
44 {
45 public:
46
47   /**
48    * @brief Creates a new TextureSet object
49    *
50    * @SINCE_1_1.43
51    * @return A handle to a newly allocated TextureSet
52    */
53   static TextureSet New();
54
55   /**
56    * @brief Default constructor, creates an empty handle
57    *
58    * @SINCE_1_1.43
59    */
60   TextureSet();
61
62   /**
63    * @brief Destructor
64    *
65    * @SINCE_1_1.43
66    */
67   ~TextureSet();
68
69   /**
70    * @brief Copy constructor, creates a new handle to the same object
71    *
72    * @SINCE_1_1.43
73    * @param[in] handle Handle to an object
74    */
75   TextureSet( const TextureSet& handle );
76
77   /**
78    * @brief Downcast to a TextureSet handle.
79    *
80    * @SINCE_1_1.43
81    * If handle is not a TextureSet, the returned handle is left uninitialized.
82    * @param[in] handle Handle to an object
83    * @return TextureSet handle or an uninitialized handle
84    */
85   static TextureSet DownCast( BaseHandle handle );
86
87   /**
88    * @brief Assignment operator, changes this handle to point at the same object
89    *
90    * @SINCE_1_1.43
91    * @param[in] handle Handle to an object
92    * @return A reference to this
93    */
94   TextureSet& operator=( const TextureSet& handle );
95
96   /**
97    * @brief Set the texture at position "index"
98    *
99    * @SINCE_1_1.43
100    * @param[in] index The position in the texture set of the texture
101    * @param[in] texture The texture
102    */
103   void SetTexture( size_t index, Texture texture );
104
105   /**
106    * @brief Get the image at position "index"
107    *
108    * @SINCE_1_1.43
109    * @param[in] index The position in the texture set of the image
110    * @return A handle to the image at the the specified position
111    */
112   Texture GetTexture( size_t index ) const;
113
114   /**
115    * @brief Set the sampler to be used by the image at position "index"
116    *
117    * @SINCE_1_1.43
118    * @param[in] index The position in the texture set of the sampler
119    * @param[in] sampler The sampler to use
120    */
121   void SetSampler( size_t index, Sampler sampler );
122
123   /**
124    * @brief Set the sampler to be used by the image at position "index"
125    *
126    * @SINCE_1_1.43
127    * @param[in] index The position in the texture set of the image
128    * @return A handle to the sampler at the specified position
129    */
130   Sampler GetSampler( size_t index ) const;
131
132   /**
133    * @brief Get the number of textures present in the TextureSet
134    *
135    * @SINCE_1_1.43
136    * @return The number of textures in the TextureSet
137    */
138   size_t GetTextureCount() const;
139
140 public:
141
142   /**
143    * @brief The constructor.
144    * @note  Not intended for application developers.
145    * @SINCE_1_1.43
146    * @param[in] pointer A pointer to a newly allocated TextureSet
147    */
148   explicit DALI_INTERNAL TextureSet( Internal::TextureSet* pointer );
149 };
150
151 } //namespace Dali
152
153
154 #endif // DALI_TEXTURE_SET_H