[dali_1.1.5] 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/sampler-data-provider.h>
25 #include <dali/internal/render/data-providers/property-buffer-data-provider.h>
26 #include <dali/internal/render/data-providers/uniform-map-data-provider.h>
27
28 namespace Dali
29 {
30 namespace Internal
31 {
32 namespace SceneGraph
33 {
34 class PropertyBuffer;
35 class Shader;
36
37 /**
38  * Wraps all the data providers for the renderer. This allows the
39  * individual providers to change connections in the update thread without affecting
40  * the current render. It essentially provides double buffering of the
41  * provider accessor through the message system. It does not take ownership
42  * of any objects.
43  *
44  * @todo - Add set of bools to state what changed (For improving performance)
45  */
46 class RenderDataProvider
47 {
48 public:
49   typedef Dali::Vector< const PropertyBufferDataProvider* > VertexBuffers;
50   typedef Dali::Vector< const SamplerDataProvider* > Samplers;
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 material data provider
68    * @param[in] materialDataProvider The material data provider
69    */
70   void SetMaterial( const MaterialDataProvider& materialDataProvider );
71
72   /**
73    * Get the material data provider
74    * @return the material data provider
75    */
76   const MaterialDataProvider& GetMaterial() const;
77
78   /**
79    * Set the uniform map data provider
80    * @param[in] uniformMapDataProvider The uniform map data provider
81    */
82   void SetUniformMap(const UniformMapDataProvider& uniformMapDataProvider);
83
84   /**
85    * Get the uniform map data provider
86    */
87   const UniformMapDataProvider& GetUniformMap() const;
88
89   /**
90    * Set the shader data provider
91    * @param[in] shader The shader data provider
92    */
93   void SetShader( Shader& shader );
94
95   /**
96    * Returns the shader
97    * @return The shader
98    */
99   Shader& GetShader() const;
100
101   /**
102    * Set the sampler data providers
103    * @param[in] samplers The sampler data providers
104    */
105   void SetSamplers( const Samplers& samplers );
106
107   /**
108    * Returns the list of sampler data providers
109    * @return The list of samplers
110    */
111   const Samplers& GetSamplers() const;
112
113 private:
114   const MaterialDataProvider*   mMaterialDataProvider;
115   const UniformMapDataProvider* mUniformMapDataProvider;
116   Shader*                       mShader;
117   Samplers                      mSamplers;
118
119 // Give Renderer access to our private data to reduce copying vectors on construction.
120   friend class Renderer;
121 };
122
123 } // SceneGraph
124 } // Internal
125 } // Dali
126
127 #endif // __DALI_INTERNAL_SCENE_GRAPH_RENDER_DATA_PROVIDER_H__