1 #ifndef DALI_INTERNAL_TEXTURE_SET_H
2 #define DALI_INTERNAL_TEXTURE_SET_H
5 * Copyright (c) 2018 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/public-api/common/dali-common.h> // DALI_ASSERT_ALWAYS
26 #include <dali/public-api/common/intrusive-ptr.h> // Dali::IntrusivePtr
27 #include <dali/public-api/rendering/texture-set.h> // Dali::TextureSet
28 #include <dali/internal/event/common/object-impl.h> // Dali::Internal::Object
29 #include <dali/internal/event/common/property-buffer-impl.h> // Dali::Internal::PropertyBuffer
30 #include <dali/internal/event/images/image-impl.h> // Dali::Internal::Image
31 #include <dali/internal/event/rendering/sampler-impl.h> // Dali::Internal::Sampler
32 #include <dali/internal/event/rendering/texture-impl.h> // Dali::Internal::Texture
33 #include <dali/internal/event/rendering/shader-impl.h> // Dali::Internal::Shader
46 typedef IntrusivePtr<TextureSet> TextureSetPtr;
49 * TextureSet is an object that holds all the textures used by a renderer
51 class TextureSet : public BaseObject
56 * @copydoc Dali::TextureSet::New()
58 static TextureSetPtr New();
61 * @copydoc Dali::TextureSet::SetTexture()
63 void SetTexture( uint32_t index, TexturePtr texture );
66 * @copydoc Dali::TextureSet::GetTexture()
68 Texture* GetTexture( uint32_t index ) const;
71 * @copydoc Dali::TextureSet::SetImage()
73 void SetImage( uint32_t index, ImagePtr image );
76 * @copydoc Dali::TextureSet::GetImage()
78 Image* GetImage( uint32_t index ) const;
81 * @copydoc Dali::TextureSet::SetSampler()
83 void SetSampler( uint32_t index, SamplerPtr sampler );
86 * @copydoc Dali::TextureSet::GetSampler()
88 Sampler* GetSampler( uint32_t index ) const;
91 * @copydoc Dali::TextureSet::GetTextureCount()
93 uint32_t GetTextureCount() const;
96 * @brief Get the TextureSet scene object
98 * @return the texture set scene object
100 const SceneGraph::TextureSet* GetTextureSetSceneObject() const;
102 private: // implementation
107 * Second stage initialization
113 * A reference counted object may only be deleted by calling Unreference()
115 virtual ~TextureSet();
117 private: // unimplemented methods
118 TextureSet( const TextureSet& );
119 TextureSet& operator=( const TextureSet& );
122 EventThreadServices& mEventThreadServices; ///<Used to send messages to the update thread
123 SceneGraph::TextureSet* mSceneObject;
124 std::vector<ImagePtr> mImages;
125 std::vector<SamplerPtr> mSamplers;
126 std::vector<TexturePtr> mTextures;
129 } // namespace Internal
131 // Helpers for public-api forwarding methods
132 inline Internal::TextureSet& GetImplementation( Dali::TextureSet& handle )
134 DALI_ASSERT_ALWAYS(handle && "TextureSet handle is empty");
136 BaseObject& object = handle.GetBaseObject();
138 return static_cast<Internal::TextureSet&>(object);
141 inline const Internal::TextureSet& GetImplementation( const Dali::TextureSet& handle )
143 DALI_ASSERT_ALWAYS(handle && "TextureSet handle is empty");
145 const BaseObject& object = handle.GetBaseObject();
147 return static_cast<const Internal::TextureSet&>(object);
152 #endif // DALI_INTERNAL_TEXTURE_SET_H