Merge "Path registration with type registry" into devel/master
[platform/core/uifw/dali-core.git] / dali / internal / render / renderers / render-texture.h
1 #ifndef DALI_INTERNAL_RENDER_TEXTURE_H
2 #define DALI_INTERNAL_RENDER_TEXTURE_H
3
4 /*
5  * Copyright (c) 2015 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 #include <dali/devel-api/rendering/sampler.h>
21 #include <dali/integration-api/resource-declarations.h>
22 #include <string>
23
24 namespace Dali
25 {
26 namespace Internal
27 {
28 namespace Render
29 {
30 class Sampler;
31
32 class Texture
33 {
34 public:
35
36   /**
37    * Constructor
38    */
39   Texture()
40   :mUniformName(),
41    mSampler(0),
42    mTextureId(Integration::InvalidResourceId)
43   {}
44
45   /**
46    * Constructor
47    */
48   Texture( const std::string& samplerName, Integration::ResourceId textureId, Render::Sampler* sampler )
49   :mUniformName( samplerName ),
50    mSampler( sampler ),
51    mTextureId( textureId)
52   {}
53
54   /**
55    * Destructor
56    */
57   ~Texture()
58   {}
59
60   /*
61    * Get the Render::Sampler used by the texture
62    * @Return The Render::Sampler being used or 0 if using the default
63    */
64   inline const Render::Sampler* GetSampler() const
65   {
66     return mSampler;
67   }
68
69 public: // called from RenderThread
70
71   /**
72    * Get the texture unit uniform name
73    * @return the name of the texture unit uniform
74    */
75   inline const std::string& GetUniformName() const
76   {
77     return mUniformName;
78   }
79
80   /**
81    * Get the texture ID
82    * @param[in] bufferIndex The buffer index to use
83    * @return the identity of the associated texture
84    */
85   inline Integration::ResourceId GetTextureId() const
86   {
87     return mTextureId;
88   }
89
90 private:
91   std::string             mUniformName;
92   Render::Sampler*        mSampler;
93   Integration::ResourceId mTextureId;
94 };
95
96 } // namespace SceneGraph
97
98 } // namespace Internal
99 } // namespace Dali
100
101
102 #endif //  DALI_INTERNAL_RENDER_TEXTURE_H