86c1270b1a87061ac41b00395c28bf1771afceaa
[platform/core/uifw/dali-core.git] / dali / internal / render / common / render-item.h
1 #ifndef __DALI_INTERNAL_SCENE_GRAPH_RENDER_ITEM_H__
2 #define __DALI_INTERNAL_SCENE_GRAPH_RENDER_ITEM_H__
3
4 /*
5  * Copyright (c) 2014 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 // INTERNAL INCLUDES
22 #include <dali/public-api/common/vector-wrapper.h>
23 #include <dali/public-api/actors/layer.h>
24 #include <dali/public-api/math/matrix.h>
25 #include <dali/internal/update/nodes/node.h>
26
27 namespace Dali
28 {
29
30 namespace Internal
31 {
32
33 namespace Render
34 {
35 class Renderer;
36 }
37
38 namespace SceneGraph
39 {
40
41 class RenderItem;
42
43 typedef std::vector< RenderItem > RendererItemContainer;
44
45 /**
46  * A render-item is a renderer & modelView matrix pair.
47  */
48 class RenderItem
49 {
50 public:
51
52   /**
53    * Create a new render-item.
54    */
55   RenderItem();
56
57   /**
58    * Non-virtual destructor; RenderItem is not suitable as a base class.
59    */
60   ~RenderItem();
61
62   /**
63    * Reset the render-item.
64    */
65   void Reset();
66
67   /**
68    * Retrieve the renderer.
69    * @return The renderer.
70    */
71   Render::Renderer& GetRenderer() const;
72
73   /**
74    * Set the renderer
75    * @param[in] renderer The renderer
76    */
77   void SetRenderer( Render::Renderer* renderer );
78
79   /**
80    * Set the node
81    * @param[in] node The node
82    */
83   void SetNode( Node* node );
84
85   /**
86    * Retrieve the node
87    * @return The node
88    */
89   const Node& GetNode() const
90   {
91     return *mNode;
92   }
93   /**
94    * Retrieve the modelView matrix.
95    * @return The modelView matrix.
96    */
97   Matrix& GetModelViewMatrix();
98
99   /**
100    * Retrieve the modelView matrix.
101    * @return The modelView matrix.
102    */
103   const Matrix& GetModelViewMatrix() const;
104
105   /**
106    * Retrieve the depth index
107    */
108   int GetDepthIndex() const
109   {
110     return mDepthIndex;
111   }
112
113   /**
114    * Set the depth index
115    */
116   void SetDepthIndex( int depthIndex );
117
118   /**
119    * Set if the RenderItem is opaque
120    * @param[in] isOpaque true if the RenderItem is opaque, false otherwise
121    */
122   void SetIsOpaque( bool isOpaque );
123
124   /**
125    * Check if the RenderItem is opaque
126    * @return True if it is opaque, false otherwise
127    */
128   bool IsOpaque() const
129   {
130     return mIsOpaque;
131   }
132
133 private:
134
135   // RenderItems should not be copied as they are heavy
136   RenderItem( const RenderItem& item );
137   RenderItem& operator = ( const RenderItem& item );
138
139   Matrix            mModelViewMatrix;
140   Render::Renderer* mRenderer;
141   Node*             mNode;
142   int               mDepthIndex;
143   bool              mIsOpaque:1;
144 };
145
146 } // namespace SceneGraph
147
148 } // namespace Internal
149
150 } // namespace Dali
151
152 #endif // __DALI_INTERNAL_SCENE_GRAPH_RENDER_ITEM_H__