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