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/object-impl.h> // Dali::Internal::Object
29 #include <dali/internal/event/common/property-buffer-impl.h> // Dali::Internal::PropertyBuffer
30 #include <dali/internal/event/rendering/sampler-impl.h> // Dali::Internal::Sampler
31 #include <dali/internal/event/rendering/texture-impl.h> // Dali::Internal::Texture
32 #include <dali/internal/event/rendering/shader-impl.h> // Dali::Internal::Shader
45 typedef IntrusivePtr<TextureSet> TextureSetPtr;
48 * TextureSet is an object that holds all the textures used by a renderer
50 class TextureSet : public BaseObject
55 * @copydoc Dali::TextureSet::New()
57 static TextureSetPtr New();
60 * @copydoc Dali::TextureSet::SetTexture()
62 void SetTexture( size_t index, TexturePtr texture );
65 * @copydoc Dali::TextureSet::GetTexture()
67 Texture* GetTexture( size_t index ) const;
70 * @copydoc Dali::TextureSet::SetSampler()
72 void SetSampler( size_t index, SamplerPtr sampler );
75 * @copydoc Dali::TextureSet::GetSampler()
77 Sampler* GetSampler( size_t index ) const;
80 * @copydoc Dali::TextureSet::GetTextureCount()
82 size_t GetTextureCount() const;
85 * @brief Get the TextureSet scene object
87 * @return the texture set scene object
89 const SceneGraph::TextureSet* GetTextureSetSceneObject() const;
91 private: // implementation
96 * Second stage initialization
102 * A reference counted object may only be deleted by calling Unreference()
104 virtual ~TextureSet();
106 private: // unimplemented methods
107 TextureSet( const TextureSet& );
108 TextureSet& operator=( const TextureSet& );
111 EventThreadServices& mEventThreadServices; ///<Used to send messages to the update thread
112 SceneGraph::TextureSet* mSceneObject;
113 std::vector<SamplerPtr> mSamplers;
114 std::vector<TexturePtr> mTextures;
117 } // namespace Internal
119 // Helpers for public-api forwarding methods
120 inline Internal::TextureSet& GetImplementation( Dali::TextureSet& handle )
122 DALI_ASSERT_ALWAYS(handle && "TextureSet handle is empty");
124 BaseObject& object = handle.GetBaseObject();
126 return static_cast<Internal::TextureSet&>(object);
129 inline const Internal::TextureSet& GetImplementation( const Dali::TextureSet& handle )
131 DALI_ASSERT_ALWAYS(handle && "TextureSet handle is empty");
133 const BaseObject& object = handle.GetBaseObject();
135 return static_cast<const Internal::TextureSet&>(object);
140 #endif // DALI_INTERNAL_TEXTURE_SET_H