1 #ifndef DALI_INTERNAL_TEXTURE_SET_H
2 #define DALI_INTERNAL_TEXTURE_SET_H
5 * Copyright (c) 2016 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/devel-api/rendering/texture-set.h> // Dali::TextureSet
28 #include <dali/internal/event/common/connectable.h> // Dali::Internal::Connectable
29 #include <dali/internal/event/common/object-connector.h> // Dali::Internal::ObjectConnector
30 #include <dali/internal/event/common/object-impl.h> // Dali::Internal::Object
31 #include <dali/internal/event/common/property-buffer-impl.h> // Dali::Internal::PropertyBuffer
32 #include <dali/internal/event/rendering/sampler-impl.h> // Dali::Internal::Sampler
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, public Connectable
56 * @copydoc Dali::TextureSet::New()
58 static TextureSetPtr New();
61 * @copydoc Dali::TextureSet::SetImage()
63 void SetImage( size_t index, ImagePtr image );
66 * @copydoc Dali::TextureSet::GetImage()
68 Image* GetImage( size_t index ) const;
71 * @copydoc Dali::TextureSet::SetSampler()
73 void SetSampler( size_t index, SamplerPtr sampler );
76 * @copydoc Dali::TextureSet::GetSampler()
78 Sampler* GetSampler( size_t index ) const;
81 * @copydoc Dali::TextureSet::GetTextureCount()
83 size_t GetTextureCount() const;
86 * @brief Get the TextureSet scene object
88 * @return the texture set scene object
90 const SceneGraph::TextureSet* GetTextureSetSceneObject() const;
92 public: // Functions from Connectable
94 * @copydoc Dali::Internal::Connectable::OnStage()
96 virtual bool OnStage() const;
99 * @copydoc Dali::Internal::Connectable::Connect()
101 virtual void Connect();
104 * @copydoc Dali::Internal::Connectable::Disconnect()
106 virtual void Disconnect();
108 private: // implementation
124 * Second stage initialization
130 * A reference counted object may only be deleted by calling Unreference()
132 virtual ~TextureSet();
134 private: // unimplemented methods
135 TextureSet( const TextureSet& );
136 TextureSet& operator=( const TextureSet& );
139 EventThreadServices& mEventThreadServices; ///<Used to send messages to the update thread
140 SceneGraph::TextureSet* mSceneObject;
141 std::vector<Texture> mTextures;
146 } // namespace Internal
148 // Helpers for public-api forwarding methods
149 inline Internal::TextureSet& GetImplementation( Dali::TextureSet& handle )
151 DALI_ASSERT_ALWAYS(handle && "TextureSet handle is empty");
153 BaseObject& object = handle.GetBaseObject();
155 return static_cast<Internal::TextureSet&>(object);
158 inline const Internal::TextureSet& GetImplementation( const Dali::TextureSet& handle )
160 DALI_ASSERT_ALWAYS(handle && "TextureSet handle is empty");
162 const BaseObject& object = handle.GetBaseObject();
164 return static_cast<const Internal::TextureSet&>(object);
169 #endif // DALI_INTERNAL_TEXTURE_SET_H