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/texture-impl.h> // Dali::Internal::Texture
34 #include <dali/internal/event/rendering/shader-impl.h> // Dali::Internal::Shader
47 typedef IntrusivePtr<TextureSet> TextureSetPtr;
50 * TextureSet is an object that holds all the textures used by a renderer
52 class TextureSet : public BaseObject, public Connectable
57 * @copydoc Dali::TextureSet::New()
59 static TextureSetPtr New();
62 * @copydoc Dali::TextureSet::SetImage()
64 void SetImage( size_t index, ImagePtr image );
67 * @copydoc Dali::TextureSet::SetTexture()
69 void SetTexture( size_t index, NewTexturePtr texture );
72 * @copydoc Dali::TextureSet::GetImage()
74 Image* GetImage( size_t index ) const;
77 * @copydoc Dali::TextureSet::GetTexture()
79 NewTexture* GetTexture( size_t index ) const;
82 * @copydoc Dali::TextureSet::SetSampler()
84 void SetSampler( size_t index, SamplerPtr sampler );
87 * @copydoc Dali::TextureSet::GetSampler()
89 Sampler* GetSampler( size_t index ) const;
92 * @copydoc Dali::TextureSet::GetTextureCount()
94 size_t GetTextureCount() const;
97 * @brief Get the TextureSet scene object
99 * @return the texture set scene object
101 const SceneGraph::TextureSet* GetTextureSetSceneObject() const;
103 public: // Functions from Connectable
105 * @copydoc Dali::Internal::Connectable::OnStage()
107 virtual bool OnStage() const;
110 * @copydoc Dali::Internal::Connectable::Connect()
112 virtual void Connect();
115 * @copydoc Dali::Internal::Connectable::Disconnect()
117 virtual void Disconnect();
119 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<ImagePtr> mImages;
142 std::vector<SamplerPtr> mSamplers;
143 std::vector<NewTexturePtr> mNewTextures;
148 } // namespace Internal
150 // Helpers for public-api forwarding methods
151 inline Internal::TextureSet& GetImplementation( Dali::TextureSet& handle )
153 DALI_ASSERT_ALWAYS(handle && "TextureSet handle is empty");
155 BaseObject& object = handle.GetBaseObject();
157 return static_cast<Internal::TextureSet&>(object);
160 inline const Internal::TextureSet& GetImplementation( const Dali::TextureSet& handle )
162 DALI_ASSERT_ALWAYS(handle && "TextureSet handle is empty");
164 const BaseObject& object = handle.GetBaseObject();
166 return static_cast<const Internal::TextureSet&>(object);
171 #endif // DALI_INTERNAL_TEXTURE_SET_H