Removing rendering backend
[platform/core/uifw/dali-core.git] / dali / internal / update / rendering / 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) 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 // 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 SceneGraph
34 {
35
36 /**
37  * A RenderItem contains all the data needed for rendering
38  */
39 struct RenderItem
40 {
41   /**
42    * Construct a new RenderItem
43    * @return A pointer to a new RenderItem.
44    */
45   static RenderItem* New();
46
47   /**
48    * Non-virtual destructor; RenderItem is not suitable as a base class.
49    */
50   ~RenderItem();
51
52   /**
53    * @brief This method is an optimized calculation of a viewport-space AABB (Axis-Aligned-Bounding-Box).
54    *
55    * We use the model-view-matrix, but we do not use projection. Therefore we assume Z = 0.
56    * As the box is Axis-Aligned (in viewport space) rotations on Z axis are correctly delt with by expanding the box as necessary.
57    * Rotations on X & Y axis will resize the AABB, but it will not handle the projection error due to the new coordinates having non-zero Z values.
58    *
59    * Note: We pass in the viewport dimensions rather than allow the caller to modify the raw AABB in order to optimally generate the final result.
60    *
61    * @param[in]    viewportWidth     The width of the viewport to calculate for
62    * @param[in]    viewportHeight    The height of the viewport to calculate for
63    * @return                         The AABB coordinates in viewport-space (x, y, width, height)
64    */
65   ClippingBox CalculateViewportSpaceAABB( const int viewportWidth, const int viewportHeight ) const;
66
67   /**
68    * Overriden delete operator.
69    * Deletes the RenderItem from its global memory pool
70    * @param[in] A pointer to the RenderItem to delete.
71    */
72   void operator delete( void* ptr );
73
74   Matrix            mModelMatrix;
75   Matrix            mModelViewMatrix;
76   Vector3           mSize;
77   Node*             mNode;
78   const void*       mTextureSet;        //< Used for sorting only
79   int               mDepthIndex;
80   bool              mIsOpaque:1;
81
82 private:
83
84   /**
85    * Private constructor. See RenderItem::New
86    */
87   RenderItem();
88
89   // RenderItems should not be copied as they are heavy
90   RenderItem( const RenderItem& item );
91   RenderItem& operator = ( const RenderItem& item );
92
93 };
94
95 } // namespace SceneGraph
96
97 } // namespace Internal
98
99 } // namespace Dali
100
101 #endif // DALI_INTERNAL_SCENE_GRAPH_RENDER_ITEM_H