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