Remove Sampler scene object
[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    mTextureId(Integration::InvalidResourceId),
42    mSampler(0)
43   {}
44
45   /**
46    * Constructor
47    */
48   Texture( const char* samplerName, Integration::ResourceId textureId, Render::Sampler* sampler )
49   :mUniformName(samplerName),
50    mTextureId( textureId),
51    mSampler(sampler)
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: // SamplerDataProvider interface - called from RenderThread
70   /**
71    * Get the texture unit uniform name
72    * @return the name of the texture unit uniform
73    */
74   inline const char* GetUniformName() const
75   {
76     return mUniformName.c_str();
77   }
78
79   /**
80    * Get the texture ID
81    * @param[in] bufferIndex The buffer index to use
82    * @return the identity of the associated texture
83    */
84   inline Integration::ResourceId GetTextureId() const
85   {
86     return mTextureId;
87   }
88
89 private:
90   std::string               mUniformName;
91   Integration::ResourceId   mTextureId;
92   Render::Sampler*          mSampler;
93 };
94
95 } // namespace SceneGraph
96
97 } // namespace Internal
98 } // namespace Dali
99
100
101 #endif //  DALI_INTERNAL_RENDER_TEXTURE_H