1 #ifndef DALI_INTERNAL_TEXTURE_SET_H
2 #define DALI_INTERNAL_TEXTURE_SET_H
5 * Copyright (c) 2021 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 <dali/public-api/common/vector-wrapper.h> // std::vector
25 #include <dali/internal/event/common/object-impl.h> // Dali::Internal::Object
26 #include <dali/internal/event/rendering/sampler-impl.h> // Dali::Internal::Sampler
27 #include <dali/internal/event/rendering/shader-impl.h> // Dali::Internal::Shader
28 #include <dali/internal/event/rendering/texture-impl.h> // Dali::Internal::Texture
29 #include <dali/public-api/common/dali-common.h> // DALI_ASSERT_ALWAYS
30 #include <dali/public-api/common/intrusive-ptr.h> // Dali::IntrusivePtr
31 #include <dali/public-api/rendering/texture-set.h> // Dali::TextureSet
43 using TextureSetPtr = IntrusivePtr<TextureSet>;
46 * TextureSet is an object that holds all the textures used by a renderer
48 class TextureSet : public BaseObject
52 * @copydoc Dali::TextureSet::New()
54 static TextureSetPtr New();
57 * @copydoc Dali::TextureSet::SetTexture()
59 void SetTexture(uint32_t index, TexturePtr texture);
62 * @copydoc Dali::TextureSet::GetTexture()
64 Texture* GetTexture(uint32_t index) const;
67 * @copydoc Dali::TextureSet::SetSampler()
69 void SetSampler(uint32_t index, SamplerPtr sampler);
72 * @copydoc Dali::TextureSet::GetSampler()
74 Sampler* GetSampler(uint32_t index) const;
77 * @copydoc Dali::TextureSet::GetTextureCount()
79 uint32_t GetTextureCount() const;
82 * @brief Get the TextureSet scene object
84 * @return the texture set scene object
86 const SceneGraph::TextureSet* GetTextureSetSceneObject() const;
88 private: // implementation
92 * Second stage initialization
98 * A reference counted object may only be deleted by calling Unreference()
100 ~TextureSet() override;
102 private: // unimplemented methods
103 TextureSet(const TextureSet&);
104 TextureSet& operator=(const TextureSet&);
107 EventThreadServices& mEventThreadServices; ///<Used to send messages to the update thread
108 SceneGraph::TextureSet* mSceneObject;
109 std::vector<SamplerPtr> mSamplers;
110 std::vector<TexturePtr> mTextures;
113 } // namespace Internal
115 // Helpers for public-api forwarding methods
116 inline Internal::TextureSet& GetImplementation(Dali::TextureSet& handle)
118 DALI_ASSERT_ALWAYS(handle && "TextureSet handle is empty");
120 BaseObject& object = handle.GetBaseObject();
122 return static_cast<Internal::TextureSet&>(object);
125 inline const Internal::TextureSet& GetImplementation(const Dali::TextureSet& handle)
127 DALI_ASSERT_ALWAYS(handle && "TextureSet handle is empty");
129 const BaseObject& object = handle.GetBaseObject();
131 return static_cast<const Internal::TextureSet&>(object);
136 #endif // DALI_INTERNAL_TEXTURE_SET_H