Tizen 2.1 base
[framework/osp/uifw.git] / src / ui / effects / inc / renderer / graphics-engine / FUiEffects_RendererGraphicsEngineRenderTextureCache.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://floralicense.org/license/
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file                FUiEffects_RendererGraphicsEngineRenderTextureCache.h
20  * @brief               Class for render textures cache
21  *
22  */
23
24 #ifndef _FUI_EFFECTS_INTERNAL_RENDERER_GRAPHICS_ENGINE_RENDER_TEXTURE_CACHE_H_
25 #define _FUI_EFFECTS_INTERNAL_RENDERER_GRAPHICS_ENGINE_RENDER_TEXTURE_CACHE_H_
26
27 #include <renderer/engine-model/FUiEffects_RendererEngineModelForwardDeclaration.h>
28 #include <renderer/engine-model/FUiEffects_RendererEngineModelTextureProperty.h>
29 #include <renderer/engine-model/FUiEffects_RendererEngineModelTexture2DProperty.h>
30 #include <renderer/system/FUiEffects_RendererSystemSmartPtr.h>
31
32 #include <renderer/graphics-engine/FUiEffects_RendererGraphicsEngineOpenGLImplementation.h>
33 #include <renderer/graphics-engine/FUiEffects_RendererGraphicsEngineRenderCache.h>
34
35 namespace Tizen { namespace Ui { namespace Effects { namespace _Renderer { namespace GraphicsEngine
36 {
37
38 class RenderTextureCache:
39         public RenderCache
40 {
41 public:
42         RenderTextureCache(Render* pRender);
43         virtual ~RenderTextureCache(void);
44
45         static GLenum GetGlInternalFormat(Tizen::Ui::Effects::_Renderer::EngineModel::TextureProperty::InternalFormat::Value internalFormat);
46         static GLenum GetGlDataFormat(Tizen::Ui::Effects::_Renderer::EngineModel::TextureProperty::DataFormat::Value dataFormat);
47         static GLenum GetGlDataType(Tizen::Ui::Effects::_Renderer::EngineModel::TextureProperty::DataType::Value dataType);
48         static GLenum GetGlFilterType(Tizen::Ui::Effects::_Renderer::EngineModel::TextureProperty::FilterType::Value filterType);
49         static GLenum GetGlWrapType(Tizen::Ui::Effects::_Renderer::EngineModel::TextureProperty::WrapType::Value wrapType);
50
51         virtual void DropCache(void);
52         virtual void DestroyCache(void);
53
54         virtual void Bind(Render*, GLuint stage) = 0;
55
56 protected:
57         GLuint _textureId;
58 };
59
60 typedef Tizen::Ui::Effects::_Renderer::System::SmartPtr<RenderTextureCache> RenderTextureCachePtr;
61
62 class RenderTexture2dCache:
63         public RenderTextureCache
64 {
65 public:
66         RenderTexture2dCache(Render* pRender, Tizen::Ui::Effects::_Renderer::EngineModel::Texture2dProperty* pTexture);
67         virtual ~RenderTexture2dCache(void);
68
69         virtual void Validate(Render*);
70         void Validate(Render*, GLuint stage);
71
72         virtual void Bind(Render*, GLuint stage);
73
74         virtual void Die(void);
75         virtual void DestroyCache(void);
76
77 private:
78         Tizen::Ui::Effects::_Renderer::EngineModel::Texture2dProperty* __pTexture;
79 };
80
81 typedef Tizen::Ui::Effects::_Renderer::System::SmartPtr<RenderTexture2dCache> RenderTexture2DCachePtr;
82
83 }}}}} //Tizen::Ui::Effects::_Renderer::GraphicsEngine
84
85 #endif //_FUI_EFFECTS_INTERNAL_RENDERER_GRAPHICS_ENGINE_RENDER_TEXTURE_CACHE_H_