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