Use modern construct 'using' instead of typedef.
[platform/core/uifw/dali-core.git] / dali / internal / event / rendering / texture-set-impl.h
1 #ifndef DALI_INTERNAL_TEXTURE_SET_H
2 #define DALI_INTERNAL_TEXTURE_SET_H
3
4 /*
5  * Copyright (c) 2020 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <dali/public-api/common/vector-wrapper.h> // std::vector
23
24 // INTERNAL INCLUDES
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/rendering/sampler-impl.h> // Dali::Internal::Sampler
30 #include <dali/internal/event/rendering/shader-impl.h> // Dali::Internal::Shader
31 #include <dali/internal/event/rendering/texture-impl.h> // Dali::Internal::Texture
32
33
34 namespace Dali
35 {
36 namespace Internal
37 {
38 namespace SceneGraph
39 {
40 class TextureSet;
41 }
42
43
44 class TextureSet;
45 using TextureSetPtr = IntrusivePtr<TextureSet>;
46
47 /**
48  * TextureSet is an object that holds all the textures used by a renderer
49  */
50 class TextureSet : public BaseObject
51 {
52 public:
53
54   /**
55    * @copydoc Dali::TextureSet::New()
56    */
57   static TextureSetPtr New();
58
59   /**
60    * @copydoc Dali::TextureSet::SetTexture()
61    */
62   void SetTexture( uint32_t index, TexturePtr texture );
63
64   /**
65    * @copydoc Dali::TextureSet::GetTexture()
66    */
67   Texture* GetTexture( uint32_t index ) const;
68
69   /**
70    * @copydoc Dali::TextureSet::SetSampler()
71    */
72   void SetSampler( uint32_t index, SamplerPtr sampler );
73
74   /**
75    * @copydoc Dali::TextureSet::GetSampler()
76    */
77   Sampler* GetSampler( uint32_t index ) const;
78
79   /**
80    * @copydoc Dali::TextureSet::GetTextureCount()
81    */
82   uint32_t GetTextureCount() const;
83
84  /**
85    * @brief Get the TextureSet scene object
86    *
87    * @return the texture set scene object
88    */
89   const SceneGraph::TextureSet* GetTextureSetSceneObject() const;
90
91 private: // implementation
92
93   TextureSet();
94
95   /**
96    * Second stage initialization
97    */
98   void Initialize();
99
100 protected:
101   /**
102    * A reference counted object may only be deleted by calling Unreference()
103    */
104   virtual ~TextureSet();
105
106 private: // unimplemented methods
107   TextureSet( const TextureSet& );
108   TextureSet& operator=( const TextureSet& );
109
110 private: // Data
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;
115 };
116
117 } // namespace Internal
118
119 // Helpers for public-api forwarding methods
120 inline Internal::TextureSet& GetImplementation( Dali::TextureSet& handle )
121 {
122   DALI_ASSERT_ALWAYS(handle && "TextureSet handle is empty");
123
124   BaseObject& object = handle.GetBaseObject();
125
126   return static_cast<Internal::TextureSet&>(object);
127 }
128
129 inline const Internal::TextureSet& GetImplementation( const Dali::TextureSet& handle )
130 {
131   DALI_ASSERT_ALWAYS(handle && "TextureSet handle is empty");
132
133   const BaseObject& object = handle.GetBaseObject();
134
135   return static_cast<const Internal::TextureSet&>(object);
136 }
137
138 } // namespace Dali
139
140 #endif // DALI_INTERNAL_TEXTURE_SET_H