68d4b1ecc16f15777615c08d402e121967af01d0
[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/shader.h> // Dali::Shader
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  */
42 class DALI_IMPORT_API TextureSet : public Handle
43 {
44 public:
45
46   /**
47    * @brief Creates a new TextureSet object
48    *
49    * @return A handle to a newly allocated TextureSet
50    */
51   static TextureSet New();
52
53   /**
54    * @brief Default constructor, creates an empty handle
55    */
56   TextureSet();
57
58   /**
59    * @brief Destructor
60    */
61   ~TextureSet();
62
63   /**
64    * @brief Copy constructor, creates a new handle to the same object
65    *
66    * @param[in] handle Handle to an object
67    */
68   TextureSet( const TextureSet& handle );
69
70   /**
71    * @brief Downcast to a TextureSet handle.
72    *
73    * If handle is not a TextureSet, the returned handle is left uninitialized.
74    * @param[in] handle to an object
75    * @return TextureSet handle or an uninitialized handle
76    */
77   static TextureSet DownCast( BaseHandle handle );
78
79   /**
80    * @brief Assignment operator, changes this handle to point at the same object
81    *
82    * @param[in] handle Handle to an object
83    */
84   TextureSet& operator=( const TextureSet& handle );
85
86   /**
87    * @brief Set the image at position "index"
88    * @param[in] index The position in the texture set of the image
89    * @param[in] image The image
90    */
91   void SetImage( size_t index, Image image );
92
93   /**
94    * @brief Get the image at position "index"
95    * @param[in] index The position in the texture set of the image
96    * @return A handle to the image at the the specified position
97    */
98   Image GetImage( size_t index ) const;
99
100   /**
101    * @brief Set the sampler to be used by the image at position "index"
102    * @param[in] index The position in the texture set of the sampler
103    * @param[in] sampler The sampler to use
104    */
105   void SetSampler( size_t index, Sampler sampler );
106
107   /**
108    * @brief Set the sampler to be used by the image at position "index"
109    * @param[in] index The position in the texture set of the image
110    * @return A handle to the sampler at the specified position
111    */
112   Sampler GetSampler( size_t index ) const;
113
114   /**
115    * @brief Get the number of textures present in the TextureSet
116    *
117    * @return The number of textures in the TextureSet
118    */
119   size_t GetTextureCount() const;
120
121 public:
122   /**
123    * @brief The constructor
124    *
125    * @param [in] pointer A pointer to a newly allocated TextureSet
126    */
127   explicit DALI_INTERNAL TextureSet( Internal::TextureSet* pointer );
128 };
129
130 } //namespace Dali
131
132
133
134 #endif // DALI_TEXTURE_SET_H