1 #ifndef DALI_TEXTURE_SET_H
2 #define DALI_TEXTURE_SET_H
5 * Copyright (c) 2020 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <cstddef> // std::size_t
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
33 * @addtogroup dali_core_rendering_effects
37 namespace Internal DALI_INTERNAL
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.
47 class DALI_CORE_API TextureSet : public BaseHandle
51 * @brief Creates a new TextureSet object.
54 * @return A handle to a newly allocated TextureSet
56 static TextureSet New();
59 * @brief Default constructor, creates an empty handle.
73 * @brief Copy constructor, creates a new handle to the same object.
76 * @param[in] handle Handle to an object
78 TextureSet(const TextureSet& handle);
81 * @brief Downcasts to a TextureSet handle.
82 * If handle is not a TextureSet, the returned handle is left uninitialized.
84 * @param[in] handle Handle to an object
85 * @return TextureSet handle or an uninitialized handle
87 static TextureSet DownCast(BaseHandle handle);
90 * @brief Assignment operator, changes this handle to point at the same object.
93 * @param[in] handle Handle to an object
94 * @return A reference to this
96 TextureSet& operator=(const TextureSet& handle);
99 * @brief Move constructor.
102 * @param[in] rhs A reference to the moved handle
104 TextureSet(TextureSet&& rhs);
107 * @brief Move assignment operator.
110 * @param[in] rhs A reference to the moved handle
111 * @return A reference to this handle
113 TextureSet& operator=(TextureSet&& rhs);
116 * @brief Sets the texture at position "index".
119 * @param[in] index The position in the texture set of the texture
120 * @param[in] texture The texture
122 void SetTexture(size_t index, Texture texture);
125 * @brief Gets the image at position "index".
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
131 Texture GetTexture(size_t index) const;
134 * @brief Sets the sampler to be used by the image at position "index".
137 * @param[in] index The position in the texture set of the sampler
138 * @param[in] sampler The sampler to use
140 void SetSampler(size_t index, Sampler sampler);
143 * @brief Sets the sampler to be used by the image at position "index".
146 * @param[in] index The position in the texture set of the image
147 * @return A handle to the sampler at the specified position
149 Sampler GetSampler(size_t index) const;
152 * @brief Gets the number of textures present in the TextureSet.
155 * @return The number of textures in the TextureSet
157 size_t GetTextureCount() const;
161 * @brief The constructor.
162 * @note Not intended for application developers.
164 * @param[in] pointer A pointer to a newly allocated TextureSet
166 explicit DALI_INTERNAL TextureSet(Internal::TextureSet* pointer);
174 #endif // DALI_TEXTURE_SET_H