d73f70cce03f06b008207cebbb384a286ff5e18c
[platform/core/uifw/dali-core.git] / dali / internal / render / data-providers / render-data-provider.h
1 #ifndef __DALI_INTERNAL_SCENE_GRAPH_RENDER_DATA_PROVIDER_H__
2 #define __DALI_INTERNAL_SCENE_GRAPH_RENDER_DATA_PROVIDER_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
21 #include <dali/internal/render/data-providers/node-data-provider.h>
22 #include <dali/internal/render/data-providers/property-buffer-data-provider.h>
23 #include <dali/internal/render/data-providers/uniform-map-data-provider.h>
24 #include <dali/internal/render/renderers/render-texture.h>
25 #include <dali/devel-api/rendering/renderer.h>
26
27 namespace Dali
28 {
29 namespace Internal
30 {
31
32 struct BlendingOptions;
33
34 namespace SceneGraph
35 {
36 class PropertyBuffer;
37 class Shader;
38
39 /**
40  * Wraps all the data providers for the renderer. This allows the
41  * individual providers to change connections in the update thread without affecting
42  * the current render. It essentially provides double buffering of the
43  * provider accessor through the message system. It does not take ownership
44  * of any objects.
45  */
46 class RenderDataProvider
47 {
48 public:
49   typedef Dali::Vector< const PropertyBufferDataProvider* > VertexBuffers;
50   typedef std::vector< Render::Texture > Textures;
51
52   /**
53    * Constructor.
54    * The RendererAttachment that creates this object will initialize the members
55    * directly.
56    */
57   RenderDataProvider();
58
59   /**
60    * Destructor
61    */
62   ~RenderDataProvider();
63
64 public:
65
66   /**
67    * Set the uniform map data provider
68    * @param[in] uniformMapDataProvider The uniform map data provider
69    */
70   void SetUniformMap(const UniformMapDataProvider& uniformMapDataProvider);
71
72   /**
73    * Get the uniform map data provider
74    */
75   const UniformMapDataProvider& GetUniformMap() const;
76
77   /**
78    * Set the shader data provider
79    * @param[in] shader The shader data provider
80    */
81   void SetShader( Shader& shader );
82
83   /**
84    * Returns the shader
85    * @return The shader
86    */
87   Shader& GetShader() const;
88
89   /**
90    * Returns the list of textures
91    * @return The list of textures
92    */
93   Textures& GetTextures();
94
95 private:
96
97   const UniformMapDataProvider*       mUniformMapDataProvider;
98   Shader*                             mShader;
99   Textures                            mTextures;
100
101   // Give Renderer access to our private data to reduce copying vectors on construction.
102   friend class Renderer;
103 };
104
105 } // SceneGraph
106 } // Internal
107 } // Dali
108
109 #endif // __DALI_INTERNAL_SCENE_GRAPH_RENDER_DATA_PROVIDER_H__