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/public-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/images/image-impl.h> // Dali::Internal::Image
33 #include <dali/internal/event/rendering/sampler-impl.h> // Dali::Internal::Sampler
34 #include <dali/internal/event/rendering/texture-impl.h> // Dali::Internal::Texture
35 #include <dali/internal/event/rendering/shader-impl.h> // Dali::Internal::Shader
48 typedef IntrusivePtr<TextureSet> TextureSetPtr;
51 * TextureSet is an object that holds all the textures used by a renderer
53 class TextureSet : public BaseObject, public Connectable
58 * @copydoc Dali::TextureSet::New()
60 static TextureSetPtr New();
63 * @copydoc Dali::TextureSet::SetImage()
65 void SetImage( size_t index, ImagePtr image );
68 * @copydoc Dali::TextureSet::SetTexture()
70 void SetTexture( size_t index, NewTexturePtr texture );
73 * @copydoc Dali::TextureSet::GetImage()
75 Image* GetImage( size_t index ) const;
78 * @copydoc Dali::TextureSet::GetTexture()
80 NewTexture* GetTexture( size_t index ) const;
83 * @copydoc Dali::TextureSet::SetSampler()
85 void SetSampler( size_t index, SamplerPtr sampler );
88 * @copydoc Dali::TextureSet::GetSampler()
90 Sampler* GetSampler( size_t index ) const;
93 * @copydoc Dali::TextureSet::GetTextureCount()
95 size_t GetTextureCount() const;
98 * @brief Get the TextureSet scene object
100 * @return the texture set scene object
102 const SceneGraph::TextureSet* GetTextureSetSceneObject() const;
104 public: // Functions from Connectable
106 * @copydoc Dali::Internal::Connectable::OnStage()
108 virtual bool OnStage() const;
111 * @copydoc Dali::Internal::Connectable::Connect()
113 virtual void Connect();
116 * @copydoc Dali::Internal::Connectable::Disconnect()
118 virtual void Disconnect();
120 private: // implementation
125 * Second stage initialization
131 * A reference counted object may only be deleted by calling Unreference()
133 virtual ~TextureSet();
135 private: // unimplemented methods
136 TextureSet( const TextureSet& );
137 TextureSet& operator=( const TextureSet& );
140 EventThreadServices& mEventThreadServices; ///<Used to send messages to the update thread
141 SceneGraph::TextureSet* mSceneObject;
142 std::vector<ImagePtr> mImages;
143 std::vector<SamplerPtr> mSamplers;
144 std::vector<NewTexturePtr> mNewTextures;
149 } // namespace Internal
151 // Helpers for public-api forwarding methods
152 inline Internal::TextureSet& GetImplementation( Dali::TextureSet& handle )
154 DALI_ASSERT_ALWAYS(handle && "TextureSet handle is empty");
156 BaseObject& object = handle.GetBaseObject();
158 return static_cast<Internal::TextureSet&>(object);
161 inline const Internal::TextureSet& GetImplementation( const Dali::TextureSet& handle )
163 DALI_ASSERT_ALWAYS(handle && "TextureSet handle is empty");
165 const BaseObject& object = handle.GetBaseObject();
167 return static_cast<const Internal::TextureSet&>(object);
172 #endif // DALI_INTERNAL_TEXTURE_SET_H