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