Property enum name changes in dali-core: Core changes
[platform/core/uifw/dali-core.git] / dali / public-api / geometry / mesh.h
1 #ifndef __DALI_MESH_H__
2 #define __DALI_MESH_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
22 // INTERNAL INCLUDES
23 #include <dali/public-api/geometry/mesh-data.h>
24 #include <dali/public-api/math/rect.h>
25 #include <dali/public-api/object/base-handle.h>
26
27 namespace Dali
28 {
29
30 namespace Internal DALI_INTERNAL
31 {
32 class Mesh;
33 }
34
35 /**
36  * @brief A Mesh holds a MeshData object supplied by the application writer.
37  *
38  * It is used to tell the Scene Graph if the mesh data has changed.
39  */
40 class DALI_IMPORT_API Mesh : public BaseHandle
41 {
42 public:
43
44   /**
45    * @brief Create an initialized Mesh.
46    *
47    * @param[in] meshData The mesh data with which to initialize the handle
48    * @return A handle to a newly allocated Dali resource.
49    */
50   static Mesh New( const MeshData& meshData );
51
52   /**
53    * @brief Create an uninitialized Mesh; this can be initialized with Mesh::New().
54    *
55    * Calling member functions with an uninitialized Dali::Object is not allowed.
56    */
57   Mesh();
58
59   /**
60    * @brief Destructor
61    *
62    * This is non-virtual since derived Handle types must not contain data or virtual methods.
63    */
64   ~Mesh();
65
66   /**
67    * @brief This copy constructor is required for (smart) pointer semantics.
68    *
69    * @param [in] handle A reference to the copied handle
70    */
71   Mesh(const Mesh& handle);
72
73   /**
74    * @brief This assignment operator is required for (smart) pointer semantics.
75    *
76    * @param [in] rhs  A reference to the copied handle
77    * @return A reference to this
78    */
79   Mesh& operator=(const Mesh& rhs);
80
81   /**
82    * @brief Create an initialized plane aligned on the XY axis.
83    *
84    * @param[in] width   The width of the plane
85    * @param[in] height  The height of the plane
86    * @param[in] xSteps  The number of vertices along the X axis
87    * @param[in] ySteps  The number of vertices along the Y axis
88    * @param[in] textureCoordinates  UV coordinates.
89    * @return A handle to a newly allocated Dali resource.
90    */
91   static Mesh NewPlane(const float width,
92                        const float height,
93                        const int xSteps,
94                        const int ySteps,
95                        const Rect<float>& textureCoordinates = Rect<float>(0.0f, 0.0f, 1.0f, 1.0f));
96
97   /**
98    * @brief Downcast an Object handle to Mesh handle.
99    *
100    * If handle points to a Mesh object the downcast produces valid
101    * handle. If not the returned handle is left uninitialized.
102    *
103    * @param[in] handle to An object
104    * @return handle to an Mesh object or an uninitialized handle
105    */
106   static Mesh DownCast( BaseHandle handle );
107
108   /**
109    * @brief Tell Dali to update it's internal meshes from the changed mesh data.
110    *
111    * @param[in] meshData
112    */
113   void UpdateMeshData( const MeshData& meshData );
114
115 public: // Not intended for application developers
116
117   /**
118    * @brief This constructor is used by Dali New() methods.
119    *
120    * @param [in] mesh A pointer to a newly allocated Dali resource
121    */
122   explicit DALI_INTERNAL Mesh(Internal::Mesh* mesh);
123 };
124
125 } // namespace Dali
126
127 #endif // __DALI_MESH_H__